r23445 by jghali - Code style fixes and refactoring for SVG exporter

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 11 23:44:11 UTC 2020


Author: jghali
Date: Sat Jan 11 23:44:11 2020
New Revision: 23445

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23445
Log:
Code style fixes and refactoring for SVG exporter

Modified:
    trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
    trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.h

Modified: trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23445&path=/trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp	Sat Jan 11 23:44:11 2020
@@ -155,11 +155,11 @@
 			return true;
 		fileName = openDia->selectedFile();
 		QFileInfo fi(fileName);
-		QString baseDir = fi.absolutePath();
+		QString m_baseDir = fi.absolutePath();
 		if (compress->isChecked())
-			fileName = baseDir + "/" + fi.baseName() + ".svgz";
-		else
-			fileName = baseDir + "/" + fi.baseName() + ".svg";
+			fileName = m_baseDir + "/" + fi.baseName() + ".svgz";
+		else
+			fileName = m_baseDir + "/" + fi.baseName() + ".svg";
 
 		SVGOptions Options;
 		Options.inlineImages = inlineImages->isChecked();
@@ -193,62 +193,64 @@
 	Options.inlineImages = true;
 	Options.exportPageBackground = false;
 	Options.compressFile = false;
-	glyphNames.clear();
+	m_glyphNames.clear();
 }
 
 bool SVGExPlug::doExport( const QString& fName, SVGOptions &Opts )
 {
 	Options = Opts;
 	QFileInfo fiBase(fName);
-	baseDir = fiBase.absolutePath();
-	ScPage *page;
-	GradCount = 0;
-	ClipCount = 0;
-	PattCount = 0;
-	MaskCount = 0;
-	FilterCount = 0;
-	docu = QDomDocument("svgdoc");
+
+	m_baseDir = fiBase.absolutePath();
+	m_gradCount = 0;
+	m_clipCount = 0;
+	m_pattCount = 0;
+	m_maskCount = 0;
+	m_filterCount = 0;
+
+	m_domDoc = QDomDocument("svgdoc");
 	QString vo = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 	QString st = "<svg></svg>";
-	docu.setContent(st);
-	page = m_Doc->currentPage();
+	m_domDoc.setContent(st);
+
+	ScPage *page = m_Doc->currentPage();
 	double pageWidth  = page->width();
 	double pageHeight = page->height();
-	docElement = docu.documentElement();
-	docElement.setAttribute("width", FToStr(pageWidth)+"pt");
-	docElement.setAttribute("height", FToStr(pageHeight)+"pt");
-	docElement.setAttribute("viewBox", QString("0 0 %1 %2").arg(pageWidth).arg(pageHeight));
-	docElement.setAttribute("xmlns", "http://www.w3.org/2000/svg");
-	docElement.setAttribute("xmlns:inkscape","http://www.inkscape.org/namespaces/inkscape");
-	docElement.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");
-	docElement.setAttribute("version","1.1");
+	m_domElem = m_domDoc.documentElement();
+	m_domElem.setAttribute("width", FToStr(pageWidth) + "pt");
+	m_domElem.setAttribute("height", FToStr(pageHeight) + "pt");
+	m_domElem.setAttribute("viewBox", QString("0 0 %1 %2").arg(pageWidth).arg(pageHeight));
+	m_domElem.setAttribute("xmlns", "http://www.w3.org/2000/svg");
+	m_domElem.setAttribute("xmlns:inkscape","http://www.inkscape.org/namespaces/inkscape");
+	m_domElem.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");
+	m_domElem.setAttribute("version","1.1");
 	if (!m_Doc->documentInfo().title().isEmpty())
 	{
-		QDomText title = docu.createTextNode(m_Doc->documentInfo().title());
-		QDomElement titleElem = docu.createElement("title");
+		QDomText title = m_domDoc.createTextNode(m_Doc->documentInfo().title());
+		QDomElement titleElem = m_domDoc.createElement("title");
 		titleElem.appendChild(title);
-		docElement.appendChild(titleElem);
+		m_domElem.appendChild(titleElem);
 	}
 	if (!m_Doc->documentInfo().comments().isEmpty())
 	{
-		QDomText desc = docu.createTextNode(m_Doc->documentInfo().comments());
-		QDomElement descElem = docu.createElement("desc");
+		QDomText desc = m_domDoc.createTextNode(m_Doc->documentInfo().comments());
+		QDomElement descElem = m_domDoc.createElement("desc");
 		descElem.appendChild(desc);
-		docElement.appendChild(descElem);
-	}
-	globalDefs = docu.createElement("defs");
+		m_domElem.appendChild(descElem);
+	}
+	m_globalDefs = m_domDoc.createElement("defs");
 	writeBasePatterns();
 	writeBaseSymbols();
-	docElement.appendChild(globalDefs);
+	m_domElem.appendChild(m_globalDefs);
 	if (Options.exportPageBackground)
 	{
-		QDomElement backG = docu.createElement("rect");
+		QDomElement backG = m_domDoc.createElement("rect");
 		backG.setAttribute("x", "0");
 		backG.setAttribute("y", "0");
 		backG.setAttribute("width", FToStr(pageWidth));
 		backG.setAttribute("height", FToStr(pageHeight));
-		backG.setAttribute("style", "fill:"+m_Doc->paperColor().name()+";" + "stroke:none;");
-		docElement.appendChild(backG);
+		backG.setAttribute("style", "fill:" + m_Doc->paperColor().name() + ";" + "stroke:none;");
+		m_domElem.appendChild(backG);
 	}
 	ScLayer ll;
 	ll.isPrintable = false;
@@ -258,16 +260,16 @@
 		if (ll.isPrintable)
 		{
 			page = m_Doc->MasterPages.at(m_Doc->MasterNames[m_Doc->currentPage()->masterPageName()]);
-			ProcessPageLayer(page, ll);
+			processPageLayer(page, ll);
 			page = m_Doc->currentPage();
-			ProcessPageLayer(page, ll);
+			processPageLayer(page, ll);
 		}
 	}
 	if(Options.compressFile)
 	{
 		// zipped saving
 		QString wr = vo;
-		wr += docu.toString();
+		wr += m_domDoc.toString();
 		QByteArray utf8wr = wr.toUtf8();
 		QFile file(fName);
 		QtIOCompressor compressor(&file);
@@ -283,7 +285,7 @@
 			return false;
 		QDataStream s(&f);
 		QString wr = vo;
-		wr += docu.toString();
+		wr += m_domDoc.toString();
 		QByteArray utf8wr = wr.toUtf8();
 		s.writeRawData(utf8wr.data(), utf8wr.length());
 		f.close();
@@ -291,7 +293,7 @@
 	return true;
 }
 
-void SVGExPlug::ProcessPageLayer(ScPage *page, ScLayer& layer)
+void SVGExPlug::processPageLayer(ScPage *page, ScLayer& layer)
 {
 	QDomElement layerGroup;
 	PageItem *Item;
@@ -307,7 +309,7 @@
 		return;
 	m_Doc->setCurrentPage(page);
 
-	layerGroup = docu.createElement("g");
+	layerGroup = m_domDoc.createElement("g");
 	layerGroup.setAttribute("id", layer.Name);
 	layerGroup.setAttribute("inkscape:label", layer.Name);
 	layerGroup.setAttribute("inkscape:groupmode", "layer");
@@ -332,19 +334,19 @@
 			continue;
 		if ((!page->pageNameEmpty()) && (Item->OwnPage != static_cast<int>(page->pageNr())) && (Item->OwnPage != -1))
 			continue;
-		ProcessItemOnPage(Item->xPos()-page->xOffset(), Item->yPos()-page->yOffset(), Item, &layerGroup);
-	}
-	docElement.appendChild(layerGroup);
+		processItemOnPage(Item->xPos()-page->xOffset(), Item->yPos()-page->yOffset(), Item, &layerGroup);
+	}
+	m_domElem.appendChild(layerGroup);
 
 	m_Doc->setCurrentPage(SavedAct);
 }
 
-void SVGExPlug::ProcessItemOnPage(double xOffset, double yOffset, PageItem *Item, QDomElement *parentElem)
+void SVGExPlug::processItemOnPage(double xOffset, double yOffset, PageItem *Item, QDomElement *parentElem)
 {
 	QDomElement ob;
-	QString trans = "translate("+FToStr(xOffset)+", "+FToStr(yOffset)+")";
+	QString trans = "translate(" + FToStr(xOffset) + ", " + FToStr(yOffset) + ")";
 	if (Item->rotation() != 0)
-		trans += " rotate("+FToStr(Item->rotation())+")";
+		trans += " rotate(" + FToStr(Item->rotation()) + ")";
 	QString fill = getFillStyle(Item);
 	fill += processDropShadow(Item);
 	QString stroke = "stroke:none";
@@ -379,7 +381,7 @@
 		case PageItem::Group:
 			if (Item->groupItemList.count() > 0)
 			{
-				ob = docu.createElement("g");
+				ob = m_domDoc.createElement("g");
 				if (!Item->AutoName)
 					ob.setAttribute("id", Item->itemName());
 				if (Item->GrMask > 0)
@@ -412,7 +414,7 @@
 					clipPath.map(transform);
 					QDomElement obc = createClipPathElement(&clipPath);
 					if (!obc.isNull())
-						ob.setAttribute("clip-path", "url(#"+ obc.attribute("id") + ")");
+						ob.setAttribute("clip-path", "url(#" + obc.attribute("id") + ")");
 					if (Item->fillRule)
 						ob.setAttribute("clip-rule", "evenodd");
 					else
@@ -421,12 +423,12 @@
 				for (int em = 0; em < Item->groupItemList.count(); ++em)
 				{
 					PageItem* embed = Item->groupItemList.at(em);
-					ProcessItemOnPage(embed->gXpos, embed->gYpos, embed, &ob);
+					processItemOnPage(embed->gXpos, embed->gYpos, embed, &ob);
 				}
 			}
 			break;
 		case PageItem::Table:
-			ob = docu.createElement("g");
+			ob = m_domDoc.createElement("g");
 			ob.setAttribute("transform", trans + QString("translate(%1, %2)").arg(Item->asTable()->gridOffset().x()).arg(Item->asTable()->gridOffset().y()));
 			// Paint table fill.
 			if (Item->asTable()->fillColor() != CommonStrings::None)
@@ -437,8 +439,8 @@
 				double y = Item->asTable()->rowPosition(0);
 				double width = Item->asTable()->columnPosition(lastCol) + Item->asTable()->columnWidth(lastCol) - x;
 				double height = Item->asTable()->rowPosition(lastRow) + Item->asTable()->rowHeight(lastRow) - y;
-				QDomElement cl = docu.createElement("rect");
-				cl.setAttribute("fill", SetColor(Item->asTable()->fillColor(), Item->asTable()->fillShade()));
+				QDomElement cl = m_domDoc.createElement("rect");
+				cl.setAttribute("fill", setColor(Item->asTable()->fillColor(), Item->asTable()->fillShade()));
 				cl.setAttribute("x", "0");
 				cl.setAttribute("y", "0");
 				cl.setAttribute("width", FToStr(width));
@@ -465,8 +467,8 @@
 							double y = Item->asTable()->rowPosition(row);
 							double width = Item->asTable()->columnPosition(lastCol) + Item->asTable()->columnWidth(lastCol) - x;
 							double height = Item->asTable()->rowPosition(lastRow) + Item->asTable()->rowHeight(lastRow) - y;
-							QDomElement cl = docu.createElement("rect");
-							cl.setAttribute("fill", SetColor(colorName, cell.fillShade()));
+							QDomElement cl = m_domDoc.createElement("rect");
+							cl.setAttribute("fill", setColor(colorName, cell.fillShade()));
 							cl.setAttribute("x", FToStr(x));
 							cl.setAttribute("y", FToStr(y));
 							cl.setAttribute("width", FToStr(width));
@@ -622,7 +624,7 @@
 					if (cell.row() == row && cell.column() == col)
 					{
 						PageItem* textFrame = cell.textFrame();
-						ProcessItemOnPage(cell.contentRect().x(), cell.contentRect().y(), textFrame, &ob);
+						processItemOnPage(cell.contentRect().x(), cell.contentRect().y(), textFrame, &ob);
 					}
 				}
 			}
