r16176 by fschmid - Finally getting rid of the "isGroupControl" and "lastGroupItem" properties of PageItem.
scribus-commit
scribus-commit at lists.scribus.net
Tue Dec 28 11:26:43 CET 2010
Author: fschmid
Date: Tue Dec 28 10:26:43 2010
New Revision: 16176
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16176
Log:
Finally getting rid of the "isGroupControl" and "lastGroupItem" properties of PageItem.
Modified:
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
trunk/Scribus/scribus/scpageoutput.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/serializer.cpp
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16176&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Tue Dec 28 10:26:43 2010
@@ -164,7 +164,6 @@
itemText(other.itemText),
isBookmark(other.isBookmark),
HasSel(other.HasSel),
-// Tinput(other.Tinput),
isAutoText(other.isAutoText),
BackBox(NULL), // otherwise other.BackBox->NextBox would be inconsistent
NextBox(NULL), // otherwise other.NextBox->BackBox would be inconsistent
@@ -201,8 +200,6 @@
BottomLine(other.BottomLine),
isTableItem(other.isTableItem),
isSingleSel(other.isSingleSel),
- isGroupControl(other.isGroupControl),
- groupsLastItem(other.groupsLastItem),
groupItemList(other.groupItemList),
groupWidth(other.groupWidth),
groupHeight(other.groupHeight),
@@ -571,7 +568,6 @@
setUName(AnName);
m_annotation.setBorderColor(outline);
HasSel = false;
-// Tinput = false;
isAutoText = false;
inPdfArticle = false;
isRaster = false;
@@ -817,8 +813,6 @@
isSingleSel = false;
Dirty = false;
invalid = true;
- isGroupControl = false;
- groupsLastItem = 0;
ChangedMasterItem = false;
isEmbedded = false;
OnMasterPage = m_Doc->currentPage() ? m_Doc->currentPage()->pageName() : QString();
@@ -1812,23 +1806,6 @@
QList<PageItem*> emG;
emG.clear();
emG.append(cembedded);
- if (cembedded->Groups.count() != 0)
- {
- for (int ga=0; ga<m_Doc->FrameItems.count(); ++ga)
- {
- if (m_Doc->FrameItems.at(ga)->Groups.count() != 0)
- {
- if (m_Doc->FrameItems.at(ga)->Groups.top() == cembedded->Groups.top())
- {
- if (m_Doc->FrameItems.at(ga)->ItemNr != cembedded->ItemNr)
- {
- if (!emG.contains(m_Doc->FrameItems.at(ga)))
- emG.append(m_Doc->FrameItems.at(ga));
- }
- }
- }
- }
- }
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16176&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Tue Dec 28 10:26:43 2010
@@ -232,9 +232,6 @@
delete tempImageFile;
}
-// static const Xml_string saxxDefaultElem;
-// static void desaxeRules(const Xml_string& prefixPattern, desaxe::Digester& ruleset, Xml_string elemtag = saxxDefaultElem);
-
void saxx(SaxHandler& handler, const Xml_string& elemtag) const {};
void saxx(SaxHandler& handler) const {}
@@ -292,8 +289,6 @@
protected:
void DrawObj_ImageFrame(ScPainter *p, double sc);
- //void DrawObj_TextFrame(ScPainter *p, QRectF e, double sc);
- //void DrawObj_Line(ScPainter *p);
void DrawObj_Polygon(ScPainter *p);
void DrawObj_PolyLine(ScPainter *p);
void DrawObj_PathText(ScPainter *p, double sc);
@@ -308,8 +303,6 @@
void updatePolyClip();
void updateClip();
void convertClip();
- //QRect getRedrawBounding(const double);
- //void setRedrawBounding();
void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
QRectF getBoundingRect() const;
@@ -335,7 +328,6 @@
* @return bool true if the x, y is in the bounds
*/
bool mouseWithinItem(const int x, const int y, double scale) const;
-// void copyToCopyPasteBuffer(struct CopyPasteBuffer *Buffer);
virtual void handleModeEditKey(QKeyEvent *k, bool &keyRepeat);
@@ -543,13 +535,6 @@
bool ScaleType;
bool AspectRatio;
QStack<int> Groups;
-// const QStack<int>& groups() const { return Groups; }
-// QStack<int>& groups() { return Groups; }
-// void setGroups( QStack<int> val) { Groups = val; }
-
-// bool controlsGroup() const { return isGroupControl; }
-// void setControlsGroup(bool val) { isGroupControl = val; }
-
QVector<double> DashValues;
double DashOffset;
const QVector<double>& dashes() const { return DashValues; }
@@ -584,8 +569,6 @@
void setTopLink(PageItem* lnk) { TopLink = lnk; }
void setBottomLink(PageItem* lnk) { BottomLink = lnk; }
bool isSingleSel;
- bool isGroupControl;
- PageItem *groupsLastItem;
QList<PageItem*> groupItemList;
virtual QList<PageItem*> getItemList();
double groupWidth;
Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16176&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp Tue Dec 28 10:26:43 2010
@@ -157,41 +157,6 @@
ScMW->pagePalette->setView(ScMW->view);
ScMW->pagePalette->Rebuild();
ScMW->doc->RePos = true;
-/* QImage pgPix(10, 10, QImage::Format_ARGB32);
- QRect rd = QRect(0,0,9,9);
- ScPainter *painter = new ScPainter(&pgPix, pgPix.width(), pgPix.height());
- for (int azz=0; azz<ScMW->doc->Items->count(); ++azz)
- {
- PageItem *ite = ScMW->doc->Items->at(azz);
- if (ite->Groups.count() != 0)
- ScMW->doc->GroupOnPage(ite);
- else
- ite->OwnPage = ScMW->doc->OnPage(ite);
- ite->setRedrawBounding();
- if ((ite->itemType() == PageItem::TextFrame) || (ite->itemType() == PageItem::PathText)) // && (!ite->Redrawn))
- {
- if (ite->itemType() == PageItem::PathText)
- {
- ite->Frame = false;
- ite->updatePolyClip();
- ite->DrawObj(painter, rd);
- }
- else
- {
- if ((ite->prevInChain() != 0) || (ite->nextInChain() != 0))
- {
- PageItem *nextItem = ite;
- while (nextItem->prevInChain() != 0)
- nextItem = nextItem->prevInChain();
- ite = nextItem;
- ite->DrawObj(painter, rd);
- }
- else
- ite->DrawObj(painter, rd);
- }
- }
- }
- delete painter; */
ScMW->doc->RePos = false;
if (ScMW->doc->m_Selection->count() != 0)
{
Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16176&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Tue Dec 28 10:26:43 2010
@@ -1184,41 +1184,12 @@
{
const CharStyle & charStyle(*hl);
QList<PageItem*> emG = hl->embedded.getGroupedItems();
- QStack<PageItem*> groupStack;
- QStack<QDomElement> groupStack2;
QDomElement layerGroup = docu.createElement("g");
if (pathT)
layerGroup.setAttribute("transform", MatrixToStr(finalMat));
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
- if (embedded->isGroupControl)
- {
- groupStack.push(embedded->groupsLastItem);
- groupStack2.push(layerGroup);
- layerGroup = docu.createElement("g");
- if (embedded->fillTransparency() != 0)
- layerGroup.setAttribute("opacity", FToStr(1.0 - embedded->fillTransparency()));
- QDomElement ob = docu.createElement("clipPath");
- ob.setAttribute("id", "Clip"+IToStr(ClipCount));
- QDomElement cl = docu.createElement("path");
- cl.setAttribute("d", SetClipPath(&embedded->PoLine, true));
- QTransform mm;
- mm.translate(xpos + embedded->gXpos * (charStyle.scaleH() / 1000.0), (ypos - (embedded->gHeight * (charStyle.scaleV() / 1000.0)) + embedded->gYpos * (charStyle.scaleV() / 1000.0)));
- if (charStyle.baselineOffset() != 0)
- mm.translate(0, embedded->gHeight * (charStyle.baselineOffset() / 1000.0));
- if (charStyle.scaleH() != 1000)
- mm.scale(charStyle.scaleH() / 1000.0, 1);
- if (charStyle.scaleV() != 1000)
- mm.scale(1, charStyle.scaleV() / 1000.0);
- mm.rotate(embedded->rotation());
- cl.setAttribute("transform", MatrixToStr(mm));
- ob.appendChild(cl);
- globalDefs.appendChild(ob);
- layerGroup.setAttribute("clip-path", "url(#Clip"+IToStr(ClipCount)+")");
- ClipCount++;
- continue;
- }
QDomElement obE;
QString fill = getFillStyle(embedded);
QString stroke = "stroke:none";
@@ -1264,17 +1235,6 @@
mm.rotate(embedded->rotation());
obE.setAttribute("transform", MatrixToStr(mm));
layerGroup.appendChild(obE);
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- groupStack.pop();
- groupStack2.top().appendChild(layerGroup);
- layerGroup = groupStack2.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < emG.count(); ++em)
{
Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16176&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Tue Dec 28 10:26:43 2010
@@ -591,23 +591,6 @@
return;
QList<PageItem*> emG;
emG.append(cembedded);
- if (cembedded->Groups.count() != 0)
- {
- for (int ga=0; ga < m_doc->FrameItems.count(); ++ga)
- {
- if (m_doc->FrameItems.at(ga)->Groups.count() != 0)
- {
- if (m_doc->FrameItems.at(ga)->Groups.top() == cembedded->Groups.top())
- {
- if (m_doc->FrameItems.at(ga)->ItemNr != cembedded->ItemNr)
- {
- if (!emG.contains(m_doc->FrameItems.at(ga)))
- emG.append(m_doc->FrameItems.at(ga));
- }
- }
- }
- }
- }
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16176&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Dec 28 10:26:43 2010
@@ -3018,28 +3018,17 @@
scrActions["editSearchReplace"]->setEnabled(false);
bool hPoly = false;
- bool isGroup = true;
- int firstElem = -1;
- if (currItem->Groups.count() != 0)
- firstElem = currItem->Groups.top();
for (uint bx=0; bx < docSelectionCount; ++bx)
{
PageItem* bxi=doc->m_Selection->itemAt(bx);
if ((bxi->asPolygon()) || (bxi->asPolyLine()))
hPoly = true;
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
}
// It is possible to select objects on different layer using
// document outline palette. We need to check selected objects
// are on a common layer before allowing user to group them
bool objectsOnSameLayer = (doc->m_Selection->objectsLayer() != -1);
- scrActions["itemGroup"]->setEnabled(!isGroup && objectsOnSameLayer);
+ scrActions["itemGroup"]->setEnabled(objectsOnSameLayer);
scrActions["itemCombinePolygons"]->setEnabled(hPoly);
if (docSelectionCount == 2)
{
@@ -5046,8 +5035,6 @@
for (int as = ac; as < doc->Items->count(); ++as)
{
doc->m_Selection->addItem(doc->Items->at(as));
- if (isGroup)
- doc->Items->at(as)->Groups.push(doc->GroupCounter);
}
doc->m_Selection->delaySignalsOff();
if (isGroup)
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16176&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Dec 28 10:26:43 2010
@@ -5174,27 +5174,6 @@
Page* addedPage = TempPages.at(0);
if (Items->count() > 1)
{
- /* bool isGroup = true;
- int firstElem = -1;
- if (currItem->Groups.count() != 0)
- firstElem = currItem->Groups.top();
- for (int bx = 0; bx < Items->count(); ++bx)
- {
- PageItem* bxi = Items->at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- {
- isGroup = false;
- break;
- }
- }
- else
- {
- isGroup = false;
- break;
- }
- } */
if ((!currItem->isGroup()) && (Items->count() > 1))
{
itemAdd(PageItem::Group, PageItem::Rectangle, addedPage->xOffset(), addedPage->yOffset(), 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
@@ -9124,38 +9103,10 @@
currItem = itemSelection->itemAt(a);
Object.Objects.clear();
currItem->getBoundingRect(&Object.x1, &Object.y1, &Object.x2, &Object.y2);
-/* if (currItem->Groups.count() > 0)
- {
- ObjGroup = currItem->Groups.top();
- bool found = false;
- for (int a2 = 0; a2 < AObjects.count(); ++a2)
- {
- if (AObjects[a2].Group == ObjGroup)
- {
- AObjects[a2].x1 = qMin(AObjects[a2].x1, Object.x1);
- AObjects[a2].y1 = qMin(AObjects[a2].y1, Object.y1);
- AObjects[a2].x2 = qMax(AObjects[a2].x2, Object.x2);
- AObjects[a2].y2 = qMax(AObjects[a2].y2, Object.y2);
- AObjects[a2].Objects.append(currItem);
- found = true;
- break;
- }
- }
- if (!found)
- {
- Object.Group = ObjGroup;
- Object.ObjNr = 0;
- Object.Objects.append(currItem);
- AObjects.append(Object);
- }
- }
- else
- { */
- Object.Group = 0;
- Object.ObjNr = currItem->ItemNr;
- Object.Objects.append(currItem);
- AObjects.append(Object);
-// }
+ Object.Group = 0;
+ Object.ObjNr = currItem->ItemNr;
+ Object.Objects.append(currItem);
+ AObjects.append(Object);
}
for (int i = 0; i < AObjects.count(); ++i)
{
Modified: trunk/Scribus/scribus/serializer.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16176&path=/trunk/Scribus/scribus/serializer.cpp
==============================================================================
--- trunk/Scribus/scribus/serializer.cpp (original)
+++ trunk/Scribus/scribus/serializer.cpp Tue Dec 28 10:26:43 2010
@@ -176,278 +176,6 @@
addRule("/SCRIBUSFRAGMENT/item", SetterP<Collection,PageItem>( & Collection::collectItem ));
}
-
-#if 0
-void Serializer::serializeObjects(const Selection& selection, SaxHandler& outputhandler)
-{
- Xml_attr attr;
- UniqueID handler( & outputhandler );
- handler.beginDoc();
- handler.begin("SCRIBUSFRAGMENT", attr);
-
- if (selection.count() == 0)
- {
- handler.end("SCRIBUSFRAGMENT");
- handler.endDoc();
- return;
- }
- ScribusDoc* doc = selection.itemAt(0)->doc();
-
- QMap<QString,int>::Iterator itf;
- for (itf = doc->UsedFonts.begin(); itf != doc->UsedFonts.end(); ++itf)
- {
- attr["name"] = itf.key();
- handler.beginEnd("font", attr);
- }
-
- ColorList usedColors;
- doc->getUsedColors(usedColors, false);
- ColorList::Iterator itc;
- for (itc = usedColors.begin(); itc != usedColors.end(); ++itc)
- {
- Xml_attr cattr;
- cattr["name"] = itc.key();
- if (doc->PageColors[itc.key()].getColorModel() == colorModelRGB)
- cattr["RGB"] = doc->PageColors[itc.key()].nameRGB();
- else
- cattr["CMYK"] = doc->PageColors[itc.key()].nameCMYK();
- cattr["Spot"] = toXMLString(doc->PageColors[itc.key()].isSpotColor());
- cattr["Register"] = toXMLString(doc->PageColors[itc.key()].isRegistrationColor());
- handler.beginEnd("color", cattr);
- }
-
- ResourceCollection lists;
- for (int i=0; i < doc->Items->count(); ++i)
- doc->Items->at(i)->getNamedResources(lists);
-
- QList<QString>::Iterator it;
- QList<QString> names = lists.styleNames();
- for (it = names.begin(); it != names.end(); ++it)
- doc->paragraphStyles().get(*it).saxx(handler);
-
- names = lists.charStyleNames();
- for (it = names.begin(); it != names.end(); ++it)
- doc->charStyles().get(*it).saxx(handler);
-
- names = lists.lineStyleNames();
- for (it = names.begin(); it != names.end(); ++it)
- {
- Xml_attr multiattr;
- multiattr["Name"] = *it;
- handler.begin("MultiLine", multiattr);
- multiLine ml = doc->MLineStyles[*it];
-
- multiLine::Iterator itMU2;
- for (itMU2 = ml.begin(); itMU2 != ml.end(); ++itMU2)
- {
- Xml_attr lineattr;
- lineattr["Color"] = (*itMU2).Color;
- lineattr["Shade"] = toXMLString((*itMU2).Shade);
- lineattr["Dash"] = toXMLString((*itMU2).Dash);
- lineattr["LineEnd"] = toXMLString((*itMU2).LineEnd);
- lineattr["LineJoin"] = toXMLString((*itMU2).LineJoin);
- lineattr["Width"] = toXMLString((*itMU2).Width);
- handler.beginEnd("SubLine", lineattr);
- }
- handler.end("MultiLine");
- }
-
- /* names = lists.patterns();
- for (it = names.begin(); it != names.end(); ++it)
- doc->patterns[*it].saxx(handler);
-*/
-/*
- QStringList patterns = doc->getUsedPatternsSelection((Selection*)&selection);
- for (int c = 0; c < patterns.count(); ++c)
- {
- ScPattern& pa = doc->docPatterns[patterns[c]];
- Xml_attr cattr;
- cattr["Name"] = patterns[c];
- cattr["scaleX"] = toXMLString(pa.scaleX);
- cattr["scaleY"] = toXMLString(pa.scaleY);
- cattr["width"] = toXMLString(pa.width);
- cattr["height"] = toXMLString(pa.height);
- cattr["xoffset"] = toXMLString(pa.xoffset);
- cattr["yoffset"] = toXMLString(pa.yoffset);
- handler.begin("Pattern", cattr);
- for (int o = 0; o < pa.items.count(); o++)
- {
- pa.items.at(o)->saxx(handler);
- }
- handler.end("Pattern");
- }
-*/
- for (int i=0; i < doc->Items->count(); ++i)
- {
- int k = selection.findItem(doc->Items->at(i));
- if (k >=0)
- doc->Items->at(i)->saxx(handler);
- }
-
- handler.end("SCRIBUSFRAGMENT");
- handler.endDoc();
-}
-
-
-Selection Serializer::cloneObjects(const Selection& objects)
-{
- backUpColors = m_Doc.PageColors;
- store<ScribusDoc>("<scribusdoc>", &m_Doc);
-
- serializeObjects(objects, *this);
-
- return importCollection();
-}
-
-
-Selection Serializer::deserializeObjects(const QByteArray & xml)
-{
- reset();
- backUpColors = m_Doc.PageColors;
- store<ScribusDoc>("<scribusdoc>", &m_Doc);
-
- parseMemory(xml, xml.length());
-
- return importCollection();
-}
-
-Selection Serializer::deserializeObjects(const QFile & file)
-{
- reset();
- backUpColors = m_Doc.PageColors;
- store<ScribusDoc>("<scribusdoc>", &m_Doc);
-
- QFileInfo fi(file);
- parseFile(fi.filePath());
-
- return importCollection();
-}
-
-
-Selection Serializer::importCollection()
-{
- Collection* coll = lookup<Collection>("<collection>");
- Selection result( &m_Doc, false);
-// qDebug() << QString("deserialize: collection %1 doc %2").arg((ulong)coll).arg((ulong)&m_Doc);
- if (coll == NULL)
- qDebug() << "deserialize: no objects collected";
- else
- {
- QMap<QString,QString> newNames;
-
- //TODO: fonts
-
- do {
- newNames.clear();
- for (int i = 0; i < coll->cstyles.count(); ++i)
- {
- QString oldName = coll->cstyles[i].name();
- int oldIndex = m_Doc.charStyles().find(oldName);
- if (oldIndex >= 0 && m_Doc.charStyle(oldName) == coll->cstyles[i])
- continue;
- QString newName = oldName;
- if (oldIndex >= 0 && !newNames.contains(oldName))
- {
- int counter = 0;
- while (m_Doc.charStyles().find(newName) >= 0)
- newName = (QObject::tr("Copy of %1 (%2)")).arg(oldName).arg(++counter);
- newNames[oldName] = newName;
- }
- }
-
- coll->cstyles.rename(newNames);
- }
- while (newNames.count() > 0);
- m_Doc.redefineCharStyles(coll->cstyles, false);
-
- do {
- newNames.clear();
- for (int i = 0; i < coll->pstyles.count(); ++i) // FIXME: QValueList<QString> StyleSet::names()
- {
- QString oldName = coll->pstyles[i].name();
- int oldIndex = m_Doc.paragraphStyles().find(oldName);
-// qDebug() << QString("comparing %1 (old %2 new %3): parent '%4'='%5' cstyle %6 equiv %7").arg(oldName).arg(oldIndex).arg(i)
-// .arg(oldIndex>=0? m_Doc.paragraphStyle(oldName).parent() : "?").arg(coll->pstyles[i].parent())
-// .arg(oldIndex>=0? m_Doc.paragraphStyle(oldName).charStyle() == coll->pstyles[i].charStyle() : false)
-// .arg(oldIndex>=0? m_Doc.paragraphStyle(oldName).equiv(coll->pstyles[i]) : false);
-
- if (oldIndex >= 0 && coll->pstyles[i] == m_Doc.paragraphStyle(oldName) )
- continue;
- QString newName = oldName;
- if (oldIndex >= 0 && !newNames.contains(oldName))
- {
- int counter = 0;
- while (m_Doc.paragraphStyles().find(newName) >= 0)
- newName = (QObject::tr("Copy of %1 (%2)")).arg(oldName).arg(++counter);
- newNames[oldName] = newName;
- }
- }
- coll->pstyles.rename(newNames);
- }
- while(newNames.count() > 0);
-
- m_Doc.redefineStyles(coll->pstyles, false);
-
- //TODO: linestyles : this is temporary code until MultiLine is replaced by LineStyle
- QMap<QString,multiLine>::Iterator mlit;
- for (mlit = coll->lstyles.begin(); mlit != coll->lstyles.end(); ++mlit)
- {
- multiLine& ml = mlit.value();
- QString oldName = mlit.key();
- QString newName = mlit.key();
- QMap<QString,multiLine>::ConstIterator mlitd = m_Doc.MLineStyles.find(oldName);
- if (mlitd != m_Doc.MLineStyles.end() && ml != mlitd.value())
- {
- int counter = 0;
- while (m_Doc.MLineStyles.contains(newName))
- newName = (QObject::tr("Copy of %1 (%2)")).arg(oldName).arg(++counter);
- }
- m_Doc.MLineStyles.insert(newName, ml);
- }
-
- //TODO: patterns
-
- QList<PageItem*>* objects = &(coll->items);
- m_Doc.PageColors = backUpColors;
- m_Doc.PageColors.addColors(coll->colors, false);
- int maxG = m_Doc.GroupCounter;
- for (int i=0; i < objects->count(); ++i)
- {
- PageItem* currItem = objects->at(i);
- currItem->Clip = FlattenPath(currItem->PoLine, currItem->Segments);
- currItem->setFillQColor();
- currItem->setLineQColor();
- currItem->set4ColorColors(currItem->GrColorP1, currItem->GrColorP2, currItem->GrColorP3, currItem->GrColorP4);
- for (int grow = 0; grow < currItem->meshGradientArray.count(); grow++)
- {
- for (int gcol = 0; gcol < currItem->meshGradientArray[grow].count(); gcol++)
- {
- meshPoint mp = currItem->meshGradientArray[grow][gcol];
- currItem->setMeshPointColor(grow, gcol, mp.colorName, mp.shade, mp.transparency);
- }
- }
- result.addItem(currItem);
- if (currItem->Groups.count() != 0)
- {
- QStack<int> groups;
- for (int i=0; i < currItem->groups().count(); ++i)
- {
- int newGroup = m_Doc.GroupCounter + currItem->groups()[i] - 1;
- groups.append(newGroup);
- }
- currItem->setGroups(groups);
- maxG = qMax(maxG, currItem->Groups.top()+1);
- }
- }
- m_Doc.GroupCounter = maxG;
- updateGradientColors(coll->colors);
- delete coll;
- }
- return result;
-}
-
-#endif
-
bool Serializer::writeWithEncoding(const QString& filename, const QString& encoding,
const QString& txt)
{
@@ -467,7 +195,6 @@
return false;
}
-
bool Serializer::readWithEncoding(const QString& filename, const QString& encoding,
QString &txt)
{
@@ -484,117 +211,3 @@
}
return false;
}
-/*
-void Serializer::updateGradientColors(const ColorList& colors)
-{
- VColorStop* grStop;
- uint itemsCount = m_Doc.Items->count();
- for (uint c=0; c < itemsCount; ++c)
- {
- PageItem *ite = m_Doc.Items->at(c);
- QList<VColorStop*> cstops = ite->fill_gradient.colorStops();
- for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- cstops = ite->stroke_gradient.colorStops();
- for (uint cst = 0; cst < ite->stroke_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- cstops = ite->mask_gradient.colorStops();
- for (uint cst = 0; cst < ite->mask_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- }
- uint masterItemsCount = m_Doc.MasterItems.count();
- for (uint c=0; c < masterItemsCount; ++c)
- {
- PageItem *ite = m_Doc.MasterItems.at(c);
- QList<VColorStop*> cstops = ite->fill_gradient.colorStops();
- for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- cstops = ite->stroke_gradient.colorStops();
- for (uint cst = 0; cst < ite->stroke_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- cstops = ite->mask_gradient.colorStops();
- for (uint cst = 0; cst < ite->mask_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- }
- uint frameItemsCount = m_Doc.FrameItems.count();
- for (uint c=0; c < frameItemsCount; ++c)
- {
- PageItem *ite = m_Doc.FrameItems.at(c);
- QList<VColorStop*> cstops = ite->fill_gradient.colorStops();
- for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- cstops = ite->stroke_gradient.colorStops();
- for (uint cst = 0; cst < ite->stroke_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- cstops = ite->mask_gradient.colorStops();
- for (uint cst = 0; cst < ite->mask_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- }
- QStringList patterns =m_Doc.docPatterns.keys();
- for (int c = 0; c < patterns.count(); ++c)
- {
- ScPattern& pa = m_Doc.docPatterns[patterns[c]];
- for (int o = 0; o < pa.items.count(); o++)
- {
- PageItem *ite = pa.items.at(o);
- QList<VColorStop*> cstops = ite->fill_gradient.colorStops();
- for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- cstops = ite->stroke_gradient.colorStops();
- for (uint cst = 0; cst < ite->stroke_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- cstops = ite->mask_gradient.colorStops();
- for (uint cst = 0; cst < ite->mask_gradient.Stops(); ++cst)
- {
- grStop = cstops.at(cst);
- if (colors.contains(grStop->name))
- grStop->color = SetColor(&m_Doc, grStop->name, grStop->shade);
- }
- }
- }
-}
-*/
More information about the scribus-commit
mailing list