[TD] DrawView*: remove unused includes - part 2

- also sort includes
- also additions to precompiled header
This commit is contained in:
Uwe
2022-10-08 02:10:26 +02:00
parent bc9897caf8
commit 5dc30b159c
19 changed files with 144 additions and 255 deletions

View File

@@ -21,37 +21,26 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <iomanip>
# include <sstream>
# include <boost/regex.hpp>
#endif
#include <iomanip>
#include <boost/regex.hpp>
#include <App/Application.h>
#include <App/Property.h>
#include <App/PropertyStandard.h>
#include <App/PropertyUnits.h>
#include <Base/Console.h>
#include <Base/Exception.h>
#include <Base/FileInfo.h>
#include <Base/Parameter.h>
#include "Preferences.h"
#include "DrawUtil.h"
#include "DrawViewSpreadsheet.h"
#include <Mod/Spreadsheet/App/Cell.h>
#include <Mod/Spreadsheet/App/Sheet.h>
using namespace TechDraw;
using namespace std;
#include "DrawViewSpreadsheet.h"
#include "DrawUtil.h"
#include "Preferences.h"
using namespace TechDraw;
//===========================================================================
// DrawViewSpreadsheet
//===========================================================================
@@ -175,7 +164,8 @@ std::string DrawViewSpreadsheet::getSheetImage()
std::string sColStart, sColEnd;
if (boost::regex_search(scellstart, what, re)) {
if (what.size() < 3) {
Base::Console().Error("%s - start cell (%s) is invalid\n", getNameInDocument(), CellStart.getValue());
Base::Console().Error("%s - start cell (%s) is invalid\n", getNameInDocument(),
CellStart.getValue());
return std::string();
}
@@ -249,14 +239,13 @@ std::string DrawViewSpreadsheet::getSheetImage()
validRowNumbers.push_back(iRow);
}
// create the Svg code
// create the SVG code
std::stringstream result;
result << getSVGHead();
std::string ViewName = Label.getValue();
App::Color c = TextColor.getValue();
result << "<g id=\"" << ViewName << "\">" << endl;
result << "<g id=\"" << ViewName << "\">" << std::endl;
// fill the cells
float rowoffset = 0.0;
@@ -267,10 +256,12 @@ std::string DrawViewSpreadsheet::getSheetImage()
Spreadsheet::Sheet* sheet = static_cast<Spreadsheet::Sheet*>(link);
std::vector<std::string> skiplist;
for (std::vector<std::string>::const_iterator col = validColNames.begin(); col != validColNames.end(); ++col) {
for (std::vector<std::string>::const_iterator col = validColNames.begin();
col != validColNames.end(); ++col) {
// create a group for each column
result << " <g id=\"" << ViewName << "_col" << (*col) << "\">" << endl;
for (std::vector<int>::const_iterator row = validRowNumbers.begin(); row != validRowNumbers.end(); ++row) {
result << " <g id=\"" << ViewName << "_col" << (*col) << "\">" << std::endl;
for (std::vector<int>::const_iterator row = validRowNumbers.begin();
row != validRowNumbers.end(); ++row) {
// get cell size
std::stringstream srow;
srow << (*row);
@@ -342,31 +333,39 @@ std::string DrawViewSpreadsheet::getSheetImage()
}
// skip cell if found in skiplist
if (std::find(skiplist.begin(), skiplist.end(), address.toString()) == skiplist.end()) {
result << " <rect x=\"" << coloffset << "\" y=\"" << rowoffset << "\" width=\"" << cellwidth
<< "\" height=\"" << cellheight << "\" style=\"fill:" << bcolor << ";stroke-width:"
<< LineWidth.getValue()/getScale() << ";stroke:" << c.asHexString() << ";\" />" << endl;
result << " <rect x=\"" << coloffset << "\" y=\"" << rowoffset << "\" width=\""
<< cellwidth << "\" height=\"" << cellheight << "\" style=\"fill:" << bcolor
<< ";stroke-width:" << LineWidth.getValue() / getScale()
<< ";stroke:" << c.asHexString() << ";\" />" << std::endl;
if (alignment & Spreadsheet::Cell::ALIGNMENT_LEFT)
result << " <text style=\"" << textstyle << "\" x=\"" << coloffset + TextSize.getValue()/2 << "\" y=\"" << rowoffset + 0.75 * cellheight << "\" font-family=\"" ;
result << " <text style=\"" << textstyle << "\" x=\""
<< coloffset + TextSize.getValue() / 2 << "\" y=\""
<< rowoffset + 0.75 * cellheight << "\" font-family=\"";
if (alignment & Spreadsheet::Cell::ALIGNMENT_HCENTER)
result << " <text text-anchor=\"middle\" style=\"" << textstyle << "\" x=\"" << coloffset + cellwidth/2 << "\" y=\"" << rowoffset + 0.75 * cellheight << "\" font-family=\"" ;
result << " <text text-anchor=\"middle\" style=\"" << textstyle << "\" x=\""
<< coloffset + cellwidth / 2 << "\" y=\""
<< rowoffset + 0.75 * cellheight << "\" font-family=\"";
if (alignment & Spreadsheet::Cell::ALIGNMENT_RIGHT)
result << " <text text-anchor=\"end\" style=\"" << textstyle << "\" x=\"" << coloffset + (cellwidth - TextSize.getValue()/2) << "\" y=\"" << rowoffset + 0.75 * cellheight << "\" font-family=\"" ;
if ((alignment & Spreadsheet::Cell::ALIGNMENT_LEFT) ||
(alignment & Spreadsheet::Cell::ALIGNMENT_HCENTER) ||
(alignment & Spreadsheet::Cell::ALIGNMENT_RIGHT)) {
result << Font.getValue() << "\"" << " font-size=\"" << TextSize.getValue() << "\""
<< " fill=\"" << fcolor << "\">" << celltext << "</text>" << endl;
result << " <text text-anchor=\"end\" style=\"" << textstyle << "\" x=\""
<< coloffset + (cellwidth - TextSize.getValue() / 2) << "\" y=\""
<< rowoffset + 0.75 * cellheight << "\" font-family=\"";
if ((alignment & Spreadsheet::Cell::ALIGNMENT_LEFT)
|| (alignment & Spreadsheet::Cell::ALIGNMENT_HCENTER)
|| (alignment & Spreadsheet::Cell::ALIGNMENT_RIGHT)) {
result << Font.getValue() << "\""
<< " font-size=\"" << TextSize.getValue() << "\""
<< " fill=\"" << fcolor << "\">" << celltext << "</text>" << std::endl;
}
}
rowoffset = rowoffset + sheet->getRowHeight(address.row());
}
result << " </g>" << endl;
result << " </g>" << std::endl;
rowoffset = 0.0;
coloffset = coloffset + cellwidth;
}
// close the containing group
result << "</g>" << endl;
result << "</g>" << std::endl;
result << getSVGTail();