@@ -646,13 +648,13 @@
 		lineStart.setY(start.y() + line.width() * startOffsetFactors.y());
 		lineEnd.setX(end.x() + line.width() * endOffsetFactors.x());
 		lineEnd.setY(end.y() + line.width() * endOffsetFactors.y());
-		QDomElement cl = docu.createElement("path");
-		cl.setAttribute("d", "M "+FToStr(lineStart.x())+" "+FToStr(lineStart.y())+" L "+FToStr(lineEnd.x())+" "+FToStr(lineEnd.y()));
+		QDomElement cl = m_domDoc.createElement("path");
+		cl.setAttribute("d", "M " + FToStr(lineStart.x()) + " " + FToStr(lineStart.y()) + " L " + FToStr(lineEnd.x()) + " " + FToStr(lineEnd.y()));
 		QString stroke = "";
 		if (line.color() != CommonStrings::None)
-			cl.setAttribute("stroke", SetColor(line.color(), line.shade()));
+			cl.setAttribute("stroke", setColor(line.color(), line.shade()));
 		if (line.width() != 0.0)
-			stroke = "stroke-width:"+FToStr(line.width())+";";
+			stroke = "stroke-width:" + FToStr(line.width()) + ";";
 		else
 			stroke = "stroke-width:1px;";
 		stroke += " stroke-linecap:butt;";
@@ -666,7 +668,7 @@
 			if (Da.isEmpty())
 				stroke += "none;";
 			else
-				stroke += Da.replace(" ", ", ")+";";
+				stroke += Da.replace(" ", ", ") + ";";
 		}
 		cl.setAttribute("style", stroke);
 		ob.appendChild(cl);
