r18028 by jghali - refactoring made possible by ScriXmlDoc being now a class without member

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 31 23:09:16 UTC 2012


Author: jghali
Date: Mon Dec 31 23:09:16 2012
New Revision: 18028

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18028
Log:
refactoring made possible by ScriXmlDoc being now a class without member

Modified:
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/plugins/import/ai/importai.cpp
    trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
    trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
    trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
    trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
    trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
    trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
    trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
    trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
    trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
    trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
    trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
    trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
    trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
    trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusXml.cpp
    trunk/Scribus/scribus/scribusXml.h
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/ui/masterpagepalette.cpp
    trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Mon Dec 31 23:09:16 2012
@@ -486,11 +486,7 @@
 				m_doc->DragElements.clear();
 				for (int dre=0; dre<m_doc->m_Selection->count(); ++dre)
 					m_doc->DragElements.append(m_doc->m_Selection->itemAt(dre));
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_doc, m_doc->m_Selection));
-				delete ss;
-				ss = NULL;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_doc, m_doc->m_Selection);
 				QDrag* dr = new QDrag(m_view);
 				dr->setMimeData(md);
 				const QPixmap& pm = loadIcon("DragPix.xpm");

Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp Mon Dec 31 23:09:16 2012
@@ -500,10 +500,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 /*#ifndef Q_WS_MAC*/
 // see #2196
 				m_Doc->itemSelection_DeleteItem(tmpSel);

Modified: trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp Mon Dec 31 23:09:16 2012
@@ -261,10 +261,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				m_Doc->m_Selection->delaySignalsOff();

Modified: trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp Mon Dec 31 23:09:16 2012
@@ -258,10 +258,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				m_Doc->m_Selection->delaySignalsOff();

Modified: trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp Mon Dec 31 23:09:16 2012
@@ -275,10 +275,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				if (importedColors.count() != 0)

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Mon Dec 31 23:09:16 2012
@@ -402,10 +402,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				m_Doc->m_Selection->delaySignalsOff();

Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp Mon Dec 31 23:09:16 2012
@@ -584,13 +584,8 @@
 			{
 				tmpSel->addItem(Elements.at(dre), true);
 			}
-			ScriXmlDoc *ss = new ScriXmlDoc();
 			tmpSel->setGroupRect();
-			//CB keep for reference conversion for now
-			//Q3DragObject *dr = new Q3TextDrag(ss->WriteElem(m_Doc, m_Doc->view(), tmpSel), m_Doc->view()->viewport());
-			ScElemMimeData* md = new ScElemMimeData();
-			md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-			delete ss;
+			ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 /*#ifndef Q_WS_MAC*/
 // see #2196, #2526
 			m_Doc->itemSelection_DeleteItem(tmpSel);

Modified: trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pct/importpct.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pct/importpct.cpp Mon Dec 31 23:09:16 2012
@@ -263,10 +263,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				if (importedColors.count() != 0)

Modified: trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/importpdf.cpp Mon Dec 31 23:09:16 2012
@@ -311,10 +311,7 @@
 					tmpSele->addItem(Elements.at(dre), true);
 				}
 				tmpSele->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSele));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSele);
 				m_Doc->itemSelection_DeleteItem(tmpSele);
 				m_Doc->view()->updatesOn(true);
 				m_Doc->m_Selection->delaySignalsOff();

Modified: trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/shape/importshape.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/shape/importshape.cpp Mon Dec 31 23:09:16 2012
@@ -263,10 +263,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				m_Doc->m_Selection->delaySignalsOff();

Modified: trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/sml/importsml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/sml/importsml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/sml/importsml.cpp Mon Dec 31 23:09:16 2012
@@ -259,10 +259,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				m_Doc->m_Selection->delaySignalsOff();

Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Mon Dec 31 23:09:16 2012
@@ -504,11 +504,8 @@
 			{
 				tmpSel->addItem(Elements.at(dre), true);
 			}
-			ScriXmlDoc *ss = new ScriXmlDoc();
 			tmpSel->setGroupRect();
-			ScElemMimeData* md = new ScElemMimeData();
-			md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-			delete ss;
+			ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 /*#ifndef Q_WS_MAC*/
 // see #2526
 			m_Doc->itemSelection_DeleteItem(tmpSel);

Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp Mon Dec 31 23:09:16 2012
@@ -659,11 +659,8 @@
 			{
 				m_tmpSel->addItem(Elements.at(dre), true);
 			}
