r14927 by cbradney - Remove itemattrs and tocsetups from the doc and use docPrefsData
scribus-commit
scribus-commit at lists.scribus.net
Wed Mar 24 00:10:58 CET 2010
Revision: 14927
Author: cbradney
Date: 2010-03-23T23:03:10.590560Z
Commit message: Remove itemattrs and tocsetups from the doc and use docPrefsData
Changeset:
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
M /trunk/Scribus/scribus/tocgenerator.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M /trunk/Scribus/scribus/ui/reformdoc.cpp
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
M /trunk/Scribus/scribus/scribusdoc.h
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14926)
+++ scribus/scribusdoc.cpp (revision 14927)
@@ -249,8 +249,8 @@
docLayerErrors(),
docItemErrors(),
masterItemErrors(),
- docItemAttributes(appPrefsData.itemAttrPrefs.defaultItemAttributes),
- docToCSetups(appPrefsData.tocPrefs.defaultToCSetups),
+ //->Prefs docItemAttributes(appPrefsData.itemAttrPrefs.defaultItemAttributes),
+ //->Prefs docToCSetups(appPrefsData.tocPrefs.defaultToCSetups),
// sections
symReturn(), symNewLine(), symTab(), symNonBreak(), symNewCol(), symNewFrame(),
docHyphenator(0),
@@ -366,8 +366,8 @@
docLayerErrors(),
docItemErrors(),
masterItemErrors(),
- docItemAttributes(appPrefsData.itemAttrPrefs.defaultItemAttributes),
- docToCSetups(appPrefsData.tocPrefs.defaultToCSetups),
+ //->Prefs docItemAttributes(appPrefsData.itemAttrPrefs.defaultItemAttributes),
+ //->Prefs docToCSetups(appPrefsData.tocPrefs.defaultToCSetups),
// sections
symReturn(), symNewLine(), symTab(), symNonBreak(), symNewCol(), symNewFrame(),
docHyphenator(0),
@@ -1612,7 +1612,7 @@
{
QStringList nameList;
- for(ObjAttrVector::Iterator it = docItemAttributes.begin(); it!= docItemAttributes.end(); ++it)
+ for(ObjAttrVector::Iterator it = itemAttributes().begin(); it!= itemAttributes().end(); ++it)
nameList.append((*it).name);
return nameList;
}
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14926)
+++ scribus/pageitem.cpp (revision 14927)
@@ -681,7 +681,7 @@
effectsInUse.clear();
//Page Item Attributes
pageItemAttributes.clear();
- for(ObjAttrVector::Iterator objAttrIt = m_Doc->docItemAttributes.begin() ; objAttrIt != m_Doc->docItemAttributes.end(); ++objAttrIt )
+ for(ObjAttrVector::Iterator objAttrIt = m_Doc->itemAttributes().begin() ; objAttrIt != m_Doc->itemAttributes().end(); ++objAttrIt )
{
if (((*objAttrIt).autoaddto=="textframes" && m_ItemType==TextFrame) ||
((*objAttrIt).autoaddto=="imageframes" && m_ItemType==ImageFrame)
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h (revision 14926)
+++ scribus/scribusdoc.h (revision 14927)
@@ -170,8 +170,20 @@
int autoSaveTime() const { return docPrefsData.docSetupPrefs.AutoSaveTime; }
void setAutoSave(bool b) { docPrefsData.docSetupPrefs.AutoSave=b; }
void setAutoSaveTime(int i) { docPrefsData.docSetupPrefs.AutoSaveTime=i; }
+ //FIXME (maybe) :non const, the loaders make a mess here
PDFOptions& pdfOptions() { return docPrefsData.pdfPrefs; }
+ ObjAttrVector& itemAttributes() { return docPrefsData.itemAttrPrefs.defaultItemAttributes; }
+ void setItemAttributes(ObjAttrVector& oav) { docPrefsData.itemAttrPrefs.defaultItemAttributes=oav;}
+ void clearItemAttributes() { docPrefsData.itemAttrPrefs.defaultItemAttributes.clear(); }
+ void appendToItemAttributes(const ObjectAttribute& oa) { docPrefsData.itemAttrPrefs.defaultItemAttributes.append(oa); }
+ ToCSetupVector& tocSetups() { return docPrefsData.tocPrefs.defaultToCSetups; }
+ void setTocSetups(ToCSetupVector& tsv) { docPrefsData.tocPrefs.defaultToCSetups=tsv; }
+ void clearTocSetups() { docPrefsData.tocPrefs.defaultToCSetups.clear(); }
+ void appendToTocSetups(const ToCSetup& ts) { docPrefsData.tocPrefs.defaultToCSetups.append(ts); }
+ //->Prefs ObjAttrVector docItemAttributes;
+ //->Prefs ToCSetupVector docToCSetups;
+
// Add, delete and move pages
Page* addPage(const int pageNumber, const QString& masterPageName=QString::null, const bool addAutoFrame=false);
@@ -915,7 +927,7 @@
/*! \brief Apply grid to an FPoint, from ScribusView */
FPoint ApplyGridF(const FPoint& in);
/*! \brief Does this doc have any TOC setups and potentially a TOC to generate */
- bool hasTOCSetup() { return !docToCSetups.empty(); }
+ bool hasTOCSetup() { return !docPrefsData.tocPrefs.defaultToCSetups.empty(); }
//! \brief Get the closest guide to the given point
void getClosestGuides(double xin, double yin, double *xout, double *yout, int *GxM, int *GyM);
//! \brief Snap an item to the guides
@@ -1144,8 +1156,8 @@
QMap<int, errorCodes> docItemErrors;
QMap<int, errorCodes> masterItemErrors;
//Attributes to be applied to frames
- ObjAttrVector docItemAttributes;
- ToCSetupVector docToCSetups;
+ //->Prefs ObjAttrVector docItemAttributes;
+ //->Prefs ToCSetupVector docToCSetups;
DocumentSectionMap sections;
FPointArray symReturn;
FPointArray symNewLine;
Index: scribus/ui/reformdoc.cpp
===================================================================
--- scribus/ui/reformdoc.cpp (revision 14926)
+++ scribus/ui/reformdoc.cpp (revision 14927)
@@ -97,12 +97,12 @@
tabDocItemAttributes = new DocumentItemAttributes(prefsWidgets);
docAttributesList=tabDocItemAttributes->getDocAttributesNames();
- tabDocItemAttributes->setup(&doc->docItemAttributes);
+ tabDocItemAttributes->setup(&doc->itemAttributes());
addItem( tr("Document Item Attributes"), loadIcon("docattributes.png"), tabDocItemAttributes);
tabTOCIndexPrefs = new TOCIndexPrefs( prefsWidgets );
tabTOCIndexPrefs->setupItemAttrs( docAttributesList );
- tabTOCIndexPrefs->setup(&(currDoc->docToCSetups), currDoc);
+ tabTOCIndexPrefs->setup(&(currDoc->tocSetups()), currDoc);
addItem( tr("Table of Contents and Indexes"), loadIcon("tabtocindex.png"), tabTOCIndexPrefs);
tabDocSections = new DocSections(prefsWidgets);
@@ -634,8 +634,8 @@
}
currDoc->documentInfo = docInfos->getDocInfo();
- currDoc->docItemAttributes = *(tabDocItemAttributes->getNewAttributes());
- currDoc->docToCSetups = *(tabTOCIndexPrefs->getNewToCs());
+ currDoc->setItemAttributes(*(tabDocItemAttributes->getNewAttributes()));
+ currDoc->setTocSetups(*(tabTOCIndexPrefs->getNewToCs()));
currDoc->sections = tabDocSections->getNewSections();
uint itemCount=currDoc->Items->count();
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 14926)
+++ scribus/scribus.cpp (revision 14927)
@@ -9289,7 +9289,7 @@
if (pageItem!=NULL)
{
PageItemAttributes *pageItemAttrs = new PageItemAttributes( this );
- pageItemAttrs->setup(pageItem->getObjectAttributes(), &doc->docItemAttributes);
+ pageItemAttrs->setup(pageItem->getObjectAttributes(), &doc->itemAttributes());
//CB TODO Probably want this non modal in the future
if (pageItemAttrs->exec()==QDialog::Accepted)
pageItem->setObjectAttributes(pageItemAttrs->getNewAttributes());
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14926)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14927)
@@ -703,7 +703,7 @@
if(pg.tagName()=="DocItemAttributes")
{
QDomNode DIA = PAGE.firstChild();
- m_Doc->docItemAttributes.clear();
+ m_Doc->clearItemAttributes();
while(!DIA.isNull())
{
QDomElement itemAttr = DIA.toElement();
@@ -717,7 +717,7 @@
objattr.relationship=itemAttr.attribute("Relationship");
objattr.relationshipto=itemAttr.attribute("RelationshipTo");
objattr.autoaddto=itemAttr.attribute("AutoAddTo");
- m_Doc->docItemAttributes.append(objattr);
+ m_Doc->appendToItemAttributes(objattr);
}
DIA = DIA.nextSibling();
}
@@ -725,7 +725,7 @@
if(pg.tagName()=="TablesOfContents")
{
QDomNode TOC = PAGE.firstChild();
- m_Doc->docToCSetups.clear();
+ m_Doc->clearTocSetups();
while(!TOC.isNull())
{
QDomElement tocElem = TOC.toElement();
@@ -744,7 +744,7 @@
tocsetup.pageLocation=End;
if (numberPlacement=="NotShown")
tocsetup.pageLocation=NotShown;
- m_Doc->docToCSetups.append(tocsetup);
+ m_Doc->appendToTocSetups(tocsetup);
}
TOC = TOC.nextSibling();
}
@@ -1582,7 +1582,7 @@
}
dc.appendChild(pdf);
QDomElement docItemAttrs = docu.createElement("DocItemAttributes");
- for(ObjAttrVector::Iterator objAttrIt = m_Doc->docItemAttributes.begin() ; objAttrIt != m_Doc->docItemAttributes.end(); ++objAttrIt )
+ for(ObjAttrVector::Iterator objAttrIt = m_Doc->itemAttributes().begin() ; objAttrIt != m_Doc->itemAttributes().end(); ++objAttrIt )
{
QDomElement itemAttr = docu.createElement("ItemAttribute");
itemAttr.setAttribute("Name", (*objAttrIt).name);
@@ -1596,7 +1596,7 @@
}
dc.appendChild(docItemAttrs);
QDomElement tocElem = docu.createElement("TablesOfContents");
- for(ToCSetupVector::Iterator tocSetupIt = m_Doc->docToCSetups.begin() ; tocSetupIt != m_Doc->docToCSetups.end(); ++tocSetupIt )
+ for(ToCSetupVector::Iterator tocSetupIt = m_Doc->tocSetups().begin() ; tocSetupIt != m_Doc->tocSetups().end(); ++tocSetupIt )
{
QDomElement tocsetup = docu.createElement("TableOfContents");
tocsetup.setAttribute("Name", (*tocSetupIt).name);
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14926)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14927)
@@ -765,7 +765,7 @@
void Scribus150Format::writeDocItemAttributes(ScXmlStreamWriter & docu)
{
docu.writeStartElement("DocItemAttributes");
- for(ObjAttrVector::Iterator objAttrIt = m_Doc->docItemAttributes.begin() ; objAttrIt != m_Doc->docItemAttributes.end(); ++objAttrIt )
+ for(ObjAttrVector::Iterator objAttrIt = m_Doc->itemAttributes().begin() ; objAttrIt != m_Doc->itemAttributes().end(); ++objAttrIt )
{
docu.writeEmptyElement("ItemAttribute");
docu.writeAttribute("Name", (*objAttrIt).name);
@@ -783,7 +783,7 @@
void Scribus150Format::writeTOC(ScXmlStreamWriter & docu)
{
docu.writeStartElement("TablesOfContents");
- for(ToCSetupVector::Iterator tocSetupIt = m_Doc->docToCSetups.begin() ; tocSetupIt != m_Doc->docToCSetups.end(); ++tocSetupIt )
+ for(ToCSetupVector::Iterator tocSetupIt = m_Doc->tocSetups().begin() ; tocSetupIt != m_Doc->tocSetups().end(); ++tocSetupIt )
{
docu.writeEmptyElement("TableOfContents");
docu.writeAttribute("Name", (*tocSetupIt).name);
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14926)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14927)
@@ -1516,7 +1516,7 @@
bool Scribus150Format::readDocItemAttributes(ScribusDoc *doc, ScXmlStreamReader& reader)
{
QStringRef tagName = reader.name();
- doc->docItemAttributes.clear();
+ doc->clearItemAttributes();
while(!reader.atEnd() && !reader.hasError())
{
reader.readNext();
@@ -1533,7 +1533,7 @@
objattr.relationship = attrs.valueAsString("Relationship");
objattr.relationshipto = attrs.valueAsString("RelationshipTo");
objattr.autoaddto = attrs.valueAsString("AutoAddTo");
- doc->docItemAttributes.append(objattr);
+ doc->appendToItemAttributes(objattr);
}
}
return !reader.hasError();
@@ -1542,7 +1542,7 @@
bool Scribus150Format::readTableOfContents(ScribusDoc* doc, ScXmlStreamReader& reader)
{
QStringRef tagName = reader.name();
- m_Doc->docToCSetups.clear();
+ m_Doc->clearTocSetups();
while(!reader.atEnd() && !reader.hasError())
{
reader.readNext();
@@ -1557,14 +1557,14 @@
tocsetup.frameName = attrs.valueAsString("FrameName");
tocsetup.textStyle = attrs.valueAsString("Style");
tocsetup.listNonPrintingFrames = QVariant(attrs.valueAsString("ListNonPrinting")).toBool();
- QString numberPlacement = attrs.valueAsString("NumberPlacement");
+ QString numberPlacement(attrs.valueAsString("NumberPlacement"));
if (numberPlacement == "Beginning")
tocsetup.pageLocation = Beginning;
if (numberPlacement == "End")
tocsetup.pageLocation = End;
if (numberPlacement == "NotShown")
tocsetup.pageLocation = NotShown;
- doc->docToCSetups.append(tocsetup);
+ doc->appendToTocSetups(tocsetup);
}
}
return !reader.hasError();
Index: scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (revision 14926)
+++ scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (revision 14927)
@@ -741,7 +741,7 @@
void Scribus134Format::writeDocItemAttributes(ScXmlStreamWriter & docu)
{
docu.writeStartElement("DocItemAttributes");
- for(ObjAttrVector::Iterator objAttrIt = m_Doc->docItemAttributes.begin() ; objAttrIt != m_Doc->docItemAttributes.end(); ++objAttrIt )
+ for(ObjAttrVector::Iterator objAttrIt = m_Doc->itemAttributes().begin() ; objAttrIt != m_Doc->itemAttributes().end(); ++objAttrIt )
{
docu.writeEmptyElement("ItemAttribute");
docu.writeAttribute("Name", (*objAttrIt).name);
@@ -759,7 +759,7 @@
void Scribus134Format::writeTOC(ScXmlStreamWriter & docu)
{
docu.writeStartElement("TablesOfContents");
- for(ToCSetupVector::Iterator tocSetupIt = m_Doc->docToCSetups.begin() ; tocSetupIt != m_Doc->docToCSetups.end(); ++tocSetupIt )
+ for(ToCSetupVector::Iterator tocSetupIt = m_Doc->tocSetups().begin() ; tocSetupIt != m_Doc->tocSetups().end(); ++tocSetupIt )
{
docu.writeEmptyElement("TableOfContents");
docu.writeAttribute("Name", (*tocSetupIt).name);
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14926)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14927)
@@ -1511,7 +1511,7 @@
bool Scribus134Format::readDocItemAttributes(ScribusDoc *doc, ScXmlStreamReader& reader)
{
QStringRef tagName = reader.name();
- doc->docItemAttributes.clear();
+ doc->clearItemAttributes();
while(!reader.atEnd() && !reader.hasError())
{
reader.readNext();
@@ -1528,7 +1528,7 @@
objattr.relationship = attrs.valueAsString("Relationship");
objattr.relationshipto = attrs.valueAsString("RelationshipTo");
objattr.autoaddto = attrs.valueAsString("AutoAddTo");
- doc->docItemAttributes.append(objattr);
+ doc->appendToItemAttributes(objattr);
}
}
return !reader.hasError();
@@ -1537,7 +1537,7 @@
bool Scribus134Format::readTableOfContents(ScribusDoc* doc, ScXmlStreamReader& reader)
{
QStringRef tagName = reader.name();
- m_Doc->docToCSetups.clear();
+ m_Doc->clearTocSetups();
while(!reader.atEnd() && !reader.hasError())
{
reader.readNext();
@@ -1559,7 +1559,7 @@
tocsetup.pageLocation = End;
if (numberPlacement == "NotShown")
tocsetup.pageLocation = NotShown;
- doc->docToCSetups.append(tocsetup);
+ doc->appendToTocSetups(tocsetup);
}
}
return !reader.hasError();
Index: scribus/tocgenerator.cpp
===================================================================
--- scribus/tocgenerator.cpp (revision 14926)
+++ scribus/tocgenerator.cpp (revision 14927)
@@ -71,7 +71,7 @@
if (currDoc==NULL)
return;
Q_ASSERT(!currDoc->masterPageMode());
- for(ToCSetupVector::Iterator tocSetupIt = currDoc->docToCSetups.begin() ; tocSetupIt != currDoc->docToCSetups.end(); ++tocSetupIt )
+ for(ToCSetupVector::Iterator tocSetupIt = currDoc->tocSetups().begin() ; tocSetupIt != currDoc->tocSetups().end(); ++tocSetupIt )
{
PageItem* tocFrame=findTargetFrame((*tocSetupIt).frameName);
if (tocFrame!=NULL)
More information about the scribus-commit
mailing list