@@ -677,65 +679,65 @@
 {
 	if (!Item->hasSoftShadow())
 		return "";
-	QString ID = "Filter"+IToStr(FilterCount);
-	QDomElement filter = docu.createElement("filter");
+	QString ID = "Filter" + IToStr(m_filterCount);
+	QDomElement filter = m_domDoc.createElement("filter");
 	filter.setAttribute("id", ID);
 	filter.setAttribute("inkscape:label", "Drop shadow");
-	QDomElement ob = docu.createElement("feGaussianBlur");
-	ob.setAttribute("id", "feGaussianBlur"+IToStr(FilterCount));
+	QDomElement ob = m_domDoc.createElement("feGaussianBlur");
+	ob.setAttribute("id", "feGaussianBlur" + IToStr(m_filterCount));
 	ob.setAttribute("in", "SourceAlpha");
 	ob.setAttribute("stdDeviation", FToStr(Item->softShadowBlurRadius()));
 	ob.setAttribute("result", "blur");
 	filter.appendChild(ob);
-	QDomElement ob2 = docu.createElement("feColorMatrix");
-	ob2.setAttribute("id", "feColorMatrix"+IToStr(FilterCount));
+	QDomElement ob2 = m_domDoc.createElement("feColorMatrix");
+	ob2.setAttribute("id", "feColorMatrix" + IToStr(m_filterCount));
 	const ScColor& col = m_Doc->PageColors[Item->softShadowColor()];
 	QColor color = ScColorEngine::getShadeColorProof(col, m_Doc, Item->softShadowShade());
 	ob2.setAttribute("type", "matrix");
 	ob2.setAttribute("values", QString("1 0 0 %1 0 0 1 0 %2 0 0 0 1 %3 0 0 0 0 %4 0").arg(color.redF()).arg(color.greenF()).arg(color.blueF()).arg(1.0 - Item->softShadowOpacity()));
 	ob2.setAttribute("result", "bluralpha");
 	filter.appendChild(ob2);
-	QDomElement ob3 = docu.createElement("feOffset");
-	ob3.setAttribute("id", "feOffset"+IToStr(FilterCount));
+	QDomElement ob3 = m_domDoc.createElement("feOffset");
+	ob3.setAttribute("id", "feOffset" + IToStr(m_filterCount));
 	ob3.setAttribute("in", "bluralpha");
 	ob3.setAttribute("dx", FToStr(Item->softShadowXOffset()));
 	ob3.setAttribute("dy", FToStr(Item->softShadowYOffset()));
 	ob3.setAttribute("result", "offsetBlur");
 	filter.appendChild(ob3);
-	QDomElement ob4 = docu.createElement("feMerge");
-	ob4.setAttribute("id", "feMerge"+IToStr(FilterCount));
-	QDomElement ob5 = docu.createElement("feMergeNode");
-	ob5.setAttribute("id", "feMergeNode1"+IToStr(FilterCount));
+	QDomElement ob4 = m_domDoc.createElement("feMerge");
+	ob4.setAttribute("id", "feMerge" + IToStr(m_filterCount));
+	QDomElement ob5 = m_domDoc.createElement("feMergeNode");
+	ob5.setAttribute("id", "feMergeNode1" + IToStr(m_filterCount));
 	ob5.setAttribute("in", "offsetBlur");
 	ob4.appendChild(ob5);
-	QDomElement ob6 = docu.createElement("feMergeNode");
-	ob6.setAttribute("id", "feMergeNode2"+IToStr(FilterCount));
+	QDomElement ob6 = m_domDoc.createElement("feMergeNode");
+	ob6.setAttribute("id", "feMergeNode2" + IToStr(m_filterCount));
 	ob6.setAttribute("in", "SourceGraphic");
 	ob4.appendChild(ob6);
 	filter.appendChild(ob4);
-	globalDefs.appendChild(filter);
-	FilterCount++;
-	return "filter:url(#"+ID+");";
+	m_globalDefs.appendChild(filter);
+	m_filterCount++;
+	return "filter:url(#" + ID + ");";
 }
 
 QDomElement SVGExPlug::processHatchFill(PageItem *Item, const QString& transl)
 {
 	QDomElement ob;
-	ob = docu.createElement("g");
+	ob = m_domDoc.createElement("g");
 	if (!transl.isEmpty())
 		ob.setAttribute("transform", transl);
 	QDomElement obc = createClipPathElement(&Item->PoLine);
 	if (!obc.isNull())
-		ob.setAttribute("clip-path", "url(#"+ obc.attribute("id") + ")");
+		ob.setAttribute("clip-path", "url(#" + obc.attribute("id") + ")");
 	if (Item->fillRule)
 		ob.setAttribute("clip-rule", "evenodd");
 	else
 		ob.setAttribute("clip-rule", "nonzero");
 	if (Item->hatchUseBackground)
 	{
-		QDomElement ob2 = docu.createElement("path");
-		ob2.setAttribute("d", SetClipPath(&Item->PoLine, true));
-		ob2.setAttribute("fill", SetColor(Item->hatchBackground, 100));
+		QDomElement ob2 = m_domDoc.createElement("path");
+		ob2.setAttribute("d", setClipPath(&Item->PoLine, true));
+		ob2.setAttribute("fill", setColor(Item->hatchBackground, 100));
 		ob.appendChild(ob2);
 	}
 	QString stroke = "";
@@ -750,18 +752,18 @@
 		mpx.translate(Item->width() / 2.0, Item->height() / 2.0);
 		if (Item->hatchAngle != 0.0)
 			mpx.rotate(-Item->hatchAngle);
-		QDomElement ob3 = docu.createElement("path");
-		ob3.setAttribute("transform", MatrixToStr(mpx));
+		QDomElement ob3 = m_domDoc.createElement("path");
+		ob3.setAttribute("transform", matrixToStr(mpx));
 		ob3.setAttribute("d", QString("M %1, %2 L %3, %4").arg(-lineLen).arg(dist).arg(lineLen).arg(dist));
-		ob3.setAttribute("stroke", SetColor(Item->hatchForeground, 100));
+		ob3.setAttribute("stroke", setColor(Item->hatchForeground, 100));
 		ob3.setAttribute("style", stroke);
 		ob.appendChild(ob3);
 		if (dist > 0)
 		{
-			QDomElement ob4 = docu.createElement("path");
-			ob4.setAttribute("transform", MatrixToStr(mpx));
+			QDomElement ob4 = m_domDoc.createElement("path");
+			ob4.setAttribute("transform", matrixToStr(mpx));
 			ob4.setAttribute("d", QString("M %1, %2 L %3, %4").arg(-lineLen).arg(-dist).arg(lineLen).arg(-dist));
-			ob4.setAttribute("stroke", SetColor(Item->hatchForeground, 100));
+			ob4.setAttribute("stroke", setColor(Item->hatchForeground, 100));
 			ob4.setAttribute("style", stroke);
 			ob.appendChild(ob4);
 		}
@@ -776,18 +778,18 @@
 			mpx.translate(Item->width() / 2.0, Item->height() / 2.0);
 			if (Item->hatchAngle != 0.0)
 				mpx.rotate(-Item->hatchAngle + 90);
-			QDomElement ob3 = docu.createElement("path");
-			ob3.setAttribute("transform", MatrixToStr(mpx));
+			QDomElement ob3 = m_domDoc.createElement("path");
+			ob3.setAttribute("transform", matrixToStr(mpx));
 			ob3.setAttribute("d", QString("M %1, %2 L %3, %4").arg(-lineLen).arg(dist).arg(lineLen).arg(dist));
-			ob3.setAttribute("stroke", SetColor(Item->hatchForeground, 100));
+			ob3.setAttribute("stroke", setColor(Item->hatchForeground, 100));
 			ob3.setAttribute("style", stroke);
 			ob.appendChild(ob3);
 			if (dist > 0)
 			{
-				QDomElement ob4 = docu.createElement("path");
-				ob4.setAttribute("transform", MatrixToStr(mpx));
+				QDomElement ob4 = m_domDoc.createElement("path");
+				ob4.setAttribute("transform", matrixToStr(mpx));
 				ob4.setAttribute("d", QString("M %1, %2 L %3, %4").arg(-lineLen).arg(-dist).arg(lineLen).arg(-dist));
-				ob4.setAttribute("stroke", SetColor(Item->hatchForeground, 100));
+				ob4.setAttribute("stroke", setColor(Item->hatchForeground, 100));
 				ob4.setAttribute("style", stroke);
 				ob.appendChild(ob4);
 			}
@@ -804,18 +806,18 @@
 			mpx.translate(Item->width() / 2.0, Item->height() / 2.0);
 			if (Item->hatchAngle != 0.0)
 				mpx.rotate(-Item->hatchAngle + 45);
-			QDomElement ob3 = docu.createElement("path");
-			ob3.setAttribute("transform", MatrixToStr(mpx));
+			QDomElement ob3 = m_domDoc.createElement("path");
+			ob3.setAttribute("transform", matrixToStr(mpx));
 			ob3.setAttribute("d", QString("M %1, %2 L %3, %4").arg(-lineLen).arg(dDist).arg(lineLen).arg(dDist));
-			ob3.setAttribute("stroke", SetColor(Item->hatchForeground, 100));
+			ob3.setAttribute("stroke", setColor(Item->hatchForeground, 100));
 			ob3.setAttribute("style", stroke);
 			ob.appendChild(ob3);
 			if (dist > 0)
 			{
-				QDomElement ob4 = docu.createElement("path");
-				ob4.setAttribute("transform", MatrixToStr(mpx));
+				QDomElement ob4 = m_domDoc.createElement("path");
+				ob4.setAttribute("transform", matrixToStr(mpx));
 				ob4.setAttribute("d", QString("M %1, %2 L %3, %4").arg(-lineLen).arg(-dDist).arg(lineLen).arg(-dDist));
-				ob4.setAttribute("stroke", SetColor(Item->hatchForeground, 100));
+				ob4.setAttribute("stroke", setColor(Item->hatchForeground, 100));
 				ob4.setAttribute("style", stroke);
 				ob.appendChild(ob4);
 			}
@@ -828,7 +830,7 @@
 QDomElement SVGExPlug::processSymbolStroke(PageItem *Item, const QString& trans)
 {
 	QDomElement ob;
-	ob = docu.createElement("g");
+	ob = m_domDoc.createElement("g");
 	ob.setAttribute("transform", trans);
 	QPainterPath path = Item->PoLine.toQPainterPath(false);
 	ScPattern pat = m_Doc->docPatterns[Item->strokePattern()];
@@ -853,8 +855,8 @@
 		trans.scale(Item->patternStrokeScaleX / 100.0, Item->patternStrokeScaleY / 100.0);
 		trans.translate(-pat.width / 2.0, -pat.height / 2.0);
 		QDomElement obS;
-		obS = docu.createElement("use");
-		obS.setAttribute("transform", MatrixToStr(trans));
+		obS = m_domDoc.createElement("use");
+		obS.setAttribute("transform", matrixToStr(trans));
 		if (Item->patternStrokeMirrorX)
 		{
 			trans.translate(pat.width, 0);
@@ -869,7 +871,7 @@
 		obS.setAttribute("y", "0");
 		obS.setAttribute("width", FToStr(pat.width));
 		obS.setAttribute("height", FToStr(pat.height));
-		obS.setAttribute("xlink:href", "#S"+Item->strokePattern());
+		obS.setAttribute("xlink:href", "#S" + Item->strokePattern());
 		ob.appendChild(obS);
 		xpos += adv;
 	}
@@ -880,12 +882,12 @@
 {
 	QDomElement ob;
 	ScPattern pat = m_Doc->docPatterns[Item->pattern()];
-	ob = docu.createElement("use");
+	ob = m_domDoc.createElement("use");
 	ob.setAttribute("x", "0");
 	ob.setAttribute("y", "0");
 	ob.setAttribute("width", FToStr(pat.width));
 	ob.setAttribute("height", FToStr(pat.height));
-	ob.setAttribute("xlink:href", "#S"+Item->pattern());
+	ob.setAttribute("xlink:href", "#S" + Item->pattern());
 	QString tr = trans + QString(" scale(%1, %2)").arg(Item->width() / pat.width).arg(Item->height() / pat.height);
 	ob.setAttribute("transform", tr);
 	return ob;
@@ -900,14 +902,14 @@
 	{
 		if ((!Item->strokePattern().isEmpty()) && (Item->patternStrokePath))
 		{
-			ob = docu.createElement("g");
+			ob = m_domDoc.createElement("g");
 			if (Item->GrType == 14)
 			{
 				QDomElement ob1 = processHatchFill(Item, trans);
 				ob.appendChild(ob1);
 			}
-			QDomElement ob2 = docu.createElement("path");
-			ob2.setAttribute("d", SetClipPath(&Item->PoLine, closedPath));
+			QDomElement ob2 = m_domDoc.createElement("path");
+			ob2.setAttribute("d", setClipPath(&Item->PoLine, closedPath));
 			ob2.setAttribute("transform", trans);
 			if (Item->GrType != 14)
 				ob2.setAttribute("style", fill);
@@ -924,19 +926,19 @@
 		{
 			if (Item->GrType == 14)
 			{
-				ob = docu.createElement("g");
+				ob = m_domDoc.createElement("g");
 				ob.setAttribute("transform", trans);
 				QDomElement ob1 = processHatchFill(Item);
 				ob.appendChild(ob1);
-				QDomElement ob2 = docu.createElement("path");
-				ob2.setAttribute("d", SetClipPath(&Item->PoLine, closedPath));
+				QDomElement ob2 = m_domDoc.createElement("path");
+				ob2.setAttribute("d", setClipPath(&Item->PoLine, closedPath));
 				ob2.setAttribute("style", stroke + "fill:none;" + processDropShadow(Item));
 				ob.appendChild(ob2);
 			}
 			else
 			{
-				ob = docu.createElement("path");
-				ob.setAttribute("d", SetClipPath(&Item->PoLine, closedPath));
+				ob = m_domDoc.createElement("path");
+				ob.setAttribute("d", setClipPath(&Item->PoLine, closedPath));
 				ob.setAttribute("transform", trans);
 				ob.setAttribute("style", fill + stroke);
 			}
@@ -944,15 +946,15 @@
 	}
 	else
 	{
-		ob = docu.createElement("g");
+		ob = m_domDoc.createElement("g");
 		ob.setAttribute("transform", trans);
 		if (Item->GrType == 14)
 		{
 			QDomElement ob1 = processHatchFill(Item);
 			ob.appendChild(ob1);
 		}
-		QDomElement ob2 = docu.createElement("path");
-		ob2.setAttribute("d", SetClipPath(&Item->PoLine, closedPath));
+		QDomElement ob2 = m_domDoc.createElement("path");
+		ob2.setAttribute("d", setClipPath(&Item->PoLine, closedPath));
 		if (Item->GrType != 14)
 			ob2.setAttribute("style", fill);
 		else
@@ -967,9 +969,9 @@
 		{
 			if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
 			{
-				QDomElement ob3 = docu.createElement("path");
-				ob3.setAttribute("d", SetClipPath(&Item->PoLine, closedPath));
-				ob3.setAttribute("style", GetMultiStroke(&ml[it], Item));
+				QDomElement ob3 = m_domDoc.createElement("path");
+				ob3.setAttribute("d", setClipPath(&Item->PoLine, closedPath));
+				ob3.setAttribute("style", getMultiStroke(&ml[it], Item));
 				ob.appendChild(ob3);
 			}
 		}
@@ -982,23 +984,23 @@
 	QDomElement ob;
 	if (Item->NamedLStyle.isEmpty())
 	{
-		ob = docu.createElement("path");
-		ob.setAttribute("d", "M 0 0 L "+FToStr(Item->width())+" 0");
+		ob = m_domDoc.createElement("path");
+		ob.setAttribute("d", "M 0 0 L " + FToStr(Item->width()) + " 0");
 		ob.setAttribute("transform", trans);
 		ob.setAttribute("style", stroke);
 	}
 	else
 	{
-		ob = docu.createElement("g");
+		ob = m_domDoc.createElement("g");
 		ob.setAttribute("transform", trans);
 		multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
 		for (int i = ml.size()-1; i > -1; i--)
 		{
 			if ((ml[i].Color != CommonStrings::None) && (ml[i].Width != 0))
 			{
-				QDomElement ob2 = docu.createElement("path");
-				ob2.setAttribute("d", "M 0 0 L "+FToStr(Item->width())+" 0");
-				ob2.setAttribute("style", GetMultiStroke(&ml[i], Item));
+				QDomElement ob2 = m_domDoc.createElement("path");
+				ob2.setAttribute("d", "M 0 0 L " + FToStr(Item->width()) + " 0");
+				ob2.setAttribute("style", getMultiStroke(&ml[i], Item));
 				ob.appendChild(ob2);
 			}
 		}
@@ -1009,7 +1011,7 @@
 QDomElement SVGExPlug::processImageItem(PageItem *Item, const QString& trans, const QString& fill, const QString& stroke)
 {
 	QDomElement ob;
-	ob = docu.createElement("g");
+	ob = m_domDoc.createElement("g");
 	ob.setAttribute("transform", trans);
 	if ((Item->fillColor() != CommonStrings::None) || (Item->GrType != 0))
 	{
@@ -1023,8 +1025,8 @@
 		}
 		else
 		{
-			QDomElement ob1 = docu.createElement("path");
-			ob1.setAttribute("d", SetClipPath(&Item->PoLine, true));
+			QDomElement ob1 = m_domDoc.createElement("path");
+			ob1.setAttribute("d", setClipPath(&Item->PoLine, true));
 			ob1.setAttribute("style", fill);
 			ob.appendChild(ob1);
 		}
@@ -1051,12 +1053,12 @@
 				mpc.translate(0, Item->height());
 				mpc.scale(1, -1);
 			}
-			cl.setAttribute("transform", MatrixToStr(mpc));
-		}
-		QDomElement ob6 = docu.createElement("g");
+			cl.setAttribute("transform", matrixToStr(mpc));
+		}
+		QDomElement ob6 = m_domDoc.createElement("g");
 		if (!ob2.isNull())
 			ob6.setAttribute("clip-path", "url(#" + ob2.attribute("id") + ")");
-		QDomElement ob3 = docu.createElement("image");
+		QDomElement ob3 = m_domDoc.createElement("image");
 		ScImage img;
 		CMSettings cms(m_Doc, Item->IProfile, Item->IRender);
 		cms.setUseEmbeddedProfile(Item->UseEmbedded);
@@ -1070,18 +1072,18 @@
 			img.qImage().save(&buffer, "PNG");
 			QByteArray ba = buffer.buffer().toBase64();
 			buffer.close();
-			ob3.setAttribute("xlink:href", "data:image/png;base64,"+QString(ba));
+			ob3.setAttribute("xlink:href", "data:image/png;base64," + QString(ba));
 		}
 		else
 		{
 			QFileInfo fi = QFileInfo(Item->Pfile);
-			QString imgFileName = baseDir + "/" + fi.baseName()+".png";
+			QString imgFileName = m_baseDir + "/" + fi.baseName() + ".png";
 			QFileInfo im = QFileInfo(imgFileName);
 			if (im.exists())
-				imgFileName = baseDir + "/" + fi.baseName()+"_copy.png";
+				imgFileName = m_baseDir + "/" + fi.baseName() + "_copy.png";
 			img.qImage().save(imgFileName, "PNG");
 			QFileInfo fi2 = QFileInfo(imgFileName);
-			ob3.setAttribute("xlink:href", fi2.baseName()+".png");
+			ob3.setAttribute("xlink:href", fi2.baseName() + ".png");
 		}
 		ob3.setAttribute("x", FToStr(Item->imageXOffset() * Item->imageXScale()));
 		ob3.setAttribute("y", FToStr(Item->imageYOffset() * Item->imageYScale()));
@@ -1099,7 +1101,7 @@
 			mpa.scale(1, -1);
 		}
 		mpa.rotate(Item->imageRotation());
-		ob3.setAttribute("transform", MatrixToStr(mpa));
+		ob3.setAttribute("transform", matrixToStr(mpa));
 		ob6.appendChild(ob3);
 		ob.appendChild(ob6);
 	}
@@ -1107,9 +1109,9 @@
 	{
 		if ((!Item->strokePattern().isEmpty()) && (Item->patternStrokePath))
 		{
-			QDomElement ob4 = docu.createElement("g");
-			QDomElement ob2 = docu.createElement("path");
-			ob2.setAttribute("d", SetClipPath(&Item->PoLine, true));
+			QDomElement ob4 = m_domDoc.createElement("g");
+			QDomElement ob2 = m_domDoc.createElement("path");
+			ob2.setAttribute("d", setClipPath(&Item->PoLine, true));
 			ob2.setAttribute("transform", trans);
 			ob2.setAttribute("style", fill);
 			ob4.appendChild(ob2);
@@ -1118,9 +1120,9 @@
 		}
 		else
 		{
-			QDomElement ob4 = docu.createElement("path");
-			ob4.setAttribute("d", SetClipPath(&Item->PoLine, true));
-			ob4.setAttribute("style", "fill:none; "+stroke);
+			QDomElement ob4 = m_domDoc.createElement("path");
+			ob4.setAttribute("d", setClipPath(&Item->PoLine, true));
+			ob4.setAttribute("style", "fill:none; " + stroke);
 			ob.appendChild(ob4);
 		}
 	}
@@ -1131,9 +1133,9 @@
 		{
 			if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
 			{
-				QDomElement ob5 = docu.createElement("path");
-				ob5.setAttribute("d", SetClipPath(&Item->PoLine, true));
-				ob5.setAttribute("style", "fill:none; "+GetMultiStroke(&ml[it], Item));
+				QDomElement ob5 = m_domDoc.createElement("path");
+				ob5.setAttribute("d", setClipPath(&Item->PoLine, true));
+				ob5.setAttribute("style", "fill:none; " + getMultiStroke(&ml[it], Item));
 				ob.appendChild(ob5);
 			}
 		}
@@ -1170,10 +1172,10 @@
 			QTransform transform = matrix();
 			transform.translate(x() + gl.xoffset + current_x, y() - (fontSize() * gc.scaleV()) + gl.yoffset);
 			transform.scale(gc.scaleH() * fontSize() / 10.0, gc.scaleV() * fontSize() / 10.0);
-			QDomElement glyph = m_svg->docu.createElement("use");
+			QDomElement glyph = m_svg->m_domDoc.createElement("use");
 			glyph.setAttribute("xlink:href", "#" + m_svg->handleGlyph(gl.glyph, font()));
-			glyph.setAttribute("transform", m_svg->MatrixToStr(transform));
-			QString fill = "fill:" + m_svg->SetColor(fillColor().color, fillColor().shade) + ";";
+			glyph.setAttribute("transform", m_svg->matrixToStr(transform));
+			QString fill = "fill:" + m_svg->setColor(fillColor().color, fillColor().shade) + ";";
 			QString stroke = "stroke:none;";
 			glyph.setAttribute("style", fill + stroke);
 			m_elem.appendChild(glyph);
@@ -1199,13 +1201,13 @@
 			QTransform transform = matrix();
 			transform.translate(x() + gl.xoffset + current_x, y() - (fontSize() * gc.scaleV()) + gl.yoffset);
 			transform.scale(gc.scaleH() * fontSize() / 10.0, gc.scaleV() * fontSize() / 10.0);
-			QDomElement glyph = m_svg->docu.createElement("use");
+			QDomElement glyph = m_svg->m_domDoc.createElement("use");
 			glyph.setAttribute("xlink:href", "#" + m_svg->handleGlyph(gl.glyph, font()));
-			glyph.setAttribute("transform", m_svg->MatrixToStr(transform));
+			glyph.setAttribute("transform", m_svg->matrixToStr(transform));
 			QString fill = "fill:none;";
 			if (hasFill)
-				fill = "fill:" + m_svg->SetColor(fillColor().color, fillColor().shade) + ";";
-			QString stroke ="stroke:" + m_svg->SetColor(strokeColor().color, strokeColor().shade) + ";";
+				fill = "fill:" + m_svg->setColor(fillColor().color, fillColor().shade) + ";";
+			QString stroke ="stroke:" + m_svg->setColor(strokeColor().color, strokeColor().shade) + ";";
 			stroke += " stroke-width:" + m_svg->FToStr(strokeWidth() / (gc.scaleV() * fontSize() / 10.0)) + ";";
 			glyph.setAttribute("style", fill + stroke);
 			m_elem.appendChild(glyph);
@@ -1218,16 +1220,16 @@
 	{
 		QTransform transform = matrix();
 		transform.translate(x(), y());
-		QDomElement path = m_svg-> docu.createElement("path");
+		QDomElement path = m_svg-> m_domDoc.createElement("path");
 		path.setAttribute("d", QString("M %1 %2 L%3 %4").arg(start.x()).arg(start.y()).arg(end.x()).arg(end.y()));
 		QString stroke = "stroke:none;";
 		if (fillColor().color != CommonStrings::None)
 		{
-			stroke = "stroke:" + m_svg->SetColor(fillColor().color, fillColor().shade) + ";";
+			stroke = "stroke:" + m_svg->setColor(fillColor().color, fillColor().shade) + ";";
 			stroke += " stroke-width:" + m_svg->FToStr(strokeWidth()) + ";";
 		}
 		path.setAttribute("style", "fill:none;" + stroke);
-		path.setAttribute("transform", m_svg->MatrixToStr(transform));
+		path.setAttribute("transform", m_svg->matrixToStr(transform));
 		m_elem.appendChild(path);
 	}
 
@@ -1240,10 +1242,10 @@
 		paS += QString("L %1 %2 ").arg(rect.x() + rect.width()).arg(rect.y() + rect.height());
 		paS += QString("L %1 %2 ").arg(rect.x()).arg(rect.y() + rect.height());
 		paS += "Z";
-		QDomElement path = m_svg->docu.createElement("path");
+		QDomElement path = m_svg->m_domDoc.createElement("path");
 		path.setAttribute("d", paS);
-		path.setAttribute("transform", m_svg->MatrixToStr(transform));
-		path.setAttribute("style", "fill:" + m_svg->SetColor(fillColor().color, fillColor().shade) + ";" + "stroke:none;");
+		path.setAttribute("transform", m_svg->matrixToStr(transform));
+		path.setAttribute("style", "fill:" + m_svg->setColor(fillColor().color, fillColor().shade) + ";" + "stroke:none;");
 		m_elem.appendChild(path);
 	}
 
@@ -1253,10 +1255,10 @@
 		transform.translate(x() + item->gXpos, y() + item->gYpos);
 		transform.rotate(item->rotation());
 		transform.scale(scaleH(), scaleV());
-		QDomElement Group = m_svg->docu.createElement("g");
+		QDomElement Group = m_svg->m_domDoc.createElement("g");
 		QDomElement layerGroup = m_svg->processInlineItem(item, m_trans, scaleH(), scaleV());
 		Group.appendChild(layerGroup);
-		Group.setAttribute("transform", m_svg->MatrixToStr(transform));
+		Group.setAttribute("transform", m_svg->matrixToStr(transform));
 		m_elem.appendChild(Group);
 	}
 };