-			ScriXmlDoc *ss = new ScriXmlDoc();
 			m_tmpSel->setGroupRect();
-			ScElemMimeData* md = new ScElemMimeData();
-			md->setScribusElem(ss->WriteElem(m_Doc, m_tmpSel));
-			delete ss;
+			ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, m_tmpSel);
 /*#ifndef QT_MAC*/
 // see #2526
 			m_Doc->itemSelection_DeleteItem(m_tmpSel);

Modified: trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp Mon Dec 31 23:09:16 2012
@@ -621,10 +621,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				m_Doc->m_Selection->delaySignalsOff();

Modified: trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xar/importxar.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xar/importxar.cpp Mon Dec 31 23:09:16 2012
@@ -368,10 +368,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 				m_Doc->itemSelection_DeleteItem(tmpSel);
 				m_Doc->view()->updatesOn(true);
 				if (importedColors.count() != 0)

Modified: trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp Mon Dec 31 23:09:16 2012
@@ -398,10 +398,7 @@
 					tmpSel->addItem(Elements.at(dre), true);
 				}
 				tmpSel->setGroupRect();
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				ScElemMimeData* md = new ScElemMimeData();
-				md->setScribusElem(ss->WriteElem(m_Doc, tmpSel));
-				delete ss;
+				ScElemMimeData* md = ScriXmlDoc::WriteToMimeData(m_Doc, tmpSel);
 /*#ifndef Q_WS_MAC*/
 // see #2196
 				m_Doc->itemSelection_DeleteItem(tmpSel);

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Mon Dec 31 23:09:16 2012
@@ -10117,8 +10117,8 @@
 					loadRawText(url.toLocalFile(), cf);
 					data = QString::fromUtf8(cf.data());
 					double gx, gy, gw, gh;
-					ScriXmlDoc *ss = new ScriXmlDoc();
-					if(ss->ReadElemHeader(data, false, &gx, &gy, &gw, &gh))
+					ScriXmlDoc ss;
+					if(ss.ReadElemHeader(data, false, &gx, &gy, &gw, &gh))
 					{
 						doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
 						HaveNewDoc();
@@ -10126,7 +10126,6 @@
 						slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view);
 						slotDocCh(false);
 						doc->regionsChanged()->update(QRectF());
-						delete ss;
 					}
 				}
 			}
@@ -10156,8 +10155,8 @@
 			if ((text.startsWith("<SCRIBUSELEM")) || (text.startsWith("SCRIBUSELEMUTF8")))
 			{
 				double gx, gy, gw, gh;
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				if(ss->ReadElemHeader(text, false, &gx, &gy, &gw, &gh))
+				ScriXmlDoc ss;
+				if(ss.ReadElemHeader(text, false, &gx, &gy, &gw, &gh))
 				{
 					doFileNew(gw, gh, 0, 0, 0, 0, 0, 0, false, false, 0, false, 0, 1, "Custom", true);
 					HaveNewDoc();
@@ -10165,7 +10164,6 @@
 					slotElemRead(text, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, false, doc, view);
 					slotDocCh(false);
 					doc->regionsChanged()->update(QRectF());
-					delete ss;
 				}
 			}
 		}

Modified: trunk/Scribus/scribus/scribusXml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/scribusXml.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusXml.cpp (original)
+++ trunk/Scribus/scribus/scribusXml.cpp Mon Dec 31 23:09:16 2012
@@ -23,9 +23,7 @@
 #include <QRegExp>
 #include <QTextCodec>
 #include <QTextStream>
-#include <QXmlSimpleReader>
 #include <QXmlStreamReader>
-#include <QXmlStreamWriter>
 #include <QDebug>
 
 #include <cstdlib>
@@ -38,6 +36,7 @@
 #endif
 #include "prefsmanager.h"
 #include "scclocale.h"
+#include "scmimedata.h"
 #include "scpage.h"
 #include "scribusdoc.h"
 #include "selection.h"
@@ -248,3 +247,10 @@
 	}
 	return documentStr;
 }