@@ -1264,7 +1266,7 @@
 QDomElement SVGExPlug::processTextItem(PageItem *Item, const QString& trans, const QString& fill, const QString& stroke)
 {
 	QDomElement ob;
-	ob = docu.createElement("g");
+	ob = m_domDoc.createElement("g");
 	ob.setAttribute("transform", trans);
 	if ((Item->fillColor() != CommonStrings::None) || (Item->GrType != 0))
 	{
@@ -1278,8 +1280,8 @@
 		}
 		else
 		{
-			QDomElement ob1 = docu.createElement("path");
-			ob1.setAttribute("d", SetClipPath(&Item->PoLine, true));
+			QDomElement ob1 = m_domDoc.createElement("path");
+			ob1.setAttribute("d", setClipPath(&Item->PoLine, true));
 			ob1.setAttribute("style", fill);
 			ob.appendChild(ob1);
 		}
@@ -1297,9 +1299,9 @@
 		{
 			if ((!Item->strokePattern().isEmpty()) && (Item->patternStrokePath))
 			{
-				QDomElement ob4 = docu.createElement("g");
-				QDomElement ob2 = docu.createElement("path");
-				ob2.setAttribute("d", SetClipPath(&Item->PoLine, true));
+				QDomElement ob4 = m_domDoc.createElement("g");
+				QDomElement ob2 = m_domDoc.createElement("path");
+				ob2.setAttribute("d", setClipPath(&Item->PoLine, true));
 				ob2.setAttribute("transform", trans);
 				ob2.setAttribute("style", fill);
 				ob4.appendChild(ob2);
@@ -1308,9 +1310,9 @@
 			}
 			else
 			{
-				QDomElement ob4 = docu.createElement("path");
-				ob4.setAttribute("d", SetClipPath(&Item->PoLine, true));
-				ob4.setAttribute("style", "fill:none; "+stroke);
+				QDomElement ob4 = m_domDoc.createElement("path");
+				ob4.setAttribute("d", setClipPath(&Item->PoLine, true));
+				ob4.setAttribute("style", "fill:none; " + stroke);
 				ob.appendChild(ob4);
 			}
 		}
@@ -1321,9 +1323,9 @@
 			{
 				if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
 				{
-					QDomElement ob5 = docu.createElement("path");
-					ob5.setAttribute("d", SetClipPath(&Item->PoLine, true));
-					ob5.setAttribute("style", "fill:none; "+GetMultiStroke(&ml[it], Item));
+					QDomElement ob5 = m_domDoc.createElement("path");
+					ob5.setAttribute("d", setClipPath(&Item->PoLine, true));
+					ob5.setAttribute("style", "fill:none; " + getMultiStroke(&ml[it], Item));
 					ob.appendChild(ob5);
 				}
 			}
@@ -1335,9 +1337,9 @@
 		{
 			if ((!Item->strokePattern().isEmpty()) && (Item->patternStrokePath))
 			{
-				QDomElement ob4 = docu.createElement("g");
-				QDomElement ob2 = docu.createElement("path");
-				ob2.setAttribute("d", SetClipPath(&Item->PoLine, false));
+				QDomElement ob4 = m_domDoc.createElement("g");
+				QDomElement ob2 = m_domDoc.createElement("path");
+				ob2.setAttribute("d", setClipPath(&Item->PoLine, false));
 				ob2.setAttribute("transform", trans);
 				ob2.setAttribute("style", fill);
 				ob4.appendChild(ob2);
@@ -1346,9 +1348,9 @@
 			}
 			else
 			{
-				QDomElement ob4 = docu.createElement("path");
-				ob4.setAttribute("d", SetClipPath(&Item->PoLine, false));
-				ob4.setAttribute("style", "fill:none; "+stroke);
+				QDomElement ob4 = m_domDoc.createElement("path");
+				ob4.setAttribute("d", setClipPath(&Item->PoLine, false));
+				ob4.setAttribute("style", "fill:none; " + stroke);
 				ob.appendChild(ob4);
 			}
 		}
@@ -1359,9 +1361,9 @@
 			{
 				if ((ml[it].Color != CommonStrings::None) && (ml[it].Width != 0))
 				{
-					QDomElement ob5 = docu.createElement("path");
-					ob5.setAttribute("d", SetClipPath(&Item->PoLine, false));
-					ob5.setAttribute("style", "fill:none; "+GetMultiStroke(&ml[it], Item));
+					QDomElement ob5 = m_domDoc.createElement("path");
+					ob5.setAttribute("d", setClipPath(&Item->PoLine, false));
+					ob5.setAttribute("style", "fill:none; " + getMultiStroke(&ml[it], Item));
 					ob.appendChild(ob5);
 				}
 			}
@@ -1378,7 +1380,7 @@
 	else 
 		emG.append(embItem);
 
-	QDomElement layerGroup = docu.createElement("g");
+	QDomElement layerGroup = m_domDoc.createElement("g");
 	for (int em = 0; em < emG.count(); ++em)
 	{
 		PageItem* embedded = emG.at(em);
@@ -1389,9 +1391,9 @@
 		QString transE = "";
 		if (embItem->isGroup())
 		{
-			transE = "translate("+FToStr(embedded->gXpos)+", "+FToStr(embedded->gYpos)+")";
+			transE = "translate(" + FToStr(embedded->gXpos) + ", " + FToStr(embedded->gYpos) + ")";
 			if (embedded->rotation() != 0)
-				transE += " rotate("+FToStr(embedded->rotation())+")";
+				transE += " rotate(" + FToStr(embedded->rotation()) + ")";
 		}
 		switch (embedded->itemType())
 		{
@@ -1423,7 +1425,7 @@
 			case PageItem::Group:
 				if (embedded->groupItemList.count() > 0)
 				{
-					obE = docu.createElement("g");
+					obE = m_domDoc.createElement("g");
 					if (!embedded->AutoName)
 						obE.setAttribute("id", embedded->itemName());
 					if (embedded->GrMask > 0)
@@ -1456,7 +1458,7 @@
 						clipPath.map(transform);
 						QDomElement obc = createClipPathElement(&clipPath);
 						if (!obc.isNull())
-							obE.setAttribute("clip-path", "url(#"+ obc.attribute("id") + ")");
+							obE.setAttribute("clip-path", "url(#" + obc.attribute("id") + ")");
 						if (embedded->fillRule)
 							obE.setAttribute("clip-rule", "evenodd");
 						else
@@ -1465,7 +1467,7 @@
 					for (int em = 0; em < embedded->groupItemList.count(); ++em)
 					{
 						PageItem* embed = embedded->groupItemList.at(em);
-						ProcessItemOnPage(embed->gXpos, embed->gYpos, embed, &obE);
+						processItemOnPage(embed->gXpos, embed->gYpos, embed, &obE);
 					}
 				}
 				break;
@@ -1477,28 +1479,28 @@
 	QTransform mm;
 	if (embItem->isGroup())
 		mm.scale(embItem->width() / embItem->groupWidth, embItem->height() / embItem->groupHeight);
-	layerGroup.setAttribute("transform", MatrixToStr(mm));
+	layerGroup.setAttribute("transform", matrixToStr(mm));
 	return layerGroup;
 }
 
 QString SVGExPlug::handleGlyph(uint gid, const ScFace& font)
 {
 	QString glName = QString("Gl%1%2").arg(font.psName().simplified().replace(QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )).arg(gid);
-	if (glyphNames.contains(glName))
+	if (m_glyphNames.contains(glName))
 		return glName;
 	FPointArray pts = font.glyphOutline(gid);
-	QDomElement ob = docu.createElement("path");
-	ob.setAttribute("d", SetClipPath(&pts, true));
+	QDomElement ob = m_domDoc.createElement("path");
+	ob.setAttribute("d", setClipPath(&pts, true));
 	ob.setAttribute("id", glName);
-	globalDefs.appendChild(ob);
-	glyphNames.append(glName);
+	m_globalDefs.appendChild(ob);
+	m_glyphNames.append(glName);
 	return glName;
 }
 
 QDomElement SVGExPlug::processArrows(PageItem *Item, const QDomElement& line, const QString& trans)
 {
 	QDomElement ob, gr;
-	gr = docu.createElement("g");
+	gr = m_domDoc.createElement("g");
 	gr.appendChild(line);
 	if (Item->startArrowIndex() != 0)
 	{
@@ -1551,16 +1553,16 @@
 		arrow.map(arrowTrans);
 		if (Item->NamedLStyle.isEmpty())
 		{
-			ob = docu.createElement("path");
-			ob.setAttribute("d", SetClipPath(&arrow, true));
+			ob = m_domDoc.createElement("path");
+			ob.setAttribute("d", setClipPath(&arrow, true));
 			ob.setAttribute("transform", trans);
 			QString aFill;
 			if (!Item->strokePattern().isEmpty())
 			{
-				QString pattID = Item->strokePattern()+IToStr(PattCount);
-				PattCount++;
+				QString pattID = Item->strokePattern()+IToStr(m_pattCount);
+				m_pattCount++;
 				ScPattern pa = m_Doc->docPatterns[Item->strokePattern()];
-				QDomElement patt = docu.createElement("pattern");
+				QDomElement patt = m_domDoc.createElement("pattern");
 				patt.setAttribute("id", pattID);
 				patt.setAttribute("height", pa.height);
 				patt.setAttribute("width", pa.width);
@@ -1580,24 +1582,24 @@
 					mpa.scale(-1, 1);
 				if (mirrorY)
 					mpa.scale(1, -1);
-				patt.setAttribute("patternTransform", MatrixToStr(mpa));
-				patt.setAttribute("xlink:href", "#"+Item->strokePattern());
-				globalDefs.appendChild(patt);
-				aFill += "fill:url(#"+pattID+");";
+				patt.setAttribute("patternTransform", matrixToStr(mpa));
+				patt.setAttribute("xlink:href", "#" + Item->strokePattern());
+				m_globalDefs.appendChild(patt);
+				aFill += "fill:url(#" + pattID + ");";
 			}
 			else if (Item->GrTypeStroke > 0)
 			{
 				QDomElement grad;
 				if (Item->GrTypeStroke == 7)
 				{
-					grad = docu.createElement("radialGradient");
+					grad = m_domDoc.createElement("radialGradient");
 					grad.setAttribute("r", FToStr(sqrt(pow(Item->GrStrokeEndX - Item->GrStrokeStartX, 2) + pow(Item->GrStrokeEndY - Item->GrStrokeStartY,2))));
 					grad.setAttribute("cx", FToStr(Item->GrStrokeStartX));
 					grad.setAttribute("cy", FToStr(Item->GrStrokeStartY));
 				}
 				else
 				{
-					grad = docu.createElement("linearGradient");
+					grad = m_domDoc.createElement("linearGradient");
 					grad.setAttribute("x1", FToStr(Item->GrStrokeStartX));
 					grad.setAttribute("y1", FToStr(Item->GrStrokeStartY));
 					grad.setAttribute("x2", FToStr(Item->GrStrokeEndX));
@@ -1611,28 +1613,28 @@
 					actualStop = cstops.at(cst)->rampPoint;
 					if ((actualStop != lastStop) || (isFirst))
 					{
-						QDomElement itcl = docu.createElement("stop");
-						itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100)+"%");
+						QDomElement itcl = m_domDoc.createElement("stop");
+						itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100) + "%");
 						if (cstops.at(cst)->name == CommonStrings::None)
 							itcl.setAttribute("stop-opacity", FToStr(0));
 						else
 							itcl.setAttribute("stop-opacity", FToStr(cstops.at(cst)->opacity));
-						itcl.setAttribute("stop-color", SetColor(cstops.at(cst)->name, cstops.at(cst)->shade));
+						itcl.setAttribute("stop-color", setColor(cstops.at(cst)->name, cstops.at(cst)->shade));
 						grad.appendChild(itcl);
 						lastStop = actualStop;
 						isFirst  = false;
 					}
 				}
-				grad.setAttribute("id", "Grad"+IToStr(GradCount));
+				grad.setAttribute("id", "Grad" + IToStr(m_gradCount));
 				grad.setAttribute("gradientUnits", "userSpaceOnUse");
-				globalDefs.appendChild(grad);
-				aFill = " fill:url(#Grad"+IToStr(GradCount)+");";
-				GradCount++;
+				m_globalDefs.appendChild(grad);
+				aFill = " fill:url(#Grad" + IToStr(m_gradCount) + ");";
+				m_gradCount++;
 			}
 			else
-				aFill = "fill:"+SetColor(Item->lineColor(), Item->lineShade())+";";
+				aFill = "fill:" + setColor(Item->lineColor(), Item->lineShade()) + ";";
 			if (Item->lineTransparency() != 0)
-				aFill += " fill-opacity:"+FToStr(1.0 - Item->lineTransparency())+";";
+				aFill += " fill-opacity:" + FToStr(1.0 - Item->lineTransparency()) + ";";
 			ob.setAttribute("style", aFill + " stroke:none;");
 			gr.appendChild(ob);
 		}
@@ -1641,10 +1643,10 @@
 			multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
 			if (ml[0].Color != CommonStrings::None)
 			{
-				ob = docu.createElement("path");
-				ob.setAttribute("d", SetClipPath(&arrow, true));
+				ob = m_domDoc.createElement("path");
+				ob.setAttribute("d", setClipPath(&arrow, true));
 				ob.setAttribute("transform", trans);
-				QString aFill = "fill:"+SetColor(ml[0].Color, ml[0].Shade)+";";
+				QString aFill = "fill:" + setColor(ml[0].Color, ml[0].Shade) + ";";
 				ob.setAttribute("style", aFill + " stroke:none;");
 				gr.appendChild(ob);
 			}
@@ -1652,12 +1654,12 @@
 			{
 				if (ml[it].Color != CommonStrings::None)
 				{
-					QDomElement ob5 = docu.createElement("path");
-					ob5.setAttribute("d", SetClipPath(&arrow, true));
+					QDomElement ob5 = m_domDoc.createElement("path");
+					ob5.setAttribute("d", setClipPath(&arrow, true));
 					ob5.setAttribute("transform", trans);
-					QString stroke = "fill:none; stroke:"+SetColor(ml[it].Color, ml[it].Shade)+"; stroke-linecap:butt; stroke-linejoin:miter; stroke-dasharray:none;";
+					QString stroke = "fill:none; stroke:" + setColor(ml[it].Color, ml[it].Shade) + "; stroke-linecap:butt; stroke-linejoin:miter; stroke-dasharray:none;";
 					if (ml[it].Width != 0.0)
-						stroke += " stroke-width:"+FToStr(ml[it].Width)+";";
+						stroke += " stroke-width:" + FToStr(ml[it].Width) + ";";
 					else
 						stroke += " stroke-width:1px;";
 					ob5.setAttribute("style", stroke);
@@ -1683,18 +1685,18 @@
 			{
 				multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
 				if (ml[ml.size()-1].Width != 0.0)
-					arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
-			}
-		}
-		else
-		{
-			FPoint End = Item->PoLine.point(Item->PoLine.size()-2);
-			for (uint xx = Item->PoLine.size()-1; xx > 0; xx -= 2)
+					arrowTrans.scale(ml[ml.size() - 1].Width, ml[ml.size() - 1].Width);
+			}
+		}
+		else
+		{
+			FPoint End = Item->PoLine.point(Item->PoLine.size() - 2);
+			for (uint xx = Item->PoLine.size() - 1; xx > 0; xx -= 2)
 			{
 				FPoint Vector = Item->PoLine.point(xx);
 				if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
 				{
-					double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
+					double r = atan2(End.y() - Vector.y(), End.x() - Vector.x()) * (180.0 / M_PI);
 					arrowTrans.translate(End.x(), End.y());
 					arrowTrans.rotate(r);
 					arrowTrans.scale(Item->endArrowScale() / 100.0, Item->endArrowScale() / 100.0);
@@ -1706,8 +1708,8 @@
 					else
 					{
 						multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
-						if (ml[ml.size()-1].Width != 0.0)
-							arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
+						if (ml[ml.size() - 1].Width != 0.0)
+							arrowTrans.scale(ml[ml.size() - 1].Width, ml[ml.size() - 1].Width);
 					}
 					break;
 				}
@@ -1716,16 +1718,16 @@
 		arrow.map(arrowTrans);
 		if (Item->NamedLStyle.isEmpty())
 		{
-			ob = docu.createElement("path");
-			ob.setAttribute("d", SetClipPath(&arrow, true));
+			ob = m_domDoc.createElement("path");
+			ob.setAttribute("d", setClipPath(&arrow, true));
 			ob.setAttribute("transform", trans);
 			QString aFill;
 			if (!Item->strokePattern().isEmpty())
 			{
-				QString pattID = Item->strokePattern()+IToStr(PattCount);
-				PattCount++;
+				QString pattID = Item->strokePattern() + IToStr(m_pattCount);
+				m_pattCount++;
 				ScPattern pa = m_Doc->docPatterns[Item->strokePattern()];
-				QDomElement patt = docu.createElement("pattern");
+				QDomElement patt = m_domDoc.createElement("pattern");
 				patt.setAttribute("id", pattID);
 				patt.setAttribute("height", pa.height);
 				patt.setAttribute("width", pa.width);
@@ -1745,24 +1747,24 @@
 					mpa.scale(-1, 1);
 				if (mirrorY)
 					mpa.scale(1, -1);
-				patt.setAttribute("patternTransform", MatrixToStr(mpa));
-				patt.setAttribute("xlink:href", "#"+Item->strokePattern());
-				globalDefs.appendChild(patt);
-				aFill += "fill:url(#"+pattID+");";
+				patt.setAttribute("patternTransform", matrixToStr(mpa));
+				patt.setAttribute("xlink:href", "#" + Item->strokePattern());
+				m_globalDefs.appendChild(patt);
+				aFill += "fill:url(#" + pattID + ");";
 			}
 			else if (Item->GrTypeStroke > 0)
 			{
 				QDomElement grad;
 				if (Item->GrTypeStroke == 7)
 				{
-					grad = docu.createElement("radialGradient");
+					grad = m_domDoc.createElement("radialGradient");
 					grad.setAttribute("r", FToStr(sqrt(pow(Item->GrStrokeEndX - Item->GrStrokeStartX, 2) + pow(Item->GrStrokeEndY - Item->GrStrokeStartY,2))));
 					grad.setAttribute("cx", FToStr(Item->GrStrokeStartX));
 					grad.setAttribute("cy", FToStr(Item->GrStrokeStartY));
 				}
 				else
 				{
-					grad = docu.createElement("linearGradient");
+					grad = m_domDoc.createElement("linearGradient");
 					grad.setAttribute("x1", FToStr(Item->GrStrokeStartX));
 					grad.setAttribute("y1", FToStr(Item->GrStrokeStartY));
 					grad.setAttribute("x2", FToStr(Item->GrStrokeEndX));
@@ -1776,28 +1778,28 @@
 					actualStop = cstops.at(cst)->rampPoint;
 					if ((actualStop != lastStop) || (isFirst))
 					{
-						QDomElement itcl = docu.createElement("stop");
-						itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100)+"%");
+						QDomElement itcl = m_domDoc.createElement("stop");
+						itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100) + "%");
 						if (cstops.at(cst)->name == CommonStrings::None)
 							itcl.setAttribute("stop-opacity", FToStr(0));
 						else
 							itcl.setAttribute("stop-opacity", FToStr(cstops.at(cst)->opacity));
-						itcl.setAttribute("stop-color", SetColor(cstops.at(cst)->name, cstops.at(cst)->shade));
+						itcl.setAttribute("stop-color", setColor(cstops.at(cst)->name, cstops.at(cst)->shade));
 						grad.appendChild(itcl);
 						lastStop = actualStop;
 						isFirst  = false;
 					}
 				}