+
+ScElemMimeData* ScriXmlDoc::WriteToMimeData(ScribusDoc *doc, Selection *selection)
+{
+	ScElemMimeData* md = new ScElemMimeData();
+	md->setScribusElem(WriteElem(doc, selection));
+	return md;
+}

Modified: trunk/Scribus/scribus/scribusXml.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/scribusXml.h
==============================================================================
--- trunk/Scribus/scribus/scribusXml.h (original)
+++ trunk/Scribus/scribus/scribusXml.h Mon Dec 31 23:09:16 2012
@@ -25,13 +25,11 @@
 #include "scribusstructs.h"
 #include "styles/styleset.h"
 
-#include <QXmlStreamAttributes>
-#include <QXmlStreamReader>
-//#include <QXmlStreamWriter>
 class PageItem;
 class PrefsManager;
 class SCFonts;
 class ScribusDoc;
+class ScElemMimeData;
 class ScPattern;
 class ScXmlStreamWriter;
 class Selection;
@@ -52,7 +50,9 @@
 	bool ReadElemHeader(QString file, bool isFile, double *x, double *y, double *w, double *h);
 	bool ReadElem(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub);
 	bool ReadElemToLayer(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, int toLayer);
-	QString WriteElem(ScribusDoc *doc, Selection *selection);
+	
+	static QString WriteElem(ScribusDoc *doc, Selection *selection);
+	static ScElemMimeData* WriteToMimeData(ScribusDoc *doc, Selection *selection);
 };
 
 #endif // _SCRIBUS_CONFIG_

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Mon Dec 31 23:09:16 2012
@@ -5235,12 +5235,11 @@
 					}
 					if (tempSelection.count() != 0)
 					{
+						ScriXmlDoc ss;
 						setMasterPageMode(true);
-						ScriXmlDoc *ss = new ScriXmlDoc();
-						QString dataS = ss->WriteElem(this, &tempSelection);
+						QString dataS = ss.WriteElem(this, &tempSelection);
 						setCurrentPage(targetPage);
-						ss->ReadElemToLayer(dataS, appPrefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, appPrefsData.fontPrefs.GFontSub, it->ID);
-						delete ss;
+						ss.ReadElemToLayer(dataS, appPrefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, appPrefsData.fontPrefs.GFontSub, it->ID);
 						setMasterPageMode(false);
 					}
 					tempSelection.clear();
@@ -5264,12 +5263,11 @@
 			}
 			if (tempSelection.count() != 0)
 			{
-				ScriXmlDoc *ss = new ScriXmlDoc();
-				QString dataS = ss->WriteElem(this, &tempSelection);
+				ScriXmlDoc ss;
+				QString dataS = ss.WriteElem(this, &tempSelection);
 				setMasterPageMode(true);
 				setCurrentPage(targetPage);
-				ss->ReadElemToLayer(dataS, appPrefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, appPrefsData.fontPrefs.GFontSub, it->ID);
-				delete ss;
+				ss.ReadElemToLayer(dataS, appPrefsData.fontPrefs.AvailFonts, this, targetPage->xOffset(), targetPage->yOffset(), false, true, appPrefsData.fontPrefs.GFontSub, it->ID);
 				setMasterPageMode(false);
 			}
 			tempSelection.clear();
@@ -7060,10 +7058,9 @@
 				}
 				if (tempSelection.count() != 0)
 				{
-					ScriXmlDoc *ss = new ScriXmlDoc();
-					QString dataS = ss->WriteElem(this, &tempSelection);
+					ScriXmlDoc ss;
+					QString dataS = ss.WriteElem(this, &tempSelection);
 					itemBuffer.append(dataS);
-					delete ss;
 				}
 				else
 					itemBuffer.append(QString());