-				grad.setAttribute("id", "Grad"+IToStr(GradCount));
+				grad.setAttribute("id", "Grad" + IToStr(m_gradCount));
 				grad.setAttribute("gradientUnits", "userSpaceOnUse");
-				globalDefs.appendChild(grad);
-				aFill = " fill:url(#Grad"+IToStr(GradCount)+");";
-				GradCount++;
+				m_globalDefs.appendChild(grad);
+				aFill = " fill:url(#Grad" + IToStr(m_gradCount) + ");";
+				m_gradCount++;
 			}
 			else
-				aFill = "fill:"+SetColor(Item->lineColor(), Item->lineShade())+";";
+				aFill = "fill:" + setColor(Item->lineColor(), Item->lineShade()) + ";";
 			if (Item->lineTransparency() != 0)
-				aFill += " fill-opacity:"+FToStr(1.0 - Item->lineTransparency())+";";
+				aFill += " fill-opacity:" + FToStr(1.0 - Item->lineTransparency()) + ";";
 			ob.setAttribute("style", aFill + " stroke:none;");
 			gr.appendChild(ob);
 		}
@@ -1806,10 +1808,10 @@
 			multiLine ml = m_Doc->MLineStyles[Item->NamedLStyle];
 			if (ml[0].Color != CommonStrings::None)
 			{
-				ob = docu.createElement("path");
-				ob.setAttribute("d", SetClipPath(&arrow, true));
+				ob = m_domDoc.createElement("path");
+				ob.setAttribute("d", setClipPath(&arrow, true));
 				ob.setAttribute("transform", trans);
-				QString aFill = "fill:"+SetColor(ml[0].Color, ml[0].Shade)+";";
+				QString aFill = "fill:" + setColor(ml[0].Color, ml[0].Shade) + ";";
 				ob.setAttribute("style", aFill + " stroke:none;");
 				gr.appendChild(ob);
 			}
@@ -1817,12 +1819,12 @@
 			{
 				if (ml[it].Color != CommonStrings::None)
 				{
-					QDomElement ob5 = docu.createElement("path");
-					ob5.setAttribute("d", SetClipPath(&arrow, true));
+					QDomElement ob5 = m_domDoc.createElement("path");
+					ob5.setAttribute("d", setClipPath(&arrow, true));
 					ob5.setAttribute("transform", trans);
-					QString stroke = "fill:none; stroke:"+SetColor(ml[it].Color, ml[it].Shade)+"; stroke-linecap:butt; stroke-linejoin:miter; stroke-dasharray:none;";
+					QString stroke = "fill:none; stroke:" + setColor(ml[it].Color, ml[it].Shade) + "; stroke-linecap:butt; stroke-linejoin:miter; stroke-dasharray:none;";
 					if (ml[it].Width != 0.0)
-						stroke += " stroke-width:"+FToStr(ml[it].Width)+";";
+						stroke += " stroke-width:" + FToStr(ml[it].Width) + ";";
 					else
 						stroke += " stroke-width:1px;";
 					ob5.setAttribute("style", stroke);
@@ -1838,130 +1840,131 @@
 {
 	QDomElement grad;
 	QString retVal = "";
-	if (Item->GrMask != 0)
-	{
-		QString maskID = "Mask"+IToStr(MaskCount);
-		MaskCount++;
-		QDomElement mask = docu.createElement("mask");
-		mask.setAttribute("id", maskID);
-		QDomElement ob = docu.createElement("path");
-		ob.setAttribute("d", "M 0 0 L "+FToStr(Item->width())+" 0 L "+FToStr(Item->width())+" "+FToStr(Item->height())+" L 0 "+FToStr(Item->height())+" Z");
-		if (Item->isGroup())
-		{
-			QString trans = "translate("+FToStr(xOffset)+", "+FToStr(yOffset)+")";
-			if (Item->rotation() != 0)
-				trans += " rotate("+FToStr(Item->rotation())+")";
-			ob.setAttribute("transform", trans);
-		}
-		if ((Item->GrMask == 3) || (Item->GrMask == 6))
-		{
-			QString pattID = Item->patternMask()+IToStr(PattCount);
-			PattCount++;
-			ScPattern pa = m_Doc->docPatterns[Item->patternMask()];
-			QDomElement patt = docu.createElement("pattern");
-			patt.setAttribute("id", pattID);
-			patt.setAttribute("height", FToStr(pa.height));
-			patt.setAttribute("width", FToStr(pa.width));
-			patt.setAttribute("patternUnits", "userSpaceOnUse");
-			double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
-			Item->maskTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
-			bool mirrorX, mirrorY;
-			Item->maskFlip(mirrorX, mirrorY);
-			QTransform mpa;
-			mpa.translate(patternOffsetX, patternOffsetY);
-			mpa.rotate(patternRotation);
-			mpa.shear(-patternSkewX, patternSkewY);
-			mpa.scale(pa.scaleX, pa.scaleY);
-			mpa.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
-			if (mirrorX)
-				mpa.scale(-1, 1);
-			if (mirrorY)
-				mpa.scale(1, -1);
-			patt.setAttribute("patternTransform", MatrixToStr(mpa));
-			patt.setAttribute("xlink:href", "#"+Item->patternMask());
-			globalDefs.appendChild(patt);
-			ob.setAttribute("fill", "url(#"+pattID+")");
-		}
-		else if ((Item->GrMask == 1) || (Item->GrMask == 2) || (Item->GrMask == 4) || (Item->GrMask == 5))
-		{
-			if ((Item->GrMask == 1) || (Item->GrMask == 4))
-			{
-				grad = docu.createElement("linearGradient");
-				grad.setAttribute("x1", FToStr(Item->GrMaskStartX));
-				grad.setAttribute("y1", FToStr(Item->GrMaskStartY));
-				grad.setAttribute("x2", FToStr(Item->GrMaskEndX));
-				grad.setAttribute("y2", FToStr(Item->GrMaskEndY));
-			}
+	if (Item->GrMask == 0)
+		return retVal;
+
+	QString maskID = "Mask" + IToStr(m_maskCount);
+	m_maskCount++;
+	QDomElement mask = m_domDoc.createElement("mask");
+	mask.setAttribute("id", maskID);
+	QDomElement ob = m_domDoc.createElement("path");
+	ob.setAttribute("d", "M 0 0 L " + FToStr(Item->width()) + " 0 L " + FToStr(Item->width()) + " " + FToStr(Item->height()) + " L 0 " + FToStr(Item->height()) + " Z");
+	if (Item->isGroup())
+	{
+		QString trans = "translate(" + FToStr(xOffset) + ", " + FToStr(yOffset) + ")";
+		if (Item->rotation() != 0)
+			trans += " rotate(" + FToStr(Item->rotation()) + ")";
+		ob.setAttribute("transform", trans);
+	}
+	if ((Item->GrMask == 3) || (Item->GrMask == 6))
+	{
+		QString pattID = Item->patternMask() + IToStr(m_pattCount);
+		m_pattCount++;
+		ScPattern pa = m_Doc->docPatterns[Item->patternMask()];
+		QDomElement patt = m_domDoc.createElement("pattern");
+		patt.setAttribute("id", pattID);
+		patt.setAttribute("height", FToStr(pa.height));
+		patt.setAttribute("width", FToStr(pa.width));
+		patt.setAttribute("patternUnits", "userSpaceOnUse");
+		double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY;
+		Item->maskTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+		bool mirrorX, mirrorY;
+		Item->maskFlip(mirrorX, mirrorY);
+		QTransform mpa;
+		mpa.translate(patternOffsetX, patternOffsetY);
+		mpa.rotate(patternRotation);
+		mpa.shear(-patternSkewX, patternSkewY);
+		mpa.scale(pa.scaleX, pa.scaleY);
+		mpa.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
+		if (mirrorX)
+			mpa.scale(-1, 1);
+		if (mirrorY)
+			mpa.scale(1, -1);
+		patt.setAttribute("patternTransform", matrixToStr(mpa));
+		patt.setAttribute("xlink:href", "#" + Item->patternMask());
+		m_globalDefs.appendChild(patt);
+		ob.setAttribute("fill", "url(#" + pattID + ")");
+	}
+	else if ((Item->GrMask == 1) || (Item->GrMask == 2) || (Item->GrMask == 4) || (Item->GrMask == 5))
+	{
+		if ((Item->GrMask == 1) || (Item->GrMask == 4))
+		{
+			grad = m_domDoc.createElement("linearGradient");
+			grad.setAttribute("x1", FToStr(Item->GrMaskStartX));
+			grad.setAttribute("y1", FToStr(Item->GrMaskStartY));
+			grad.setAttribute("x2", FToStr(Item->GrMaskEndX));
+			grad.setAttribute("y2", FToStr(Item->GrMaskEndY));
+		}
+		else
+		{
+			grad = m_domDoc.createElement("radialGradient");
+			grad.setAttribute("r", FToStr(sqrt(pow(Item->GrMaskEndX - Item->GrMaskStartX, 2) + pow(Item->GrMaskEndY - Item->GrMaskStartY,2))));
+			grad.setAttribute("cx", FToStr(Item->GrMaskStartX));
+			grad.setAttribute("cy", FToStr(Item->GrMaskStartY));
+			grad.setAttribute("fx", FToStr(Item->GrMaskFocalX));
+			grad.setAttribute("fy", FToStr(Item->GrMaskFocalY));
+		}
+		double gradientSkew;
+		if (Item->GrMaskSkew == 90)
+			gradientSkew = 1;
+		else if (Item->GrMaskSkew == 180)
+			gradientSkew = 0;
+		else if (Item->GrMaskSkew == 270)
+			gradientSkew = -1;
+		else if (Item->GrMaskSkew == 390)
+			gradientSkew = 0;
+		else
+			gradientSkew = tan(M_PI / 180.0 * Item->GrMaskSkew);
+		QTransform qmatrix;
+		if (Item->GrType == 6)
+		{
+			qmatrix.translate(Item->GrMaskStartX, Item->GrMaskStartY);
+			qmatrix.shear(-gradientSkew, 0);
+			qmatrix.translate(-Item->GrMaskStartX, -Item->GrMaskStartY);
+		}
+		else
+		{
+			double rotEnd = xy2Deg(Item->GrMaskEndX - Item->GrMaskStartX, Item->GrMaskEndY - Item->GrMaskStartY);
+			qmatrix.translate(Item->GrMaskStartX, Item->GrMaskStartY);
+			qmatrix.rotate(rotEnd);
+			qmatrix.shear(gradientSkew, 0);
+			qmatrix.translate(0, Item->GrMaskStartY * (1.0 - Item->GrMaskScale));
+			qmatrix.translate(-Item->GrMaskStartX, -Item->GrMaskStartY);
+			qmatrix.scale(1, Item->GrMaskScale);
+		}
+		grad.setAttribute("gradientTransform", matrixToStr(qmatrix));
+		grad.setAttribute("id", "Grad" + IToStr(m_gradCount));
+		grad.setAttribute("gradientUnits", "userSpaceOnUse");
+		QList<VColorStop*> cstops = Item->mask_gradient.colorStops();
+		for (int cst = 0; cst < Item->mask_gradient.stops(); ++cst)
+		{
+			QDomElement itcl = m_domDoc.createElement("stop");
+			itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100) + "%");
+			if (cstops.at(cst)->name == CommonStrings::None)
+				itcl.setAttribute("stop-opacity", FToStr(0));
 			else
-			{
-				grad = docu.createElement("radialGradient");
-				grad.setAttribute("r", FToStr(sqrt(pow(Item->GrMaskEndX - Item->GrMaskStartX, 2) + pow(Item->GrMaskEndY - Item->GrMaskStartY,2))));
-				grad.setAttribute("cx", FToStr(Item->GrMaskStartX));
-				grad.setAttribute("cy", FToStr(Item->GrMaskStartY));
-				grad.setAttribute("fx", FToStr(Item->GrMaskFocalX));
-				grad.setAttribute("fy", FToStr(Item->GrMaskFocalY));
-			}
-			double gradientSkew;
-			if (Item->GrMaskSkew == 90)
-				gradientSkew = 1;
-			else if (Item->GrMaskSkew == 180)
-				gradientSkew = 0;
-			else if (Item->GrMaskSkew == 270)
-				gradientSkew = -1;
-			else if (Item->GrMaskSkew == 390)
-				gradientSkew = 0;
-			else
-				gradientSkew = tan(M_PI / 180.0 * Item->GrMaskSkew);
-			QTransform qmatrix;
-			if (Item->GrType == 6)
-			{
-				qmatrix.translate(Item->GrMaskStartX, Item->GrMaskStartY);
-				qmatrix.shear(-gradientSkew, 0);
-				qmatrix.translate(-Item->GrMaskStartX, -Item->GrMaskStartY);
-			}
-			else
-			{
-				double rotEnd = xy2Deg(Item->GrMaskEndX - Item->GrMaskStartX, Item->GrMaskEndY - Item->GrMaskStartY);
-				qmatrix.translate(Item->GrMaskStartX, Item->GrMaskStartY);
-				qmatrix.rotate(rotEnd);
-				qmatrix.shear(gradientSkew, 0);
-				qmatrix.translate(0, Item->GrMaskStartY * (1.0 - Item->GrMaskScale));
-				qmatrix.translate(-Item->GrMaskStartX, -Item->GrMaskStartY);
-				qmatrix.scale(1, Item->GrMaskScale);
-			}
-			grad.setAttribute("gradientTransform", MatrixToStr(qmatrix));
-			grad.setAttribute("id", "Grad"+IToStr(GradCount));
-			grad.setAttribute("gradientUnits", "userSpaceOnUse");
-			QList<VColorStop*> cstops = Item->mask_gradient.colorStops();
-			for (int cst = 0; cst < Item->mask_gradient.stops(); ++cst)
-			{
-				QDomElement itcl = docu.createElement("stop");
-				itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100)+"%");
-				if (cstops.at(cst)->name == CommonStrings::None)
-					itcl.setAttribute("stop-opacity", FToStr(0));
-				else
-					itcl.setAttribute("stop-opacity", FToStr(cstops.at(cst)->opacity));
-				itcl.setAttribute("stop-color", SetColor(cstops.at(cst)->name, cstops.at(cst)->shade));
-				grad.appendChild(itcl);
-			}
-			globalDefs.appendChild(grad);
-			ob.setAttribute("fill", "url(#Grad"+IToStr(GradCount)+")");
-			GradCount++;
-		}
-		if ((Item->lineColor() != CommonStrings::None) && (!Item->isGroup()))
-		{
-			ob.setAttribute("stroke", "white");
-			if (Item->lineWidth() != 0.0)
-				ob.setAttribute("stroke-width", FToStr(Item->lineWidth()));
-			else
-				ob.setAttribute("stroke-width", "1px");
-		}
-		else
-			ob.setAttribute("stroke", "none");
-		mask.appendChild(ob);
-		globalDefs.appendChild(mask);
-		retVal = "url(#"+maskID+")";
-	}
+				itcl.setAttribute("stop-opacity", FToStr(cstops.at(cst)->opacity));
+			itcl.setAttribute("stop-color", setColor(cstops.at(cst)->name, cstops.at(cst)->shade));
+			grad.appendChild(itcl);
+		}
+		m_globalDefs.appendChild(grad);
+		ob.setAttribute("fill", "url(#Grad" + IToStr(m_gradCount) + ")");
+		m_gradCount++;
+	}
+	if ((Item->lineColor() != CommonStrings::None) && (!Item->isGroup()))
+	{
+		ob.setAttribute("stroke", "white");
+		if (Item->lineWidth() != 0.0)
+			ob.setAttribute("stroke-width", FToStr(Item->lineWidth()));
+		else
+			ob.setAttribute("stroke-width", "1px");
+	}
+	else
+		ob.setAttribute("stroke", "none");
+	mask.appendChild(ob);
+	m_globalDefs.appendChild(mask);
+
+	retVal = "url(#" + maskID + ")";
 	return retVal;
 }
 
@@ -1973,15 +1976,15 @@
 		return "fill:none;";
 	if ((Item->fillColor() != CommonStrings::None) || (Item->GrType != 0))
 	{
-		fill = "fill:"+SetColor(Item->fillColor(), Item->fillShade())+";";
+		fill = "fill:" + setColor(Item->fillColor(), Item->fillShade()) + ";";
 		if (Item->GrType != 0)
 		{
 			if (Item->GrType == 8)
 			{
-				QString pattID = Item->pattern()+IToStr(PattCount);
-				PattCount++;
+				QString pattID = Item->pattern() + IToStr(m_pattCount);
+				m_pattCount++;
 				ScPattern pa = m_Doc->docPatterns[Item->pattern()];
-				QDomElement patt = docu.createElement("pattern");
+				QDomElement patt = m_domDoc.createElement("pattern");
 				patt.setAttribute("id", pattID);
 				patt.setAttribute("height", FToStr(pa.height));
 				patt.setAttribute("width", FToStr(pa.width));
@@ -2000,16 +2003,16 @@
 					mpa.scale(-1, 1);
 				if (mirrorY)
 					mpa.scale(1, -1);
-				patt.setAttribute("patternTransform", MatrixToStr(mpa));
-				patt.setAttribute("xlink:href", "#"+Item->pattern());
-				globalDefs.appendChild(patt);
-				fill = "fill:url(#"+pattID+");";
+				patt.setAttribute("patternTransform", matrixToStr(mpa));
+				patt.setAttribute("xlink:href", "#" + Item->pattern());
+				m_globalDefs.appendChild(patt);
+				fill = "fill:url(#" + pattID + ");";
 			}
 			else
 			{
 				if (Item->GrType == 6)
 				{
-					grad = docu.createElement("linearGradient");
+					grad = m_domDoc.createElement("linearGradient");
 					grad.setAttribute("x1", FToStr(Item->GrStartX));
 					grad.setAttribute("y1", FToStr(Item->GrStartY));
 					grad.setAttribute("x2", FToStr(Item->GrEndX));
@@ -2017,7 +2020,7 @@
 				}
 				else
 				{
-					grad = docu.createElement("radialGradient");
+					grad = m_domDoc.createElement("radialGradient");
 					grad.setAttribute("r", FToStr(sqrt(pow(Item->GrEndX - Item->GrStartX, 2) + pow(Item->GrEndY - Item->GrStartY,2))));
 					grad.setAttribute("cx", FToStr(Item->GrStartX));
 					grad.setAttribute("cy", FToStr(Item->GrStartY));
@@ -2052,8 +2055,8 @@
 					qmatrix.translate(-Item->GrStartX, -Item->GrStartY);
 					qmatrix.scale(1, Item->GrScale);
 				}
-				grad.setAttribute("gradientTransform", MatrixToStr(qmatrix));
-				grad.setAttribute("id", "Grad"+IToStr(GradCount));
+				grad.setAttribute("gradientTransform", matrixToStr(qmatrix));
+				grad.setAttribute("id", "Grad" + IToStr(m_gradCount));
 				grad.setAttribute("gradientUnits", "userSpaceOnUse");
 				bool   isFirst = true;
 				double actualStop = 0.0, lastStop = 0.0;
@@ -2063,21 +2066,21 @@
 					actualStop = cstops.at(cst)->rampPoint;
 					if ((actualStop != lastStop) || (isFirst))
 					{
-						QDomElement itcl = docu.createElement("stop");
-						itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100)+"%");
+						QDomElement itcl = m_domDoc.createElement("stop");
+						itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint * 100) + "%");
 						if (cstops.at(cst)->name == CommonStrings::None)
 							itcl.setAttribute("stop-opacity", FToStr(0));
 						else
 							itcl.setAttribute("stop-opacity", FToStr(cstops.at(cst)->opacity));
-						itcl.setAttribute("stop-color", SetColor(cstops.at(cst)->name, cstops.at(cst)->shade));
+						itcl.setAttribute("stop-color", setColor(cstops.at(cst)->name, cstops.at(cst)->shade));
 						grad.appendChild(itcl);
 						lastStop = actualStop;
 						isFirst  = false;
 					}
 				}
-				globalDefs.appendChild(grad);
-				fill = "fill:url(#Grad"+IToStr(GradCount)+");";
-				GradCount++;
+				m_globalDefs.appendChild(grad);
+				fill = "fill:url(#Grad" + IToStr(m_gradCount) + ");";
+				m_gradCount++;
 			}
 		}
 		if (Item->fillRule)
@@ -2085,7 +2088,7 @@
 		else
 			fill += " fill-rule:nonzero;";
 		if (Item->fillTransparency() != 0)
-			fill += " fill-opacity:"+FToStr(1.0 - Item->fillTransparency())+";";
+			fill += " fill-opacity:" + FToStr(1.0 - Item->fillTransparency()) + ";";
 	}
 	else
 		fill = "fill:none;";
@@ -2098,16 +2101,16 @@
 	for (int c = 0; c < patterns.count(); ++c)
 	{
 		ScPattern pa = m_Doc->docPatterns[patterns[c]];
-		QDomElement patt = docu.createElement("pattern");
+		QDomElement patt = m_domDoc.createElement("pattern");
 		patt.setAttribute("id", patterns[c]);
 		patt.setAttribute("height", FToStr(pa.height));
 		patt.setAttribute("width", FToStr(pa.width));
 		for (int em = 0; em < pa.items.count(); ++em)
 		{
 			PageItem* Item = pa.items.at(em);
-			ProcessItemOnPage(Item->gXpos, Item->gYpos, Item, &patt);
-		}
-		globalDefs.appendChild(patt);
+			processItemOnPage(Item->gXpos, Item->gYpos, Item, &patt);
+		}
+		m_globalDefs.appendChild(patt);
 	}
 }
 
@@ -2117,15 +2120,15 @@
 	for (int c = 0; c < patterns.count(); ++c)
 	{
 		ScPattern pa = m_Doc->docPatterns[patterns[c]];
-		QDomElement patt = docu.createElement("symbol");
-		patt.setAttribute("id", "S"+patterns[c]);
-		patt.setAttribute("viewbox", "0 0 "+ FToStr(pa.height) + " " + FToStr(pa.width));
+		QDomElement patt = m_domDoc.createElement("symbol");
+		patt.setAttribute("id", "S" + patterns[c]);
+		patt.setAttribute("viewbox", "0 0 " +  FToStr(pa.height) + " " + FToStr(pa.width));
 		for (int em = 0; em < pa.items.count(); ++em)
 		{
 			PageItem* Item = pa.items.at(em);
-			ProcessItemOnPage(Item->gXpos, Item->gYpos, Item, &patt);
-		}
-		globalDefs.appendChild(patt);
+			processItemOnPage(Item->gXpos, Item->gYpos, Item, &patt);
+		}
+		m_globalDefs.appendChild(patt);
 	}
 }
 