@@ -7145,10 +7142,9 @@
 				{
 					if ((lcount < itemBuffer.count()) && !itemBuffer[lcount].isEmpty())
 					{
+						ScriXmlDoc ss;
 						QString fragment = itemBuffer[lcount];
-						ScriXmlDoc *ss = new ScriXmlDoc();
-						ss->ReadElemToLayer(fragment, appPrefsData.fontPrefs.AvailFonts, this, destination->xOffset(), destination->yOffset(), false, true, appPrefsData.fontPrefs.GFontSub, it->ID);
-						delete ss;
+						ss.ReadElemToLayer(fragment, appPrefsData.fontPrefs.AvailFonts, this, destination->xOffset(), destination->yOffset(), false, true, appPrefsData.fontPrefs.GFontSub, it->ID);
 					}
 					lcount++;
 				}

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Mon Dec 31 23:09:16 2012
@@ -735,8 +735,8 @@
 	{
 		e->acceptProposedAction();
 		double gx, gy, gw, gh;
-		ScriXmlDoc *ss = new ScriXmlDoc();
-		if(ss->ReadElemHeader(text, fromFile, &gx, &gy, &gw, &gh))
+		ScriXmlDoc ss;
+		if(ss.ReadElemHeader(text, fromFile, &gx, &gy, &gw, &gh))
 		{
 			FPoint dragPosDoc = m_canvas->globalToCanvas(widget()->mapToGlobal(e->pos()));
 			dragX = dragPosDoc.x(); //e->pos().x() / m_canvas->scale();
@@ -753,8 +753,6 @@
 //				redrawMarker->show();
 			emit ItemGeom();
 		}
-		delete ss;
-		ss=NULL;
 	}
 }
 
@@ -3782,14 +3780,11 @@
 						{
 							if (hl->hasObject(Doc))
 							{
+								ScriXmlDoc ss;
 								Selection tempSelection(this, false);
 								tempSelection.addItem(hl->getItem(Doc), true);
-								ScriXmlDoc *ss = new ScriXmlDoc();
-								QString dataS = ss->WriteElem(Doc, &tempSelection);
-								delete ss;
-								ss = new ScriXmlDoc();
+								QString dataS = ss.WriteElem(Doc, &tempSelection);
 								emit LoadElem(dataS, currItem->xPos(), currItem->yPos(), false, true, Doc, this);
-								delete ss;
 								bb = Doc->Items->last();
 								int z = Doc->Items->indexOf(bb);
 								bb->setTextFlowMode(currItem->textFlowMode());

Modified: trunk/Scribus/scribus/ui/masterpagepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/ui/masterpagepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/masterpagepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/masterpagepalette.cpp Mon Dec 31 23:09:16 2012
@@ -279,11 +279,10 @@
 				}
 				if (currentDoc->m_Selection->count() != 0)
 				{
-					ScriXmlDoc *ss = new ScriXmlDoc();
-					QString buffer = ss->WriteElem(currentDoc, currentDoc->m_Selection);
-					ss->ReadElemToLayer(buffer, prefsManager->appPrefs.fontPrefs.AvailFonts, currentDoc, destination->xOffset(), destination->yOffset(), false, true, prefsManager->appPrefs.fontPrefs.GFontSub, it->ID);
+					ScriXmlDoc ss;
+					QString buffer = ss.WriteElem(currentDoc, currentDoc->m_Selection);
+					ss.ReadElemToLayer(buffer, prefsManager->appPrefs.fontPrefs.AvailFonts, currentDoc, destination->xOffset(), destination->yOffset(), false, true, prefsManager->appPrefs.fontPrefs.GFontSub, it->ID);
 					currentDoc->m_Selection->clear();
-					delete ss;
 				}
 			}
 			currentDoc->m_Selection->clear();

Modified: trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18028&path=/trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp (original)
+++ trunk/Scribus/scribus/ui/pagepalette_masterpages.cpp Mon Dec 31 23:09:16 2012
@@ -284,11 +284,10 @@
 				}
 				if (currentDoc->m_Selection->count() != 0)
 				{
-					ScriXmlDoc *ss = new ScriXmlDoc();
-					QString buffer = ss->WriteElem(currentDoc, currentDoc->m_Selection);
-					ss->ReadElemToLayer(buffer, prefsManager->appPrefs.fontPrefs.AvailFonts, currentDoc, destination->xOffset(), destination->yOffset(), false, true, prefsManager->appPrefs.fontPrefs.GFontSub, it->ID);
+					ScriXmlDoc ss;
+					QString buffer = ss.WriteElem(currentDoc, currentDoc->m_Selection);
+					ss.ReadElemToLayer(buffer, prefsManager->appPrefs.fontPrefs.AvailFonts, currentDoc, destination->xOffset(), destination->yOffset(), false, true, prefsManager->appPrefs.fontPrefs.GFontSub, it->ID);
 					currentDoc->m_Selection->clear();
-					delete ss;
 				}
 			}
 			currentDoc->m_Selection->clear();




More information about the scribus-commit mailing list