@@ -2133,9 +2136,9 @@
 {
 	QString stroke = "";
 	if (Item->lineTransparency() != 0)
-		stroke = "stroke-opacity:"+FToStr(1.0 - Item->lineTransparency())+";";
+		stroke = "stroke-opacity:" + FToStr(1.0 - Item->lineTransparency()) + ";";
 	if (Item->lineWidth() != 0.0)
-		stroke = "stroke-width:"+FToStr(Item->lineWidth())+";";
+		stroke = "stroke-width:" + FToStr(Item->lineWidth()) + ";";
 	else
 		stroke = "stroke-width:1px;";
 	stroke += " stroke-linecap:";
@@ -2175,9 +2178,9 @@
 	{
 		for (auto it = Item->DashValues.cbegin(); it != Item->DashValues.cend(); ++it )
 		{
-			stroke += IToStr(static_cast<int>(*it))+" ";
-		}
-		stroke += "; stroke-dashoffset:"+IToStr(static_cast<int>(Item->DashOffset))+";";
+			stroke += IToStr(static_cast<int>(*it)) + " ";
+		}
+		stroke += "; stroke-dashoffset:" + IToStr(static_cast<int>(Item->DashOffset)) + ";";
 	}
 	else
 	{
@@ -2189,15 +2192,15 @@
 			if (Da.isEmpty())
 				stroke += "none;";
 			else
-				stroke += Da.replace(" ", ", ")+";";
+				stroke += Da.replace(" ", ", ") + ";";
 		}
 	}
 	if ((!Item->strokePattern().isEmpty()) && (!Item->patternStrokePath))
 	{
-		QString pattID = Item->strokePattern()+IToStr(PattCount);
-		PattCount++;
+		QString pattID = Item->strokePattern() + IToStr(m_pattCount);
+		m_pattCount++;
 		ScPattern pa = m_Doc->docPatterns[Item->strokePattern()];
-		QDomElement patt = docu.createElement("pattern");
+		QDomElement patt = m_domDoc.createElement("pattern");
 		patt.setAttribute("id", pattID);
 		patt.setAttribute("height", FToStr(pa.height));
 		patt.setAttribute("width", FToStr(pa.width));
@@ -2217,17 +2220,17 @@
 			mpa.scale(-1, 1);
 		if (mirrorY)
 			mpa.scale(1, -1);
-		patt.setAttribute("patternTransform", MatrixToStr(mpa));
-		patt.setAttribute("xlink:href", "#"+Item->strokePattern());
-		globalDefs.appendChild(patt);
-		stroke += " stroke:url(#"+pattID+");";
+		patt.setAttribute("patternTransform", matrixToStr(mpa));
+		patt.setAttribute("xlink:href", "#" + Item->strokePattern());
+		m_globalDefs.appendChild(patt);
+		stroke += " stroke:url(#" + pattID + ");";
 	}
 	else if (Item->GrTypeStroke > 0)
 	{
 		QDomElement grad;
 		if (Item->GrTypeStroke == 7)
 		{
-			grad = docu.createElement("radialGradient");
+			grad = m_domDoc.createElement("radialGradient");
 			grad.setAttribute("r", FToStr(sqrt(pow(Item->GrStrokeEndX - Item->GrStrokeStartX, 2) + pow(Item->GrStrokeEndY - Item->GrStrokeStartY,2))));
 			grad.setAttribute("cx", FToStr(Item->GrStrokeStartX));
 			grad.setAttribute("cy", FToStr(Item->GrStrokeStartY));
@@ -2236,7 +2239,7 @@
 		}
 		else
 		{
-			grad = docu.createElement("linearGradient");
+			grad = m_domDoc.createElement("linearGradient");
 			grad.setAttribute("x1", FToStr(Item->GrStrokeStartX));
 			grad.setAttribute("y1", FToStr(Item->GrStrokeStartY));
 			grad.setAttribute("x2", FToStr(Item->GrStrokeEndX));
@@ -2250,13 +2253,13 @@
 			actualStop = cstops.at(cst)->rampPoint;
 			if ((actualStop != lastStop) || (isFirst))
 			{
-				QDomElement itcl = docu.createElement("stop");
-				itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100)+"%");
+				QDomElement itcl = m_domDoc.createElement("stop");
+				itcl.setAttribute("offset", FToStr(cstops.at(cst)->rampPoint*100) + "%");
 				if (cstops.at(cst)->name == CommonStrings::None)
 					itcl.setAttribute("stop-opacity", FToStr(0));
 				else
 					itcl.setAttribute("stop-opacity", FToStr(cstops.at(cst)->opacity));
-				itcl.setAttribute("stop-color", SetColor(cstops.at(cst)->name, cstops.at(cst)->shade));
+				itcl.setAttribute("stop-color", setColor(cstops.at(cst)->name, cstops.at(cst)->shade));
 				grad.appendChild(itcl);
 				lastStop = actualStop;
 				isFirst  = false;
@@ -2290,16 +2293,16 @@
 			qmatrix.translate(-Item->GrStrokeStartX, -Item->GrStrokeStartY);
 			qmatrix.scale(1, Item->GrStrokeScale);
 		}
-		grad.setAttribute("gradientTransform", MatrixToStr(qmatrix));
-		grad.setAttribute("id", "Grad"+IToStr(GradCount));
+		grad.setAttribute("gradientTransform", matrixToStr(qmatrix));
+		grad.setAttribute("id", "Grad" + IToStr(m_gradCount));
 		grad.setAttribute("gradientUnits", "userSpaceOnUse");
-		globalDefs.appendChild(grad);
-		stroke += " stroke:url(#Grad"+IToStr(GradCount)+");";
-		GradCount++;
+		m_globalDefs.appendChild(grad);
+		stroke += " stroke:url(#Grad" + IToStr(m_gradCount) + ");";
+		m_gradCount++;
 	}
 	else if (Item->lineColor() != CommonStrings::None)
 	{
-		stroke += " stroke:"+SetColor(Item->lineColor(), Item->lineShade())+";";
+		stroke += " stroke:" + setColor(Item->lineColor(), Item->lineShade()) + ";";
 	}
 	else
 		stroke = "stroke:none;";
@@ -2308,22 +2311,22 @@
 
 QDomElement SVGExPlug::createClipPathElement(FPointArray *ite, QDomElement* pathElem)
 {
-	QString clipPathStr = SetClipPath(ite, true);
+	QString clipPathStr = setClipPath(ite, true);
 	if (clipPathStr.isEmpty())
 		return QDomElement();
-	QDomElement clipPathElem = docu.createElement("clipPath");
-	clipPathElem.setAttribute("id", "Clip"+IToStr(ClipCount));
-	QDomElement cl = docu.createElement("path");
+	QDomElement clipPathElem = m_domDoc.createElement("clipPath");
+	clipPathElem.setAttribute("id", "Clip" + IToStr(m_clipCount));
+	QDomElement cl = m_domDoc.createElement("path");
 	if (pathElem)
 		*pathElem = cl;
 	cl.setAttribute("d", clipPathStr);
 	clipPathElem.appendChild(cl);
-	globalDefs.appendChild(clipPathElem);
-	ClipCount++;
+	m_globalDefs.appendChild(clipPathElem);
+	m_clipCount++;
 	return clipPathElem;
 }
 
-QString SVGExPlug::SetClipPath(FPointArray *ite, bool closed)
+QString SVGExPlug::setClipPath(FPointArray *ite, bool closed)
 {
 	QString tmp;
 	FPoint np, np1, np2, np3, np4, firstP;
@@ -2378,13 +2381,13 @@
 	return cc.setNum(c);
 }
 
-QString SVGExPlug::MatrixToStr(QTransform &mat)
+QString SVGExPlug::matrixToStr(QTransform &mat)
 {
 	QString cc("matrix(%1 %2 %3 %4 %5 %6)");
 	return  cc.arg(mat.m11()).arg(mat.m12()).arg(mat.m21()).arg(mat.m22()).arg(mat.dx()).arg(mat.dy());
 }
 
-QString SVGExPlug::SetColor(const QString& farbe, int shad)
+QString SVGExPlug::setColor(const QString& farbe, int shad)
 {
 	if (farbe == CommonStrings::None)
 		return "#FFFFFF";
@@ -2392,16 +2395,16 @@
 	return ScColorEngine::getShadeColorProof(col, m_Doc, shad).name();
 }
 
-QString SVGExPlug::GetMultiStroke(struct SingleLine *sl, PageItem *Item)
+QString SVGExPlug::getMultiStroke(struct SingleLine *sl, PageItem *Item)
 {
 	QString tmp = "fill:none; ";
-	tmp += "stroke:"+SetColor(sl->Color, sl->Shade)+"; ";
+	tmp += "stroke:" + setColor(sl->Color, sl->Shade) + "; ";
 	if (Item->fillTransparency() != 0)
 		tmp += QString(" stroke-opacity:%1; ").arg(1.0 - Item->fillTransparency());
 	tmp += QString("stroke-width:%1; ").arg(sl->Width);
 	tmp += "stroke-linecap:";
 	switch (static_cast<Qt::PenCapStyle>(sl->LineEnd))
-		{
+	{
 		case Qt::FlatCap:
 			tmp += "butt;";
 			break;
@@ -2414,10 +2417,10 @@
 		default:
 			tmp += "butt;";
 			break;
-		}
+	}
 	tmp += " stroke-linejoin:";
 	switch (static_cast<Qt::PenJoinStyle>(sl->LineJoin))
-		{
+	{
 		case Qt::MiterJoin:
 			tmp += "miter;";
 			break;
@@ -2430,7 +2433,7 @@
 		default:
 			tmp += "miter;";
 			break;
-		}
+	}
 	tmp += " stroke-dasharray:";
 	if (static_cast<Qt::PenStyle>(sl->Dash) == Qt::SolidLine)
 		tmp += "none;";
@@ -2440,7 +2443,7 @@
 		if (Da.isEmpty())
 			tmp += "none;";
 		else
-			tmp += Da.replace(" ", ", ")+";";
+			tmp += Da.replace(" ", ", ") + ";";
 	}
 	return tmp;
 }

Modified: trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23445&path=/trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.h
==============================================================================
--- trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.h	(original)
+++ trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.h	Sat Jan 11 23:44:11 2020
@@ -75,13 +75,25 @@
 
 private:
 	ScribusDoc* m_Doc;
+
+	int m_gradCount;
+	int m_clipCount;
+	int m_pattCount;
+	int m_maskCount;
+	int m_filterCount;
+	QString m_baseDir;
+	QDomDocument m_domDoc;
+	QDomElement m_domElem;
+	QDomElement m_globalDefs;
+	QList<QString> m_glyphNames;
+
 	/*!
 	\author Franz Schmid
 	\brief Process a page to export to SVG format
 	\param Seite Page *
 	*/
-	void ProcessPageLayer(ScPage *page, ScLayer& layer);
-	void ProcessItemOnPage(double xOffset, double yOffset, PageItem *Item, QDomElement *parentElem);
+	void processPageLayer(ScPage *page, ScLayer& layer);
+	void processItemOnPage(double xOffset, double yOffset, PageItem *Item, QDomElement *parentElem);
 	void paintBorder(const TableBorder& border, const QPointF& start, const QPointF& end, const QPointF& startOffsetFactors, const QPointF& endOffsetFactors, QDomElement &ob);
 	QString processDropShadow(PageItem *Item);
 	QDomElement processHatchFill(PageItem *Item, const QString& transl = "");
@@ -104,7 +116,7 @@
 	\param ite PageItem *
 	\retval QString Clipping Path
 	*/
-	QString SetClipPath(FPointArray *ite, bool closed);
+	QString setClipPath(FPointArray *ite, bool closed);
 	QDomElement createClipPathElement(FPointArray *ite, QDomElement* pathElem = nullptr);
 	/*!
 	\author Franz Schmid
@@ -127,25 +139,15 @@
 	\param plug ScribusMainWindow *
 	\retval QString Colour settings
 	*/
-	QString MatrixToStr(QTransform &mat);
-	QString SetColor(const QString& farbe, int shad);
+	QString matrixToStr(QTransform &mat);
+	QString setColor(const QString& farbe, int shad);
 	/*!
 	\author Franz Schmid
 	\param sl struct SingleLine *
 	\param Item PageItem *
 	\retval QString Stroke settings
 	*/
-	QString GetMultiStroke(struct SingleLine *sl, PageItem *Item);
-	int GradCount;
-	int ClipCount;
-	int PattCount;
-	int MaskCount;
-	int FilterCount;
-	QString baseDir;
-	QDomDocument docu;
-	QDomElement docElement;
-	QDomElement globalDefs;
-	QList<QString> glyphNames;
+	QString getMultiStroke(struct SingleLine *sl, PageItem *Item);
 };
 
 #endif




More information about the scribus-commit mailing list