r16105 by fschmid - Added a new type of object: PageItem::Group, which replaces the old groupcontrol item.
scribus-commit
scribus-commit at lists.scribus.net
Sat Dec 18 22:33:08 CET 2010
Author: fschmid
Date: Sat Dec 18 21:33:07 2010
New Revision: 16105
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16105
Log:
Added a new type of object: PageItem::Group, which replaces the old groupcontrol item.
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/canvas.cpp
trunk/Scribus/scribus/canvasmode_normal.cpp
trunk/Scribus/scribus/collect4output.cpp
trunk/Scribus/scribus/loadsaveplugin.cpp
trunk/Scribus/scribus/loadsaveplugin.h
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pageitem_imageframe.cpp
trunk/Scribus/scribus/pageitem_imageframe.h
trunk/Scribus/scribus/pageitem_symbol.cpp
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.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/oodraw/oodrawimp.cpp
trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
trunk/Scribus/scribus/plugins/import/ps/importps.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/plugins/svgexplugin/svgexplugin.cpp
trunk/Scribus/scribus/pslib.cpp
trunk/Scribus/scribus/scpageoutput.cpp
trunk/Scribus/scribus/scpattern.cpp
trunk/Scribus/scribus/scpreview.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusXml.cpp
trunk/Scribus/scribus/scribusXml.h
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/scribusstructs.h
trunk/Scribus/scribus/sctextstruct.cpp
trunk/Scribus/scribus/selection.cpp
trunk/Scribus/scribus/ui/about.cpp
trunk/Scribus/scribus/ui/contextmenu.cpp
trunk/Scribus/scribus/ui/nodeeditpalette.cpp
trunk/Scribus/scribus/ui/outlinepalette.cpp
trunk/Scribus/scribus/ui/outlinepalette.h
trunk/Scribus/scribus/ui/paintmanager.cpp
trunk/Scribus/scribus/ui/picstatus.cpp
trunk/Scribus/scribus/ui/propertiespalette.cpp
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Sat Dec 18 21:33:07 2010
@@ -182,6 +182,7 @@
navigator.h
observable.h
pageitem.h
+ pageitem_group.h
pageitem_imageframe.h
pageitem_latexframe.h
pageitem_line.h
@@ -504,6 +505,7 @@
page.cpp
pageitem.cpp
pageitem_desaxe.cpp
+ pageitem_group.cpp
pageitem_imageframe.cpp
pageitem_latexframe.cpp
pageitem_line.cpp
Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Sat Dec 18 21:33:07 2010
@@ -1258,8 +1258,6 @@
FPoint orig = localToCanvas(clip.topLeft());
QRectF cullingArea = QRectF(static_cast<int>(orig.x()), static_cast<int>(orig.y()),
qRound(clip.width() / m_viewMode.scale + 0.5), qRound(clip.height() / m_viewMode.scale + 0.5));
- QStack<PageItem*> groupStack;
- QStack<PageItem*> groupStack2;
PageItem *currItem;
Page* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]);
@@ -1289,66 +1287,6 @@
currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset();
currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset();
}
- if (currItem->isGroupControl)
- {
- painter->save();
- QTransform mm;
- mm.translate(currItem->xPos(), currItem->yPos());
- mm.rotate(currItem->rotation());
- if ((currItem->maskType() == 1) || (currItem->maskType() == 2) || (currItem->maskType() == 4) || (currItem->maskType() == 5))
- {
- if ((currItem->maskType() == 1) || (currItem->maskType() == 2))
- painter->setMaskMode(1);
- else
- painter->setMaskMode(3);
- if ((!currItem->gradientMask().isEmpty()) && (!m_doc->docGradients.contains(currItem->gradientMask())))
- currItem->gradientMaskVal = "";
- if (!(currItem->gradientMask().isEmpty()) && (m_doc->docGradients.contains(currItem->gradientMask())))
- currItem->mask_gradient = m_doc->docGradients[currItem->gradientMask()];
- painter->mask_gradient = currItem->mask_gradient;
- if ((currItem->maskType() == 1) || (currItem->maskType() == 4))
- painter->setGradientMask(VGradient::linear, FPoint(currItem->GrMaskStartX, currItem->GrMaskStartY).transformPoint(mm, false), FPoint(currItem->GrMaskEndX, currItem->GrMaskEndY).transformPoint(mm, false), FPoint(currItem->GrMaskStartX, currItem->GrMaskStartY).transformPoint(mm, false), currItem->GrMaskScale, currItem->GrMaskSkew);
- else
- painter->setGradientMask(VGradient::radial, FPoint(currItem->GrMaskStartX, currItem->GrMaskStartY).transformPoint(mm, false), FPoint(currItem->GrMaskEndX, currItem->GrMaskEndY).transformPoint(mm, false), FPoint(currItem->GrMaskFocalX, currItem->GrMaskFocalY).transformPoint(mm, false), currItem->GrMaskScale, currItem->GrMaskSkew);
- }
- else if ((currItem->maskType() == 3) || (currItem->maskType() == 6))
- {
- if ((currItem->patternMask().isEmpty()) || (!m_doc->docPatterns.contains(currItem->patternMask())))
- painter->setMaskMode(0);
- else
- {
- painter->setPatternMask(&m_doc->docPatterns[currItem->patternMask()], currItem->patternMaskScaleX, currItem->patternMaskScaleY, currItem->patternMaskOffsetX + currItem->xPos(), currItem->patternMaskOffsetY + currItem->yPos(), currItem->patternMaskRotation + currItem->rotation(), currItem->patternMaskSkewX, currItem->patternMaskSkewY, currItem->patternMaskMirrorX, currItem->patternMaskMirrorY);
- if (currItem->maskType() == 3)
- painter->setMaskMode(2);
- else
- painter->setMaskMode(4);
- }
- }
- else
- painter->setMaskMode(0);
- currItem->savedOwnPage = currItem->OwnPage;
- currItem->OwnPage = page->pageNr();
- if ((cullingArea.intersects(currItem->getBoundingRect().adjusted(0.0, 0.0, 1.0, 1.0))) && (m_doc->guidesPrefs().layerMarkersShown) && (m_doc->layerCount() > 1))
- {
- currItem->DrawObj(painter, cullingArea);
- currItem->DrawObj_Decoration(painter);
- }
- FPointArray cl = currItem->PoLine.copy();
- cl.map( mm );
- painter->beginLayer(1.0 - currItem->fillTransparency(), currItem->fillBlendmode(), &cl);
- groupStack.push(currItem->groupsLastItem);
- groupStack2.push(currItem);
- painter->setMaskMode(0);
- currItem->OwnPage = currItem->savedOwnPage;
- if (!currItem->ChangedMasterItem)
- {
- //Hack to not check for undo changes, indicate drawing only
- currItem->setXYPos(OldX, OldY, true);
- currItem->BoundingX = OldBX;
- currItem->BoundingY = OldBY;
- }
- continue;
- }
currItem->savedOwnPage = currItem->OwnPage;
currItem->OwnPage = page->pageNr();
//FIXME if (!evSpon || forceRedraw)
@@ -1372,42 +1310,6 @@
currItem->setXYPos(OldX, OldY, true);
currItem->BoundingX = OldBX;
currItem->BoundingY = OldBY;
- }
- if (groupStack.count() != 0)
- {
- while (currItem == groupStack.top())
- {
- painter->endLayer();
- painter->restore();
- PageItem *cite = groupStack2.pop();
- double OldX = cite->xPos();
- double OldY = cite->yPos();
- double OldBX = cite->BoundingX;
- double OldBY = cite->BoundingY;
- if (!cite->ChangedMasterItem)
- {
- //Hack to not check for undo changes, indicate drawing only
- cite->moveBy(-Mp->xOffset() + page->xOffset(), -Mp->yOffset() + page->yOffset(), true);
- cite->BoundingX = OldBX - Mp->xOffset() + page->xOffset();
- cite->BoundingY = OldBY - Mp->yOffset() + page->yOffset();
- }
- if ((cullingArea.intersects(cite->getBoundingRect().adjusted(0.0, 0.0, 1.0, 1.0))) && (m_doc->guidesPrefs().layerMarkersShown) && (m_doc->layerCount() > 1))
- {
- cite->DrawObj(painter, cullingArea);
- cite->DrawObj_Decoration(painter);
- }
- cite->OwnPage = cite->savedOwnPage;
- if (!currItem->ChangedMasterItem)
- {
- //Hack to not check for undo changes, indicate drawing only
- cite->setXYPos(OldX, OldY, true);
- cite->BoundingX = OldBX;
- cite->BoundingY = OldBY;
- }
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
}
}
for (uint a = 0; a < pageFromMasterCount; ++a)
@@ -1422,8 +1324,6 @@
if ((m_viewMode.viewAsPreview) && (!currItem->printEnabled()))
continue;
if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr())))
- continue;
- if (currItem->isGroupControl)
continue;
double OldX = currItem->xPos();
double OldY = currItem->yPos();
@@ -1491,8 +1391,6 @@
FPoint orig = localToCanvas(clip.topLeft());
QRectF cullingArea = QRectF(static_cast<int>(orig.x()), static_cast<int>(orig.y()),
qRound(clip.width() / m_viewMode.scale + 0.5), qRound(clip.height() / m_viewMode.scale + 0.5));
- QStack<PageItem*> groupStack;
- QStack<PageItem*> groupStack2;
PageItem *currItem;
uint layerCount = m_doc->layerCount();
@@ -1515,51 +1413,6 @@
if (currItem->OnMasterPage != m_doc->currentPage()->pageName())
continue;
}
- if (currItem->isGroupControl)
- {
- painter->save();
- QTransform mm;
- mm.translate(currItem->xPos(), currItem->yPos());
- mm.rotate(currItem->rotation());
- if ((currItem->maskType() == 1) || (currItem->maskType() == 2) || (currItem->maskType() == 4) || (currItem->maskType() == 5))
- {
- if ((currItem->maskType() == 1) || (currItem->maskType() == 2))
- painter->setMaskMode(1);
- else
- painter->setMaskMode(3);
- if ((!currItem->gradientMask().isEmpty()) && (!m_doc->docGradients.contains(currItem->gradientMask())))
- currItem->gradientMaskVal = "";
- if (!(currItem->gradientMask().isEmpty()) && (m_doc->docGradients.contains(currItem->gradientMask())))
- currItem->mask_gradient = m_doc->docGradients[currItem->gradientMask()];
- painter->mask_gradient = currItem->mask_gradient;
- if ((currItem->maskType() == 1) || (currItem->maskType() == 4))
- painter->setGradientMask(VGradient::linear, FPoint(currItem->GrMaskStartX, currItem->GrMaskStartY).transformPoint(mm, false), FPoint(currItem->GrMaskEndX, currItem->GrMaskEndY).transformPoint(mm, false), FPoint(currItem->GrMaskStartX, currItem->GrMaskStartY).transformPoint(mm, false), currItem->GrMaskScale, currItem->GrMaskSkew);
- else
- painter->setGradientMask(VGradient::radial, FPoint(currItem->GrMaskStartX, currItem->GrMaskStartY).transformPoint(mm, false), FPoint(currItem->GrMaskEndX, currItem->GrMaskEndY).transformPoint(mm, false), FPoint(currItem->GrMaskFocalX, currItem->GrMaskFocalY).transformPoint(mm, false), currItem->GrMaskScale, currItem->GrMaskSkew);
- }
- else if ((currItem->maskType() == 3) || (currItem->maskType() == 6))
- {
- if ((currItem->patternMask().isEmpty()) || (!m_doc->docPatterns.contains(currItem->patternMask())))
- painter->setMaskMode(0);
- else
- {
- painter->setPatternMask(&m_doc->docPatterns[currItem->patternMask()], currItem->patternMaskScaleX, currItem->patternMaskScaleY, currItem->patternMaskOffsetX + currItem->xPos(), currItem->patternMaskOffsetY + currItem->yPos(), currItem->patternMaskRotation + currItem->rotation(), currItem->patternMaskSkewX, currItem->patternMaskSkewY, currItem->patternMaskMirrorX, currItem->patternMaskMirrorY);
- if (currItem->maskType() == 3)
- painter->setMaskMode(2);
- else
- painter->setMaskMode(4);
- }
- }
- else
- painter->setMaskMode(0);
- FPointArray cl = currItem->PoLine.copy();
- cl.map( mm );
- painter->beginLayer(1.0 - currItem->fillTransparency(), currItem->fillBlendmode(), &cl);
- groupStack.push(currItem->groupsLastItem);
- groupStack2.push(currItem);
- painter->setMaskMode(0);
- continue;
- }
if (cullingArea.intersects(currItem->getBoundingRect().adjusted(0.0, 0.0, 1.0, 1.0)))
{
//FIXME if (!evSpon || forceRedraw)
@@ -1605,23 +1458,6 @@
{
setupEditHRuler(currItem);
- }
- }
- if (groupStack.count() != 0)
- {
- while (currItem == groupStack.top())
- {
- painter->endLayer();
- painter->restore();
- PageItem *cite = groupStack2.pop();
- if ((cullingArea.intersects(cite->getBoundingRect())) && (((m_doc->guidesPrefs().layerMarkersShown) && (m_doc->layerCount() > 1)) || (cite->textFlowUsesContourLine())))
- {
- cite->DrawObj(painter, cullingArea);
- cite->DrawObj_Decoration(painter);
- }
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
}
}
}
Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Sat Dec 18 21:33:07 2010
@@ -185,7 +185,7 @@
m_view->requestMode(submodeEditExternal);
}
#endif
- else if ((currItem->itemType() == PageItem::Polygon) || (currItem->itemType() == PageItem::PolyLine) || (currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::PathText))
+ else if ((currItem->itemType() == PageItem::Polygon) || (currItem->itemType() == PageItem::PolyLine) || (currItem->itemType() == PageItem::Group) || (currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::PathText))
{
if (currItem->locked()) //|| (!currItem->ScaleType))
{
@@ -208,7 +208,7 @@
m_view->requestMode(modeEdit);
}
else
- m_view->requestMode(modeEditClip);
+ m_view->requestMode(modeEditClip);
}
else if (currItem->itemType() == PageItem::TextFrame)
{
@@ -236,7 +236,8 @@
}
else if (currItem->asSymbolFrame())
{
- m_view->requestMode(submodeEditSymbol);
+ if (!m_doc->symbolEditMode())
+ m_view->requestMode(submodeEditSymbol);
}
}
}
@@ -1226,7 +1227,7 @@
{
currItem->isSingleSel = true;
}
- else if (currItem->Groups.count() > 0)
+/* else if (currItem->Groups.count() > 0)
{
for (int ga=0; ga<m_doc->Items->count(); ++ga)
{
@@ -1246,7 +1247,7 @@
}
}
}
- }
+ } */
}
if(pageChanged)
{
@@ -1410,7 +1411,9 @@
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
+ {
fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
+ }
}
if (m_doc->m_Selection->count() > 0)
{
Modified: trunk/Scribus/scribus/collect4output.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/collect4output.cpp
==============================================================================
--- trunk/Scribus/scribus/collect4output.cpp (original)
+++ trunk/Scribus/scribus/collect4output.cpp Sat Dec 18 21:33:07 2010
@@ -173,9 +173,10 @@
{
uint counter = 0;
int c=0;
+ QList<PageItem*> allItems;
+ PageItem* ite = NULL;
for (uint lc = 0; lc < 3; ++lc)
{
- PageItem* ite = NULL;
switch (lc)
{
case 0:
@@ -202,7 +203,15 @@
ite = m_Doc->FrameItems.at(b);
break;
}
- processItem(ite);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ processItem(ite);
+ }
if (uiCollect)
emit itemsCollected(c++);
}
@@ -212,7 +221,16 @@
ScPattern pa = m_Doc->docPatterns[patterns[c]];
for (int o = 0; o < pa.items.count(); o++)
{
- processItem(pa.items.at(o));
+ ite = pa.items.at(o);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ processItem(ite);
+ }
}
if (uiCollect)
emit patternsCollected(c);
Modified: trunk/Scribus/scribus/loadsaveplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/loadsaveplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/loadsaveplugin.cpp (original)
+++ trunk/Scribus/scribus/loadsaveplugin.cpp Sat Dec 18 21:33:07 2010
@@ -202,6 +202,11 @@
bool LoadSavePlugin::saveFile(const QString & /* fileName */,
const FileFormat & /* fmt */)
+{
+ return false;
+}
+
+bool LoadSavePlugin::loadElements(const QString & data, QString fileDir, int toLayer, double Xp_in, double Yp_in, bool loc)
{
return false;
}
@@ -444,6 +449,11 @@
return (plug && save) ? plug->savePalette(fileName) : false;
}
+bool FileFormat::loadElements(const QString & data, QString fileDir, int toLayer, double Xp_in, double Yp_in, bool loc) const
+{
+ return (plug && load) ? plug->loadElements(data, fileDir, toLayer, Xp_in, Yp_in, loc) : false;
+}
+
bool FileFormat::loadPalette(const QString & fileName) const
{
return (plug && load) ? plug->loadPalette(fileName) : false;
Modified: trunk/Scribus/scribus/loadsaveplugin.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/loadsaveplugin.h
==============================================================================
--- trunk/Scribus/scribus/loadsaveplugin.h (original)
+++ trunk/Scribus/scribus/loadsaveplugin.h Sat Dec 18 21:33:07 2010
@@ -76,6 +76,7 @@
static const FileFormat * getFormatById(const int id);
static FileFormat* getFormatByExt(const QString ext);
+ virtual bool loadElements(const QString & data, QString fileDir, int toLayer, double Xp_in, double Yp_in, bool loc);
// Non-static members implemented by plugins:
//
// Load the requested format from the specified path.
@@ -191,6 +192,8 @@
FileFormat() : load(false), save(false), thumb(false), colorReading(false), plug(0) {}
// Standard ctor that sets up a valid FileFormat
FileFormat(LoadSavePlugin * plug) : load(false), save(false), thumb(false), colorReading(false), plug(plug) {}
+
+ bool loadElements(const QString & data, QString fileDir, int toLayer, double Xp_in, double Yp_in, bool loc) const;
// Load a file with this format
bool loadFile(const QString & fileName, int flags, int index = 0) const;
bool loadPalette(const QString & fileName) const;
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sat Dec 18 21:33:07 2010
@@ -202,6 +202,9 @@
isSingleSel(other.isSingleSel),
isGroupControl(other.isGroupControl),
groupsLastItem(other.groupsLastItem),
+ groupItemList(other.groupItemList),
+ groupWidth(other.groupWidth),
+ groupHeight(other.groupHeight),
BoundingX(other.BoundingX),
BoundingY(other.BoundingY),
BoundingW(other.BoundingW),
@@ -552,6 +555,10 @@
AnName = tr("Symbol");
setUPixmap(Um::IPolygon);
break;
+ case Group:
+ AnName = tr("Group");
+ setUPixmap(Um::IPolygon);
+ break;
default:
AnName = "Item";
break;
@@ -573,6 +580,9 @@
IRender = Intent_Relative_Colorimetric;
EmProfile = "";
Groups.clear();
+ groupItemList.clear();
+ groupWidth = 1.0;
+ groupHeight = 1.0;
LayerID = m_Doc->activeLayer();
ScaleType = true;
AspectRatio = true;
@@ -1311,13 +1321,12 @@
DrawObj_Pre(p);
if (m_Doc->layerOutline(LayerID))
{
- if ((itemType()==TextFrame || itemType()==ImageFrame || itemType()==PathText || itemType()==Line || itemType()==PolyLine) && (!isGroupControl))
+ if ((itemType()==TextFrame || itemType()==ImageFrame || itemType()==PathText || itemType()==Line || itemType()==PolyLine))
DrawObj_Item(p, cullingArea);
}
else
{
- if (!isGroupControl)
- DrawObj_Item(p, cullingArea);
+ DrawObj_Item(p, cullingArea);
}
DrawObj_Post(p);
}
@@ -1337,7 +1346,7 @@
}
else
{
- if (!isGroupControl)
+ if (!isGroup())
{
#ifdef HAVE_CAIRO
#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4))
@@ -1509,7 +1518,7 @@
void PageItem::DrawObj_Post(ScPainter *p)
{
bool doStroke=true;
- if (!isGroupControl)
+ if (!isGroup())
{
if (m_Doc->layerOutline(LayerID))
{
@@ -1556,7 +1565,7 @@
p->endLayer();
#endif
p->setMaskMode(0);
- if (itemType()==PathText || itemType()==PolyLine || itemType()==Line || itemType()==Symbol)
+ if (itemType()==PathText || itemType()==PolyLine || itemType()==Line || itemType()==Symbol || itemType()==Group)
doStroke=false;
if ((doStroke) && (!m_Doc->RePos))
{
@@ -1686,7 +1695,7 @@
{
double aestheticFactor(5.0);
double scpInv = 1.0 / (qMax(view->scale(), 1.0) * aestheticFactor);
- if (!isGroupControl)
+ if (!isGroup())
{
if ((Frame) && (m_Doc->guidesPrefs().framesShown) && ((itemType() == ImageFrame) || (itemType() == LatexFrame) || (itemType() == OSGFrame) || (itemType() == PathText)))
{
@@ -1766,7 +1775,7 @@
p->restore();
}
}
- if ((m_Doc->guidesPrefs().layerMarkersShown) && (m_Doc->layerCount() > 1) && (!m_Doc->layerOutline(LayerID)) && ((isGroupControl) || (Groups.count() == 0)) && (!view->m_canvas->isPreviewMode()))
+ if ((m_Doc->guidesPrefs().layerMarkersShown) && (m_Doc->layerCount() > 1) && (!m_Doc->layerOutline(LayerID)) && (isGroup()) && (!view->m_canvas->isPreviewMode()))
{
p->setPen(Qt::black, 0.5/ m_Doc->view()->scale(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
p->setPenOpacity(1.0);
@@ -1794,8 +1803,6 @@
if (!m_Doc->DoDrawing)
return;
QList<PageItem*> emG;
- QStack<PageItem*> groupStack;
- groupStack.clear();
emG.clear();
emG.append(cembedded);
if (cembedded->Groups.count() != 0)
@@ -1818,52 +1825,6 @@
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
- if (embedded->isGroupControl)
- {
- p->save();
- QTransform mm;
- mm.translate((embedded->gXpos * (style.scaleH() / 1000.0)), ( - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos * (style.scaleV() / 1000.0)));
- if (style.baselineOffset() != 0)
- mm.translate(0, -embedded->gHeight * (style.baselineOffset() / 1000.0));
- mm.scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
- mm.rotate(embedded->rotation());
- if ((embedded->GrMask == 1) || (embedded->GrMask == 2) || (embedded->GrMask == 4) || (embedded->GrMask == 5))
- {
- if ((embedded->GrMask == 1) || (embedded->GrMask == 2))
- p->setMaskMode(1);
- else
- p->setMaskMode(3);
- if ((!embedded->gradientMaskVal.isEmpty()) && (!m_Doc->docGradients.contains(embedded->gradientMaskVal)))
- embedded->gradientMaskVal = "";
- if (!(embedded->gradientMaskVal.isEmpty()) && (m_Doc->docGradients.contains(embedded->gradientMaskVal)))
- embedded->mask_gradient = m_Doc->docGradients[embedded->gradientMaskVal];
- p->mask_gradient = embedded->mask_gradient;
- if ((embedded->GrMask == 1) || (embedded->GrMask == 4))
- p->setGradientMask(VGradient::linear, FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), FPoint(embedded->GrMaskEndX, embedded->GrMaskEndY).transformPoint(mm, false), FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), embedded->GrMaskScale, embedded->GrMaskSkew);
- else
- p->setGradientMask(VGradient::radial, FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), FPoint(embedded->GrMaskEndX, embedded->GrMaskEndY).transformPoint(mm, false), FPoint(embedded->GrMaskFocalX, embedded->GrMaskFocalY).transformPoint(mm, false), embedded->GrMaskScale, embedded->GrMaskSkew);
- }
- else if ((embedded->GrMask == 3) || (embedded->GrMask == 6))
- {
- if ((embedded->patternMaskVal.isEmpty()) || (!m_Doc->docPatterns.contains(embedded->patternMaskVal)))
- p->setMaskMode(0);
- else
- {
- p->setPatternMask(&m_Doc->docPatterns[embedded->patternMask()], embedded->patternMaskScaleX, embedded->patternMaskScaleY, embedded->patternMaskOffsetX + embedded->xPos(), embedded->patternMaskOffsetY + embedded->yPos(), embedded->patternMaskRotation + embedded->rotation(), embedded->patternMaskSkewX, embedded->patternMaskSkewY, embedded->patternMaskMirrorX, embedded->patternMaskMirrorY);
- if (embedded->GrMask == 3)
- p->setMaskMode(2);
- else
- p->setMaskMode(4);
- }
- }
- else
- p->setMaskMode(0);
- FPointArray cl = embedded->PoLine.copy();
- cl.map( mm );
- p->beginLayer(1.0 - embedded->fillTransparency(), embedded->fillBlendmode(), &cl);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
p->save();
double x = embedded->xPos();
double y = embedded->yPos();
@@ -1889,6 +1850,7 @@
case Polygon:
case PathText:
case Symbol:
+ case Group:
embedded->DrawObj_Item(p, cullingArea);
break;
case Line:
@@ -1904,17 +1866,6 @@
embedded->Xpos = x;
embedded->Ypos = y;
p->restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- p->endLayer();
- p->restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
embedded->m_lineWidth = pws;
}
for (int em = 0; em < emG.count(); ++em)
@@ -2000,54 +1951,9 @@
}
trans *= savWM;
p->setWorldMatrix(trans);
- QStack<PageItem*> groupStack;
- groupStack.clear();
for (int em = 0; em < pat.items.count(); ++em)
{
PageItem* embedded = pat.items.at(em);
- if (embedded->isGroupControl)
- {
- p->save();
- QTransform mm;
- mm.translate(embedded->gXpos, embedded->gYpos);
- mm.rotate(embedded->rotation());
- if ((embedded->GrMask == 1) || (embedded->GrMask == 2) || (embedded->GrMask == 4) || (embedded->GrMask == 5))
- {
- if ((embedded->GrMask == 1) || (embedded->GrMask == 2))
- p->setMaskMode(1);
- else
- p->setMaskMode(3);
- if ((!embedded->gradientMaskVal.isEmpty()) && (!m_Doc->docGradients.contains(embedded->gradientMaskVal)))
- embedded->gradientMaskVal = "";
- if (!(embedded->gradientMaskVal.isEmpty()) && (m_Doc->docGradients.contains(embedded->gradientMaskVal)))
- embedded->mask_gradient = m_Doc->docGradients[embedded->gradientMaskVal];
- p->mask_gradient = embedded->mask_gradient;
- if ((embedded->GrMask == 1) || (embedded->GrMask == 4))
- p->setGradientMask(VGradient::linear, FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), FPoint(embedded->GrMaskEndX, embedded->GrMaskEndY).transformPoint(mm, false), FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), embedded->GrMaskScale, embedded->GrMaskSkew);
- else
- p->setGradientMask(VGradient::radial, FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), FPoint(embedded->GrMaskEndX, embedded->GrMaskEndY).transformPoint(mm, false), FPoint(embedded->GrMaskFocalX, embedded->GrMaskFocalY).transformPoint(mm, false), embedded->GrMaskScale, embedded->GrMaskSkew);
- }
- else if ((embedded->GrMask == 3) || (embedded->GrMask == 6))
- {
- if ((embedded->patternMaskVal.isEmpty()) || (!m_Doc->docPatterns.contains(embedded->patternMaskVal)))
- p->setMaskMode(0);
- else
- {
- p->setPatternMask(&m_Doc->docPatterns[embedded->patternMask()], embedded->patternMaskScaleX, embedded->patternMaskScaleY, embedded->patternMaskOffsetX + embedded->xPos(), embedded->patternMaskOffsetY + embedded->yPos(), embedded->patternMaskRotation + embedded->rotation(), embedded->patternMaskSkewX, embedded->patternMaskSkewY, embedded->patternMaskMirrorX, embedded->patternMaskMirrorY);
- if (embedded->GrMask == 3)
- p->setMaskMode(2);
- else
- p->setMaskMode(4);
- }
- }
- else
- p->setMaskMode(0);
- FPointArray cl = embedded->PoLine.copy();
- cl.map( mm );
- p->beginLayer(1.0 - embedded->fillTransparency(), embedded->fillBlendmode(), &cl);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
p->save();
p->translate(embedded->gXpos, embedded->gYpos);
embedded->isEmbedded = true;
@@ -2055,17 +1961,6 @@
embedded->DrawObj(p, QRectF());
embedded->isEmbedded = false;
p->restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- p->endLayer();
- p->restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < pat.items.count(); ++em)
{
@@ -2120,7 +2015,7 @@
if (!m_Doc->m_Selection->isEmpty())
{
// qDebug() << "Item: " << ItemNr << "W: " << Width << "H: " << Height;
- if (Groups.count() == 0)
+ if (!isGroup())
{
//Locked line colour selection
if (m_Locked)
@@ -2222,134 +2117,36 @@
double miny = std::numeric_limits<double>::max();
double maxx = -std::numeric_limits<double>::max();
double maxy = -std::numeric_limits<double>::max();
- if (Groups.count() != 0)
- {
- for (int ga=0; ga<m_Doc->Items->count(); ++ga)
- {
- if (m_Doc->Items->at(ga)->Groups.count() != 0)
- {
- if (m_Doc->Items->at(ga)->Groups.top() == Groups.top())
- {
- if (!emG.contains(m_Doc->Items->at(ga)))
- {
- emG.append(m_Doc->Items->at(ga));
- PageItem *currItem = m_Doc->Items->at(ga);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- }
- }
- }
- for (int em = 0; em < emG.count(); ++em)
- {
- PageItem* currItem = emG.at(em);
- currItem->gXpos = currItem->xPos() - minx;
- currItem->gYpos = currItem->yPos() - miny;
- currItem->gWidth = maxx - minx;
- currItem->gHeight = maxy - miny;
- }
- }
- else
- {
- double x1, x2, y1, y2;
- getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- gXpos = xPos() - minx;
- gYpos = yPos() - miny;
- gWidth = maxx - minx;
- gHeight = maxy - miny;
- emG.append(this);
- }
+ double x1, x2, y1, y2;
+ getVisualBoundingRect(&x1, &y1, &x2, &y2);
+ minx = qMin(minx, x1);
+ miny = qMin(miny, y1);
+ maxx = qMax(maxx, x2);
+ maxy = qMax(maxy, y2);
+ gXpos = xPos() - minx;
+ gYpos = yPos() - miny;
+ gWidth = maxx - minx;
+ gHeight = maxy - miny;
+ emG.append(this);
return DrawObj_toImage(emG);
}
QImage PageItem::DrawObj_toImage(QList<PageItem*> &emG)
{
QImage retImg = QImage(qRound(gWidth), qRound(gHeight), QImage::Format_ARGB32_Premultiplied);
-// retImg.fill( qRgba(255, 255, 255, 0) );
retImg.fill( qRgba(0, 0, 0, 0) );
ScPainter *painter = new ScPainter(&retImg, retImg.width(), retImg.height(), 1, 0);
painter->setZoomFactor(qMax(qRound(gWidth) / gWidth, qRound(gHeight) / gHeight));
- QStack<PageItem*> groupStack;
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
- if (embedded->isGroupControl)
- {
- painter->save();
- QTransform mm;
- mm.translate(embedded->gXpos, embedded->gYpos);
- mm.rotate(embedded->rotation());
- if ((embedded->GrMask == 1) || (embedded->GrMask == 2) || (embedded->GrMask == 4) || (embedded->GrMask == 5))
- {
- if ((embedded->GrMask == 1) || (embedded->GrMask == 2))
- painter->setMaskMode(1);
- else
- painter->setMaskMode(3);
- if ((!embedded->gradientMaskVal.isEmpty()) && (!m_Doc->docGradients.contains(embedded->gradientMaskVal)))
- embedded->gradientMaskVal = "";
- if (!(embedded->gradientMaskVal.isEmpty()) && (m_Doc->docGradients.contains(embedded->gradientMaskVal)))
- embedded->mask_gradient = m_Doc->docGradients[embedded->gradientMaskVal];
- painter->mask_gradient = embedded->mask_gradient;
- if ((embedded->GrMask == 1) || (embedded->GrMask == 4))
- painter->setGradientMask(VGradient::linear, FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), FPoint(embedded->GrMaskEndX, embedded->GrMaskEndY).transformPoint(mm, false), FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), embedded->GrMaskScale, embedded->GrMaskSkew);
- else
- painter->setGradientMask(VGradient::radial, FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), FPoint(embedded->GrMaskEndX, embedded->GrMaskEndY).transformPoint(mm, false), FPoint(embedded->GrMaskFocalX, embedded->GrMaskFocalY).transformPoint(mm, false), embedded->GrMaskScale, embedded->GrMaskSkew);
- }
- else if ((embedded->GrMask == 3) || (embedded->GrMask == 6))
- {
- if ((embedded->patternMaskVal.isEmpty()) || (!m_Doc->docPatterns.contains(embedded->patternMaskVal)))
- painter->setMaskMode(0);
- else
- {
- painter->setPatternMask(&m_Doc->docPatterns[embedded->patternMask()], embedded->patternMaskScaleX, embedded->patternMaskScaleY, embedded->patternMaskOffsetX + embedded->xPos(), embedded->patternMaskOffsetY + embedded->yPos(), embedded->patternMaskRotation + embedded->rotation(), embedded->patternMaskSkewX, embedded->patternMaskSkewY, embedded->patternMaskMirrorX, embedded->patternMaskMirrorY);
- if (embedded->GrMask == 3)
- painter->setMaskMode(2);
- else
- painter->setMaskMode(4);
- }
- }
- else
- painter->setMaskMode(0);
- FPointArray cl = embedded->PoLine.copy();
- cl.map( mm );
- painter->beginLayer(1.0 - embedded->fillTransparency(), embedded->fillBlendmode(), &cl);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
painter->save();
-// qDebug()<<embedded<<embedded->xPos()<<embedded->yPos()<<embedded->gXpos<<embedded->gYpos;
-// double x = embedded->xPos();
-// double y = embedded->yPos();
-// embedded->Xpos = embedded->gXpos;
-// embedded->Ypos = embedded->gYpos;
- // Seems to work without all this coordinates mess. To monitor tho
painter->translate(embedded->gXpos, embedded->gYpos);
embedded->isEmbedded = true;
embedded->invalid = true;
embedded->DrawObj(painter, QRectF());
-// embedded->Xpos = x;
-// embedded->Ypos = y;
embedded->isEmbedded = false;
painter->restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- painter->endLayer();
- painter->restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < emG.count(); ++em)
{
@@ -2357,10 +2154,6 @@
if (!embedded->isTableItem)
continue;
painter->save();
-// double x = embedded->xPos();
-// double y = embedded->yPos();
-// embedded->Xpos = embedded->gXpos;
-// embedded->Ypos = embedded->gYpos;
painter->translate(embedded->gXpos, embedded->gYpos);
painter->rotate(embedded->rotation());
embedded->isEmbedded = true;
@@ -2383,8 +2176,6 @@
}
}
embedded->isEmbedded = false;
-// embedded->Xpos = x;
-// embedded->Ypos = y;
painter->restore();
}
painter->end();
@@ -3820,7 +3611,7 @@
void PageItem::setLineWidth(double newWidth)
{
- if ((m_lineWidth == newWidth) || (isGroupControl))
+ if ((m_lineWidth == newWidth) || (isGroup()))
return; // nothing to do -> return
if (UndoManager::undoEnabled())
{
@@ -4021,6 +3812,13 @@
undoManager->action(this, is);
}
groupsLastItem = item;
+}
+
+QList<PageItem*> PageItem::getItemList()
+{
+ QList<PageItem*> ret;
+ ret.clear();
+ return ret;
}
void PageItem::toggleSizeLock()
@@ -5079,7 +4877,7 @@
tagged=tag;
}
-void PageItem::replaceNamedResources(ResourceCollection& newNames)
+void PageItem::replaceNamedResources(ResourceCollection& newNames)
{
QMap<QString,QString>::ConstIterator it;
@@ -5383,7 +5181,7 @@
if (prevInChain() == NULL)
itemText.getNamedResources(lists);
}
-
+/*
void PageItem::copyToCopyPasteBuffer(struct CopyPasteBuffer *Buffer)
{
Buffer->PType = realItemType();
@@ -5443,8 +5241,6 @@
Buffer->PicArt = PicArt;
Buffer->flippedH = imageFlippedH();
Buffer->flippedV = imageFlippedV();
-/* Buffer->BBoxX = BBoxX;
- Buffer->BBoxH = BBoxH; */
Buffer->isPrintable = printEnabled();
Buffer->isBookmark = isBookmark;
// Buffer->BMnr = BMnr;
@@ -5554,7 +5350,7 @@
Buffer->startArrowScale = m_startArrowScale;
Buffer->endArrowScale = m_endArrowScale;
}
-
+*/
//Moved from View
void PageItem::SetFrameShape(int count, double *vals)
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Sat Dec 18 21:33:07 2010
@@ -70,6 +70,7 @@
class PageItem_PathText;
class PageItem_LatexFrame;
class PageItem_Symbol;
+class PageItem_Group;
#ifdef HAVE_OSG
class PageItem_OSGFrame;
#endif
@@ -167,6 +168,7 @@
LatexFrame = 9,
OSGFrame = 10,
Symbol = 11,
+ Group = 12,
Multiple = 99
};
@@ -194,6 +196,7 @@
virtual PageItem_OSGFrame * asOSGFrame() { return NULL; }
#endif
virtual PageItem_Symbol * asSymbolFrame() { return NULL; }
+ virtual PageItem_Group * asGroupFrame() { return NULL; }
virtual bool isImageFrame() const { return false; }
virtual bool isLine() const { return false; }
@@ -204,6 +207,7 @@
virtual bool isLatexFrame() const { return false; }
virtual bool isOSGFrame() const { return false; }
virtual bool isSymbol() const { return false; }
+ virtual bool isGroup() const { return false; }
/** @brief Frame Type
*
@@ -330,7 +334,7 @@
* @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);
+// void copyToCopyPasteBuffer(struct CopyPasteBuffer *Buffer);
virtual void handleModeEditKey(QKeyEvent *k, bool &keyRepeat);
@@ -582,6 +586,10 @@
bool isGroupControl;
PageItem *groupsLastItem;
void setGroupsLastItem(PageItem* item);
+ QList<PageItem*> groupItemList;
+ virtual QList<PageItem*> getItemList();
+ double groupWidth;
+ double groupHeight;
double BoundingX;
double BoundingY;
double BoundingW;
@@ -1094,8 +1102,8 @@
/** @brief Required by the UndoObject */
void restore(UndoState *state, bool isUndo);
- void getNamedResources(ResourceCollection& lists) const;
- void replaceNamedResources(ResourceCollection& newNames);
+ virtual void getNamedResources(ResourceCollection& lists) const;
+ virtual void replaceNamedResources(ResourceCollection& newNames);
/**
* @brief Return a variant of `originalName' that is guaranteed to be unique
Modified: trunk/Scribus/scribus/pageitem_imageframe.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/pageitem_imageframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_imageframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_imageframe.cpp Sat Dec 18 21:33:07 2010
@@ -28,6 +28,7 @@
#include <cmath>
#include <cassert>
+#include "filewatcher.h"
#include "page.h"
#include "pageitem.h"
#include "pageitem_imageframe.h"
@@ -37,6 +38,7 @@
#include "scpainter.h"
#include "scribus.h"
#include "scribusstructs.h"
+#include "scribuscore.h"
#include "scribusdoc.h"
#include "commonstrings.h"
#include "undomanager.h"
@@ -51,6 +53,16 @@
PageItem_ImageFrame::PageItem_ImageFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline)
: PageItem(pa, PageItem::ImageFrame, x, y, w, h, w2, fill, outline)
{
+}
+
+PageItem_ImageFrame::~PageItem_ImageFrame()
+{
+ if ((PictureIsAvailable) && (!Pfile.isEmpty()))
+ {
+ ScCore->fileWatcher->removeFile(Pfile);
+ QFileInfo fi(Pfile);
+ ScCore->fileWatcher->removeDir(fi.absolutePath());
+ }
}
void PageItem_ImageFrame::DrawObj_Item(ScPainter *p, QRectF /*e*/)
Modified: trunk/Scribus/scribus/pageitem_imageframe.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/pageitem_imageframe.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_imageframe.h (original)
+++ trunk/Scribus/scribus/pageitem_imageframe.h Sat Dec 18 21:33:07 2010
@@ -38,7 +38,7 @@
public:
PageItem_ImageFrame(ScribusDoc *pa, double x, double y, double w, double h, double w2, QString fill, QString outline);
PageItem_ImageFrame(const PageItem & p) : PageItem(p) {}
- ~PageItem_ImageFrame() {};
+ ~PageItem_ImageFrame();
virtual PageItem_ImageFrame * asImageFrame() { return this; }
virtual bool isImageFrame() const { return true; }
Modified: trunk/Scribus/scribus/pageitem_symbol.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/pageitem_symbol.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_symbol.cpp (original)
+++ trunk/Scribus/scribus/pageitem_symbol.cpp Sat Dec 18 21:33:07 2010
@@ -102,54 +102,9 @@
ScPattern pat = m_Doc->docPatterns[patternVal];
p->scale(Width / pat.width, Height / pat.height);
p->translate(pat.items.at(0)->gXpos, pat.items.at(0)->gYpos);
- QStack<PageItem*> groupStack;
- groupStack.clear();
for (int em = 0; em < pat.items.count(); ++em)
{
PageItem* embedded = pat.items.at(em);
- if (embedded->isGroupControl)
- {
- p->save();
- QTransform mm;
- mm.translate(embedded->gXpos, embedded->gYpos);
- mm.rotate(embedded->rotation());
- if ((embedded->GrMask == 1) || (embedded->GrMask == 2) || (embedded->GrMask == 4) || (embedded->GrMask == 5))
- {
- if ((embedded->GrMask == 1) || (embedded->GrMask == 2))
- p->setMaskMode(1);
- else
- p->setMaskMode(3);
- if ((!embedded->gradientMaskVal.isEmpty()) && (!m_Doc->docGradients.contains(embedded->gradientMaskVal)))
- embedded->gradientMaskVal = "";
- if (!(embedded->gradientMaskVal.isEmpty()) && (m_Doc->docGradients.contains(embedded->gradientMaskVal)))
- embedded->mask_gradient = m_Doc->docGradients[embedded->gradientMaskVal];
- p->mask_gradient = embedded->mask_gradient;
- if ((embedded->GrMask == 1) || (embedded->GrMask == 4))
- p->setGradientMask(VGradient::linear, FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), FPoint(embedded->GrMaskEndX, embedded->GrMaskEndY).transformPoint(mm, false), FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), embedded->GrMaskScale, embedded->GrMaskSkew);
- else
- p->setGradientMask(VGradient::radial, FPoint(embedded->GrMaskStartX, embedded->GrMaskStartY).transformPoint(mm, false), FPoint(embedded->GrMaskEndX, embedded->GrMaskEndY).transformPoint(mm, false), FPoint(embedded->GrMaskFocalX, embedded->GrMaskFocalY).transformPoint(mm, false), embedded->GrMaskScale, embedded->GrMaskSkew);
- }
- else if ((embedded->GrMask == 3) || (embedded->GrMask == 6))
- {
- if ((embedded->patternMaskVal.isEmpty()) || (!m_Doc->docPatterns.contains(embedded->patternMaskVal)))
- p->setMaskMode(0);
- else
- {
- p->setPatternMask(&m_Doc->docPatterns[embedded->patternMask()], embedded->patternMaskScaleX, embedded->patternMaskScaleY, embedded->patternMaskOffsetX + embedded->xPos(), embedded->patternMaskOffsetY + embedded->yPos(), embedded->patternMaskRotation, embedded->patternMaskSkewX, embedded->patternMaskSkewY, embedded->patternMaskMirrorX, embedded->patternMaskMirrorY);
- if (embedded->GrMask == 3)
- p->setMaskMode(2);
- else
- p->setMaskMode(4);
- }
- }
- else
- p->setMaskMode(0);
- FPointArray cl = embedded->PoLine.copy();
- cl.map( mm );
- p->beginLayer(1.0 - embedded->fillTransparency(), embedded->fillBlendmode(), &cl);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
p->save();
p->translate(embedded->gXpos, embedded->gYpos);
embedded->isEmbedded = true;
@@ -157,17 +112,6 @@
embedded->DrawObj(p, QRectF());
embedded->isEmbedded = false;
p->restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- p->endLayer();
- p->restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < pat.items.count(); ++em)
{
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Sat Dec 18 21:33:07 2010
@@ -2493,29 +2493,12 @@
PutPage("1 0 0 -1 0 "+FToStr(-ite->height())+" cm\n");
QTransform trans;
trans.translate(0.0, -ite->height());
- trans.scale(ite->width() / pat.width, ite->height() / pat.height);
+ trans.scale(ite->width() / ite->groupWidth, ite->height() / ite->groupHeight);
trans.translate(pat.items.at(0)->gXpos, -pat.items.at(0)->gYpos);
PutPage(FToStr(trans.m11())+" "+FToStr(trans.m12())+" "+FToStr(trans.m21())+" "+FToStr(trans.m22())+" "+FToStr(trans.dx())+" "+FToStr(trans.dy())+" cm\n");
- QStack<PageItem*> groupStack;
for (int em = 0; em < pat.items.count(); ++em)
{
PageItem* embedded = pat.items.at(em);
- if (embedded->isGroupControl)
- {
- tmpD += "q\n";
- FPointArray cl = embedded->PoLine.copy();
- FPointArray clb = embedded->PoLine.copy();
- QTransform mm;
- mm.translate(embedded->gXpos, -(embedded->gHeight - embedded->gYpos));
- mm.rotate(embedded->rotation());
- cl.map( mm );
- embedded->PoLine = cl;
- tmpD += SetClipPath(embedded);
- tmpD += "h W* n\n";
- groupStack.push(embedded->groupsLastItem);
- embedded->PoLine = clb.copy();
- continue;
- }
tmpD += "q\n";
tmpD += "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(embedded->gHeight - embedded->gYpos)+" cm\n";
QString output;
@@ -2523,20 +2506,56 @@
return "";
tmpD += output;
tmpD += "Q\n";
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- tmpD += "Q\n";
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < pat.items.count(); ++em)
{
PageItem* embedded = pat.items.at(em);
+ if (!embedded->isTableItem)
+ continue;
+ if ((embedded->lineColor() == CommonStrings::None) || (embedded->lineWidth() == 0.0))
+ continue;
+ tmpD += "q\n";
+ tmpD += "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(embedded->gHeight - embedded->gYpos)+" cm\n";
+ tmpD += PDF_ProcessTableItem(embedded, pag);
+ tmpD += "Q\n";
+ }
+ if (Options.Version >= PDFOptions::PDFVersion_14 || Options.Version == PDFOptions::PDFVersion_X4)
+ PutPage(Write_TransparencyGroup(ite->fillTransparency(), ite->fillBlendmode(), tmpD, ite));
+ else
+ PutPage(tmpD);
+ PutPage("Q\n");
+ }
+ break;
+ case PageItem::Group:
+ if (ite->groupItemList.count() > 0)
+ {
+ QString tmpD = "";
+ PutPage("q\n");
+ PutPage(SetClipPath(ite));
+ PutPage("h W* n\n");
+ if (ite->imageFlippedH())
+ PutPage("-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n");
+ if (ite->imageFlippedV())
+ PutPage("1 0 0 -1 0 "+FToStr(-ite->height())+" cm\n");
+ QTransform trans;
+ trans.translate(0.0, -ite->height());
+ trans.scale(ite->width() / ite->groupWidth, ite->height() / ite->groupHeight);
+ trans.translate(ite->groupItemList.at(0)->gXpos, -ite->groupItemList.at(0)->gYpos);
+ PutPage(FToStr(trans.m11())+" "+FToStr(trans.m12())+" "+FToStr(trans.m21())+" "+FToStr(trans.m22())+" "+FToStr(trans.dx())+" "+FToStr(trans.dy())+" cm\n");
+ for (int em = 0; em < ite->groupItemList.count(); ++em)
+ {
+ PageItem* embedded = ite->groupItemList.at(em);
+ tmpD += "q\n";
+ tmpD += "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(embedded->gHeight - embedded->gYpos)+" cm\n";
+ QString output;
+ if (!PDF_ProcessItem(output, embedded, pag, pag->pageNr(), true))
+ return "";
+ tmpD += output;
+ tmpD += "Q\n";
+ }
+ for (int em = 0; em < ite->groupItemList.count(); ++em)
+ {
+ PageItem* embedded = ite->groupItemList.at(em);
if (!embedded->isTableItem)
continue;
if ((embedded->lineColor() == CommonStrings::None) || (embedded->lineWidth() == 0.0))
@@ -3149,9 +3168,6 @@
{
PageItem* ite;
QString output;
- QStack<PageItem*> groupStack;
- QStack<PageItem*> groupStackS;
- QStack<QString> groupDataStack;
QList<PageItem*> PItems;
if (pag->MPageNam.isEmpty())
@@ -3177,22 +3193,6 @@
if ((!pag->pageName().isEmpty()) && (ite->OwnPage != static_cast<int>(pag->pageNr())) && (ite->OwnPage != -1))
continue;
QString name = QString("/master_page_obj_%1_%2").arg(mPageIndex).arg(ite->ItemNr);
- if (ite->isGroupControl)
- {
- PutPage("q\n");
- FPointArray cl = ite->PoLine.copy();
- FPointArray clb = ite->PoLine.copy();
- QTransform mm;
- mm.translate(ite->xPos() - mPage->xOffset(), (ite->yPos() - mPage->yOffset()) - mPage->height());
- mm.rotate(ite->rotation());
- cl.map( mm );
- ite->PoLine = cl;
- PutPage(SetClipPath(ite));
- PutPage("h W* n\n");
- groupStack.push(ite->groupsLastItem);
- ite->PoLine = clb.copy();
- continue;
- }
if (! ite->asTextFrame())
PutPage(name+" Do\n");
else
@@ -3209,16 +3209,6 @@
ite->setXYPos(oldX, oldY, true);
ite->BoundingX = OldBX;
ite->BoundingY = OldBY;
- }
- if (groupStack.count() != 0)
- {
- while (ite == groupStack.top())
- {
- PutPage("Q\n");
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
}
}
for (int am = 0; am < pag->FromMaster.count(); ++am)
@@ -3253,9 +3243,6 @@
{
PageItem* ite;
QString output;
- QStack<PageItem*> groupStack;
- QStack<PageItem*> groupStackS;
- QStack<QString> groupDataStack;
QList<PageItem*> PItems;
int pc_exportpagesitems = usingGUI ? progressDialog->progress("ECPI") : 0;
@@ -3274,36 +3261,6 @@
{
progressDialog->setProgress("ECPI", ++pc_exportpagesitems);
qApp->processEvents();
- }
- QString grcon = "";
- if (ite->isGroupControl)
- {
- grcon += "q\n";
- FPointArray cl = ite->PoLine.copy();
- FPointArray clb = ite->PoLine.copy();
- QTransform mm;
- mm.translate(ite->xPos() - pag->xOffset(), (ite->yPos() - pag->yOffset()) - pag->height());
- mm.rotate(ite->rotation());
- cl.map( mm );
- ite->PoLine = cl;
- grcon += SetClipPath(ite);
- grcon += "h W* n\n";
- groupStack.push(ite->groupsLastItem);
- groupStackS.push(ite);
- if (((layer.transparency != 1) || (layer.blendMode != 0)) && ((Options.Version >= PDFOptions::PDFVersion_14) || (Options.Version == PDFOptions::PDFVersion_X4)))
- {
- inh += grcon;
- groupDataStack.push(inh);
- inh = "";
- }
- else
- {
- PutPage(grcon);
- groupDataStack.push(Content);
- Content = "";
- }
- ite->PoLine = clb.copy();
- continue;
}
if (!PDF_ProcessItem(output, ite, pag, PNr))
return false;
@@ -3311,37 +3268,6 @@
inh += output;
else
PutPage(output);
- if (groupStack.count() != 0)
- {
- while (ite == groupStack.top())
- {
- QString tmpData;
- PageItem *controlItem = groupStackS.pop();
- if (((layer.transparency != 1) || (layer.blendMode != 0)) && ((Options.Version >= PDFOptions::PDFVersion_14) || (Options.Version == PDFOptions::PDFVersion_X4)))
- {
- tmpData = inh;
- inh = groupDataStack.pop();
- if (Options.Version >= PDFOptions::PDFVersion_14 || Options.Version == PDFOptions::PDFVersion_X4)
- inh += Write_TransparencyGroup(controlItem->fillTransparency(), controlItem->fillBlendmode(), tmpData, controlItem);
- else
- inh += tmpData;
- inh += "Q\n";
- }
- else
- {
- tmpData = Content;
- Content = groupDataStack.pop();
- if (Options.Version >= PDFOptions::PDFVersion_14 || Options.Version == PDFOptions::PDFVersion_X4)
- Content += Write_TransparencyGroup(controlItem->fillTransparency(), controlItem->fillBlendmode(), tmpData, controlItem);
- else
- Content += tmpData;
- PutPage("Q\n");
- }
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int a = 0; a < PItems.count() && !abortExport; ++a)
{
@@ -4304,26 +4230,9 @@
trans.scale(ite->width() / pat.width, ite->height() / pat.height);
trans.translate(pat.items.at(0)->gXpos, -pat.items.at(0)->gYpos);
tmp += FToStr(trans.m11())+" "+FToStr(trans.m12())+" "+FToStr(trans.m21())+" "+FToStr(trans.m22())+" "+FToStr(trans.dx())+" "+FToStr(trans.dy())+" cm\n";
- QStack<PageItem*> groupStack;
for (int em = 0; em < pat.items.count(); ++em)
{
PageItem* embedded = pat.items.at(em);
- if (embedded->isGroupControl)
- {
- tmpD += "q\n";
- FPointArray cl = embedded->PoLine.copy();
- FPointArray clb = embedded->PoLine.copy();
- QTransform mm;
- mm.translate(embedded->gXpos, -(embedded->gHeight - embedded->gYpos));
- mm.rotate(embedded->rotation());
- cl.map( mm );
- embedded->PoLine = cl;
- tmpD += SetClipPath(embedded);
- tmpD += "h W* n\n";
- groupStack.push(embedded->groupsLastItem);
- embedded->PoLine = clb.copy();
- continue;
- }
tmpD += "q\n";
tmpD += "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(embedded->gHeight - embedded->gYpos)+" cm\n";
QString output;
@@ -4331,20 +4240,56 @@
return "";
tmpD += output;
tmpD += "Q\n";
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- tmpD += "Q\n";
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < pat.items.count(); ++em)
{
PageItem* embedded = pat.items.at(em);
+ if (!embedded->isTableItem)
+ continue;
+ if ((embedded->lineColor() == CommonStrings::None) || (embedded->lineWidth() == 0.0))
+ continue;
+ tmpD += "q\n";
+ tmpD += "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(embedded->gHeight - embedded->gYpos)+" cm\n";
+ tmpD += PDF_ProcessTableItem(embedded, pag);
+ tmpD += "Q\n";
+ }
+ if (Options.Version >= PDFOptions::PDFVersion_14 || Options.Version == PDFOptions::PDFVersion_X4)
+ tmp += Write_TransparencyGroup(ite->fillTransparency(), ite->fillBlendmode(), tmpD, ite);
+ else
+ tmp += tmpD;
+ tmp += "Q\n";
+ }
+ break;
+ case PageItem::Group:
+ if (ite->groupItemList.count() > 0)
+ {
+ QString tmpD = "";
+ tmp += "q\n";
+ tmp += SetClipPath(ite);
+ tmp += "h W* n\n";
+ if (ite->imageFlippedH())
+ tmp += "-1 0 0 1 "+FToStr(ite->width())+" 0 cm\n";
+ if (ite->imageFlippedV())
+ tmp += "1 0 0 -1 0 "+FToStr(-ite->height())+" cm\n";
+ QTransform trans;
+ trans.translate(0.0, -ite->height());
+ trans.scale(ite->width() / ite->groupWidth, ite->height() / ite->groupHeight);
+ trans.translate(ite->groupItemList.at(0)->gXpos, -ite->groupItemList.at(0)->gYpos);
+ tmp += FToStr(trans.m11())+" "+FToStr(trans.m12())+" "+FToStr(trans.m21())+" "+FToStr(trans.m22())+" "+FToStr(trans.dx())+" "+FToStr(trans.dy())+" cm\n";
+ for (int em = 0; em < ite->groupItemList.count(); ++em)
+ {
+ PageItem* embedded = ite->groupItemList.at(em);
+ tmpD += "q\n";
+ tmpD += "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(embedded->gHeight - embedded->gYpos)+" cm\n";
+ QString output;
+ if (!PDF_ProcessItem(output, embedded, pag, PNr, true))
+ return "";
+ tmpD += output;
+ tmpD += "Q\n";
+ }
+ for (int em = 0; em < ite->groupItemList.count(); ++em)
+ {
+ PageItem* embedded = ite->groupItemList.at(em);
if (!embedded->isTableItem)
continue;
if ((embedded->lineColor() == CommonStrings::None) || (embedded->lineWidth() == 0.0))
@@ -4411,26 +4356,9 @@
trans.scale(1, -1);
}
tmp += FToStr(trans.m11())+" "+FToStr(trans.m12())+" "+FToStr(trans.m21())+" "+FToStr(trans.m22())+" "+FToStr(trans.dx())+" "+FToStr(trans.dy())+" cm\n";
- QStack<PageItem*> groupStack;
for (int em = 0; em < pat.items.count(); ++em)
{
PageItem* embedded = pat.items.at(em);
- if (embedded->isGroupControl)
- {
- tmp += "q\n";
- FPointArray cl = embedded->PoLine.copy();
- FPointArray clb = embedded->PoLine.copy();
- QTransform mm;
- mm.translate(embedded->gXpos, -(embedded->gHeight - embedded->gYpos));
- mm.rotate(embedded->rotation());
- cl.map( mm );
- embedded->PoLine = cl;
- tmp += SetClipPath(embedded);
- tmp += "h W* n\n";
- groupStack.push(embedded->groupsLastItem);
- embedded->PoLine = clb.copy();
- continue;
- }
tmp += "q\n";
tmp += "1 0 0 1 "+FToStr(embedded->gXpos)+" "+FToStr(embedded->gHeight - embedded->gYpos)+" cm\n";
QString output;
@@ -4438,16 +4366,6 @@
return "";
tmp += output;
tmp += "Q\n";
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- tmp += "Q\n";
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < pat.items.count(); ++em)
{
@@ -5113,35 +5031,9 @@
tmp2 = "";
}
QList<PageItem*> emG = embedded.getGroupedItems();
- QStack<PageItem*> groupStack;
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
- if (embedded->isGroupControl)
- {
- tmp2 += "q\n";
- FPointArray cl = embedded->PoLine.copy();
- FPointArray clb = embedded->PoLine.copy();
- QTransform mm;
- if (ite->asPathText())
- mm.translate(embedded->gXpos * (style.scaleH() / 1000.0), ((embedded->gHeight * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)) * -1);
- else
- mm.translate(x + hl->glyph.xoffset + embedded->gXpos * (style.scaleH() / 1000.0), (y + hl->glyph.yoffset - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos * (style.scaleV() / 1000.0)));
- if (style.baselineOffset() != 0)
- mm.translate(0, embedded->gHeight * (style.baselineOffset() / 1000.0));
- if (style.scaleH() != 1000)
- mm.scale(style.scaleH() / 1000.0, 1);
- if (style.scaleV() != 1000)
- mm.scale(1, style.scaleV() / 1000.0);
- mm.rotate(embedded->rotation());
- cl.map( mm );
- embedded->PoLine = cl;
- tmp2 += SetClipPath(embedded);
- tmp2 += "h W* n\n";
- groupStack.push(embedded->groupsLastItem);
- embedded->PoLine = clb.copy();
- continue;
- }
tmp2 += "q\n";
if (ite->asPathText())
tmp2 += FToStr(style.scaleH() / 1000.0)+" 0 0 "+FToStr(style.scaleV() / 1000.0)+" "+FToStr(embedded->gXpos * (style.scaleH() / 1000.0))+" "+FToStr((embedded->gHeight * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)+embedded->gHeight * (style.baselineOffset() / 1000.0))+" cm\n";
@@ -5151,16 +5043,6 @@
return false;
tmp2 +=output;
tmp2 += "Q\n";
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- tmp2 += "Q\n";
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < emG.count(); ++em)
{
@@ -5962,7 +5844,7 @@
StopVec.clear();
TransVec.clear();
QTransform mpa;
- if (currItem->isGroupControl)
+ if (currItem->isGroup())
{
mpa.translate(currItem->xPos() - ActPageP->xOffset(), ActPageP->height() - (currItem->yPos() - ActPageP->yOffset()));
mpa.rotate(-currItem->rotation());
@@ -6089,7 +5971,7 @@
PutDoc("/FormType 1\n");
PutDoc("/Group << /S /Transparency /CS /DeviceGray >>\n");
double lw = currItem->lineWidth();
- if ((currItem->isGroupControl) || (currItem->itemType() == PageItem::Symbol))
+ if ((currItem->isGroup()) || (currItem->itemType() == PageItem::Symbol))
PutDoc("/BBox [0 0 "+FToStr(ActPageP->width())+" "+FToStr(ActPageP->height())+" ]\n");
else
PutDoc("/BBox ["+FToStr(-lw / 2.0)+" "+FToStr(lw / 2.0)+" "+FToStr(currItem->width()+lw)+" "+FToStr(-(currItem->height()+lw))+" ]\n");
@@ -6104,7 +5986,7 @@
}
PutDoc(">>\n");
QString stre = "q\n";
- if (currItem->isGroupControl)
+ if (currItem->isGroup())
{
QTransform mpa;
mpa.translate(currItem->xPos() - ActPageP->xOffset(), ActPageP->height() - (currItem->yPos() - ActPageP->yOffset()));
@@ -6160,7 +6042,7 @@
}
}
PutDoc(" >>\n");
- if ((currItem->isGroupControl) || (currItem->itemType() == PageItem::Symbol))
+ if ((currItem->isGroup()) || (currItem->itemType() == PageItem::Symbol))
PutDoc("/BBox [0 0 "+FToStr(ActPageP->width())+" "+FToStr(ActPageP->height())+" ]\n");
else
PutDoc("/BBox [0 0 "+FToStr(currItem->width())+" "+FToStr(-(currItem->height()))+" ]\n");
@@ -6175,7 +6057,7 @@
}
PutDoc(">>\n");
QString stre = "q\n";
- if (currItem->isGroupControl)
+ if (currItem->isGroup())
{
QTransform mpa;
mpa.translate(currItem->xPos() - ActPageP->xOffset(), ActPageP->height() - (currItem->yPos() - ActPageP->yOffset()));
@@ -6230,7 +6112,6 @@
bool PDFLibCore::PDF_PatternFillStroke(QString& output, PageItem *currItem, int kind, bool forArrow)
{
- QStack<PageItem*> groupStack;
QString tmp2 = "", tmpOut;
ScPattern *pat = NULL;
if (kind == 0)
@@ -6244,22 +6125,6 @@
for (int em = 0; em < pat->items.count(); ++em)
{
PageItem* item = pat->items.at(em);
- if (item->isGroupControl)
- {
- tmp2 += "q\n";
- FPointArray cl = item->PoLine.copy();
- FPointArray clb = item->PoLine.copy();
- QTransform mm;
- mm.translate(item->gXpos, item->gYpos - pat->height);
- mm.rotate(item->rotation());
- cl.map( mm );
- item->PoLine = cl;
- tmp2 += SetClipPath(item);
- tmp2 += "h W* n\n";
- groupStack.push(item->groupsLastItem);
- item->PoLine = clb.copy();
- continue;
- }
tmp2 += "q\n";
tmp2 += "1 0 0 1 "+FToStr(item->gXpos)+" "+FToStr(-(item->gYpos - pat->height))+" cm\n";
item->setXYPos(item->xPos() + ActPageP->xOffset(), item->yPos() + ActPageP->yOffset(), true);
@@ -6270,16 +6135,6 @@
item->setXYPos(item->xPos() - ActPageP->xOffset(), item->yPos() - ActPageP->yOffset(), true);
inPattern--;
tmp2 += "Q\n";
- if (groupStack.count() != 0)
- {
- while (item == groupStack.top())
- {
- tmp2 += "Q\n";
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < pat->items.count(); ++em)
{
@@ -6409,7 +6264,7 @@
}
else if (kind == 2)
{
- if (currItem->isGroupControl)
+ if (currItem->isGroup())
{
mpa.translate(currItem->xPos() - ActPageP->xOffset(), ActPageP->height() - (currItem->yPos() - ActPageP->yOffset()));
mpa.rotate(-currItem->rotation());
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sat Dec 18 21:33:07 2010
@@ -195,9 +195,14 @@
QList<PageItem*> TableItems;
QList<PageItem*> TableItemsM;
QList<PageItem*> TableItemsF;
- QMap<PageItem*, int> groupID;
- QMap<PageItem*, int> groupIDM;
- QMap<PageItem*, int> groupIDF;
+// QMap<PageItem*, int> groupID;
+// QMap<PageItem*, int> groupIDM;
+// QMap<PageItem*, int> groupIDF;
+ QStack< QList<PageItem*> > groupStack;
+ QStack< QList<PageItem*> > groupStackF;
+ QStack< QList<PageItem*> > groupStackM;
+ QStack< QList<PageItem*> > groupStackP;
+ QStack<int> groupStack2;
QString f(readSLA(fileName));
if (f.isEmpty())
@@ -440,7 +445,28 @@
TableIDM.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
}
}
- if (itemInfo.item->isGroupControl)
+ if (groupStack.count() > 0)
+ {
+ groupStack.top().append(itemInfo.item);
+ if (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+ {
+ if (tagName == "PAGEOBJECT")
+ groupStackP.push(groupStack.pop());
+ else if (tagName == "FRAMEOBJECT")
+ groupStackF.push(groupStack.pop());
+ else
+ groupStackM.push(groupStack.pop());
+ groupStack2.pop();
+ }
+ }
+ if (itemInfo.isGroupControl)
+ {
+ QList<PageItem*> GroupItems;
+ GroupItems.append(itemInfo.item);
+ groupStack.push(GroupItems);
+ groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+ }
+ /* if (itemInfo.item->isGroupControl)
{
if (tagName == "PAGEOBJECT")
groupID.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
@@ -448,7 +474,7 @@
groupIDF.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
else
groupIDM.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
- }
+ } */
}
if (tagName == "Pattern")
{
@@ -544,7 +570,7 @@
ta->BottomLink = 0;
}
}
- if (groupIDF.count() != 0)
+/* if (groupIDF.count() != 0)
{
QMap<PageItem*, int>::Iterator it;
for (it = groupIDF.begin(); it != groupIDF.end(); ++it)
@@ -567,7 +593,7 @@
{
it.key()->groupsLastItem = m_Doc->MasterItems.at(it.value());
}
- }
+ } */
//CB Add this in to set this in the file in memory. Its saved, why not load it.
//Will of course be replaced by per page settings although we still probably need a document default
if (!hasPageSets)
@@ -629,6 +655,82 @@
}
}
}
+ if (groupStackP.count() > 0)
+ {
+ while (groupStackP.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackP.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->DocItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackF.count() > 0)
+ {
+ while (groupStackF.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackF.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->FrameItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackM.count() > 0)
+ {
+ while (groupStackM.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackM.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->MasterItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ m_Doc->renumberItemsInListOrder();
// reestablish first/lastAuto
m_Doc->FirstAuto = m_Doc->LastAuto;
@@ -1760,8 +1862,8 @@
info.ownLink = newItem->isTableItem ? attrs.valueAsInt("OwnLINK", 0) : 0;
info.groupLastItem = 0;
- newItem->isGroupControl = attrs.valueAsBool("isGroupControl", 0);
- if (newItem->isGroupControl)
+ info.isGroupControl = attrs.valueAsBool("isGroupControl", 0);
+ if (info.isGroupControl)
{
int groupLastItem = attrs.valueAsInt("groupsLastItem", 0);
// Sanity check for some broken files created using buggy development versions.
@@ -1948,7 +2050,9 @@
return true;
}
- QMap<PageItem*, int> groupID2;
+ QStack< QList<PageItem*> > groupStack;
+ QStack< QList<PageItem*> > groupStackP;
+ QStack<int> groupStack2;
QMap<int,int> TableID2;
QList<PageItem*> TableItems2;
@@ -1993,9 +2097,21 @@
TableItems2.append(itemInfo.item);
TableID2.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
}
- if (itemInfo.item->isGroupControl)
- {
- groupID2.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
+ if (groupStack.count() > 0)
+ {
+ groupStack.top().append(itemInfo.item);
+ if (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+ {
+ groupStackP.push(groupStack.pop());
+ groupStack2.pop();
+ }
+ }
+ if (itemInfo.isGroupControl)
+ {
+ QList<PageItem*> GroupItems;
+ GroupItems.append(itemInfo.item);
+ groupStack.push(GroupItems);
+ groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
}
}
@@ -2006,14 +2122,6 @@
return false;
}
- if (groupID2.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupID2.begin(); it != groupID2.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->Items->at(it.value());
- }
- }
if (TableItems2.count() != 0)
{
for (int ttc = 0; ttc < TableItems2.count(); ++ttc)
@@ -2037,6 +2145,32 @@
ta->BottomLink = 0;
}
}
+ if (groupStackP.count() > 0)
+ {
+ while (groupStackP.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackP.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->DocItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ m_Doc->renumberItemsInListOrder();
uint itemCount2 = m_Doc->Items->count();
if (itemCount2 > itemCount1)
@@ -2295,6 +2429,9 @@
int z = 0;
struct ImageLoadRequest loadingInfo;
PageItem::ItemType pt = static_cast<PageItem::ItemType>(attrs.valueAsInt("PTYPE"));
+ bool isGroupControl = attrs.valueAsBool("isGroupControl", 0);
+ if (isGroupControl)
+ pt = PageItem::Group;
double x = attrs.valueAsDouble("XPOS");
double y = attrs.valueAsDouble("YPOS");
double w = attrs.valueAsDouble("WIDTH");
@@ -2434,6 +2571,15 @@
currItem = doc->Items->at(z);
if (pagenr > -2)
currItem->OwnPage = pagenr;
+ break;
+ case PageItem::Group:
+ z = doc->itemAdd(PageItem::Group, PageItem::Unspecified, x, y, w, h, 0, CommonStrings::None, CommonStrings::None, true);
+ currItem = doc->Items->at(z);
+ if (pagenr > -2)
+ currItem->OwnPage = pagenr;
+ currItem->groupWidth = attrs.valueAsDouble("groupWidth", w);
+ currItem->groupHeight = attrs.valueAsDouble("groupHeight", h);
+ doc->GroupCounter++;
break;
case PageItem::Symbol:
case PageItem::Multiple:
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h Sat Dec 18 21:33:07 2010
@@ -67,11 +67,12 @@
class ItemInfo
{
public:
- ItemInfo(void) { groupLastItem = nextItem = ownLink = 0; item = NULL; };
+ ItemInfo(void) { groupLastItem = nextItem = ownLink = 0; item = NULL; isGroupControl = false; };
PageItem* item;
int groupLastItem;
int nextItem;
int ownLink;
+ bool isGroupControl;
};
void registerFormats();
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Sat Dec 18 21:33:07 2010
@@ -66,7 +66,7 @@
const QString Scribus150Format::fullTrName() const
{
- return QObject::tr("Scribus 1.3.4+ Support");
+ return QObject::tr("Scribus 1.5.0+ Support");
}
const ScActionPlugin::AboutData* Scribus150Format::getAboutData() const
@@ -76,8 +76,8 @@
about->authors = QString::fromUtf8(
"Franz Schmid <franz at scribus.info>, "
"The Scribus Team");
- about->shortDescription = tr("Scribus 1.3.4+ File Format Support");
- about->description = tr("Allows Scribus to read Scribus 1.3.4 and higher formatted files.");
+ about->shortDescription = tr("Scribus 1.5.0+ File Format Support");
+ about->description = tr("Allows Scribus to read Scribus 1.5.0 and higher formatted files.");
// about->version
// about->releaseDate
// about->copyright
@@ -124,10 +124,14 @@
// Not gzip encoded, just load it
loadRawText(fileName, docBytes);
}
-// if (docBytes.left(16) == "<SCRIBUSUTF8NEW " && docBytes.left(35).contains("Version=\"1.3.4"))
-// return true;
+ QRegExp regExp150("Version=\"1.5.[0-9]");
int startElemPos = docBytes.left(512).indexOf("<SCRIBUSUTF8NEW ");
- return startElemPos >= 0 && ((docBytes.mid(startElemPos, 64).indexOf("Version=\"1.5.0") >= 0));
+ if (startElemPos >= 0)
+ {
+ bool is150 = ( regExp150.indexIn(docBytes.mid(startElemPos, 64)) >= 0 );
+ return is150;
+ }
+ return false;
}
QString Scribus150Format::readSLA(const QString & fileName)
@@ -148,12 +152,17 @@
}
QString docText("");
int startElemPos = docBytes.left(512).indexOf("<SCRIBUSUTF8NEW ");
- if (startElemPos >= 0 && ((docBytes.mid(startElemPos, 64).indexOf("Version=\"1.5.0") >= 0)))
- docText = QString::fromUtf8(docBytes);
- else
+ if (startElemPos >= 0)
+ {
+ QRegExp regExp150("Version=\"1.5.[0-9]");
+ bool is150 = ( regExp150.indexIn(docBytes.mid(startElemPos, 64)) >= 0 );
+ if (is150)
+ docText = QString::fromUtf8(docBytes);
+ if (docText.endsWith(QChar(10)) || docText.endsWith(QChar(13)))
+ docText.truncate(docText.length()-1);
+ }
+ if (docText.isEmpty())
return QString::null;
- if (docText.endsWith(QChar(10)) || docText.endsWith(QChar(13)))
- docText.truncate(docText.length()-1);
return docText;
}
@@ -163,16 +172,15 @@
getReplacedFonts.clear();
}
-bool Scribus150Format::loadPalette(const QString & fileName)
-{
- if (m_Doc==0 || m_AvailableFonts==0)
- {
- Q_ASSERT(m_Doc==0 || m_AvailableFonts==0);
- return false;
- }
+bool Scribus150Format::loadElements(const QString & data, QString fileDir, int toLayer, double Xp_in, double Yp_in, bool loc)
+{
ParagraphStyle vg;
- struct ScribusDoc::BookMa bok;
- QMap<int, ScribusDoc::BookMa> bookmarks;
+ bool newVersion = false;
+ LayerToPaste = toLayer;
+ Xp = Xp_in;
+ Yp = Yp_in;
+ GrX = 0.0;
+ GrY = 0.0;
QMap<int,int> TableID;
QMap<int,int> TableIDM;
@@ -180,28 +188,14 @@
QList<PageItem*> TableItems;
QList<PageItem*> TableItemsM;
QList<PageItem*> TableItemsF;
- QMap<PageItem*, int> groupID;
- QMap<PageItem*, int> groupIDM;
- QMap<PageItem*, int> groupIDF;
-
- QByteArray docBytes("");
- loadRawText(fileName, docBytes);
- QString f = QString::fromUtf8(docBytes);
- if (f.isEmpty())
- {
- setFileReadError();
- return false;
- }
- QString fileDir = QFileInfo(fileName).absolutePath();
+ QStack< QList<PageItem*> > groupStack;
+ QStack< QList<PageItem*> > groupStackF;
+ QStack< QList<PageItem*> > groupStackM;
+ QStack< QList<PageItem*> > groupStackP;
+ QStack<int> groupStack2;
+
ScColor lf = ScColor();
-
- if (m_mwProgressBar!=0)
- {
- m_mwProgressBar->setMaximum(f.length());
- m_mwProgressBar->setValue(0);
- }
-
- groupRemap.clear();
+
itemRemap.clear();
itemNext.clear();
itemCount = 0;
@@ -218,6 +212,363 @@
TableItemsF.clear();
TableIDF.clear();
+ bool firstElement = true;
+ bool success = true;
+
+ ScXmlStreamReader reader(data);
+ ScXmlStreamAttributes attrs;
+ while(!reader.atEnd() && !reader.hasError())
+ {
+ QXmlStreamReader::TokenType tType = reader.readNext();
+ if (tType != QXmlStreamReader::StartElement)
+ continue;
+ QStringRef tagName = reader.name();
+ attrs = reader.scAttributes();
+
+ if (firstElement)
+ {
+ if (tagName == "SCRIBUSELEM" || tagName == "SCRIBUSELEMUTF8")
+ {
+ if (!loc)
+ {
+ GrX = attrs.valueAsDouble("XP");
+ GrY = attrs.valueAsDouble("YP");
+ }
+ if (attrs.hasAttribute("Version"))
+ newVersion = true;
+ }
+ else
+ {
+ success = false;
+ break;
+ }
+ firstElement = false;
+ }
+ // 10/25/2004 pv - None is "reserved" color. cannot be defined in any file...
+ if (tagName == "COLOR" && attrs.valueAsString("NAME") != CommonStrings::None)
+ {
+ success = readColor(m_Doc->PageColors, attrs);
+ if (!success) break;
+ }
+ if (tagName == "Gradient")
+ {
+ VGradient gra;
+ QString grName = attrs.valueAsString("Name");
+ success = readGradient(m_Doc, gra, reader);
+ if (!success) break;
+ if (!grName.isEmpty())
+ {
+ m_Doc->docGradients.insert(grName, gra);
+ }
+ }
+ if (tagName == "STYLE")
+ {
+ readParagraphStyle(m_Doc, reader, vg, *m_AvailableFonts);
+ StyleSet<ParagraphStyle>tmp;
+ tmp.create(vg);
+ m_Doc->redefineStyles(tmp, false);
+ }
+ if (tagName == "CHARSTYLE")
+ {
+ readParagraphStyle(m_Doc, reader, vg, *m_AvailableFonts);
+ StyleSet<CharStyle> temp;
+ temp.create(vg.charStyle());
+ m_Doc->redefineCharStyles(temp, false);
+ }
+ if (tagName == "Arrows")
+ {
+ success = readArrows(m_Doc, attrs);
+ if (!success) break;
+ }
+ if (tagName == "MultiLine")
+ {
+ multiLine ml;
+ QString mlName = attrs.valueAsString("Name");
+ success = readMultiline(ml, reader);
+ if (!success) break;
+ if (!mlName.isEmpty())
+ {
+ m_Doc->MLineStyles.insert(mlName, ml);
+ }
+ }
+ if (tagName == "ITEM")
+ {
+ ItemInfo itemInfo;
+ success = readObject(m_Doc, reader, itemInfo, fileDir, true);
+ if (!success)
+ break;
+ // first of linked chain?
+ if (tagName == "ITEM")
+ {
+ if (itemInfo.nextItem != -1)
+ itemNext[itemInfo.item->ItemNr] = itemInfo.nextItem;
+ }
+ if (itemInfo.item->isTableItem)
+ {
+ if (tagName == "ITEM")
+ {
+ TableItems.append(itemInfo.item);
+ TableID.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
+ }
+ }
+ if (groupStack.count() > 0)
+ {
+ groupStack.top().append(itemInfo.item);
+ if (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+ {
+ if ((tagName == "PAGEOBJECT") || (tagName == "ITEM"))
+ groupStackP.push(groupStack.pop());
+ else if (tagName == "FRAMEOBJECT")
+ groupStackF.push(groupStack.pop());
+ else
+ groupStackM.push(groupStack.pop());
+ groupStack2.pop();
+ }
+ }
+ if (itemInfo.isGroupControl)
+ {
+ QList<PageItem*> GroupItems;
+ GroupItems.append(itemInfo.item);
+ groupStack.push(GroupItems);
+ groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+ }
+ }
+ if (tagName == "Pattern")
+ {
+ success = readPattern(m_Doc, reader, fileDir);
+ if (!success) break;
+ }
+ }
+ if (reader.hasError())
+ {
+ setDomParsingError(reader.errorString(), reader.lineNumber(), reader.columnNumber());
+ return false;
+ }
+ if (TableItemsF.count() != 0)
+ {
+ for (int ttc = 0; ttc < TableItemsF.count(); ++ttc)
+ {
+ PageItem* ta = TableItemsF.at(ttc);
+ if (ta->TopLinkID != -1)
+ ta->TopLink = m_Doc->FrameItems.at(TableIDF[ta->TopLinkID]);
+ else
+ ta->TopLink = 0;
+ if (ta->LeftLinkID != -1)
+ ta->LeftLink = m_Doc->FrameItems.at(TableIDF[ta->LeftLinkID]);
+ else
+ ta->LeftLink = 0;
+ if (ta->RightLinkID != -1)
+ ta->RightLink = m_Doc->FrameItems.at(TableIDF[ta->RightLinkID]);
+ else
+ ta->RightLink = 0;
+ if (ta->BottomLinkID != -1)
+ ta->BottomLink = m_Doc->FrameItems.at(TableIDF[ta->BottomLinkID]);
+ else
+ ta->BottomLink = 0;
+ }
+ }
+ if (TableItemsM.count() != 0)
+ {
+ for (int ttc = 0; ttc < TableItemsM.count(); ++ttc)
+ {
+ PageItem* ta = TableItemsM.at(ttc);
+ if (ta->TopLinkID != -1)
+ ta->TopLink = m_Doc->MasterItems.at(TableIDM[ta->TopLinkID]);
+ else
+ ta->TopLink = 0;
+ if (ta->LeftLinkID != -1)
+ ta->LeftLink = m_Doc->MasterItems.at(TableIDM[ta->LeftLinkID]);
+ else
+ ta->LeftLink = 0;
+ if (ta->RightLinkID != -1)
+ ta->RightLink = m_Doc->MasterItems.at(TableIDM[ta->RightLinkID]);
+ else
+ ta->RightLink = 0;
+ if (ta->BottomLinkID != -1)
+ ta->BottomLink = m_Doc->MasterItems.at(TableIDM[ta->BottomLinkID]);
+ else
+ ta->BottomLink = 0;
+ }
+ }
+ if (TableItems.count() != 0)
+ {
+ for (int ttc = 0; ttc < TableItems.count(); ++ttc)
+ {
+ PageItem* ta = TableItems.at(ttc);
+ if (ta->TopLinkID != -1)
+ ta->TopLink = m_Doc->Items->at(TableID[ta->TopLinkID]);
+ else
+ ta->TopLink = 0;
+ if (ta->LeftLinkID != -1)
+ ta->LeftLink = m_Doc->Items->at(TableID[ta->LeftLinkID]);
+ else
+ ta->LeftLink = 0;
+ if (ta->RightLinkID != -1)
+ ta->RightLink = m_Doc->Items->at(TableID[ta->RightLinkID]);
+ else
+ ta->RightLink = 0;
+ if (ta->BottomLinkID != -1)
+ ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
+ else
+ ta->BottomLink = 0;
+ }
+ }
+ // reestablish textframe links
+ if (itemNext.count() != 0)
+ {
+ QMap<int,int>::Iterator lc;
+ for (lc = itemNext.begin(); lc != itemNext.end(); ++lc)
+ {
+ if (lc.value() >= 0)
+ {
+ PageItem * Its = m_Doc->DocItems.at(lc.key());
+ PageItem * Itn = m_Doc->DocItems.at(lc.value());
+ if (Itn->prevInChain() || Its->nextInChain())
+ {
+ qDebug() << "scribus150format: corruption in linked textframes detected";
+ continue;
+ }
+ Its->link(Itn);
+ }
+ }
+ }
+ if (groupStackP.count() > 0)
+ {
+ while (groupStackP.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackP.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->DocItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackF.count() > 0)
+ {
+ while (groupStackF.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackF.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->FrameItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackM.count() > 0)
+ {
+ while (groupStackM.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackM.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->MasterItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ m_Doc->renumberItemsInListOrder();
+ return true;
+}
+
+bool Scribus150Format::loadPalette(const QString & fileName)
+{
+ if (m_Doc==0 || m_AvailableFonts==0)
+ {
+ Q_ASSERT(m_Doc==0 || m_AvailableFonts==0);
+ return false;
+ }
+ ParagraphStyle vg;
+ Xp = 0.0;
+ Yp = 0.0;
+ GrX = 0.0;
+ GrY = 0.0;
+
+ QMap<int,int> TableID;
+ QMap<int,int> TableIDM;
+ QMap<int,int> TableIDF;
+ QList<PageItem*> TableItems;
+ QList<PageItem*> TableItemsM;
+ QList<PageItem*> TableItemsF;
+ QStack< QList<PageItem*> > groupStack;
+ QStack< QList<PageItem*> > groupStackF;
+ QStack< QList<PageItem*> > groupStackM;
+ QStack< QList<PageItem*> > groupStackP;
+ QStack<int> groupStack2;
+
+ QByteArray docBytes("");
+ loadRawText(fileName, docBytes);
+ QString f = QString::fromUtf8(docBytes);
+ if (f.isEmpty())
+ {
+ setFileReadError();
+ return false;
+ }
+ QString fileDir = QFileInfo(fileName).absolutePath();
+ ScColor lf = ScColor();
+
+ if (m_mwProgressBar!=0)
+ {
+ m_mwProgressBar->setMaximum(f.length());
+ m_mwProgressBar->setValue(0);
+ }
+
+ itemRemap.clear();
+ itemNext.clear();
+ itemCount = 0;
+ itemRemapM.clear();
+ itemNextM.clear();
+ itemCountM = 0;
+ itemRemapF.clear();
+ itemNextF.clear();
+
+ TableItems.clear();
+ TableID.clear();
+ TableItemsM.clear();
+ TableIDM.clear();
+ TableItemsF.clear();
+ TableIDF.clear();
+
m_Doc->GroupCounter = 1;
m_Doc->LastAuto = 0;
m_Doc->PageColors.clear();
@@ -225,7 +576,6 @@
bool firstElement = true;
bool success = true;
-// bool hasPageSets = false;
int progress = 0;
ScXmlStreamReader reader(f);
@@ -332,14 +682,26 @@
TableIDM.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
}
}
- if (itemInfo.item->isGroupControl)
- {
- if (tagName == "PAGEOBJECT")
- groupID.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
- else if (tagName == "FRAMEOBJECT")
- groupIDF.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
- else
- groupIDM.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
+ if (groupStack.count() > 0)
+ {
+ groupStack.top().append(itemInfo.item);
+ if (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+ {
+ if (tagName == "PAGEOBJECT")
+ groupStackP.push(groupStack.pop());
+ else if (tagName == "FRAMEOBJECT")
+ groupStackF.push(groupStack.pop());
+ else
+ groupStackM.push(groupStack.pop());
+ groupStack2.pop();
+ }
+ }
+ if (itemInfo.isGroupControl)
+ {
+ QList<PageItem*> GroupItems;
+ GroupItems.append(itemInfo.item);
+ groupStack.push(GroupItems);
+ groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
}
}
if (tagName == "Pattern")
@@ -421,30 +783,6 @@
ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
else
ta->BottomLink = 0;
- }
- }
- if (groupIDF.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupIDF.begin(); it != groupIDF.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->FrameItems.at(it.value());
- }
- }
- if (groupID.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupID.begin(); it != groupID.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->DocItems.at(it.value());
- }
- }
- if (groupIDM.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupIDM.begin(); it != groupIDM.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->MasterItems.at(it.value());
}
}
// reestablish textframe links
@@ -484,6 +822,82 @@
}
}
}
+ if (groupStackP.count() > 0)
+ {
+ while (groupStackP.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackP.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->DocItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackF.count() > 0)
+ {
+ while (groupStackF.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackF.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->FrameItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackM.count() > 0)
+ {
+ while (groupStackM.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackM.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->MasterItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ m_Doc->renumberItemsInListOrder();
if (m_Doc->Layers.count() == 0)
m_Doc->Layers.newLayer( QObject::tr("Background") );
@@ -503,6 +917,10 @@
return false;
}
ParagraphStyle vg;
+ Xp = 0.0;
+ Yp = 0.0;
+ GrX = 0.0;
+ GrY = 0.0;
struct ScribusDoc::BookMa bok;
QMap<int, ScribusDoc::BookMa> bookmarks;
@@ -514,9 +932,11 @@
QList<PageItem*> TableItems;
QList<PageItem*> TableItemsM;
QList<PageItem*> TableItemsF;
- QMap<PageItem*, int> groupID;
- QMap<PageItem*, int> groupIDM;
- QMap<PageItem*, int> groupIDF;
+ QStack< QList<PageItem*> > groupStack;
+ QStack< QList<PageItem*> > groupStackF;
+ QStack< QList<PageItem*> > groupStackM;
+ QStack< QList<PageItem*> > groupStackP;
+ QStack<int> groupStack2;
QString f(readSLA(fileName));
if (f.isEmpty())
@@ -537,8 +957,7 @@
// Stop autosave timer,it will be restarted only if doc has autosave feature is enabled
if (m_Doc->autoSaveTimer->isActive())
m_Doc->autoSaveTimer->stop();
-
- groupRemap.clear();
+
itemRemap.clear();
itemNext.clear();
itemCount = 0;
@@ -726,13 +1145,15 @@
if (tagName == "PAGE" || tagName == "MASTERPAGE")
{
success = readPage(m_Doc, reader);
- if (!success) break;
+ if (!success)
+ break;
}
if (tagName == "PAGEOBJECT" || tagName == "MASTEROBJECT" || tagName == "FRAMEOBJECT")
{
ItemInfo itemInfo;
success = readObject(m_Doc, reader, itemInfo, fileDir, false);
- if (!success) break;
+ if (!success)
+ break;
// first of linked chain?
if (tagName == "PAGEOBJECT")
@@ -770,20 +1191,33 @@
TableIDM.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
}
}
- if (itemInfo.item->isGroupControl)
- {
- if (tagName == "PAGEOBJECT")
- groupID.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
- else if (tagName == "FRAMEOBJECT")
- groupIDF.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
- else
- groupIDM.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
+ if (groupStack.count() > 0)
+ {
+ groupStack.top().append(itemInfo.item);
+ if (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+ {
+ if (tagName == "PAGEOBJECT")
+ groupStackP.push(groupStack.pop());
+ else if (tagName == "FRAMEOBJECT")
+ groupStackF.push(groupStack.pop());
+ else
+ groupStackM.push(groupStack.pop());
+ groupStack2.pop();
+ }
+ }
+ if (itemInfo.isGroupControl)
+ {
+ QList<PageItem*> GroupItems;
+ GroupItems.append(itemInfo.item);
+ groupStack.push(GroupItems);
+ groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
}
}
if (tagName == "Pattern")
{
success = readPattern(m_Doc, reader, fileDir);
- if (!success) break;
+ if (!success)
+ break;
}
}
@@ -872,30 +1306,6 @@
ta->BottomLink = m_Doc->Items->at(TableID[ta->BottomLinkID]);
else
ta->BottomLink = 0;
- }
- }
- if (groupIDF.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupIDF.begin(); it != groupIDF.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->FrameItems.at(it.value());
- }
- }
- if (groupID.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupID.begin(); it != groupID.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->DocItems.at(it.value());
- }
- }
- if (groupIDM.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupIDM.begin(); it != groupIDM.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->MasterItems.at(it.value());
}
}
//CB Add this in to set this in the file in memory. Its saved, why not load it.
@@ -934,7 +1344,6 @@
}
}
}
-
if (itemNextM.count() != 0)
{
QMap<int,int>::Iterator lc;
@@ -953,6 +1362,82 @@
}
}
}
+ if (groupStackP.count() > 0)
+ {
+ while (groupStackP.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackP.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->DocItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackF.count() > 0)
+ {
+ while (groupStackF.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackF.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->FrameItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackM.count() > 0)
+ {
+ while (groupStackM.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackM.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->MasterItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ m_Doc->renumberItemsInListOrder();
// reestablish first/lastAuto
m_Doc->FirstAuto = m_Doc->LastAuto;
@@ -971,7 +1456,6 @@
if (m_mwProgressBar!=0)
m_mwProgressBar->setValue(reader.characterOffset());
return true;
-// return false;
}
// Low level plugin API
@@ -2056,7 +2540,7 @@
if (!loadPage)
{
- if (tagName == "PAGEOBJECT" || tagName == "FRAMEOBJECT" || tagName == "PatternItem")
+ if (tagName == "PAGEOBJECT" || tagName == "FRAMEOBJECT" || tagName == "PatternItem" || tagName == "ITEM")
doc->setMasterPageMode(false);
else
doc->setMasterPageMode(true);
@@ -2075,8 +2559,10 @@
newItem->OwnPage = doc->OnPage(newItem);
else
newItem->OwnPage = attrs.valueAsInt("OwnPage");
- if (tagName == "PAGEOBJECT")
+ if ((tagName == "PAGEOBJECT") || (tagName == "ITEM"))
newItem->OnMasterPage = "";
+ if (tagName == "ITEM")
+ newItem->LayerID = LayerToPaste;
QString tmpf = attrs.valueAsString("IFONT", doc->itemToolPrefs().textFont);
m_AvailableFonts->findFont(tmpf, doc);
@@ -2101,8 +2587,8 @@
info.ownLink = newItem->isTableItem ? attrs.valueAsInt("OwnLINK", 0) : 0;
info.groupLastItem = 0;
- newItem->isGroupControl = attrs.valueAsBool("isGroupControl", 0);
- if (newItem->isGroupControl)
+ info.isGroupControl = attrs.valueAsBool("isGroupControl", 0);
+ if (info.isGroupControl)
{
int groupLastItem = attrs.valueAsInt("groupsLastItem", 0);
// Sanity check for some broken files created using buggy development versions.
@@ -2319,6 +2805,24 @@
}
}
}
+ if ((tName == "PAGEOBJECT") || (tName == "ITEM"))
+ {
+ if (newItem->asGroupFrame())
+ {
+ bool success = true;
+ QList<PageItem*>* DItems = doc->Items;
+ QList<PageItem*> GroupItems;
+ doc->Items = &GroupItems;
+ ItemInfo itemInfo;
+ success = readObject(doc, reader, itemInfo, baseDir, loadPage);
+ for (int as = 0; as < GroupItems.count(); ++as)
+ {
+ PageItem* currItem = GroupItems.at(as);
+ newItem->groupItemList.append(currItem);
+ }
+ doc->Items = DItems;
+ }
+ }
}
delete lastStyle;
@@ -2383,7 +2887,6 @@
}
}
}
-
if (!loadPage)
doc->setMasterPageMode(false);
return !reader.hasError();
@@ -2402,7 +2905,9 @@
return true;
}
- QMap<PageItem*, int> groupID2;
+ QStack< QList<PageItem*> > groupStack;
+ QStack< QList<PageItem*> > groupStackP;
+ QStack<int> groupStack2;
QMap<int,int> TableID2;
QList<PageItem*> TableItems2;
@@ -2447,9 +2952,21 @@
TableItems2.append(itemInfo.item);
TableID2.insert(itemInfo.ownLink, itemInfo.item->ItemNr);
}
- if (itemInfo.item->isGroupControl)
- {
- groupID2.insert(itemInfo.item, itemInfo.groupLastItem + itemInfo.item->ItemNr);
+ if (groupStack.count() > 0)
+ {
+ groupStack.top().append(itemInfo.item);
+ if (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+ {
+ groupStackP.push(groupStack.pop());
+ groupStack2.pop();
+ }
+ }
+ if (itemInfo.isGroupControl)
+ {
+ QList<PageItem*> GroupItems;
+ GroupItems.append(itemInfo.item);
+ groupStack.push(GroupItems);
+ groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
}
}
@@ -2459,15 +2976,6 @@
{
return false;
}
-
- if (groupID2.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupID2.begin(); it != groupID2.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->Items->at(it.value());
- }
- }
if (TableItems2.count() != 0)
{
for (int ttc = 0; ttc < TableItems2.count(); ++ttc)
@@ -2491,6 +2999,32 @@
ta->BottomLink = 0;
}
}
+ if (groupStackP.count() > 0)
+ {
+ while (groupStackP.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackP.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->DocItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ m_Doc->renumberItemsInListOrder();
uint itemCount2 = m_Doc->Items->count();
if (itemCount2 > itemCount1)
@@ -2653,9 +3187,14 @@
int z = 0;
struct ImageLoadRequest loadingInfo;
PageItem::ItemType pt = static_cast<PageItem::ItemType>(attrs.valueAsInt("PTYPE"));
+ bool isGroupControl = attrs.valueAsBool("isGroupControl", 0);
+ if (isGroupControl)
+ pt = PageItem::Group;
double xf, yf;
double x = attrs.valueAsDouble("XPOS");
double y = attrs.valueAsDouble("YPOS");
+ x = Xp + x - GrX;
+ y = Yp + y - GrY;
double w = attrs.valueAsDouble("WIDTH");
double h = attrs.valueAsDouble("HEIGHT");
double pw = attrs.valueAsDouble("PWIDTH");
@@ -2670,8 +3209,6 @@
QColor tmpc;
PageItem *currItem=NULL;
QString tmp, clPath;
- int xi;
-
switch (pt)
{
// OBSOLETE CR 2005-02-06
@@ -2804,6 +3341,15 @@
if (pagenr > -2)
currItem->OwnPage = pagenr;
currItem->setPattern( attrs.valueAsString("pattern", "") );
+ break;
+ case PageItem::Group:
+ z = doc->itemAdd(PageItem::Group, PageItem::Unspecified, x, y, w, h, 0, CommonStrings::None, CommonStrings::None, true);
+ currItem = doc->Items->at(z);
+ if (pagenr > -2)
+ currItem->OwnPage = pagenr;
+ currItem->groupWidth = attrs.valueAsDouble("groupWidth", w);
+ currItem->groupHeight = attrs.valueAsDouble("groupHeight", h);
+ doc->GroupCounter++;
break;
case PageItem::Multiple:
Q_ASSERT(false);
@@ -2914,7 +3460,6 @@
currItem->itemText.setDefaultStyle(defStyle);
}
}
-
currItem->setRotation( attrs.valueAsDouble("ROT") );
currItem->setTextToFrameDist(attrs.valueAsDouble("EXTRA"),
attrs.valueAsDouble("REXTRA", 1.0),
@@ -3047,35 +3592,6 @@
if (attrs.valueAsInt("LAYER", 0) != -1)
currItem->LayerID = attrs.valueAsInt("LAYER", 0);
tmp = "";
-
- if (attrs.hasAttribute("GROUPS") && (attrs.valueAsInt("NUMGROUP", 0) != 0))
- {
- int groupMax = doc->GroupCounter;
- QMap<int, int>::ConstIterator gIt;
- tmp = attrs.valueAsString("GROUPS");
- ScTextStream fg(&tmp, QIODevice::ReadOnly);
- currItem->Groups.clear();
- int numGroup = attrs.valueAsInt("NUMGROUP", 0);
- for (int cx = 0; cx < numGroup; ++cx)
- {
- fg >> xi;
- gIt = groupRemap.find(xi);
- if (gIt != groupRemap.end())
- currItem->Groups.push(gIt.value());
- else
- {
- currItem->Groups.push(groupMax);
- groupRemap.insert(xi, groupMax);
- ++groupMax;
- }
- }
- doc->GroupCounter = groupMax;
- tmp = "";
- }
- else
- currItem->Groups.clear();
-
- tmp = "";
if ((attrs.hasAttribute("NUMDASH")) && (attrs.valueAsInt("NUMDASH", 0) != 0))
{
tmp = attrs.valueAsString("DASHS");
@@ -3363,6 +3879,10 @@
return false;
}
ParagraphStyle vg;
+ Xp = 0.0;
+ Yp = 0.0;
+ GrX = 0.0;
+ GrY = 0.0;
struct ScribusDoc::BookMa bok;
QMap<int, ScribusDoc::BookMa> bookmarks;
@@ -3371,7 +3891,10 @@
QString tmp;
QMap<int,int> TableID;
QList<PageItem*> TableItems;
- QMap<PageItem*, int> groupID;
+ QStack< QList<PageItem*> > groupStack;
+ QStack< QList<PageItem*> > groupStackF;
+ QStack< QList<PageItem*> > groupStackP;
+ QStack<int> groupStack2;
double pageX = 0, pageY = 0;
bool newVersion = false;
QMap<int,int> layerTrans;
@@ -3385,7 +3908,6 @@
maxLevel = qMax(m_Doc->Layers[la2].Level, maxLevel);
}
- groupRemap.clear();
itemRemap.clear();
itemNext.clear();
itemCount = 0;
@@ -3601,15 +4123,32 @@
TableItems.append(newItem);
TableID.insert(itemInfo.ownLink, newItem->ItemNr);
}
- if (newItem->isGroupControl)
- {
- groupID.insert(newItem, itemInfo.groupLastItem + newItem->ItemNr);
- }
if (tagName == "FRAMEOBJECT")
{
m_Doc->FrameItems.append(m_Doc->Items->takeAt(newItem->ItemNr));
newItem->ItemNr = m_Doc->FrameItems.count()-1;
}
+ if (groupStack.count() > 0)
+ {
+ groupStack.top().append(itemInfo.item);
+ if (static_cast<int>(itemInfo.item->ItemNr) == groupStack2.top())
+ {
+ if (tagName == "PAGEOBJECT")
+ groupStackP.push(groupStack.pop());
+ else if (tagName == "FRAMEOBJECT")
+ groupStackF.push(groupStack.pop());
+ else
+ groupStack.pop();
+ groupStack2.pop();
+ }
+ }
+ if (itemInfo.isGroupControl)
+ {
+ QList<PageItem*> GroupItems;
+ GroupItems.append(itemInfo.item);
+ groupStack.push(GroupItems);
+ groupStack2.push(itemInfo.groupLastItem + itemInfo.item->ItemNr);
+ }
}
}
}
@@ -3655,16 +4194,6 @@
ta->BottomLink = 0;
}
}
-
- if (groupID.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupID.begin(); it != groupID.end(); ++it)
- {
- it.key()->groupsLastItem = m_Doc->Items->at(it.value());
- }
- }
-
// reestablish textframe links
if (itemNext.count() != 0 && !Mpage)
{
@@ -3708,6 +4237,57 @@
}
}
}
+ if (groupStackP.count() > 0)
+ {
+ while (groupStackP.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackP.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->DocItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ if (groupStackF.count() > 0)
+ {
+ while (groupStackF.count() > 0)
+ {
+ QList<PageItem*> gpL = groupStackF.pop();
+ PageItem* gItem = gpL.takeFirst();
+ for (int id = 0; id < gpL.count(); id++)
+ {
+ PageItem* cItem = gpL.at(id);
+ cItem->gXpos = cItem->xPos() - gItem->xPos();
+ cItem->gYpos = cItem->yPos() - gItem->yPos();
+ if (gItem->rotation() != 0)
+ {
+ QTransform ma;
+ ma.rotate(-gItem->rotation());
+ FPoint n = FPoint(cItem->gXpos, cItem->gYpos);
+ cItem->gXpos = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
+ cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
+ cItem->setRotation(cItem->rotation() - gItem->rotation());
+ }
+ m_Doc->FrameItems.removeOne(cItem);
+ }
+ gItem->groupItemList = gpL;
+ }
+ }
+ m_Doc->renumberItemsInListOrder();
// reestablish first/lastAuto
m_Doc->FirstAuto = m_Doc->LastAuto;
@@ -3976,7 +4556,3 @@
*num2 = counter2;
return success;
}
-
-
-
-
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h Sat Dec 18 21:33:07 2010
@@ -46,6 +46,7 @@
virtual bool saveFile(const QString & fileName, const FileFormat & fmt);
virtual bool savePalette(const QString & fileName);
virtual bool loadPalette(const QString & fileName);
+ virtual bool loadElements(const QString & data, QString fileDir, int toLayer, double Xp_in, double Yp_in, bool loc);
virtual void addToMainWindowMenu(ScribusMainWindow *) {};
// Special features - .sla page extraction support
@@ -64,16 +65,18 @@
ItemSelectionPage = 1,
ItemSelectionFrame = 2,
ItemSelectionPattern= 3,
+ ItemSelectionGroup = 4,
};
class ItemInfo
{
public:
- ItemInfo(void) { groupLastItem = nextItem = ownLink = 0; item = NULL; };
+ ItemInfo(void) { groupLastItem = nextItem = ownLink = 0; item = NULL; isGroupControl = false; };
PageItem* item;
int groupLastItem;
int nextItem;
int ownLink;
+ bool isGroupControl;
};
void registerFormats();
@@ -142,7 +145,6 @@
void WriteObjects(ScribusDoc *doc, ScXmlStreamWriter& docu, const QString& baseDir, QProgressBar *dia2, uint maxC, ItemSelection master, QList<PageItem*> *items = 0);
void SetItemProps(ScXmlStreamWriter& docu, PageItem* item, const QString& baseDir, bool newFormat);
- QMap<int, int> groupRemap;
QMap<int, int> itemRemap;
QMap<int, int> itemNext;
QMap<int, int> itemRemapF;
@@ -153,6 +155,11 @@
int itemCount;
int itemCountM;
bool layerFound;
+ int LayerToPaste;
+ double Xp;
+ double GrX;
+ double Yp;
+ double GrY;
QString clipPath;
};
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp Sat Dec 18 21:33:07 2010
@@ -1159,6 +1159,7 @@
case ItemSelectionFrame:
items = &doc->FrameItems;
break;
+ case ItemSelectionGroup:
case ItemSelectionPattern:
items = some_items;
break;
@@ -1178,6 +1179,7 @@
// item = doc->MasterItems.at(j);
docu.writeStartElement("MASTEROBJECT");
break;
+ case ItemSelectionGroup:
case ItemSelectionPage:
// item = doc->DocItems.at(j);
docu.writeStartElement("PAGEOBJECT");
@@ -1524,6 +1526,10 @@
}
}
#endif
+ if (item->asGroupFrame())
+ {
+ WriteObjects(m_Doc, docu, baseDir, 0, 0, ItemSelectionGroup, &item->groupItemList);
+ }
//CB PageItemAttributes
docu.writeStartElement("PageItemAttributes");
@@ -1800,11 +1806,10 @@
docu.writeAttribute("BottomLINK", -1);
docu.writeAttribute("OwnLINK", item->ItemNr);
}
- docu.writeAttribute("isGroupControl", static_cast<int>(item->isGroupControl));
- if (item->isGroupControl)
- {
- if (item->groupsLastItem != 0)
- docu.writeAttribute("groupsLastItem", item->groupsLastItem->ItemNr - item->ItemNr);
+ if (item->isGroup())
+ {
+ docu.writeAttribute("groupWidth", item->groupWidth);
+ docu.writeAttribute("groupHeight", item->groupHeight);
}
docu.writeAttribute("NUMDASH", static_cast<int>(item->DashValues.count()));
QString dlp = "";
@@ -1829,12 +1834,6 @@
colp += tmp.setNum(xf) + " " + tmpy.setNum(yf) + " ";
}
docu.writeAttribute("COCOOR", colp);
- docu.writeAttribute("NUMGROUP", static_cast<int>(item->Groups.count()));
- QString glp = "";
- QStack<int>::Iterator nx;
- for (nx = item->Groups.begin(); nx != item->Groups.end(); ++nx)
- glp += tmp.setNum((*nx)) + " ";
- docu.writeAttribute("GROUPS", glp);
if ( ! item->itemText.defaultStyle().charStyle().isInhLanguage())
docu.writeAttribute("LANGUAGE", item->itemText.defaultStyle().charStyle().language());
if (item->asLine() || item->asPolyLine())
Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -173,65 +173,8 @@
{
tmpSel->clear();
QDir::setCurrent(CurDirP);
- if (Elements.count() > 0)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -488,7 +431,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -523,64 +466,7 @@
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -593,7 +479,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -663,7 +549,7 @@
{
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
@@ -679,7 +565,7 @@
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
@@ -1690,11 +1576,9 @@
else
Elements.removeAll(gElements.at(dre));
}
- m_Doc->itemSelection_GroupObjects(false, false, tmpSel);
- ite = tmpSel->itemAt(0);
+ ite = m_Doc->groupObjectsSelection(tmpSel);
if ((clipCoords.size() > 4) && (command == "Q"))
{
- ite = tmpSel->itemAt(0);
clipCoords.translate(m_Doc->currentPage()->xOffset()-ite->xPos(), m_Doc->currentPage()->yOffset()-ite->yPos());
ite->PoLine = clipCoords.copy();
ite->PoLine.translate(baseX, baseY);
@@ -2203,7 +2087,7 @@
else
Elements.removeAll(gElements.at(dre));
}
- m_Doc->itemSelection_GroupObjects(false, false, tmpSel);
+ m_Doc->groupObjectsSelection(tmpSel);
ite = tmpSel->itemAt(0);
if (Coords.size() > 3)
{
@@ -2602,6 +2486,8 @@
for (int dre = 0; dre < PatternElements.count(); ++dre)
{
tmpSel->addItem(PatternElements.at(dre), true);
+ if (groupStack.count() != 0)
+ groupStack.top().removeAll(PatternElements.at(dre));
}
if (PatternElements.count() > 1)
m_Doc->itemSelection_GroupObjects(false, false, tmpSel);
@@ -2646,13 +2532,6 @@
importedPatterns.append(currentPatternDefName);
}
}
- if (groupStack.count() != 0)
- {
- for (int as = 0; as < tmpSel->count(); ++as)
- {
- groupStack.top().removeAll(tmpSel->itemAt(as));
- }
- }
m_Doc->itemSelection_DeleteItem(tmpSel);
}
PatternElements.clear();
@@ -2756,6 +2635,7 @@
for (int dre = 0; dre < PatternElements.count(); ++dre)
{
tmpSel->addItem(PatternElements.at(dre), true);
+ groupStack.top().removeAll(PatternElements.at(dre));
}
if (PatternElements.count() > 1)
m_Doc->itemSelection_GroupObjects(false, false, tmpSel);
@@ -2781,13 +2661,6 @@
importedPatterns.append(currentPatternDefName);
importedSymbols.insert(currentPatternDefName, QPointF(currItem->xPos(), currItem->yPos()));
m_Doc->addPattern(currentPatternDefName, pat);
- }
- }
- if (groupStack.count() != 0)
- {
- for (int as = 0; as < tmpSel->count(); ++as)
- {
- groupStack.top().removeAll(tmpSel->itemAt(as));
}
}
m_Doc->itemSelection_DeleteItem(tmpSel);
Modified: trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -90,66 +90,8 @@
{
tmpSel->clear();
QDir::setCurrent(CurDirP);
- if (Elements.count() > 0)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
@@ -273,7 +215,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -284,65 +226,7 @@
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -355,7 +239,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -399,7 +283,7 @@
{
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
@@ -415,7 +299,7 @@
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
Modified: trunk/Scribus/scribus/plugins/import/cvg/importcvg.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -86,66 +86,8 @@
{
tmpSel->clear();
QDir::setCurrent(CurDirP);
- if (Elements.count() > 0)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
@@ -272,7 +214,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -283,65 +225,7 @@
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -354,7 +238,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -398,7 +282,7 @@
{
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
@@ -408,14 +292,14 @@
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
Modified: trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -93,66 +93,8 @@
{
tmpSel->clear();
QDir::setCurrent(CurDirP);
- if (Elements.count() > 0)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
}
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
@@ -287,7 +229,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -298,65 +240,7 @@
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -369,7 +253,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -427,7 +311,7 @@
{
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
@@ -443,7 +327,7 @@
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
@@ -1334,17 +1218,15 @@
for (uint i = 0; i < selectedItemCount; ++i)
{
PageItem *item = tmpSel->itemAt(i);
- item->Groups.push(m_Doc->GroupCounter);
- listStack.top().GElements.append(item);
- }
- popped.groupItem->Groups.push(m_Doc->GroupCounter);
+ popped.groupItem->groupItemList.append(item);
+ item->gXpos = item->xPos() - popped.groupItem->xPos();
+ item->gYpos = item->yPos() - popped.groupItem->yPos();
+ }
if (popped.itemGroupName.isEmpty())
- popped.groupItem->setItemName( tr("Group%1").arg(popped.groupItem->Groups.top()));
+ popped.groupItem->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
else
popped.groupItem->setItemName(popped.itemGroupName);
popped.groupItem->AutoName = false;
- popped.groupItem->isGroupControl = true;
- popped.groupItem->groupsLastItem = tmpSel->itemAt(selectedItemCount - 1);
}
m_Doc->GroupCounter++;
tmpSel->clear();
@@ -1460,7 +1342,7 @@
ds >> dummy;
if (dummy > 0)
{
- z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, posX, posY, bBox.width(), bBox.height(), 0, fillC, fillC, true);
+ z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, posX, posY, bBox.width(), bBox.height(), 0, fillC, fillC, true);
gList.groupItem = m_Doc->Items->at(z);
gList.groupX = groupX + bBox.x();
gList.groupY = groupY + bBox.y();
Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -358,63 +358,8 @@
QImage tmpImage = QImage();
if (Elements.count() > 0)
{
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -593,12 +538,12 @@
m_Doc->documentInfo().setKeywords(Keys.left(Keys.length()-2));
}
}
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->Deselect();
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -635,65 +580,7 @@
}
}
if (Elements.count() > 1)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
if (interactive)
@@ -707,7 +594,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -759,7 +646,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
m_Doc->setLoading(loadF);
}
@@ -771,13 +658,13 @@
OODrawStyle oostyle;
FPointArray ImgClip;
QList<PageItem*> elements, cElements;
- double BaseX = m_Doc->currentPage()->xOffset();
- double BaseY = m_Doc->currentPage()->yOffset();
+// double BaseX = m_Doc->currentPage()->xOffset();
+// double BaseY = m_Doc->currentPage()->yOffset();
storeObjectStyles(e);
parseStyle(oostyle, e);
QString drawID = e.attribute("draw:name");
- int zn = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, BaseX, BaseY, 1, 1, 0, CommonStrings::None, CommonStrings::None, true);
- PageItem *neu = m_Doc->Items->at(zn);
+// int zn = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, BaseX, BaseY, 1, 1, 0, CommonStrings::None, CommonStrings::None, true);
+// PageItem *neu = m_Doc->Items->at(zn);
for (QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling())
{
QDomElement b = n.toElement();
@@ -789,8 +676,8 @@
}
if (cElements.count() < 2)
{
- m_Doc->Items->takeAt(zn);
- delete neu;
+// m_Doc->Items->takeAt(zn);
+// delete neu;
for (int a = 0; a < m_Doc->Items->count(); ++a)
{
m_Doc->Items->at(a)->ItemNr = a;
@@ -802,49 +689,13 @@
}
else
{
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
+ PageItem *neu = m_Doc->groupObjectsList(cElements);
elements.append(neu);
- for (int gr = 0; gr < cElements.count(); ++gr)
- {
- PageItem* currItem = cElements.at(gr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- neu->setXYPos(gx, gy);
- neu->setWidthHeight(gw, gh);
- if (ImgClip.size() != 0)
- neu->PoLine = ImgClip.copy();
- else
- neu->SetRectFrame();
- ImgClip.resize(0);
- neu->Clip = FlattenPath(neu->PoLine, neu->Segments);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->isGroupControl = true;
- neu->groupsLastItem = cElements.at(cElements.count()-1);
if( !e.attribute("id").isEmpty() )
neu->setItemName(e.attribute("id"));
else
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
+ neu->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
neu->AutoName = false;
-// neu->setFillTransparency(1 - gc->Opacity);
- for (int gr = 0; gr < cElements.count(); ++gr)
- {
- cElements.at(gr)->Groups.push(m_Doc->GroupCounter);
- elements.append(cElements.at(gr));
- }
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- m_Doc->GroupCounter++;
}
return elements;
}
Modified: trunk/Scribus/scribus/plugins/import/pct/importpct.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -89,66 +89,8 @@
{
tmpSel->clear();
QDir::setCurrent(CurDirP);
- if (Elements.count() > 0)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
@@ -273,7 +215,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -284,65 +226,7 @@
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -355,7 +239,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -413,7 +297,7 @@
{
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
@@ -429,7 +313,7 @@
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
Modified: trunk/Scribus/scribus/plugins/import/ps/importps.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/plugins/import/ps/importps.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ps/importps.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/ps/importps.cpp Sat Dec 18 21:33:07 2010
@@ -214,7 +214,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -227,65 +227,7 @@
QDir::setCurrent(CurDirP);
// if ((Elements.count() > 1) && (interactive))
if (Elements.count() > 1)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -298,7 +240,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -347,7 +289,7 @@
{
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
@@ -363,7 +305,7 @@
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
@@ -506,8 +448,8 @@
bool fillRuleEvenOdd = true;
PageItem* ite;
QStack<PageItem*> groupStack;
+ QStack< QList<PageItem*> > groupStackP;
QStack<int> gsStack;
- QStack<uint> elemCount;
QStack<uint> gsStackMarks;
QFile f(fn);
lasttoken = "";
@@ -609,14 +551,8 @@
ite->setFillTransparency(1.0 - Opacity);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
m_Doc->AdjustItemSize(ite);
- if (groupStack.count() != 0)
- {
- QStack<int> groupOld = groupStack.top()->Groups;
- for (int gg = 0; gg < groupOld.count(); gg++)
- {
- ite->Groups.push(groupOld[gg]);
- }
- }
+ if ((groupStack.count() != 0) && (groupStackP.count() != 0))
+ groupStackP.top().append(ite);
Elements.append(ite);
lastPath = currPath;
}
@@ -661,14 +597,8 @@
m_Doc->AdjustItemSize(ite);
ite->setLineWidth(LineW);
ite->setTextFlowMode(PageItem::TextFlowDisabled);
- if (groupStack.count() != 0)
- {
- QStack<int> groupOld = groupStack.top()->Groups;
- for (int gg = 0; gg < groupOld.count(); gg++)
- {
- ite->Groups.push(groupOld[gg]);
- }
- }
+ if ((groupStack.count() != 0) && (groupStackP.count() != 0))
+ groupStackP.top().append(ite);
Elements.append(ite);
}
lastPath = "";
@@ -687,7 +617,7 @@
if (vers < "4.3.3")
{
clipCoords = Coords;
- z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
+ z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
ite = m_Doc->Items->at(z);
ite->PoLine = Coords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
@@ -697,22 +627,15 @@
ite->setWidthHeight(wh.x(),wh.y());
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
m_Doc->AdjustItemSize(ite);
- ite->Groups.push(m_Doc->GroupCounter);
- if (groupStack.count() != 0)
- {
- QStack<int> groupOld = groupStack.top()->Groups;
- for (int gg = 0; gg < groupOld.count(); gg++)
- {
- ite->Groups.push(groupOld[gg]);
- }
- }
- ite->isGroupControl = true;
ite->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
ite->AutoName = false;
ite->setTextFlowMode(PageItem::TextFlowDisabled);
Elements.append(ite);
+ if ((groupStack.count() != 0) && (groupStackP.count() != 0))
+ groupStackP.top().append(ite);
groupStack.push(ite);
- elemCount.push(Elements.count());
+ QList<PageItem*> gElements;
+ groupStackP.push(gElements);
gsStackMarks.push(gsStack.count());
m_Doc->GroupCounter++;
}
@@ -723,7 +646,7 @@
if ((tmpPath.boundingRect().width() != 0) && (tmpPath.boundingRect().height() != 0))
{
clipCoords.fromQPainterPath(tmpPath);
- z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
+ z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
ite = m_Doc->Items->at(z);
ite->PoLine = clipCoords.copy(); //FIXME: try to avoid copy if FPointArray when properly shared
ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset());
@@ -733,22 +656,15 @@
ite->setWidthHeight(wh.x(),wh.y());
ite->Clip = FlattenPath(ite->PoLine, ite->Segments);
m_Doc->AdjustItemSize(ite);
- ite->Groups.push(m_Doc->GroupCounter);
- if (groupStack.count() != 0)
- {
- QStack<int> groupOld = groupStack.top()->Groups;
- for (int gg = 0; gg < groupOld.count(); gg++)
- {
- ite->Groups.push(groupOld[gg]);
- }
- }
- ite->isGroupControl = true;
ite->setItemName( tr("Group%1").arg(m_Doc->GroupCounter));
ite->AutoName = false;
ite->setTextFlowMode(PageItem::TextFlowDisabled);
Elements.append(ite);
+ if ((groupStack.count() != 0) && (groupStackP.count() != 0))
+ groupStackP.top().append(ite);
groupStack.push(ite);
- elemCount.push(Elements.count());
+ QList<PageItem*> gElements;
+ groupStackP.push(gElements);
gsStackMarks.push(gsStack.count());
m_Doc->GroupCounter++;
}
@@ -767,19 +683,17 @@
// #6834 : self defense against incorrectly balanced save/restore
if (gsStack.count() > 0)
gsStack.pop();
- if (groupStack.count() != 0)
+ if ((groupStack.count() != 0) && (groupStackP.count() != 0))
{
if (gsStack.count() < static_cast<int>(gsStackMarks.top()))
{
PageItem *ite = groupStack.pop();
- int count = elemCount.pop();
- if (count == Elements.count())
+ QList<PageItem*> gList = groupStackP.pop();
+ for (int d = 0; d < gList.count(); d++)
{
- m_Doc->Items->removeLast();
- Elements.removeLast();
+ Elements.removeAll(gList.at(d));
}
- else
- ite->groupsLastItem = Elements.at(Elements.count()-1);
+ m_Doc->groupObjectsToItem(ite, gList);
gsStackMarks.pop();
}
}
@@ -788,7 +702,6 @@
{
ScTextStream Lw(¶ms, QIODevice::ReadOnly);
Lw >> LineW;
-// currPath += params;
}
else if (token == "ld")
{
@@ -804,7 +717,6 @@
DashPattern.append(dcp);
}
}
-// currPath += params;
}
else if (token == "lc")
{
@@ -825,7 +737,6 @@
CapStyle = Qt::FlatCap;
break;
}
-// currPath += params;
}
else if (token == "lj")
{
@@ -846,7 +757,6 @@
JoinStyle = Qt::MiterJoin;
break;
}
-// currPath += params;
}
else if (token == "cp") {
ClosedPath = true;
@@ -863,14 +773,12 @@
while (!groupStack.isEmpty())
{
PageItem *ite = groupStack.pop();
- int count = elemCount.pop();
- if (count == Elements.count())
- {
- m_Doc->Items->removeLast();
- Elements.removeLast();
- }
- else
- ite->groupsLastItem = Elements.at(Elements.count()-1);
+ QList<PageItem*> gList = groupStackP.pop();
+ for (int d = 0; d < gList.count(); d++)
+ {
+ Elements.removeAll(gList.at(d));
+ }
+ m_Doc->groupObjectsToItem(ite, gList);
}
}
}
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -292,64 +292,7 @@
QImage tmpImage = QImage();
if (Elements.count() > 0)
{
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- neu->setRedrawBounding();
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -452,11 +395,11 @@
m_Doc->setPageOrientation(0);
m_Doc->setPageSize("Custom");
}
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->Deselect();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -528,64 +471,7 @@
}
if (Elements.count() > 1)
{
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- neu->setRedrawBounding();
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
+ m_Doc->groupObjectsList(Elements);
}
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
@@ -600,7 +486,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -671,11 +557,11 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
m_Doc->setLoading(loadF);
}
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if (interactive)
m_Doc->view()->DrawNew();
@@ -1194,7 +1080,7 @@
groupLevel++;
setupNode(e);
parseClipPathAttr(e, clipPath);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, BaseX, BaseY, 1, 1, 0, CommonStrings::None, CommonStrings::None, true);
+ int z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, BaseX, BaseY, 1, 1, 0, CommonStrings::None, CommonStrings::None, true);
PageItem *neu = m_Doc->Items->at(z);
for ( QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling() )
{
@@ -1269,9 +1155,6 @@
else
neu->SetRectFrame();
neu->Clip = FlattenPath(neu->PoLine, neu->Segments);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->isGroupControl = true;
- neu->groupsLastItem = gElements.at(gElements.count()-1);
if( !e.attribute("id").isEmpty() )
neu->setItemName(e.attribute("id"));
else
@@ -1280,20 +1163,22 @@
neu->setFillTransparency(1 - gc->Opacity);
neu->gXpos = neu->xPos() - gx;
neu->gYpos = neu->yPos() - gy;
- neu->gWidth = gw;
- neu->gHeight = gh;
+ neu->groupWidth = gw;
+ neu->groupHeight = gh;
for (int gr = 0; gr < gElements.count(); ++gr)
{
- gElements.at(gr)->Groups.push(m_Doc->GroupCounter);
- gElements.at(gr)->gXpos = gElements.at(gr)->xPos() - gx;
- gElements.at(gr)->gYpos = gElements.at(gr)->yPos() - gy;
- gElements.at(gr)->gWidth = gw;
- gElements.at(gr)->gHeight = gh;
- GElements.append(gElements.at(gr));
+ PageItem* currItem = gElements.at(gr);
+ currItem->gXpos = currItem->xPos() - gx;
+ currItem->gYpos = currItem->yPos() - gy;
+ currItem->gWidth = gw;
+ currItem->gHeight = gh;
+ neu->groupItemList.append(currItem);
+ m_Doc->Items->removeAll(currItem);
}
neu->setRedrawBounding();
neu->setTextFlowMode(PageItem::TextFlowDisabled);
m_Doc->GroupCounter++;
+ m_Doc->renumberItemsInListOrder();
}
delete( m_gc.pop() );
return GElements;
@@ -2770,10 +2655,8 @@
inGroupYOrigin = 999999;
double wpat = parseUnit(b.attribute("width", "0"));
double hpat = parseUnit(b.attribute("height", "0"));
- int ac = m_Doc->Items->count();
QList<PageItem*> GElements;
GElements = parseGroup( b );
- int ae = m_Doc->Items->count();
if (GElements.count() > 0)
{
ScPattern pat = ScPattern();
@@ -2794,20 +2677,8 @@
m_Doc->DoDrawing = false;
pat.width = qMin(currItem->gWidth, wpat);
pat.height = qMin(currItem->gHeight, hpat);
- bool more = false;
- for (int as = ac; as < ae; ++as)
- {
- PageItem* Neu = m_Doc->Items->takeAt(ac);
- if (more)
- {
- Neu->moveBy(xOrg, yOrg, true);
- Neu->gXpos += xOrg;
- Neu->gYpos += yOrg;
- }
- more = true;
- Neu->ItemNr = pat.items.count();
- pat.items.append(Neu);
- }
+ pat.items.append(currItem);
+ m_Doc->Items->removeAll(currItem);
m_Doc->addPattern(id, pat);
importedPatterns.append(id);
importedPattTrans.insert(origName, id);
Modified: trunk/Scribus/scribus/plugins/import/wmf/wmfimport.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -335,64 +335,8 @@
QImage tmpImage = QImage();
if (Elements.count() > 0)
{
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- neu->setRedrawBounding();
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -655,7 +599,7 @@
m_Doc->view()->Deselect();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
@@ -681,66 +625,7 @@
}
}
if (Elements.count() > 1)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- neu->setRedrawBounding();
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
if (interactive)
@@ -754,7 +639,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -804,7 +689,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
m_Doc->setLoading(loadF);
}
Modified: trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -450,66 +450,8 @@
{
tmpSel->clear();
QDir::setCurrent(CurDirP);
- if (Elements.count() > 0)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
@@ -633,7 +575,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -644,65 +586,7 @@
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -715,7 +599,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -759,7 +643,7 @@
{
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
@@ -775,7 +659,7 @@
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
Modified: trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -318,7 +318,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -329,65 +329,7 @@
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -400,7 +342,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -469,14 +411,14 @@
QDir::setCurrent(CurDirP);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
}
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
@@ -3030,9 +2972,8 @@
gg.clipping = false;
gg.idNr = idNr;
gg.isBrush = true;
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
+ int z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
PageItem *neu = m_Doc->Items->at(z);
- neu->isGroupControl = true;
gg.groupItem = neu;
Elements.append(neu);
XarStyle *gc = m_gc.top();
@@ -3048,9 +2989,8 @@
gg.clipping = false;
gg.idNr = 0;
gg.isBrush = false;
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
+ int z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
PageItem *neu = m_Doc->Items->at(z);
- neu->isGroupControl = true;
gg.groupItem = neu;
Elements.append(neu);
XarStyle *gc = m_gc.top();
@@ -3066,9 +3006,8 @@
gg.clipping = true;
gg.idNr = 0;
gg.isBrush = false;
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
+ int z = m_Doc->itemAdd(PageItem::Group, PageItem::Rectangle, baseX, baseY, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
PageItem *neu = m_Doc->Items->at(z);
- neu->isGroupControl = true;
gg.groupItem = neu;
Elements.append(neu);
XarStyle *gc = m_gc.top();
@@ -3542,7 +3481,7 @@
for (int a = gg.index+1; a < Elements.count(); ++a)
{
PageItem* currItem = Elements.at(a);
- currItem->Groups.push(m_Doc->GroupCounter);
+ groupItem->groupItemList.append(currItem);
double x1, x2, y1, y2;
currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
minx = qMin(minx, x1);
@@ -3552,6 +3491,8 @@
}
groupItem->setXYPos(minx, miny, true);
groupItem->setWidthHeight(maxx - minx, maxy - miny, true);
+ groupItem->groupWidth = groupItem->width();
+ groupItem->groupHeight = groupItem->height();
groupItem->SetRectFrame();
groupItem->ClipEdited = true;
groupItem->FrameType = 3;
@@ -3566,11 +3507,8 @@
m_Doc->AdjustItemSize(groupItem);
}
groupItem->AutoName = false;
- groupItem->isGroupControl = true;
groupItem->setFillTransparency(0);
groupItem->setLineTransparency(0);
- groupItem->groupsLastItem = Elements.last();
- groupItem->Groups.push(m_Doc->GroupCounter);
m_Doc->GroupCounter++;
if (gg.isBrush)
{
@@ -3581,13 +3519,9 @@
pat.width = groupItem->width();
pat.height = groupItem->height();
pat.pattern = tmpImg;
- for (int a = gg.index; a < Elements.count(); ++a)
- {
- PageItem* paItem = Elements.at(a);
- paItem->setItemName(groupItem->itemName()+QString("_%1").arg(a));
- pat.items.append(paItem);
- m_Doc->Items->removeAll(paItem);
- }
+ pat.items.append(groupItem);
+ m_Doc->Items->removeAll(groupItem);
+ Elements.removeAll(groupItem);
QString patternName = "Pattern_"+groupItem->itemName();
patternName = patternName.trimmed().simplified().replace(" ", "_");
m_Doc->addPattern(patternName, pat);
@@ -3595,6 +3529,15 @@
m_Doc->DoDrawing = false;
brushRef.insert(gg.idNr, patternName);
}
+ for (int a = 0; a < groupItem->groupItemList.count(); ++a)
+ {
+ PageItem* currItem = groupItem->groupItemList.at(a);
+ currItem->gXpos = currItem->xPos() - groupItem->xPos();
+ currItem->gYpos = currItem->yPos() - groupItem->yPos();
+ m_Doc->Items->removeAll(currItem);
+ Elements.removeAll(currItem);
+ }
+ m_Doc->renumberItemsInListOrder();
}
}
}
@@ -3603,7 +3546,7 @@
for (int a = 0; a < gc->Elements.count(); a++)
{
PageItem *item = gc->Elements.at(a);
- if (item->isGroupControl)
+ if (item->isGroup())
continue;
if (!item->asPolyLine())
{
Modified: trunk/Scribus/scribus/plugins/import/xfig/importxfig.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&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 Sat Dec 18 21:33:07 2010
@@ -153,66 +153,8 @@
{
tmpSel->clear();
QDir::setCurrent(CurDirP);
- if (Elements.count() > 0)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
QImage tmpImage;
@@ -408,7 +350,7 @@
Elements.clear();
m_Doc->setLoading(true);
m_Doc->DoDrawing = false;
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(false);
m_Doc->scMW()->setScriptRunning(true);
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
@@ -419,65 +361,7 @@
tmpSel->clear();
QDir::setCurrent(CurDirP);
if ((Elements.count() > 1) && (!(importerFlags & LoadSavePlugin::lfCreateDoc)))
- {
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
- }
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
m_Doc->setLoading(false);
@@ -490,7 +374,7 @@
m_Doc->setLoading(false);
m_Doc->changed();
m_Doc->setLoading(loadF);
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
@@ -539,7 +423,7 @@
{
m_Doc->changed();
m_Doc->reformPages();
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
m_Doc->view()->updatesOn(true);
}
success = true;
@@ -555,7 +439,7 @@
if (interactive)
m_Doc->setLoading(false);
//CB If we have a gui we must refresh it if we have used the progressbar
- if (!flags & LoadSavePlugin::lfLoadAsPattern)
+ if (!(flags & LoadSavePlugin::lfLoadAsPattern))
{
if ((showProgress) && (!interactive))
m_Doc->view()->DrawNew();
Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Sat Dec 18 21:33:07 2010
@@ -279,8 +279,6 @@
QDomElement layerGroup;
PageItem *Item;
QList<PageItem*> Items;
- QStack<PageItem*> groupStack;
- QStack<QDomElement> groupStack2;
Page* SavedAct = m_Doc->currentPage();
if (page->pageName().isEmpty())
Items = m_Doc->DocItems;
@@ -315,46 +313,7 @@
continue;
if ((!page->pageName().isEmpty()) && (Item->OwnPage != static_cast<int>(page->pageNr())) && (Item->OwnPage != -1))
continue;
- if (Item->isGroupControl)
- {
- groupStack.push(Item->groupsLastItem);
- groupStack2.push(layerGroup);
- layerGroup = docu.createElement("g");
- if (!Item->AutoName)
- layerGroup.setAttribute("id", Item->itemName());
- if (Item->GrMask > 0)
- layerGroup.setAttribute("mask", handleMask(Item, Item->xPos()-page->xOffset(), Item->yPos()-page->yOffset()));
- else
- {
- if (Item->fillTransparency() != 0)
- layerGroup.setAttribute("opacity", FToStr(1.0 - Item->fillTransparency()));
- }
- QDomElement ob = docu.createElement("clipPath");
- ob.setAttribute("id", "Clip"+IToStr(ClipCount));
- QDomElement cl = docu.createElement("path");
- cl.setAttribute("d", SetClipPath(&Item->PoLine, true));
- QString trans = "translate("+FToStr(Item->xPos()-page->xOffset())+", "+FToStr(Item->yPos()-page->yOffset())+")";
- if (Item->rotation() != 0)
- trans += " rotate("+FToStr(Item->rotation())+")";
- cl.setAttribute("transform", trans);
- ob.appendChild(cl);
- globalDefs.appendChild(ob);
- layerGroup.setAttribute("clip-path", "url(#Clip"+IToStr(ClipCount)+")");
- ClipCount++;
- continue;
- }
ProcessItemOnPage(Item->xPos()-page->xOffset(), Item->yPos()-page->yOffset(), Item, &layerGroup);
- if (groupStack.count() != 0)
- {
- while (Item == groupStack.top())
- {
- groupStack.pop();
- groupStack2.top().appendChild(layerGroup);
- layerGroup = groupStack2.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for(int j = 0; j < Items.count(); ++j)
{
@@ -441,6 +400,36 @@
break;
case PageItem::Symbol:
ob = processSymbolItem(Item, trans);
+ break;
+ case PageItem::Group:
+ if (Item->groupItemList.count() > 0)
+ {
+ ob = docu.createElement("g");
+ if (!Item->AutoName)
+ ob.setAttribute("id", Item->itemName());
+ if (Item->GrMask > 0)
+ ob.setAttribute("mask", handleMask(Item, xOffset, yOffset));
+ else
+ {
+ if (Item->fillTransparency() != 0)
+ ob.setAttribute("opacity", FToStr(1.0 - Item->fillTransparency()));
+ }
+ ob.setAttribute("transform", trans);
+ ob.setAttribute("style", "fill:none; stroke:none");
+ QDomElement obc = docu.createElement("clipPath");
+ obc.setAttribute("id", "Clip"+IToStr(ClipCount));
+ QDomElement cl = docu.createElement("path");
+ cl.setAttribute("d", SetClipPath(&Item->PoLine, true));
+ obc.appendChild(cl);
+ globalDefs.appendChild(obc);
+ ob.setAttribute("clip-path", "url(#Clip"+IToStr(ClipCount)+")");
+ ClipCount++;
+ for (int em = 0; em < Item->groupItemList.count(); ++em)
+ {
+ PageItem* embed = Item->groupItemList.at(em);
+ ProcessItemOnPage(embed->gXpos, embed->gYpos, embed, &ob);
+ }
+ }
break;
default:
break;
@@ -1692,7 +1681,7 @@
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->isGroupControl)
+ if (Item->isGroup())
{
QString trans = "translate("+FToStr(xOffset)+", "+FToStr(yOffset)+")";
if (Item->rotation() != 0)
@@ -1714,11 +1703,6 @@
bool mirrorX, mirrorY;
Item->maskFlip(mirrorX, mirrorY);
QTransform mpa;
- // if (Item->isGroupControl)
- // {
- // if (Item->rotation() != 0)
- // mpa.rotate(-Item->rotation());
- // }
mpa.translate(patternOffsetX, patternOffsetY);
mpa.rotate(patternRotation);
mpa.shear(-patternSkewX, patternSkewY);
@@ -1799,7 +1783,7 @@
ob.setAttribute("fill", "url(#Grad"+IToStr(GradCount)+")");
GradCount++;
}
- if ((Item->lineColor() != CommonStrings::None) && (!Item->isGroupControl))
+ if ((Item->lineColor() != CommonStrings::None) && (!Item->isGroup()))
{
ob.setAttribute("stroke", "white");
if (Item->lineWidth() != 0.0)
@@ -1948,8 +1932,6 @@
QStringList patterns = m_Doc->getPatternDependencyList(m_Doc->getUsedPatterns());
for (int c = 0; c < patterns.count(); ++c)
{
- QStack<PageItem*> groupStack;
- QStack<QDomElement> groupStack2;
ScPattern pa = m_Doc->docPatterns[patterns[c]];
QDomElement patt = docu.createElement("pattern");
patt.setAttribute("id", patterns[c]);
@@ -1958,39 +1940,7 @@
for (int em = 0; em < pa.items.count(); ++em)
{
PageItem* Item = pa.items.at(em);
- if (Item->isGroupControl)
- {
- groupStack.push(Item->groupsLastItem);
- groupStack2.push(patt);
- patt = docu.createElement("g");
- if (Item->fillTransparency() != 0)
- patt.setAttribute("opacity", FToStr(1.0 - Item->fillTransparency()));
- QDomElement ob = docu.createElement("clipPath");
- ob.setAttribute("id", "Clip"+IToStr(ClipCount));
- QDomElement cl = docu.createElement("path");
- cl.setAttribute("d", SetClipPath(&Item->PoLine, true));
- QString trans = "translate("+FToStr(Item->gXpos)+", "+FToStr(Item->gYpos)+")";
- if (Item->rotation() != 0)
- trans += " rotate("+FToStr(Item->rotation())+")";
- cl.setAttribute("transform", trans);
- ob.appendChild(cl);
- globalDefs.appendChild(ob);
- patt.setAttribute("clip-path", "url(#Clip"+IToStr(ClipCount)+")");
- ClipCount++;
- continue;
- }
ProcessItemOnPage(Item->gXpos, Item->gYpos, Item, &patt);
- if (groupStack.count() != 0)
- {
- while (Item == groupStack.top())
- {
- groupStack.pop();
- groupStack2.top().appendChild(patt);
- patt = groupStack2.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < pa.items.count(); ++em)
{
@@ -2030,8 +1980,6 @@
QStringList patterns = m_Doc->getUsedSymbols();
for (int c = 0; c < patterns.count(); ++c)
{
- QStack<PageItem*> groupStack;
- QStack<QDomElement> groupStack2;
ScPattern pa = m_Doc->docPatterns[patterns[c]];
QDomElement patt = docu.createElement("symbol");
patt.setAttribute("id", "S"+patterns[c]);
@@ -2039,39 +1987,7 @@
for (int em = 0; em < pa.items.count(); ++em)
{
PageItem* Item = pa.items.at(em);
- if (Item->isGroupControl)
- {
- groupStack.push(Item->groupsLastItem);
- groupStack2.push(patt);
- patt = docu.createElement("g");
- if (Item->fillTransparency() != 0)
- patt.setAttribute("opacity", FToStr(1.0 - Item->fillTransparency()));
- QDomElement ob = docu.createElement("clipPath");
- ob.setAttribute("id", "Clip"+IToStr(ClipCount));
- QDomElement cl = docu.createElement("path");
- cl.setAttribute("d", SetClipPath(&Item->PoLine, true));
- QString trans = "translate("+FToStr(Item->gXpos)+", "+FToStr(Item->gYpos)+")";
- if (Item->rotation() != 0)
- trans += " rotate("+FToStr(Item->rotation())+")";
- cl.setAttribute("transform", trans);
- ob.appendChild(cl);
- globalDefs.appendChild(ob);
- patt.setAttribute("clip-path", "url(#Clip"+IToStr(ClipCount)+")");
- ClipCount++;
- continue;
- }
ProcessItemOnPage(Item->gXpos, Item->gYpos, Item, &patt);
- if (groupStack.count() != 0)
- {
- while (Item == groupStack.top())
- {
- groupStack.pop();
- groupStack2.top().appendChild(patt);
- patt = groupStack2.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
for (int em = 0; em < pa.items.count(); ++em)
{
Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Sat Dec 18 21:33:07 2010
@@ -492,39 +492,14 @@
QBuffer b(&buf);
b.open( QIODevice::WriteOnly );
spoolStream.setDevice(&b);
- QStack<PageItem*> groupStack;
for (int em = 0; em < pa.items.count(); ++em)
{
PageItem* item = pa.items.at(em);
- if (item->isGroupControl)
- {
- PS_save();
- FPointArray cl = item->PoLine.copy();
- QTransform mm;
- mm.translate(item->gXpos, item->gYpos - pa.height);
- mm.rotate(item->rotation());
- cl.map( mm );
- SetClipPath(&cl);
- PS_closepath();
- PS_clip(true);
- groupStack.push(item->groupsLastItem);
- continue;
- }
PutStream("{\n");
PS_save();
PS_translate(item->gXpos, pa.height - item->gYpos);
ProcessItem(m_Doc, m_Doc->Pages->at(0), item, 0, sep, farb, ic, gcr, false, true, true);
PS_restore();
- if (groupStack.count() != 0)
- {
- while (item == groupStack.top())
- {
- PS_restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
PutStream("} exec\n");
}
for (int em = 0; em < pa.items.count(); ++em)
@@ -1478,7 +1453,6 @@
bool gcr = options.doGCR;
bool doDev = options.setDevParam;
bool doClip = options.doClip;
- QStack<PageItem*> groupStack;
int sepac;
int pagemult;
if ((sep) && (SepNam == QObject::tr("All")))
@@ -1526,7 +1500,6 @@
ScQApp->processEvents();
}
}
- //if ((!Art) && (view->SelItem.count() != 0))
uint docSelectionCount=Doc->m_Selection->count();
if ((!psExport) && (docSelectionCount != 0))
{
@@ -1536,7 +1509,6 @@
double maxy = -999999.9;
for (uint ep = 0; ep < docSelectionCount; ++ep)
{
- //PageItem* currItem = view->SelItem.at(ep);
PageItem* currItem = Doc->m_Selection->itemAt(ep);
double lw = currItem->lineWidth() / 2.0;
if (currItem->rotation() != 0)
@@ -1653,7 +1625,6 @@
ScQApp->processEvents();
a = pageNs[aa]-1;
Page* page = Doc->Pages->at(a);
- //if ((!Art) && (view->SelItem.count() != 0))
if ((!psExport) && (Doc->m_Selection->count() != 0))
{
MarginStruct Ma;
@@ -2289,30 +2260,9 @@
if (style.scaleH() != 1000)
PS_scale(style.scaleH() / 1000.0, 1);
QList<PageItem*> emG = hl->embedded.getGroupedItems();
- QStack<PageItem*> groupStack;
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
- if (embedded->isGroupControl)
- {
- PS_save();
- FPointArray cl = embedded->PoLine.copy();
- QTransform mm;
- mm.translate(embedded->gXpos * (style.scaleH() / 1000.0), ((embedded->gHeight * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)) * -1);
- if (style.baselineOffset() != 0)
- mm.translate(0, embedded->gHeight * (style.baselineOffset() / 1000.0));
- if (style.scaleH() != 1000)
- mm.scale(style.scaleH() / 1000.0, 1);
- if (style.scaleV() != 1000)
- mm.scale(1, style.scaleV() / 1000.0);
- mm.rotate(embedded->rotation());
- cl.map( mm );
- SetClipPath(&cl);
- PS_closepath();
- PS_clip(true);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
PS_save();
PS_translate(embedded->gXpos * (style.scaleH() / 1000.0), ((embedded->gHeight * (style.scaleV() / 1000.0)) - embedded->gYpos * (style.scaleV() / 1000.0)));
if (style.baselineOffset() != 0)
@@ -2323,16 +2273,6 @@
PS_scale(1, style.scaleV() / 1000.0);
ProcessItem(Doc, a, embedded, PNr, sep, farb, ic, gcr, master, true);
PS_restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- PS_restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
PS_restore();
continue;
@@ -2671,41 +2611,43 @@
PS_translate(0, -c->height());
PS_scale(c->width() / pat.width, c->height() / pat.height);
PS_translate(pat.items.at(0)->gXpos, -pat.items.at(0)->gYpos);
- QStack<PageItem*> groupStack;
for (int em = 0; em < pat.items.count(); ++em)
{
- PageItem* embedded = pat.items.at(em);
- if (embedded->isGroupControl)
- {
- PS_save();
- FPointArray cl = embedded->PoLine.copy();
- QTransform mm;
- mm.translate(embedded->gXpos, -(embedded->gHeight - embedded->gYpos));
- mm.rotate(embedded->rotation());
- cl.map( mm );
- SetClipPath(&cl);
- PS_closepath();
- PS_clip(true);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
+ PageItem* embed = pat.items.at(em);
PS_save();
- PS_translate(embedded->gXpos, embedded->gHeight - embedded->gYpos);
- ProcessItem(m_Doc, a, embedded, PNr, sep, farb, ic, gcr, master, true);
+ PS_translate(embed->gXpos, embed->gHeight - embed->gYpos);
+ ProcessItem(m_Doc, a, embed, PNr, sep, farb, ic, gcr, master, true);
PS_restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- PS_restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
PS_restore();
}
+ break;
+ case PageItem::Group:
+ PS_save();
+ SetClipPath(&c->PoLine);
+ PS_closepath();
+ PS_clip(true);
+ if (c->imageFlippedH())
+ {
+ PS_translate(c->width(), 0);
+ PS_scale(-1, 1);
+ }
+ if (c->imageFlippedV())
+ {
+ PS_translate(0, -c->height());
+ PS_scale(1, -1);
+ }
+ PS_translate(0, -c->height());
+ PS_scale(c->width() / c->groupWidth, c->height() / c->groupHeight);
+ for (int em = 0; em < c->groupItemList.count(); ++em)
+ {
+ PageItem* embed = c->groupItemList.at(em);
+ PS_save();
+ PS_translate(embed->gXpos, embed->gHeight - embed->gYpos);
+ ProcessItem(m_Doc, a, embed, PNr, sep, farb, ic, gcr, master, true);
+ PS_restore();
+ }
+ PS_restore();
break;
default:
break;
@@ -2723,7 +2665,6 @@
QString chstr, chglyph, tmp;
PageItem *c;
QList<PageItem*> PItems;
- QStack<PageItem*> groupStack;
int Lnr = 0;
ScLayer ll;
ll.isPrintable = false;
@@ -2765,31 +2706,7 @@
continue;
if ((!a->pageName().isEmpty()) && (c->OwnPage != static_cast<int>(a->pageNr())) && (c->OwnPage != -1))
continue;
- if (c->isGroupControl)
- {
- PS_save();
- FPointArray cl = c->PoLine.copy();
- QTransform mm;
- mm.translate(c->xPos() - a->xOffset(), (c->yPos() - a->yOffset()) - a->height());
- mm.rotate(c->rotation());
- cl.map( mm );
- SetClipPath(&cl);
- PS_closepath();
- PS_clip(true);
- groupStack.push(c->groupsLastItem);
- continue;
- }
ProcessItem(Doc, a, c, PNr, sep, farb, ic, gcr, false);
- if (groupStack.count() != 0)
- {
- while (c == groupStack.top())
- {
- PS_restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
}
for (b = 0; b < PItems.count() && !abortExport; ++b)
@@ -2879,7 +2796,6 @@
bool success = true;
int h, s, v, k;
QVector<double> dum;
- QStack<PageItem*> groupStack;
Page* mPage = Doc->MasterPages.at(Doc->MasterNames[page->MPageNam]);
if (layer.isPrintable)
{
@@ -2891,20 +2807,6 @@
ScQApp->processEvents();
if ((ite->LayerID != layer.ID) || (!ite->printEnabled()))
continue;
- if (ite->isGroupControl)
- {
- PS_save();
- FPointArray cl = ite->PoLine.copy();
- QTransform mm;
- mm.translate(ite->xPos() - mPage->xOffset(), (ite->yPos() - mPage->yOffset()) - page->height());
- mm.rotate(ite->rotation());
- cl.map( mm );
- SetClipPath(&cl);
- PS_closepath();
- PS_clip(true);
- groupStack.push(ite->groupsLastItem);
- continue;
- }
if (!(ite->asTextFrame()) && !(ite->asImageFrame()))
{
int mpIndex = Doc->MasterNames[page->MPageNam];
@@ -3002,17 +2904,8 @@
}
PS_restore();
}
- if (groupStack.count() != 0)
- {
- while (ite == groupStack.top())
- {
- PS_restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
- if (!success) break;
+ if (!success)
+ break;
}
}
for (int am = 0; am < page->FromMaster.count() && !abortExport; ++am)
@@ -3076,7 +2969,6 @@
bool success = true;
int b, h, s, v, k;
QList<PageItem*> items;
- QStack<PageItem*> groupStack;
items = (page->pageName().isEmpty()) ? Doc->DocItems : Doc->MasterItems;
if (layer.isPrintable && !abortExport)
{
@@ -3111,32 +3003,9 @@
continue;
if ((!page->pageName().isEmpty()) && (item->OwnPage != static_cast<int>(page->pageNr())) && (item->OwnPage != -1))
continue;
- if (item->isGroupControl)
- {
- PS_save();
- FPointArray cl = item->PoLine.copy();
- QTransform mm;
- mm.translate(item->xPos() - page->xOffset(), (item->yPos() - page->yOffset()) - page->height());
- mm.rotate(item->rotation());
- cl.map( mm );
- SetClipPath(&cl);
- PS_closepath();
- PS_clip(true);
- groupStack.push(item->groupsLastItem);
- continue;
- }
success &= ProcessItem(Doc, page, item, PNr, sep, farb, ic, gcr, false);
- if (groupStack.count() != 0)
- {
- while (item == groupStack.top())
- {
- PS_restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
- if (!success) break;
+ if (!success)
+ break;
}
}
if (!success)
@@ -3257,38 +3126,13 @@
trans.scale(1, -1);
}
PutStream( MatrixToStr(trans.m11(), trans.m12(), trans.m21(), trans.m22(), trans.dx(), trans.dy()) + " concat\n");
- QStack<PageItem*> groupStack;
for (int em = 0; em < pat.items.count(); ++em)
{
PageItem* embedded = pat.items.at(em);
- if (embedded->isGroupControl)
- {
- PS_save();
- FPointArray cl = embedded->PoLine.copy();
- QTransform mm;
- mm.translate(embedded->gXpos, -(embedded->gHeight - embedded->gYpos));
- mm.rotate(embedded->rotation());
- cl.map( mm );
- SetClipPath(&cl);
- PS_closepath();
- PS_clip(true);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
PS_save();
PS_translate(embedded->gXpos, embedded->gHeight - embedded->gYpos);
ProcessItem(m_Doc, a, embedded, PNr, sep, farb, ic, gcr, master, true);
PS_restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- PS_restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
xpos += adv;
PS_restore();
@@ -4397,30 +4241,9 @@
if ((hl->ch == SpecialChars::OBJECT) && (hl->embedded.hasItem()))
{
QList<PageItem*> emG = hl->embedded.getGroupedItems();
- QStack<PageItem*> groupStack;
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
- if (embedded->isGroupControl)
- {
- PS_save();
- FPointArray cl = embedded->PoLine.copy();
- QTransform mm;
- mm.translate(x + hl->glyph.xoffset + embedded->gXpos * (cstyle.scaleH() / 1000.0), (y + hl->glyph.yoffset - (embedded->gHeight * (cstyle.scaleV() / 1000.0)) + embedded->gYpos * (cstyle.scaleV() / 1000.0)));
- if (cstyle.baselineOffset() != 0)
- mm.translate(0, embedded->gHeight * (cstyle.baselineOffset() / 1000.0));
- if (cstyle.scaleH() != 1000)
- mm.scale(cstyle.scaleH() / 1000.0, 1);
- if (cstyle.scaleV() != 1000)
- mm.scale(1, cstyle.scaleV() / 1000.0);
- mm.rotate(embedded->rotation());
- cl.map( mm );
- SetClipPath(&cl);
- PS_closepath();
- PS_clip(true);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
PS_save();
PS_translate(x + hl->glyph.xoffset + embedded->gXpos * (cstyle.scaleH() / 1000.0), (y + hl->glyph.yoffset - (embedded->gHeight * (cstyle.scaleV() / 1000.0)) + embedded->gYpos * (cstyle.scaleV() / 1000.0)) * -1);
if (cstyle.baselineOffset() != 0)
@@ -4431,16 +4254,6 @@
PS_scale(1, cstyle.scaleV() / 1000.0);
ProcessItem(Doc, pg, embedded, argh, sep, farb, ic, gcr, master, true);
PS_restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- PS_restore();
- groupStack.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=16105&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Sat Dec 18 21:33:07 2010
@@ -102,8 +102,6 @@
void ScPageOutput::drawMasterItems(ScPainterExBase *painter, Page *page, ScLayer& layer, const QRect& clip)
{
PageItem* currItem;
- QStack<PageItem*> groupStack;
- QStack<PageItem*> groupClips;
if (page->MPageNam.isEmpty())
return;
if (page->FromMaster.count() <= 0)
@@ -121,13 +119,6 @@
continue;
if (!currItem->printEnabled())
continue;
- if (currItem->isGroupControl)
- {
- painter->save();
- groupClips.push(currItem);
- groupStack.push(currItem->groupsLastItem);
- continue;
- }
int savedOwnPage = currItem->OwnPage;
double OldX = currItem->xPos();
double OldY = currItem->yPos();
@@ -156,24 +147,6 @@
currItem->setXYPos(OldX, OldY, true);
currItem->BoundingX = OldBX;
currItem->BoundingY = OldBY;
- }
- if (groupStack.count() != 0)
- {
- while (currItem == groupStack.top())
- {
- QTransform mm;
- PageItem *tmpItem = groupClips.pop();
- FPointArray cl = tmpItem->PoLine.copy();
- mm.translate(tmpItem->xPos(), tmpItem->yPos());
- mm.rotate(tmpItem->rotation());
- cl.map( mm );
- painter->setupPolygon(&cl);
- painter->setClipPath();
- painter->restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
}
}
for (uint a = 0; a < pageFromMasterCount; ++a)
@@ -233,8 +206,6 @@
void ScPageOutput::drawPageItems(ScPainterExBase *painter, Page *page, ScLayer& layer, const QRect& clip)
{
PageItem *currItem;
- QStack<PageItem*> groupStack;
- QStack<PageItem*> groupClips;
if (m_doc->Items->count() <= 0)
return;
if (!layer.isViewable || !layer.isPrintable)
@@ -254,13 +225,6 @@
if (currItem->OnMasterPage != page->pageName())
continue;
}
- if (currItem->isGroupControl)
- {
- painter->save();
- groupClips.push(currItem);
- groupStack.push(currItem->groupsLastItem);
- continue;
- }
QRect oldR(currItem->getRedrawBounding(1.0));
if (clip.intersects(oldR))
{
@@ -275,24 +239,6 @@
else
break;
}
- }
- }
- if (groupStack.count() != 0)
- {
- while (currItem == groupStack.top())
- {
- QTransform mm;
- PageItem *tmpItem = groupClips.pop();
- FPointArray cl = tmpItem->PoLine.copy();
- mm.translate(tmpItem->xPos(), tmpItem->yPos());
- mm.rotate(tmpItem->rotation());
- cl.map( mm );
- painter->setupPolygon(&cl);
- painter->setClipPath();
- painter->restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
}
}
}
@@ -644,7 +590,6 @@
if (!cembedded)
return;
QList<PageItem*> emG;
- QStack<PageItem*> groupStack;
emG.append(cembedded);
if (cembedded->Groups.count() != 0)
{
@@ -666,19 +611,6 @@
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
- if (embedded->isGroupControl)
- {
- p->save();
- FPointArray cl = embedded->PoLine.copy();
- QTransform mm;
- mm.translate((embedded->gXpos * (style.scaleH() / 1000.0)), ( - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos * (style.scaleV() / 1000.0)));
- if (style.baselineOffset() != 0)
- mm.translate(0, -embedded->gHeight * (style.baselineOffset() / 1000.0));
- mm.scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
- cl.map( mm );
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
p->save();
double x = embedded->xPos();
double y = embedded->yPos();
@@ -700,6 +632,8 @@
case PageItem::TextFrame:
case PageItem::Polygon:
case PageItem::PathText:
+ case PageItem::Symbol:
+ case PageItem::Group:
drawItem(embedded, p, clip);
break;
case PageItem::Line:
@@ -715,16 +649,6 @@
embedded->setXPos(x, true);
embedded->setYPos(y, true);
p->restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- p->restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
embedded->m_lineWidth = pws;
}
for (int em = 0; em < emG.count(); ++em)
@@ -816,8 +740,6 @@
{
QRectF itRect;
PageItem* it = pattern.items.at(index);
- if (it->isGroupControl)
- continue;
painter->save();
painter->translate(patternOffsetX, patternOffsetY);
Modified: trunk/Scribus/scribus/scpattern.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/scpattern.cpp
==============================================================================
--- trunk/Scribus/scribus/scpattern.cpp (original)
+++ trunk/Scribus/scribus/scpattern.cpp Sat Dec 18 21:33:07 2010
@@ -43,6 +43,10 @@
ScPattern::~ScPattern()
{
+// while (!items.isEmpty())
+// {
+// delete items.takeFirst();
+// }
}
void ScPattern::setDoc(ScribusDoc *doc)
Modified: trunk/Scribus/scribus/scpreview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/scpreview.cpp
==============================================================================
--- trunk/Scribus/scribus/scpreview.cpp (original)
+++ trunk/Scribus/scribus/scpreview.cpp Sat Dec 18 21:33:07 2010
@@ -52,66 +52,11 @@
if(ss.ReadElem(data, prefsManager->appPrefs.fontPrefs.AvailFonts, m_Doc, 0, 0, false, true, prefsManager->appPrefs.fontPrefs.GFontSub))
{
QList<PageItem*> Elements = *m_Doc->Items;
+ Selection *tmpSel = new Selection(m_Doc, false);
if (Elements.count() > 0)
{
- Selection *tmpSel = new Selection(0, false);
- bool isGroup = true;
- int firstElem = -1;
- if (Elements.at(0)->Groups.count() != 0)
- firstElem = Elements.at(0)->Groups.top();
- for (int bx = 0; bx < Elements.count(); ++bx)
- {
- PageItem* bxi = Elements.at(bx);
- if (bxi->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- {
- double minx = 999999.9;
- double miny = 999999.9;
- double maxx = -999999.9;
- double maxy = -999999.9;
- uint lowestItem = 999999;
- uint highestItem = 0;
- for (int a = 0; a < Elements.count(); ++a)
- {
- Elements.at(a)->Groups.push(m_Doc->GroupCounter);
- PageItem* currItem = Elements.at(a);
- lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- double gx = minx;
- double gy = miny;
- double gw = maxx - minx;
- double gh = maxy - miny;
- PageItem *high = m_Doc->Items->at(highestItem);
- int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, m_Doc->itemToolPrefs().shapeFillColor, m_Doc->itemToolPrefs().shapeLineColor, true);
- PageItem *neu = m_Doc->Items->takeAt(z);
- m_Doc->Items->insert(lowestItem, neu);
- neu->Groups.push(m_Doc->GroupCounter);
- neu->setItemName( QObject::tr("Group%1").arg(neu->Groups.top()));
- neu->AutoName = false;
- neu->isGroupControl = true;
- neu->groupsLastItem = high;
- neu->setTextFlowMode(PageItem::TextFlowDisabled);
- for (int a = 0; a < m_Doc->Items->count(); ++a)
- {
- m_Doc->Items->at(a)->ItemNr = a;
- }
- Elements.prepend(neu);
- m_Doc->GroupCounter++;
- }
+ if (Elements.count() > 1)
+ m_Doc->groupObjectsList(Elements);
m_Doc->DoDrawing = true;
m_Doc->m_Selection->delaySignalsOn();
for (int dre=0; dre<Elements.count(); ++dre)
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Dec 18 21:33:07 2010
@@ -3084,7 +3084,7 @@
scrActions["itemLock"]->setEnabled(true);
scrActions["itemLockSize"]->setEnabled(true);
scrActions["itemPrintingEnabled"]->setEnabled(true);
- if (currItem->Groups.count() != 0)
+ if (currItem->isGroup())
scrActions["itemUngroup"]->setEnabled(true);
else
{
@@ -3119,7 +3119,7 @@
}
else
{
- bool setter=!(currItem->isSingleSel && (currItem->isTableItem || currItem->isGroupControl));
+ bool setter=!(currItem->isSingleSel && (currItem->isTableItem || currItem->isGroup()));
scrMenuMgr->setMenuEnabled("ItemLevel", setter);
scrActions["itemDuplicate"]->setEnabled(setter);
scrActions["itemMulDuplicate"]->setEnabled(setter);
@@ -3325,7 +3325,9 @@
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
+ {
fmt->loadFile(data, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
+ }
}
if (doc->m_Selection->count() > 0)
{
@@ -3467,7 +3469,9 @@
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
+ {
fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive);
+ }
}
}
}
@@ -4924,7 +4928,7 @@
}
else
{
- if (((currItem->isSingleSel) && (currItem->isGroupControl)) || ((currItem->isSingleSel) && (currItem->isTableItem)))
+ if (((currItem->isSingleSel) && (currItem->isGroup())) || ((currItem->isSingleSel) && (currItem->isTableItem)))
return;
// new version:
@@ -4999,9 +5003,9 @@
}
else
{
- if (((currItem->isSingleSel) && (currItem->isGroupControl)) || ((currItem->isSingleSel) && (currItem->isTableItem)))
+ if (((currItem->isSingleSel) && (currItem->isGroup())) || ((currItem->isSingleSel) && (currItem->isTableItem)))
return;
-
+/*
// new version:
std::ostringstream xmlString;
SaxXML xmlStream(xmlString);
@@ -5019,18 +5023,18 @@
Serializer::serializeObjects(objects, tmpfile2);
doc->itemSelection_DeleteItem(&objects);
#endif
-
+*/
+ ScriXmlDoc ss;
+ QString BufferS = ss.WriteElem(doc, doc->m_Selection);
if ((prefsManager->appPrefs.scrapbookPrefs.doCopyToScrapbook) && (!internalCopy))
{
- ScriXmlDoc ss;
- QString buffer = ss.WriteElem(doc, doc->m_Selection);
- scrapbookPalette->ObjFromCopyAction(buffer, currItem->itemName());
+ scrapbookPalette->ObjFromCopyAction(BufferS, currItem->itemName());
rebuildRecentPasteMenu();
}
- ScFragmentMimeData* mimeData = new ScFragmentMimeData();
- mimeData->setScribusFragment( QByteArray(xml.c_str(), xml.length()) );
- mimeData->setText( QString::fromUtf8(xml.c_str(), xml.length()) );
+ ScElemMimeData* mimeData = new ScElemMimeData();
+ mimeData->setScribusElem(BufferS);
+ mimeData->setText(BufferS);
QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
}
scrActions["editPaste"]->setEnabled(true);
@@ -5095,16 +5099,16 @@
// if embedded item is deleted, undo system will not be aware of its deletion => crash - JG
undoManager->setUndoEnabled(false);
- if (ScMimeData::clipboardHasScribusElem())
- {
+ // if (ScMimeData::clipboardHasScribusElem())
+ // {
QString buffer = ScMimeData::clipboardScribusElem();
slotElemRead(buffer, 0, 0, false, true, doc, view);
- }
- else
- {
- QByteArray fragment = ScMimeData::clipboardScribusFragment();
- doc->serializer()->deserializeObjects(fragment);
- }
+ // }
+ // else
+ // {
+ // QByteArray fragment = ScMimeData::clipboardScribusFragment();
+ // doc->serializer()->deserializeObjects(fragment);
+ // }
// update style lists:
styleManager->setDoc(doc);
@@ -5184,17 +5188,17 @@
bool savedAlignGuides = doc->SnapGuides;
doc->useRaster = false;
doc->SnapGuides = false;
- if (ScMimeData::clipboardHasScribusElem())
- {
+ // if (ScMimeData::clipboardHasScribusElem())
+ // {
QString buffer = ScMimeData::clipboardScribusElem();
slotElemRead(buffer, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), false, true, doc, view);
- }
- else
- {
- QByteArray fragment = ScMimeData::clipboardScribusFragment();
- Selection pastedObjects = doc->serializer()->deserializeObjects(fragment);
- for (int i=0; i < pastedObjects.count(); ++i)
- pastedObjects.itemAt(i)->LayerID = doc->activeLayer();
+ // }
+ // else
+ // {
+ // QByteArray fragment = ScMimeData::clipboardScribusFragment();
+ // Selection pastedObjects = doc->serializer()->deserializeObjects(fragment);
+ // for (int i=0; i < pastedObjects.count(); ++i)
+ // pastedObjects.itemAt(i)->LayerID = doc->activeLayer();
/*double x = doc->currentPage()->xOffset();
double y = doc->currentPage()->yOffset();
@@ -5210,7 +5214,7 @@
pastedObjects.itemAt(i)->moveBy(x, y, true);
}
*/
- }
+ // }
// update style lists:
styleManager->setDoc(doc);
@@ -10004,7 +10008,6 @@
void ScribusMainWindow::PutToPatterns()
{
int z;
- PageItem* groupItem;
uint docSelectionCount = doc->m_Selection->count();
QString patternName = "Pattern_"+doc->m_Selection->itemAt(0)->itemName();
patternName = patternName.trimmed().simplified().replace(" ", "_");
@@ -10018,103 +10021,36 @@
return;
bool wasUndo = undoManager->undoEnabled();
undoManager->setUndoEnabled(false);
- int ac = doc->Items->count();
- uint oldNum = doc->TotalItems;
- bool savedAlignGrid = doc->useRaster;
- bool savedAlignGuides = doc->SnapGuides;
- internalCopy = true;
- doc->useRaster = false;
- doc->SnapGuides = false;
- bool isGroup = true;
- int firstElem = -1;
- PageItem* currItem = doc->m_Selection->itemAt(0);
- 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->Groups.count() != 0)
- {
- if (bxi->Groups.top() != firstElem)
- {
- isGroup = false;
- break;
- }
- }
- else
- {
- isGroup = false;
- break;
- }
- }
+ PageItem* currItem;
Selection itemSelection(this, false);
itemSelection.copy(*doc->m_Selection, false);
- slotEditCopy();
- doc->m_Selection->delaySignalsOn();
view->Deselect(true);
- if ((docSelectionCount > 1) && (!isGroup))
- {
- z = doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, 0, 0, 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
- groupItem = doc->Items->at(z);
- }
- slotEditPaste();
- doc->useRaster = savedAlignGrid;
- doc->SnapGuides = savedAlignGuides;
- internalCopy = false;
- int ae = doc->Items->count();
- if ((docSelectionCount > 1) && (!isGroup))
- {
- double minx = std::numeric_limits<double>::max();
- double miny = std::numeric_limits<double>::max();
- double maxx = -std::numeric_limits<double>::max();
- double maxy = -std::numeric_limits<double>::max();
- for (int as = ac+1; as < ae; ++as)
- {
- PageItem* currItem = doc->Items->at(as);
- currItem->Groups.push(doc->GroupCounter);
- double x1, x2, y1, y2;
- currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
- minx = qMin(minx, x1);
- miny = qMin(miny, y1);
- maxx = qMax(maxx, x2);
- maxy = qMax(maxy, y2);
- }
- groupItem->setXYPos(minx, miny, true);
- groupItem->setWidthHeight(maxx - minx, maxy - miny, true);
- groupItem->SetRectFrame();
- groupItem->ClipEdited = true;
- groupItem->FrameType = 3;
- groupItem->setTextFlowMode(PageItem::TextFlowDisabled);
- groupItem->AutoName = false;
- groupItem->isGroupControl = true;
- groupItem->setFillTransparency(0);
- groupItem->setLineTransparency(0);
- groupItem->groupsLastItem = doc->Items->at(ae-1);
- groupItem->Groups.push(doc->GroupCounter);
- doc->GroupCounter++;
- }
+ if (docSelectionCount > 1)
+ currItem = doc->groupObjectsSelection(&itemSelection);
+ else
+ currItem = itemSelection.itemAt(0);
ScPattern pat = ScPattern();
pat.setDoc(doc);
- currItem = doc->Items->at(ac);
pat.pattern = currItem->DrawObj_toImage();
pat.width = currItem->gWidth;
pat.height = currItem->gHeight;
- for (int as = ac; as < ae; ++as)
- {
- PageItem* paItem = doc->Items->takeAt(ac);
- paItem->setItemName(patternName+QString("_%1").arg(as-ac));
- pat.items.append(paItem);
- }
+ pat.items.append(currItem);
if (doc->docPatterns.contains(patternName))
doc->docPatterns.remove(patternName);
doc->addPattern(patternName, pat);
+ double x = currItem->xPos();
+ double y = currItem->yPos();
+ double w = currItem->width();
+ double h = currItem->height();
+ int d = doc->Items->indexOf(currItem);
+ z = doc->itemAdd(PageItem::Symbol, PageItem::Rectangle, x, y, w, h, 0, CommonStrings::None, CommonStrings::None, true);
+ PageItem* groupItem = doc->Items->takeAt(z);
+ groupItem->setPattern(patternName);
+ doc->Items->replace(d, groupItem);
propertiesPalette->updateColorList();
symbolPalette->updateSymbolList();
if (outlinePalette->isVisible())
outlinePalette->BuildTree();
- doc->TotalItems = oldNum;
- view->Deselect(true);
- doc->m_Selection->copy(itemSelection, false);
doc->m_Selection->delaySignalsOff();
view->DrawNew();
undoManager->setUndoEnabled(wasUndo);
Modified: trunk/Scribus/scribus/scribusXml.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/scribusXml.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusXml.cpp (original)
+++ trunk/Scribus/scribus/scribusXml.cpp Sat Dec 18 21:33:07 2010
@@ -44,7 +44,6 @@
#include "selection.h"
#include "text/nlsconfig.h"
#include "units.h"
-#include "ui/missing.h"
#include <iostream>
@@ -60,6 +59,9 @@
#include "sctextstream.h"
#include "scxmlstreamwriter.h"
#include "scpainter.h"
+#include "fileloader.h"
+#include "loadsaveplugin.h"
+#include "plugins/formatidlist.h"
using namespace std;
@@ -67,531 +69,6 @@
ScriXmlDoc::ScriXmlDoc()
{
- prefsManager=PrefsManager::instance();
-}
-
-bool ScriXmlDoc::attrHasValue(const QXmlStreamAttributes& attrs, const char* attName)
-{
- QLatin1String attString(attName);
- bool hasValue = false;
- QXmlStreamAttributes::ConstIterator pIter, pEnd = attrs.constEnd();
- for (pIter = attrs.constBegin(); pIter != pEnd; ++pIter)
- {
- if (pIter->name() == attString)
- {
- hasValue = true;
- break;
- }
- }
- return hasValue;
-}
-
-bool ScriXmlDoc::attrAsBool(const QXmlStreamAttributes& attrs, const char* attName, bool defVal)
-{
- QLatin1String attString(attName);
- bool value = defVal;
- QStringRef att = attrs.value(attString);
- if (!att.isEmpty())
- value = static_cast<bool>(QString::fromRawData(att.constData(), att.length()).toInt());
- return value;
-}
-
-int ScriXmlDoc::attrAsInt(const QXmlStreamAttributes& attrs, const char* attName, int defVal)
-{
- QLatin1String attString(attName);
- int value = defVal;
- QStringRef att = attrs.value(attString);
- if (!att.isEmpty())
- value = QString::fromRawData(att.constData(), att.length()).toInt();
- return value;
-}
-
-double ScriXmlDoc::attrAsDbl(const QXmlStreamAttributes& attrs, const char* attName, double defVal)
-{
- QLatin1String attString(attName);
- double value = defVal;
- QStringRef att = attrs.value(attString);
- if (!att.isEmpty())
- value = ScCLocale::toDoubleC(QString::fromRawData(att.constData(), att.length()));
- return value;
-}
-
-QString ScriXmlDoc::attrAsString (const QXmlStreamAttributes& attrs, const char* attName, const QString& defVal)
-{
- QLatin1String attString(attName);
- QStringRef att = attrs.value(attString);
- if (!att.isNull())
- return att.toString();
- return defVal;
-}
-
-void ScriXmlDoc::GetItemProps(const QXmlStreamAttributes& attrs, struct CopyPasteBuffer *OB, const QString& baseDir, bool newVersion)
-{
- QString tmp;
- int x, y;
- double xf, yf, xf2;
- OB->PType = static_cast<PageItem::ItemType>(attrAsInt(attrs, "PTYPE"));
- OB->Width = attrAsDbl(attrs, "WIDTH", 0.0);
- OB->Height = attrAsDbl(attrs, "HEIGHT", 0.);
- OB->RadRect = attrAsDbl(attrs, "RADRECT", 0.0);
- OB->ClipEdited = attrAsInt(attrs, "CLIPEDIT", 0);
- OB->FrameType = attrAsInt(attrs, "FRTYPE", 0);
- OB->Pwidth = attrAsDbl(attrs, "PWIDTH");
- OB->Pcolor = attrAsString(attrs, "PCOLOR", CommonStrings::None);
- if ((!newVersion) && (OB->PType == 4))
- {
- OB->TxtFill = attrAsString(attrs, "PCOLOR2", CommonStrings::None);
- OB->Pcolor2 = CommonStrings::None;
- }
- else
- {
- OB->Pcolor2 = attrAsString(attrs, "PCOLOR2", CommonStrings::None);
- OB->TxtFill = attrAsString(attrs, "TXTFILL", "Black");
- }
- OB->Shade = attrAsInt(attrs, "SHADE");
- OB->Shade2 = attrAsInt(attrs, "SHADE2");
- OB->FillRule = attrAsInt(attrs, "fillRule", 1);
- OB->TxtStroke = attrAsString(attrs, "TXTSTROKE", CommonStrings::None);
- OB->ShTxtFill = attrAsInt(attrs, "TXTFILLSH", 100);
- OB->ShTxtStroke= attrAsInt(attrs, "TXTSTRSH", 100);
- OB->TxtScale = qRound(attrAsDbl(attrs, "TXTSCALE", 100.0) * 10);
- OB->TxtScaleV = qRound(attrAsDbl(attrs, "TXTSCALEV", 100.0) * 10);
- OB->TxTBase = qRound(attrAsDbl(attrs, "TXTBASE", 0) * 10);
- OB->TxTStyle = attrAsInt(attrs, "TXTSTYLE", 0);
- OB->TxtShadowX = qRound(attrAsDbl(attrs, "TXTSHX", 5.0) * 10);
- OB->TxtShadowY = qRound(attrAsDbl(attrs, "TXTSHY", -5.0)* 10);
- OB->TxtOutline = qRound(attrAsDbl(attrs, "TXTOUT", 1.0) * 10);
- OB->TxtUnderPos = qRound(attrAsDbl(attrs, "TXTULP", -0.1) * 10);
- OB->TxtUnderWidth = qRound(attrAsDbl(attrs, "TXTULW", -0.1) * 10);
- OB->TxtStrikePos = qRound(attrAsDbl(attrs, "TXTSTP", -0.1) * 10);
- OB->TxtStrikeWidth= qRound(attrAsDbl(attrs, "TXTSTW", -0.1) * 10);
- OB->Cols = attrAsInt(attrs, "COLUMNS", 1);
- OB->ColGap = attrAsDbl(attrs, "COLGAP" , 0.0);
- OB->GrType = attrAsInt(attrs, "GRTYP" , 0);
- OB->fill_gradient.clearStops();
- if (OB->PType == PageItem::Symbol)
- OB->pattern = attrAsString(attrs, "pattern", "");
- OB->mGArrayRows = 1;
- OB->mGArrayCols = 1;
- if (OB->GrType != 0)
- {
- if (OB->GrType == 8)
- {
- OB->pattern = attrAsString(attrs, "pattern", "");
- OB->patternScaleX = attrAsDbl(attrs, "pScaleX", 100.0);
- OB->patternScaleY = attrAsDbl(attrs, "pScaleY", 100.0);
- OB->patternOffsetX = attrAsDbl(attrs, "pOffsetX", 0.0);
- OB->patternOffsetY = attrAsDbl(attrs, "pOffsetY", 0.0);
- OB->patternRotation = attrAsDbl(attrs, "pRotation", 0.0);
- OB->patternSkewX = attrAsDbl(attrs, "pSkewX", 0.0);
- OB->patternSkewY = attrAsDbl(attrs, "pSkewY", 0.0);
- OB->patternMirrorX = attrAsBool(attrs, "pMirrorX", false);
- OB->patternMirrorY = attrAsBool(attrs, "pMirrorY", false);
- }
- else
- {
- if (OB->GrType == 11)
- {
- OB->mGArrayRows = attrAsInt(attrs, "GMAX", 1);
- OB->mGArrayCols = attrAsInt(attrs, "GMAY", 1);
- }
- else
- {
- OB->GrStartX = attrAsDbl(attrs, "GRSTARTX", 0.0);
- OB->GrStartY = attrAsDbl(attrs, "GRSTARTY", 0.0);
- OB->GrEndX = attrAsDbl(attrs, "GRENDX", 0.0);
- OB->GrEndY = attrAsDbl(attrs, "GRENDY", 0.0);
- OB->GrColor = attrAsString(attrs, "GRCOLOR", "Black");
- OB->GrFocalX = attrAsDbl(attrs, "GRFOCALX", 0.0);
- OB->GrFocalY = attrAsDbl(attrs, "GRFOCALY", 0.0);
- OB->GrScale = attrAsDbl(attrs, "GRSCALE", 1.0);
- OB->GrSkew = attrAsDbl(attrs, "GRSKEW", 0.0);
- if (OB->GrColor.isEmpty())
- OB->GrColor = "Black";
- OB->GrColor2 = attrAsString(attrs, "GRCOLOR2","Black");
- if (OB->GrColor2.isEmpty())
- OB->GrColor2 = "Black";
- OB->GrShade = attrAsInt(attrs, "GRSHADE", 100);
- OB->GrShade2 = attrAsInt(attrs, "GRSHADE2", 100);
- OB->GrControl1 = FPoint(attrAsDbl(attrs, "GRC1X", 0.0), attrAsDbl(attrs, "GRC1Y", 0.0));
- OB->GrControl2 = FPoint(attrAsDbl(attrs, "GRC2X", OB->Width), attrAsDbl(attrs, "GRC2Y", 0.0));
- OB->GrControl3 = FPoint(attrAsDbl(attrs, "GRC3X", OB->Width), attrAsDbl(attrs, "GRC3Y", OB->Height));
- OB->GrControl4 = FPoint(attrAsDbl(attrs, "GRC4X", 0.0), attrAsDbl(attrs, "GRC4Y", OB->Height));
- OB->GrControl5 = FPoint(attrAsDbl(attrs, "GRC5X", OB->Width / 2.0), attrAsDbl(attrs, "GRC5Y", OB->Height / 2.0));
- OB->GrColorP1 = attrAsString(attrs, "GRCOLP1", "Black");
- OB->GrColorP2 = attrAsString(attrs, "GRCOLP2", "Black");
- OB->GrColorP3 = attrAsString(attrs, "GRCOLP3", "Black");
- OB->GrColorP4 = attrAsString(attrs, "GRCOLP4", "Black");
- OB->GrCol1transp = attrAsDbl(attrs, "GRCOLT1", 1.0);
- OB->GrCol2transp = attrAsDbl(attrs, "GRCOLT2", 1.0);
- OB->GrCol3transp = attrAsDbl(attrs, "GRCOLT3", 1.0);
- OB->GrCol4transp = attrAsDbl(attrs, "GRCOLT4", 1.0);
- OB->GrCol1Shade = attrAsInt(attrs, "GRCOLS1", 100);
- OB->GrCol2Shade = attrAsInt(attrs, "GRCOLS2", 100);
- OB->GrCol3Shade = attrAsInt(attrs, "GRCOLS3", 100);
- OB->GrCol4Shade = attrAsInt(attrs, "GRCOLS4", 100);
- }
- }
- }
- OB->GrTypeStroke = attrAsInt(attrs, "GRTYPS" , 0);
- OB->stroke_gradient.clearStops();
- if (OB->GrTypeStroke > 0)
- {
- OB->GrStrokeStartX = attrAsDbl(attrs, "GRSTARTXS", 0.0);
- OB->GrStrokeStartY = attrAsDbl(attrs, "GRSTARTYS", 0.0);
- OB->GrStrokeEndX = attrAsDbl(attrs, "GRENDXS", 0.0);
- OB->GrStrokeEndY = attrAsDbl(attrs, "GRENDYS", 0.0);
- OB->GrStrokeFocalX = attrAsDbl(attrs, "GRFOCALXS", 0.0);
- OB->GrStrokeFocalY = attrAsDbl(attrs, "GRFOCALYS", 0.0);
- OB->GrStrokeScale = attrAsDbl(attrs, "GRSCALES", 1.0);
- OB->GrStrokeSkew = attrAsDbl(attrs, "GRSKEWS", 1.0);
- }
- OB->GrMask = attrAsInt(attrs, "GRTYPM" , 0);
- if ((OB->GrMask == 1) || (OB->GrMask == 2) || (OB->GrMask == 4) || (OB->GrMask == 5))
- {
- if ((OB->GrMask == 1) || (OB->GrMask == 4))
- OB->mask_gradient = VGradient(VGradient::linear);
- else if ((OB->GrMask == 2) || (OB->GrMask == 5))
- OB->mask_gradient = VGradient(VGradient::radial);
- OB->mask_gradient.clearStops();
- OB->GrMaskStartX = attrAsDbl(attrs, "GRSTARTXM", 0.0);
- OB->GrMaskStartY = attrAsDbl(attrs, "GRSTARTYM", 0.0);
- OB->GrMaskEndX = attrAsDbl(attrs, "GRENDXM", 0.0);
- OB->GrMaskEndY = attrAsDbl(attrs, "GRENDYM", 0.0);
- OB->GrMaskFocalX = attrAsDbl(attrs, "GRFOCALXM", 0.0);
- OB->GrMaskFocalY = attrAsDbl(attrs, "GRFOCALYM", 0.0);
- OB->GrMaskScale = attrAsDbl(attrs, "GRSCALEM", 1.0);
- OB->GrMaskSkew = attrAsDbl(attrs, "GRSKEWM", 1.0);
- }
- if ((OB->GrMask == 3) || (OB->GrMask == 6))
- {
- OB->patternMaskVal = attrAsString(attrs, "patternM", "");
- OB->patternMaskScaleX = attrAsDbl(attrs, "pScaleXM", 100.0);
- OB->patternMaskScaleY = attrAsDbl(attrs, "pScaleYM", 100.0);
- OB->patternMaskOffsetX = attrAsDbl(attrs, "pOffsetXM", 0.0);
- OB->patternMaskOffsetY = attrAsDbl(attrs, "pOffsetYM", 0.0);
- OB->patternMaskRotation = attrAsDbl(attrs, "pRotationM", 0.0);
- OB->patternMaskSkewX = attrAsDbl(attrs, "pSkewXM", 0.0);
- OB->patternMaskSkewY = attrAsDbl(attrs, "pSkewYM", 0.0);
- OB->patternMaskMirrorX = attrAsBool(attrs, "pMirrorXM", false);
- OB->patternMaskMirrorY = attrAsBool(attrs, "pMirrorYM", false);
- }
- OB->Rot = attrAsDbl(attrs, "ROT", 0.0);
- OB->PLineArt = Qt::PenStyle ( attrAsInt(attrs, "PLINEART", 0) );
- OB->PLineEnd = Qt::PenCapStyle ( attrAsInt(attrs, "PLINEEND", 0) );
- OB->PLineJoin = Qt::PenJoinStyle( attrAsInt(attrs, "PLINEJOIN", 0));
- OB->LineSp = attrAsDbl(attrs, "LINESP");
- OB->LineSpMode = attrAsInt(attrs, "LINESPMode", 0);
- OB->LocalScX = attrAsDbl(attrs, "LOCALSCX");
- OB->LocalScY = attrAsDbl(attrs, "LOCALSCY");
- OB->LocalX = attrAsDbl(attrs, "LOCALX");
- OB->LocalY = attrAsDbl(attrs, "LOCALY");
- OB->LocalRot = attrAsDbl(attrs, "LOCALROT");
- OB->PicArt = attrAsInt(attrs, "PICART");
- OB->flippedH = attrAsInt(attrs, "FLIPPEDH") % 2;
- OB->flippedV = attrAsInt(attrs, "FLIPPEDV") % 2;
-/* OB->BBoxX=obj->attribute("BBOXX").toDouble();
- OB->BBoxH=obj->attribute("BBOXH").toDouble(); */
- OB->ScaleType = attrAsInt(attrs, "SCALETYPE", 1);
- OB->AspectRatio= attrAsInt(attrs, "RATIO", 0);
- OB->isPrintable= attrAsInt(attrs, "PRINTABLE");
- OB->m_isAnnotation = attrAsInt(attrs, "ANNOTATION", 0);
- OB->m_annotation.setType (attrAsInt(attrs, "ANTYPE", 0));
- OB->m_annotation.setAction(attrAsString(attrs, "ANACTION",""));
- OB->m_annotation.setE_act (attrAsString(attrs, "ANEACT",""));
- OB->m_annotation.setX_act (attrAsString(attrs, "ANXACT",""));
- OB->m_annotation.setD_act (attrAsString(attrs, "ANDACT",""));
- OB->m_annotation.setFo_act(attrAsString(attrs, "ANFOACT",""));
- OB->m_annotation.setBl_act(attrAsString(attrs, "ANBLACT",""));
- OB->m_annotation.setK_act (attrAsString(attrs, "ANKACT",""));
- OB->m_annotation.setF_act (attrAsString(attrs, "ANFACT",""));
- OB->m_annotation.setV_act (attrAsString(attrs, "ANVACT",""));
- OB->m_annotation.setC_act (attrAsString(attrs, "ANCACT",""));
- OB->m_annotation.setActionType(attrAsInt(attrs, "ANACTYP", 0));
- OB->m_annotation.setExtern (attrAsString(attrs, "ANEXTERN",""));
- if ((!OB->m_annotation.Extern().isEmpty()) && (OB->m_annotation.ActionType() != 8))
- {
- QFileInfo efp(OB->m_annotation.Extern());
- OB->m_annotation.setExtern(efp.absoluteFilePath());
- }
- OB->m_annotation.setZiel (attrAsInt(attrs, "ANZIEL", 0));
- OB->AnName = attrAsString(attrs, "ANNAME","");
- OB->m_annotation.setToolTip (attrAsString(attrs, "ANTOOLTIP",""));
- OB->m_annotation.setRollOver(attrAsString(attrs, "ANROLL",""));
- OB->m_annotation.setDown (attrAsString(attrs, "ANDOWN",""));
- OB->m_annotation.setBwid (attrAsInt(attrs, "ANBWID", 1));
- OB->m_annotation.setBsty (attrAsInt(attrs, "ANBSTY", 0));
- OB->m_annotation.setFeed (attrAsInt(attrs, "ANFEED", 1));
- OB->m_annotation.setFlag (attrAsInt(attrs, "ANFLAG", 0));
- OB->m_annotation.setFont (attrAsInt(attrs, "ANFONT", 4));
- OB->m_annotation.setFormat(attrAsInt(attrs, "ANFORMAT", 0));
- OB->m_annotation.setVis (attrAsInt(attrs, "ANVIS", 0));
- OB->m_annotation.setIsChk (attrAsBool(attrs, "ANCHK", false));
- OB->m_annotation.setAAact (attrAsBool(attrs, "ANAA", false));
- OB->m_annotation.setHTML (attrAsInt(attrs, "ANHTML", 0));
- OB->m_annotation.setUseIcons(attrAsBool(attrs, "ANICON", false));
- OB->m_annotation.setChkStil (attrAsInt(attrs, "ANCHKS", 0));
- OB->m_annotation.setMaxChar (attrAsInt(attrs, "ANMC", -1));
- OB->m_annotation.setBorderColor(attrAsString(attrs, "ANBCOL",CommonStrings::None));
- OB->m_annotation.setIPlace (attrAsInt(attrs, "ANPLACE", 1));
- OB->m_annotation.setScaleW (attrAsInt(attrs, "ANSCALE", 0));
- if (attrAsInt(attrs, "TRANSPARENT", 0) == 1)
- OB->Pcolor = CommonStrings::None;
- OB->textAlignment = attrAsInt(attrs, "ALIGN", 0);
- if (!attrs.value("TEXTFLOWMODE").isEmpty() )
- OB->TextflowMode = (PageItem::TextFlowMode) attrAsInt(attrs, "TEXTFLOWMODE", 0);
- else if (attrAsInt(attrs, "TEXTFLOW", 0))
- {
- if (attrAsInt(attrs, "TEXTFLOW2", 0))
- OB->TextflowMode = PageItem::TextFlowUsesBoundingBox;
- else if (attrAsInt(attrs, "TEXTFLOW3", 0))
- OB->TextflowMode = PageItem::TextFlowUsesContourLine;
- else
- OB->TextflowMode = PageItem::TextFlowUsesFrameShape;
- }
- else
- OB->TextflowMode = PageItem::TextFlowDisabled;
- OB->Extra = attrAsDbl(attrs, "EXTRA", 0.0);
- OB->TExtra = attrAsDbl(attrs, "TEXTRA", 1.0);
- OB->BExtra = attrAsDbl(attrs, "BEXTRA", 1.0);
- OB->RExtra = attrAsDbl(attrs, "REXTRA", 1.0);
- OB->firstLineOffsetP = static_cast<FirstLineOffsetPolicy>(attrAsInt(attrs, "FLOP", 0));
- OB->PoShow = attrAsInt(attrs, "PLTSHOW", 0);
- OB->BaseOffs = attrAsDbl(attrs, "BASEOF", 0.0);
- OB->textPathType = attrAsInt (attrs, "textPathType", 0);
- OB->textPathFlipped = attrAsBool(attrs, "textPathFlipped", false);
- OB->ISize = qRound(attrAsDbl(attrs, "ISIZE", 12.0) * 10);
- if (!attrs.value("EXTRAV").isEmpty())
- OB->ExtraV = qRound( attrAsDbl(attrs, "EXTRAV", 0.0) / attrAsDbl(attrs, "ISIZE", 12.0) * 1000.0);
- else
- OB->ExtraV = attrAsInt(attrs, "TXTKERN");
-/* OB->Pfile = Relative2Path( attrAsString(attrs, "PFILE" ,""), baseDir);
- OB->Pfile2 = Relative2Path( attrAsString(attrs, "PFILE2",""), baseDir);
- OB->Pfile3 = Relative2Path( attrAsString(attrs, "PFILE3",""), baseDir); */
- OB->Pfile = attrAsString(attrs, "PFILE" ,"");
- OB->Pfile2 = attrAsString(attrs, "PFILE2","");
- OB->Pfile3 = attrAsString(attrs, "PFILE3","");
- OB->IProfile = attrAsString(attrs, "PRFILE","");
- OB->EmProfile = attrAsString(attrs, "EPROF","");
- OB->IRender = (eRenderIntent) attrAsInt (attrs, "IRENDER", (int) Intent_Relative_Colorimetric);
- OB->UseEmbedded= attrAsInt (attrs, "EMBEDDED", 1);
- if ((OB->OverrideCompressionMethod = attrHasValue(attrs, "COMPRESSIONMETHOD")))
- OB->CompressionMethodIndex = attrAsInt(attrs, "COMPRESSIONMETHOD", 0);
- if ((OB->OverrideCompressionQuality = attrHasValue(attrs, "COMPRESSIONQUALITY")))
- OB->CompressionQualityIndex = attrAsInt(attrs, "COMPRESSIONQUALITY", 0);
- OB->Locked = attrAsBool(attrs, "LOCK", false);
- OB->LockRes = attrAsBool(attrs, "LOCKR", false);
- OB->Reverse = attrAsBool(attrs, "REVERS", false);
- OB->isTableItem = attrAsBool(attrs, "isTableItem", false);
- OB->TopLine = attrAsBool(attrs, "TopLine", false);
- OB->LeftLine = attrAsBool(attrs, "LeftLine", false);
- OB->RightLine = attrAsBool(attrs, "RightLine", false);
- OB->BottomLine = attrAsBool(attrs, "BottomLine", false);
- OB->TopLinkID = attrAsInt(attrs, "TopLINK", -1);
- OB->LeftLinkID = attrAsInt(attrs, "LeftLINK", -1);
- OB->RightLinkID = attrAsInt(attrs, "RightLINK", -1);
- OB->BottomLinkID = attrAsInt(attrs, "BottomLINK", -1);
- OB->Transparency = attrAsDbl(attrs, "TransValue", 0.0);
- if (!attrs.value("TransValueS").isEmpty())
- OB->TranspStroke = attrAsDbl(attrs, "TransValueS", 0.0);
- else
- OB->TranspStroke = OB->Transparency;
- OB->TransBlend = attrAsInt(attrs, "TransBlend", 0);
- OB->TransBlendS = attrAsInt(attrs, "TransBlendS", 0);
- tmp = "";
- int numClip = attrAsInt(attrs, "NUMCLIP", 0);
- if (numClip > 0)
- {
- OB->Clip.resize(numClip);
- tmp = attrAsString(attrs, "CLIPCOOR", "");
- QTextStream fc(&tmp, QIODevice::ReadOnly);
- for (int c=0; c < numClip; ++c)
- {
- fc >> x;
- fc >> y;
- OB->Clip.setPoint(c, x, y);
- }
- }
- else
- OB->Clip.resize(0);
- tmp = "";
- int numPo = attrAsInt(attrs, "NUMPO", 0);
- if (numPo > 0 )
- {
- OB->PoLine.resize(numPo);
- tmp = attrAsString(attrs, "POCOOR", "");
- QTextStream fp(&tmp, QIODevice::ReadOnly);
- for (int cx=0; cx < numPo; ++cx)
- {
- QString s;
- fp >> s;
- xf = ScCLocale::toDoubleC(s);
- fp >> s;
- yf = ScCLocale::toDoubleC(s);
- OB->PoLine.setPoint(cx, xf, yf);
- }
- }
- else
- OB->PoLine.resize(0);
- tmp = "";
- int numCo = attrAsInt(attrs, "NUMCO", 0);
- if (numCo > 0)
- {
- OB->ContourLine.resize(numCo);
- tmp = attrAsString(attrs, "COCOOR", "");
- QTextStream fp(&tmp, QIODevice::ReadOnly);
- for (int cx=0; cx < numCo; ++cx)
- {
- QString s;
- fp >> s;
- xf = ScCLocale::toDoubleC(s);
- fp >> s;
- yf = ScCLocale::toDoubleC(s);
- OB->ContourLine.setPoint(cx, xf, yf);
- }
- }
- else
- OB->ContourLine.resize(0);
- tmp = "";
- int numTab = attrAsInt(attrs, "NUMTAB", 0);
- if (numTab > 0)
- {
- ParagraphStyle::TabRecord tb;
- tmp = attrAsString(attrs, "TABS", "");
- QTextStream tgv(&tmp, QIODevice::ReadOnly);
- OB->TabValues.clear();
- for (int cxv = 0; cxv < numTab; cxv += 2)
- {
- QString s;
- tgv >> s;
- xf = ScCLocale::toDoubleC(s);
- tgv >> s;
- xf2 = ScCLocale::toDoubleC(s);
- tb.tabPosition = xf2;
- tb.tabType = static_cast<int>(xf);
- tb.tabFillChar = QChar();
- OB->TabValues.append(tb);
- }
- tmp = "";
- }
- else
- OB->TabValues.clear();
- int numDash = attrAsInt(attrs, "NUMDASH", 0);
- if (numDash > 0)
- {
- tmp = attrAsString(attrs, "DASHS", "");
- QTextStream dgv(&tmp, QIODevice::ReadOnly);
- OB->DashValues.clear();
- for (int cxv = 0; cxv < numDash; ++cxv)
- {
- QString s;
- dgv >> s;
- xf = ScCLocale::toDoubleC(s);
- OB->DashValues.append(xf);
- }
- tmp = "";
- }
- else
- OB->DashValues.clear();
- OB->DashOffset = attrAsDbl(attrs, "DASHOFF", 0.0);
-}
-
-void ScriXmlDoc::GetItemText(const QXmlStreamAttributes& attrs, StoryText& story, ScribusDoc *doc, LastStyles* last, bool VorLFound, bool impo)
-{
- CharStyle newStyle;
- QString pstylename;
- QString tmp2, tmf, tmpf, tmp3;
- tmp2 = attrAsString(attrs, "CH", "");
- tmp2.replace(QRegExp("\r"), QChar(5));
- tmp2.replace(QRegExp("\n"), QChar(5));
- tmp2.replace(QRegExp("\t"), QChar(4));
-
- ReadLegacyCStyle(attrs, newStyle, doc);
-
- QString pstyleName = attrAsString(attrs, "PSTYLE", "");
- int calign = attrAsInt(attrs, "CALIGN", -1);
- int cab = attrAsInt(attrs, "CAB", -1);
- if (cab >= 5) {
- pstylename = DoVorl[cab];
- calign = -1;
- }
- else if (cab >= 0) {
- pstylename = "";
- calign = cab;
- }
-
- for (int cxx=0; cxx<tmp2.length(); ++cxx)
- {
- CharStyle style;
- QChar ch = tmp2.at(cxx);
- if (ch == QChar(5))
- ch = SpecialChars::PARSEP;
- if (ch == QChar(4))
- ch = SpecialChars::TAB;
-
- if (impo && cab >= 0 && VorLFound)
- last->ParaStyle = DoVorl[cab];
- else
- last->ParaStyle = pstylename;
-
- int pos = story.length();
- story.insertChars(pos, QString(ch));
-
- if (newStyle != last->Style) {
- story.applyCharStyle(last->StyleStart, pos-last->StyleStart, last->Style);
- last->Style = newStyle;
- last->StyleStart = pos;
- }
- if (ch == SpecialChars::PARSEP)
- {
- ParagraphStyle pstyle;
- if (!pstyleName.isEmpty())
- pstyle.setParent(pstyleName);
- if (calign >= 0)
- pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(calign));
- story.applyStyle(pos, pstyle);
- }
- else
- story.applyCharStyle(pos, 1, style);
- }
- story.applyCharStyle(last->StyleStart, story.length()-last->StyleStart, last->Style);
- ParagraphStyle pstyle;
- pstyle.setParent( last->ParaStyle );
- if (calign >= 0)
- pstyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(calign));
- story.applyStyle(story.length()-1, pstyle);
- last->StyleStart = story.length();
-}
-
-QString ScriXmlDoc::AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc)
-{
- PrefsManager *prefsManager=PrefsManager::instance();
-// QFont fo;
- QString tmpf = fStr;
- if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
- {
- if ((!prefsManager->appPrefs.fontPrefs.GFontSub.contains(tmpf)) || (!avail[prefsManager->appPrefs.fontPrefs.GFontSub[tmpf]].usable()))
- {
- qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont *dia = new MissingFont(0, tmpf, doc);
- dia->exec();
- tmpf = dia->getReplacementFont();
- delete dia;
- qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
- prefsManager->appPrefs.fontPrefs.GFontSub[fStr] = tmpf;
- }
- else
- tmpf = prefsManager->appPrefs.fontPrefs.GFontSub[tmpf];
- ReplacedFonts[fStr] = tmpf;
- }
- if (!doc->UsedFonts.contains(tmpf))
- {
-// fo = avail[tmpf]->Font;
-// fo.setPointSize(qRound(doc->toolSettings.defSize / 10.0));
- doc->AddFont(tmpf);
- }
- DoFonts[fStr] = tmpf;
- return tmpf;
}
void ScriXmlDoc::SetItemProps(ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem* item, const QString& baseDir, bool newFormat)
@@ -605,6 +82,8 @@
writer.writeAttribute("PTYPE" ,item->realItemType());
writer.writeAttribute("XPOS" ,item->xPos() - doc->currentPage()->xOffset());
writer.writeAttribute("YPOS" ,item->yPos() - doc->currentPage()->yOffset());
+ writer.writeAttribute("gXpos" ,item->gXpos);
+ writer.writeAttribute("gYpos" ,item->gYpos);
writer.writeAttribute("WIDTH" ,item->width());
writer.writeAttribute("HEIGHT" ,item->height());
writer.writeAttribute("RADRECT" ,item->cornerRadius());
@@ -657,8 +136,6 @@
writer.writeAttribute("textPathFlipped",item->textPathFlipped ? "1" : "0");
writer.writeAttribute("FLIPPEDH" , item->imageFlippedH() ? "1" : "0");
writer.writeAttribute("FLIPPEDV" , item->imageFlippedV() ? "1" : "0");
-/* writer.writeAttribute("BBOXX",item->BBoxX);
- writer.writeAttribute("BBOXH",item->BBoxH); */
writer.writeAttribute("SCALETYPE",item->ScaleType ? "1" : "0");
writer.writeAttribute("RATIO" ,item->AspectRatio ? "1" : "0");
writer.writeAttribute("PRINTABLE",item->printEnabled() ? "1" : "0");
@@ -816,12 +293,6 @@
writer.writeAttribute("BottomLINK", "-1");
writer.writeAttribute("OwnLINK", item->ItemNr);
}
- writer.writeAttribute("isGroupControl", item->isGroupControl ? "1" : "0");
- if (item->isGroupControl)
- {
- if (item->groupsLastItem != 0)
- writer.writeAttribute("groupsLastItem", item->groupsLastItem->ItemNr - item->ItemNr);
- }
writer.writeAttribute("NUMDASH", item->DashValues.count());
QString dlp = "";
QVector<double>::Iterator dax;
@@ -845,174 +316,11 @@
colp += tmp.setNum(xf) + " " + tmpy.setNum(yf) + " ";
}
writer.writeAttribute("COCOOR" , colp);
- writer.writeAttribute("NUMGROUP", item->Groups.count());
- QString glp = "";
- QStack<int>::Iterator nx;
- for (nx = item->Groups.begin(); nx != item->Groups.end(); ++nx)
- glp += tmp.setNum((*nx)) + " ";
- writer.writeAttribute("GROUPS" , glp);
writer.writeAttribute("LANGUAGE", charStyle.language());
writer.writeAttribute("startArrowIndex", item->startArrowIndex());
writer.writeAttribute("endArrowIndex" , item->endArrowIndex());
writer.writeAttribute("startArrowScale", item->startArrowScale());
writer.writeAttribute("endArrowScale" , item->endArrowScale());
-}
-
-//CB: Private only now
-void ScriXmlDoc::GetStyle(QXmlStreamReader &reader, ParagraphStyle &vg, StyleSet<ParagraphStyle>* tempStyles, ScribusDoc* doc, bool fl)
-{
- bool fou = false;
- QString tmpf, tmf, tmV;
- double xf, xf2;
- const StyleSet<ParagraphStyle>& docParagraphStyles = tempStyles ? *tempStyles : doc->paragraphStyles();
- QString tagName = reader.name().toString();
- if (tagName != "STYLE" || !reader.isStartElement())
- return;
- QXmlStreamAttributes attrs = reader.attributes();
- vg.setName( attrAsString(attrs, "NAME", "") );
- vg.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(attrAsInt(attrs, "LINESPMode", 0)));
- if (static_cast<bool>(attrAsInt(attrs, "BASE", 0)))
- vg.setLineSpacingMode(ParagraphStyle::BaselineGridLineSpacing);
- vg.setLineSpacing( attrAsDbl(attrs, "LINESP") );
- vg.setLeftMargin( attrAsDbl(attrs, "INDENT", 0.0) );
- vg.setFirstIndent( attrAsDbl(attrs, "FIRST", 0.0) );
- vg.setAlignment(static_cast<ParagraphStyle::AlignmentType>(attrAsInt(attrs, "ALIGN", 0)));
- vg.setGapBefore( attrAsDbl(attrs, "VOR", 0.0) );
- vg.setGapAfter( attrAsDbl(attrs, "NACH", 0.0) );
- vg.setHasDropCap (static_cast<bool>(attrAsInt(attrs, "DROP", 0)));
- vg.setDropCapLines ( attrAsInt(attrs, "DROPLIN", 2) );
- vg.setDropCapOffset( attrAsDbl(attrs, "DROPDIST", 0.0) );
-
- tmpf = attrAsString(attrs, "FONT", doc->itemToolPrefs().textFont);
- if (tmpf.isEmpty())
- tmpf = doc->itemToolPrefs().textFont;
- tmf = tmpf;
- if (!DoFonts.contains(tmpf))
- tmpf = AskForFont(prefsManager->appPrefs.fontPrefs.AvailFonts, tmpf, doc);
- else
- tmpf = DoFonts[tmf];
-
- vg.charStyle().setFont(prefsManager->appPrefs.fontPrefs.AvailFonts[tmpf]);
- vg.charStyle().setFontSize(qRound(attrAsDbl(attrs, "FONTSIZE", 12.0) * 10.0));
- vg.charStyle().setFeatures(static_cast<StyleFlag>(attrAsInt(attrs, "EFFECT", 0)).featureList());
- vg.charStyle().setFillColor(attrAsString(attrs, "FCOLOR", doc->itemToolPrefs().shapeFillColor));
- vg.charStyle().setFillShade(attrAsInt(attrs, "FSHADE", 100));
- vg.charStyle().setStrokeColor(attrAsString(attrs, "SCOLOR", doc->itemToolPrefs().shapeLineColor));
- vg.charStyle().setStrokeShade(attrAsInt(attrs, "SSHADE", 100));
- vg.charStyle().setShadowXOffset(qRound(attrAsDbl(attrs, "TXTSHX", 5.0) * 10));
- vg.charStyle().setShadowYOffset(qRound(attrAsDbl(attrs, "TXTSHY", -5.0) * 10));
- vg.charStyle().setOutlineWidth(qRound(attrAsDbl(attrs, "TXTOUT", 1.0) * 10));
- vg.charStyle().setUnderlineOffset(qRound(attrAsDbl(attrs, "TXTULP", -0.1) * 10));
- vg.charStyle().setUnderlineWidth(qRound(attrAsDbl(attrs, "TXTULW", -0.1) * 10));
- vg.charStyle().setStrikethruOffset(qRound(attrAsDbl(attrs, "TXTSTP", -0.1) * 10));
- vg.charStyle().setStrikethruWidth(qRound(attrAsDbl(attrs, "TXTSTW", -0.1) * 10));
- vg.charStyle().setScaleH(qRound(attrAsDbl(attrs, "SCALEH", 100.0) * 10));
- vg.charStyle().setScaleV(qRound(attrAsDbl(attrs, "SCALEV", 100.0) * 10));
- vg.charStyle().setBaselineOffset(attrAsDbl(attrs, "BASEO", 0.0) * 10);
- vg.charStyle().setTracking(qRound(attrAsDbl(attrs, "KERN", 0.0) * 10));
-// vg.tabValues().clear();
-
- int numTab = attrAsInt(attrs, "NUMTAB", 0);
- if (numTab != 0)
- {
- QList<ParagraphStyle::TabRecord> tbs;
- ParagraphStyle::TabRecord tb;
- QString tmp = attrAsString(attrs, "TABS", "");
- QTextStream tgv(&tmp, QIODevice::ReadOnly);
- tbs.clear();
- for (int cxv = 0; cxv < numTab; cxv += 2)
- {
- QString s;
- tgv >> s;
- xf = ScCLocale::toDoubleC(s);
- tgv >> s;
- xf2 = ScCLocale::toDoubleC(s);
- tb.tabPosition = xf2;
- tb.tabType = static_cast<int>(xf);
- tb.tabFillChar = QChar();
- tbs.append(tb);
- }
- vg.setTabValues(tbs);
- tmp = "";
- }
- else
- {
- QList<ParagraphStyle::TabRecord> tbs;
- while (!reader.atEnd() && !reader.hasError())
- {
-// QXmlStreamReader::TokenType tType = reader.readNext();
- reader.readNext();
- QString tagName = reader.name().toString();
- if (tagName == "STYLE" && reader.isEndElement())
- break;
- if (tagName == "Tabs" && reader.isStartElement())
- {
- ParagraphStyle::TabRecord tb;
- QXmlStreamAttributes tabAttrs = reader.attributes();
- tb.tabPosition = attrAsDbl(tabAttrs, "Pos");
- tb.tabType = attrAsInt(tabAttrs, "Type");
- QString tbCh = attrAsString(tabAttrs, "Fill","");
- tb.tabFillChar = tbCh.isEmpty() ? QChar() : tbCh.at(0);
- tbs.append(tb);
- }
- }
- vg.setTabValues(tbs);
- }
- for (int xx=0; xx<docParagraphStyles.count(); ++xx)
- {
- if (vg.name() == docParagraphStyles[xx].name())
- {
- //Compare the attributes of the pasted styles vs existing ones
- if (vg.equiv(docParagraphStyles[xx]))
- {
- if (fl)
- {
- DoVorl[VorlC] = tmV.setNum(xx);
- VorlC++;
- }
- fou = true;
- }
- else
- {
- vg.setName("Copy of "+docParagraphStyles[xx].name());
- fou = false;
- }
- break;
- }
- }
- if (!fou)
- {
- for (int xx=0; xx< docParagraphStyles.count(); ++xx)
- {
- if (vg.equiv(docParagraphStyles[xx]))
- {
- vg.setName(docParagraphStyles[xx].name());
- fou = true;
- if (fl)
- {
- DoVorl[VorlC] = tmV.setNum(xx);
- VorlC++;
- }
- break;
- }
- }
- }
- if (!fou)
- {
- if (tempStyles)
- tempStyles->create(vg);
- else
- {
- StyleSet<ParagraphStyle> tmp;
- tmp.create(vg);
- doc->redefineStyles(tmp, false);
- }
- if (fl)
- {
- DoVorl[VorlC] = tmV.setNum(docParagraphStyles.count()-1);
- VorlC++;
- }
- }
}
bool ScriXmlDoc::ReadElemHeader(QString file, bool isFile, double *x, double *y, double *w, double *h)
@@ -1069,26 +377,6 @@
bool ScriXmlDoc::ReadElemToLayer(QString fileName, SCFonts &avail, ScribusDoc *doc, double Xp, double Yp, bool Fi, bool loc, QMap<QString,QString> &FontSub, int toLayer)
{
QString ff;
- struct CopyPasteBuffer OB;
- ParagraphStyle vg;
- QString tmp, tmpf, tmf;
- QMap<int,int> TableID;
- QMap<int,int> arrowID;
- QMap<int,int> groupMap;
- QMap<PageItem*, int> groupID;
- QMap<int, ImageLoadRequest> loadRequests;
-#ifdef HAVE_OSG
- QHash<QString, PageItem_OSGFrame::viewDefinition> viewMap;
-#endif
- QList<PageItem*> TableItems;
- ScImageEffectList imageEffects;
- bool VorLFound = false;
- bool newVersion = false;
- double GrX = 0.0, GrY = 0.0;
- int x;
- int GrMax = doc->GroupCounter;
- ScColor lf = ScColor();
-
QString fileDir = QDir::homePath();
if (Fi)
{
@@ -1111,1017 +399,14 @@
ff.replace(QChar(0), QChar(32));
ff.replace("", SpecialChars::PARSEP);
ff.replace("", SpecialChars::TAB);
-
- bool isScribusElem = false;
- QXmlStreamReader sReader(ff);
- QXmlStreamAttributes attrs;
- while (!sReader.atEnd() && !sReader.hasError())
- {
- if (sReader.readNext() == QXmlStreamReader::StartElement)
- {
- QStringRef tName = sReader.name();
- if (tName == "SCRIBUSELEM" || tName == "SCRIBUSELEMUTF8")
- {
- QXmlStreamAttributes attrs = sReader.attributes();
- if (!loc)
- {
- GrX = ScCLocale::toDoubleC(attrs.value("XP").toString());
- GrY = ScCLocale::toDoubleC(attrs.value("YP").toString());
- }
- if (!attrs.value("Version").isEmpty())
- newVersion = true;
- isScribusElem = true;
- break;
- }
- }
- }
- if (!isScribusElem || sReader.hasError())
- return false;
-
- DoFonts.clear();
- DoFonts[doc->itemToolPrefs().textFont] = doc->itemToolPrefs().textFont;
- DoVorl.clear();
- DoVorl[0] = "0";
- DoVorl[1] = "1";
- DoVorl[2] = "2";
- DoVorl[3] = "3";
- DoVorl[4] = "4";
- VorlC = 5;
- TableItems.clear();
- TableID.clear();
- arrowID.clear();
- QString CurDirP = QDir::currentPath();
- QDir::setCurrent(QDir::homePath());
- int startNumArrows = doc->arrowStyles().count();
- while (!sReader.atEnd() && !sReader.hasError())
- {
- if (sReader.readNext() != QXmlStreamReader::StartElement)
- continue;
- QString tagName = sReader.name().toString();
- attrs = sReader.attributes();
- if( tagName == "Arrows")
- {
- QString attIndex = attrs.value("Index").toString();
- if (attIndex.toInt() > startNumArrows)
- {
- struct ArrowDesc arrow;
- double xa, ya;
- arrow.name = attrs.value("Name").toString();
- arrow.userArrow = true;
- QString tmp = attrs.value("Points").toString();
- QTextStream fp(&tmp, QIODevice::ReadOnly);
- uint numPoints = attrs.value("NumPoints").toString().toUInt();
- for (uint cx = 0; cx < numPoints; ++cx)
- {
- QString xs;
- fp >> xs;
- xa = ScCLocale::toDoubleC(xs);
- fp >> xs;
- ya = ScCLocale::toDoubleC(xs);
- arrow.points.addPoint(xa, ya);
- }
- doc->arrowStyles().append(arrow);
- arrowID.insert(attIndex.toInt(), doc->arrowStyles().count());
- }
- else
- arrowID.insert(attIndex.toInt(), attIndex.toInt());
- }
- if ( tagName == "FONT" )
- {
- QString attName = attrs.value("NAME").toString();
- tmpf = attName;
- if ((!avail.contains(tmpf)) || (!avail[tmpf].usable()))
- {
- if (!FontSub.contains(tmpf) || (!avail[FontSub[tmpf]].usable()))
- {
- MissingFont *dia = new MissingFont(0, tmpf, doc);
- dia->exec();
- tmpf = dia->getReplacementFont();
- FontSub[attName] = tmpf;
- delete dia;
- }
- else
- tmpf = FontSub[tmpf];
- }
-// fo = avail[tmpf]->Font;
-// fo.setPointSize(qRound(doc->toolSettings.defSize / 10.0));
- if(!doc->UsedFonts.contains(tmpf))
- doc->AddFont(tmpf);
- DoFonts[attName] = tmpf;
- }
- // 10/25/2004 pv - None is "reserved" color. cannot be defined in any file...
- if ( tagName=="COLOR" && attrs.value("NAME")!=CommonStrings::None )
- {
- QString colName = attrs.value("NAME").toString();
- if (!attrs.value("CMYK").isEmpty())
- lf.setNamedColor(attrs.value("CMYK").toString());
- else
- lf.fromQColor(QColor(attrs.value("RGB").toString()));
- lf.setSpotColor( attrAsBool(attrs, "Spot", false) );
- lf.setRegistrationColor( attrAsBool(attrs, "Register", false) );
- if (!doc->PageColors.contains(colName))
- doc->PageColors[colName] = lf;
- }
- if (tagName=="MultiLine")
- {
- multiLine ml;
- SingleLine sl;
- QString mlName = attrs.value("Name").toString();
- while(!(sReader.isEndElement() && sReader.name() == tagName))
- {
- if (sReader.readNext() != QXmlStreamReader::StartElement)
- continue;
- QString tagName1 = sReader.name().toString();
- QXmlStreamAttributes attrs1 = sReader.attributes();
- if (tagName1 == "SubLine")
- {
- sl.Color = attrs1.value("Color").toString();
- sl.Dash = attrAsInt(attrs1, "Dash");
- sl.LineEnd = attrAsInt(attrs1, "LineEnd");
- sl.LineJoin = attrAsInt(attrs1, "LineJoin");
- sl.Shade = attrAsInt(attrs1, "Shade");
- sl.Width = attrAsDbl(attrs1, "Width");
- ml.push_back(sl);
- }
- }
- if (!doc->MLineStyles.contains(mlName))
- doc->MLineStyles.insert(mlName, ml);
- }
- if (tagName == "Gradient")
- {
- VGradient gra;
- QString grName = attrs.value("Name").toString();
- gra = VGradient(VGradient::linear);
- gra.clearStops();
- while(!(sReader.isEndElement() && sReader.name() == tagName))
- {
- if (sReader.readNext() != QXmlStreamReader::StartElement)
- continue;
- QString tagName1 = sReader.name().toString();
- QXmlStreamAttributes attrs1 = sReader.attributes();
- if (tagName1 == "CSTOP")
- {
- QString name = attrs1.value("NAME").toString();
- double ramp = ScCLocale::toDoubleC(attrs1.value("RAMP").toString());
- double opa = ScCLocale::toDoubleC(attrs1.value("TRANS").toString());
- int shade = attrAsInt(attrs1, "SHADE");
- gra.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade);
- }
- }
- if (!doc->docGradients.contains(grName))
- doc->docGradients.insert(grName, gra);
- }
- if (tagName=="STYLE")
- {
- GetStyle(sReader, vg, NULL, doc, true);
- VorLFound = true;
- }
- if (tagName=="Pattern")
- {
- ScPattern pat;
-// uint ac = doc->Items->count();
- QString patFile = Fi ? fileName : QString();
- ReadPattern(sReader, doc, patFile, GrMax, VorLFound, newVersion);
-
- }
- }
-
- sReader.clear();
- sReader.addData(ff);
-
- bool inItem = false;
- bool isGroupControl = false;
- bool doOverprint = false;
- int groupsLastItem = 0;
- int itemOwnLink = 0;
- QString itemClip;
- StoryText storyText;
- LastStyles lastStyles;
- int LatexDPI = 0;
- bool LatexPream = true;
- QString LatexConfig;
- bool inlineF = false;
- QByteArray inlineImageData;
- QString inlineImageExt;
- int lowResType = 1;
- int actualPageNumber = 0;
- int mGArrayRows = 0;
- int mGArrayCols = 0;
- QString modelFile;
- QString currentView;
- QString gradName;
- QString StrokePattern;
- double patternScaleXS = 1.0;
- double patternScaleYS = 1.0;
- double patternOffsetXS = 0.0;
- double patternOffsetYS = 0.0;
- double patternRotationS = 0.0;
- double patternSkewXS = 0.0;
- double patternSkewYS = 0.0;
- double patternSpace = 0.0;
- bool patternMirrorX = false;
- bool patternMirrorY = false;
- bool atPath = false;
- QString gradNameS;
- QString gradNameM;
- while(!sReader.atEnd() && !sReader.hasError())
- {
- sReader.readNext();
- QString tagName = sReader.name().toString();
- QXmlStreamAttributes attrs = sReader.attributes();
- if (sReader.isStartElement() && tagName == "ITEM")
- {
- inItem = true;
- imageEffects.clear();
- loadRequests.clear();
- storyText = StoryText(doc);
- lastStyles = LastStyles();
- GetItemProps(attrs, &OB, fileDir, newVersion);
- OB.meshGradientArray.clear();
- for (int mgr = 0; mgr < OB.mGArrayRows; mgr++)
- {
- QList<meshPoint> ml;
- for (int mgc = 0; mgc < OB.mGArrayCols; mgc++)
- {
- meshPoint mp;
- ml.append(mp);
- }
- OB.meshGradientArray.append(ml);
- }
- OB.Xpos = Xp + attrAsDbl(attrs, "XPOS", 0.0) - GrX;
- OB.Ypos = Yp + attrAsDbl(attrs, "YPOS", 0.0) - GrY;
- OB.startArrowIndex = arrowID[ attrAsInt(attrs, "startArrowIndex", 0) ];
- OB.endArrowIndex = arrowID[ attrAsInt(attrs, "endArrowIndex", 0)];
- OB.isBookmark = attrAsInt(attrs, "BOOKMARK");
- OB.NamedLStyle = attrAsString(attrs, "NAMEDLST", "");
- gradName = attrAsString(attrs, "GRNAME", "");
- gradNameS = attrAsString(attrs, "GRNAMES", "");
- gradNameM = attrAsString(attrs, "GRNAMEM", "");
- isGroupControl = attrAsBool(attrs, "isGroupControl", false);
- doOverprint = attrAsBool(attrs, "doOverprint", false);
- groupsLastItem = attrAsInt (attrs, "groupsLastItem", 0);
- itemOwnLink = attrAsInt (attrs, "OwnLINK", 0);
- itemClip = attrAsString(attrs, "ImageClip", "");
- lowResType = attrAsInt (attrs, "ImageRes", 1);
- actualPageNumber = attrAsInt (attrs, "Pagenumber", 0);
- inlineF = attrAsBool(attrs, "isInlineImage", false);
- inlineImageData.resize(0);
- QString dat = attrAsString(attrs, "ImageData", "");
- inlineImageData.append(dat);
- inlineImageExt = attrAsString(attrs, "inlineImageExt", "");
- if (!doc->MLineStyles.contains(OB.NamedLStyle))
- OB.NamedLStyle = "";
- OB.itemText = "";
- OB.textAlignment = attrAsInt(attrs, "ALIGN", 0);
- tmf = attrAsString(attrs, "IFONT", doc->itemToolPrefs().textFont);
- if (tmf.isEmpty())
- tmf = doc->itemToolPrefs().textFont;
- if (DoFonts[tmf].isEmpty())
- OB.IFont = doc->itemToolPrefs().textFont;
- else
- OB.IFont = DoFonts[tmf];
- // #7725
- OB.LayerID = toLayer;
- OB.Language = attrAsString(attrs, "LANGUAGE", doc->hyphLanguage());
- tmp = "";
- int numGroup = attrAsInt(attrs, "NUMGROUP", 0);
- if ((!attrs.value("GROUPS").isEmpty()) && (numGroup > 0))
- {
- QMap<int, int>::ConstIterator gIt;
- tmp = attrAsString(attrs, "GROUPS", "");
- QTextStream fg(&tmp, QIODevice::ReadOnly);
- OB.Groups.clear();
- for (int cx = 0; cx < numGroup; ++cx)
- {
- fg >> x;
- gIt = groupMap.find(x);
- if (gIt != groupMap.end())
- OB.Groups.push(gIt.value());
- else
- {
- OB.Groups.push(GrMax + 1);
- groupMap.insert(x, GrMax + 1);
- GrMax = qMax(GrMax + 1, doc->GroupCounter + 1);
- }
- }
- tmp = "";
- }
- else
- OB.Groups.clear();
- tmp = "";
- LatexDPI = attrAsInt (attrs, "LatexDpi", 0);
- LatexPream = attrAsBool(attrs, "LatexUsePreamble", true);
- LatexConfig = attrAsString(attrs, "LatexConfig", "");
- modelFile = attrAsString(attrs, "modelFile", "");
- currentView = attrAsString(attrs, "currentViewName", "");
- StrokePattern = attrAsString(attrs, "patternS", "");
- patternScaleXS = attrAsDbl(attrs, "pScaleXS", 100.0);
- patternScaleYS = attrAsDbl(attrs, "pScaleYS", 100.0);
- patternOffsetXS = attrAsDbl(attrs, "pOffsetXS", 0.0);
- patternOffsetYS = attrAsDbl(attrs, "pOffsetYS", 0.0);
- patternRotationS = attrAsDbl(attrs, "pRotationS", 0.0);
- patternSkewXS = attrAsDbl(attrs, "pSkewXS", 0.0);
- patternSkewYS = attrAsDbl(attrs, "pSkewYS", 0.0);
- patternSpace = attrAsDbl(attrs, "pSpaceS", 0.0);
- patternMirrorX = attrAsBool(attrs, "pMirrorXS", false);
- patternMirrorY = attrAsBool(attrs, "pMirrorYS", false);
- atPath = attrAsBool(attrs, "pAtPathS", false);
- }
- if (inItem && sReader.isStartElement() && tagName == "ITEXT")
- {
- GetItemText(sReader.attributes(), storyText, doc, &lastStyles, VorLFound, true);
-// continue;
- }
- if (inItem && sReader.isStartElement() && tagName == "var")
- {
- QString varName=attrAsString(attrs, "name", "");
- if (varName == "pgno")
- storyText.insertChars(storyText.length(), SpecialChars::PAGENUMBER);
- else
- storyText.insertChars(storyText.length(), SpecialChars::PAGECOUNT);
- CharStyle newStyle;
- ReadLegacyCStyle(attrs, newStyle, doc);
- storyText.setCharStyle(storyText.length()-1, 1, newStyle);
- lastStyles.StyleStart = storyText.length()-1;
- lastStyles.Style = newStyle;
- }
- if (inItem && sReader.isStartElement() && tagName == "PARA")
- {
- storyText.insertChars(storyText.length(), SpecialChars::PARSEP);
- ParagraphStyle newStyle;
-// PrefsManager* prefsManager=PrefsManager::instance();
- ReadPStyle(sReader, newStyle, doc);
- storyText.setStyle(storyText.length()-1, newStyle);
- storyText.setCharStyle(storyText.length()-1, 1, lastStyles.Style);
- }
- if (inItem && sReader.isStartElement() && tagName == "LATEX-SOURCE")
- {
- OB.itemText = sReader.readElementText();
- }
- if (inItem && sReader.isStartElement() && tagName == "ImageEffect")
- {
- struct ImageEffect ef;
- ef.effectParameters = attrAsString(attrs, "Param", "");
- ef.effectCode = attrAsInt(attrs, "Code");
- imageEffects.append(ef);
- }
- if (inItem && sReader.isStartElement() && tagName == "PSDLayer")
- {
- struct ImageLoadRequest loadingInfo;
- loadingInfo.blend = attrAsString(attrs, "Blend", "");
- loadingInfo.opacity = attrAsInt(attrs, "Opacity", 1);
- loadingInfo.visible = attrAsBool(attrs, "Visible", true);
- loadingInfo.useMask = attrAsBool(attrs, "useMask", true);
- loadRequests.insert( attrAsInt(attrs, "Layer"), loadingInfo);
- }
-#ifdef HAVE_OSG
- if (inItem && sReader.isStartElement() && tagName == "OSGViews")
- {
- struct PageItem_OSGFrame::viewDefinition currentView;
- currentView.angleFOV = attrAsDbl(attrs, "angleFOV", 0.0);
- QString tmp = "";
- tmp = attrAsString(attrs, "trackM", "");
- ScTextStream fp(&tmp, QIODevice::ReadOnly);
- double m1, m2, m3, m4;
- double m5, m6, m7, m8;
- double m9, m10, m11, m12;
- double m13, m14, m15, m16;
- fp >> m1 >> m2 >> m3 >> m4;
- fp >> m5 >> m6 >> m7 >> m8;
- fp >> m9 >> m10 >> m11 >> m12;
- fp >> m13 >> m14 >> m15 >> m16;
- currentView.trackerMatrix.set(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13, m14, m15, m16);
- tmp = "";
- tmp = attrAsString(attrs, "trackC", "");
- ScTextStream fp2(&tmp, QIODevice::ReadOnly);
- double v1, v2, v3;
- fp2 >> v1 >> v2 >> v3;
- currentView.trackerCenter.set(v1, v2, v3);
- tmp = "";
- tmp = attrAsString(attrs, "cameraP", "");
- ScTextStream fp3(&tmp, QIODevice::ReadOnly);
- fp3 >> v1 >> v2 >> v3;
- currentView.cameraPosition.set(v1, v2, v3);
- tmp = "";
- tmp = attrAsString(attrs, "cameraU", "");
- ScTextStream fp4(&tmp, QIODevice::ReadOnly);
- fp4 >> v1 >> v2 >> v3;
- currentView.cameraUp.set(v1, v2, v3);
- currentView.trackerDist = attrAsDbl(attrs, "trackerDist", 0.0);
- currentView.trackerSize = attrAsDbl(attrs, "trackerSize", 0.0);
- currentView.illumination = static_cast<PageItem_OSGFrame::LightType>(attrAsInt(attrs, "illumination", 1));
- currentView.rendermode = static_cast<PageItem_OSGFrame::RenderType>(attrAsInt(attrs, "rendermode", 0));
- currentView.addedTransparency = attrAsDbl(attrs, "trans", 0.5);
- currentView.colorAC = QColor(attrAsString(attrs, "colorAC", ""));
- currentView.colorFC = QColor(attrAsString(attrs, "colorFC", ""));
- viewMap.insert(attrAsString(attrs, "viewName", ""), currentView);
- }
-#endif
- if (inItem && sReader.isStartElement() && tagName == "CSTOP")
- {
- QString name = attrAsString(attrs, "NAME", "");
- double ramp = attrAsDbl(attrs, "RAMP", 0.0);
- int shade = attrAsInt(attrs, "SHADE", 100);
- double opa = attrAsDbl(attrs, "TRANS", 1.0);
- OB.fill_gradient.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade);
- OB.GrColor = "";
- OB.GrColor2 = "";
- }
- if (inItem && sReader.isStartElement() && tagName == "S_CSTOP")
- {
- QString name = attrAsString(attrs, "NAME", "");
- double ramp = attrAsDbl(attrs, "RAMP", 0.0);
- int shade = attrAsInt(attrs, "SHADE", 100);
- double opa = attrAsDbl(attrs, "TRANS", 1.0);
- OB.stroke_gradient.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade);
- OB.GrColor = "";
- OB.GrColor2 = "";
- }
- if (inItem && sReader.isStartElement() && tagName == "M_CSTOP")
- {
- QString name = attrAsString(attrs, "NAME", "");
- double ramp = attrAsDbl(attrs, "RAMP", 0.0);
- int shade = attrAsInt(attrs, "SHADE", 100);
- double opa = attrAsDbl(attrs, "TRANS", 1.0);
- OB.mask_gradient.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade);
- }
- if (inItem && sReader.isStartElement() && tagName == "MPoint")
- {
- meshPoint mp;
- mp.colorName = attrAsString(attrs, "NAME", "");
- mp.shade = attrAsInt(attrs, "SHADE", 100);
- mp.transparency = attrAsDbl(attrs, "TRANS", 1.0);
- mp.gridPoint = FPoint(attrAsDbl(attrs, "GX", 0.0), attrAsDbl(attrs, "GY", 0.0));
- mp.controlTop = FPoint(attrAsDbl(attrs, "CTX", 0.0), attrAsDbl(attrs, "CTY", 0.0));
- mp.controlBottom = FPoint(attrAsDbl(attrs, "CBX", 0.0), attrAsDbl(attrs, "CBY", 0.0));
- mp.controlLeft = FPoint(attrAsDbl(attrs, "CLX", 0.0), attrAsDbl(attrs, "CLY", 0.0));
- mp.controlRight = FPoint(attrAsDbl(attrs, "CRX", 0.0), attrAsDbl(attrs, "CRY", 0.0));
- mp.color = SetColor(doc, mp.colorName, mp.shade);
- mp.color.setAlphaF(mp.transparency);
- OB.meshGradientArray[mGArrayRows][mGArrayCols] = mp;
- mGArrayCols++;
- if (mGArrayCols == OB.mGArrayCols)
- {
- mGArrayCols = 0;
- mGArrayRows++;
- }
- }
- if (inItem && sReader.isStartElement() && tagName == "Tabs")
- {
- ParagraphStyle::TabRecord tb;
- tb.tabPosition = attrAsDbl(attrs, "Pos", 0.0);
- tb.tabType = attrAsInt(attrs,"Type");
- QStringRef tbCh = attrs.value("Fill");
- if (tbCh.isEmpty())
- tb.tabFillChar = QChar();
- else
- tb.tabFillChar = tbCh.at(0);
- OB.TabValues.append(tb);
- }
- if (inItem && Fi && attrAsBool(attrs, "relativePaths", false))
- {
- if (!OB.Pfile.isEmpty())
- {
- QFileInfo pfi(fileName);
- QString test = QDir::cleanPath(QDir::convertSeparators(pfi.absolutePath()+"/"+OB.Pfile));
- QFileInfo pfi2(test);
- OB.Pfile = pfi2.absoluteFilePath();
- }
- if (!OB.Pfile2.isEmpty())
- {
- QFileInfo pfi(fileName);
- QString test = QDir::cleanPath(QDir::convertSeparators(pfi.absolutePath()+"/"+OB.Pfile2));
- QFileInfo pfi2(test);
- OB.Pfile2 = pfi2.absoluteFilePath();
- }
- if (!OB.Pfile3.isEmpty())
- {
- QFileInfo pfi(fileName);
- QString test = QDir::cleanPath(QDir::convertSeparators(pfi.absolutePath()+"/"+OB.Pfile3));
- QFileInfo pfi2(test);
- OB.Pfile3 = pfi2.absoluteFilePath();
- }
- if (!modelFile.isEmpty())
- {
- QFileInfo pfi(fileName);
- QString test = QDir::cleanPath(QDir::convertSeparators(pfi.absolutePath()+"/"+modelFile));
- QFileInfo pfi2(test);
- modelFile = pfi2.absoluteFilePath();
- }
- }
- if (sReader.isEndElement() && (tagName == "ITEM"))
- {
- LastStyles lastStyle;
- doc->PasteItem(&OB, true, false);
- PageItem* Neu = doc->Items->at(doc->Items->count()-1);
- Neu->OverrideCompressionMethod = OB.OverrideCompressionMethod;
- Neu->OverrideCompressionQuality = OB.OverrideCompressionQuality;
- Neu->CompressionMethodIndex = OB.CompressionMethodIndex;
- Neu->CompressionQualityIndex = OB.CompressionQualityIndex;
- Neu->setGradient(gradName);
- Neu->setStrokeGradient(gradNameS);
- Neu->setGradientMask(gradNameM);
- Neu->doOverprint = doOverprint;
- Neu->setStrokePattern(StrokePattern);
- Neu->setStrokePatternTransform(patternScaleXS, patternScaleYS, patternOffsetXS, patternOffsetYS, patternRotationS, patternSkewXS, patternSkewYS, patternSpace);
- Neu->setStrokePatternFlip(patternMirrorX, patternMirrorY);
- Neu->setStrokePatternToPath(atPath);
- storyText.setDefaultStyle(Neu->itemText.defaultStyle());
- if (Neu->asLatexFrame())
- {
- PageItem_LatexFrame *latexitem = Neu->asLatexFrame();
- latexitem->setConfigFile(LatexConfig);
- latexitem->setDpi(LatexDPI);
- latexitem->setUsePreamble(LatexPream);
- }
- if (Neu->asImageFrame() && inlineF)
- {
- if (inlineImageData.size() > 0)
- {
- Neu->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + inlineImageExt);
- Neu->tempImageFile->open();
- QString fileName = getLongPathName(Neu->tempImageFile->fileName());
- Neu->tempImageFile->close();
- Neu->isInlineImage = true;
- Neu->Pfile = fileName;
- inlineImageData = qUncompress(QByteArray::fromBase64(inlineImageData));
- QFile outFil(fileName);
- if (outFil.open(QIODevice::WriteOnly))
- {
- outFil.write(inlineImageData);
- outFil.close();
- Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
- Neu->setImageXYOffset(OB.LocalX, OB.LocalY);
- Neu->setImageRotation(OB.LocalRot);
- Neu->IProfile = OB.IProfile;
- Neu->EmProfile = OB.EmProfile;
- Neu->IRender = OB.IRender;
- Neu->UseEmbedded = OB.UseEmbedded;
- if (!Neu->Pfile.isEmpty())
- doc->LoadPict(Neu->Pfile, doc->Items->count()-1);
- Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
- Neu->setImageShown(OB.PicArt);
- Neu->ScaleType = OB.ScaleType;
- Neu->AspectRatio = OB.AspectRatio;
- }
- }
- }
-#ifdef HAVE_OSG
- if (Neu->asOSGFrame())
- {
- PageItem_OSGFrame *osgframe = Neu->asOSGFrame();
- osgframe->modelFile = modelFile;
- osgframe->currentView = currentView;
- osgframe->viewMap = viewMap;
- osgframe->loadModel();
- }
-#endif
- Neu->itemText = storyText;
- Neu->effectsInUse = imageEffects;
- Neu->pixm.imgInfo.RequestProps = loadRequests;
- Neu->pixm.imgInfo.isRequest = (loadRequests.count() > 0);
- Neu->pixm.imgInfo.lowResType = lowResType;
- Neu->pixm.imgInfo.actualPageNumber = actualPageNumber;
- if ((Neu->effectsInUse.count() != 0) || (Neu->pixm.imgInfo.RequestProps.count() != 0) || (doc->itemToolPrefs().imageLowResType != lowResType))
- doc->LoadPict(Neu->Pfile, Neu->ItemNr, true);
- if (Neu->pixm.imgInfo.PDSpathData.contains(itemClip))
- {
- Neu->imageClip = Neu->pixm.imgInfo.PDSpathData[itemClip].copy();
- Neu->pixm.imgInfo.usedPath = itemClip;
- QTransform cl;
- cl.translate(Neu->imageXOffset()*Neu->imageXScale(), Neu->imageYOffset()*Neu->imageYScale());
- cl.rotate(Neu->imageRotation());
- cl.scale(Neu->imageXScale(), Neu->imageYScale());
- Neu->imageClip.map(cl);
- }
- if (Neu->isTableItem)
- {
- TableItems.append(Neu);
- TableID.insert(itemOwnLink, Neu->ItemNr);
- }
- Neu->isGroupControl = isGroupControl;
- if (Neu->isGroupControl)
- groupID.insert(Neu, groupsLastItem + Neu->ItemNr );
- if (Neu->asPathText())
- Neu->updatePolyClip();
- imageEffects.clear();
- loadRequests.clear();
-#ifdef HAVE_OSG
- viewMap.clear();
-#endif
- inItem = false;
- }
- }
- if (TableItems.count() != 0)
- {
- for (int ttc = 0; ttc < TableItems.count(); ++ttc)
- {
- PageItem* ta = TableItems.at(ttc);
- if (ta->TopLinkID != -1)
- ta->TopLink = doc->Items->at(TableID[ta->TopLinkID]);
- else
- ta->TopLink = 0;
- if (ta->LeftLinkID != -1)
- ta->LeftLink = doc->Items->at(TableID[ta->LeftLinkID]);
- else
- ta->LeftLink = 0;
- if (ta->RightLinkID != -1)
- ta->RightLink = doc->Items->at(TableID[ta->RightLinkID]);
- else
- ta->RightLink = 0;
- if (ta->BottomLinkID != -1)
- ta->BottomLink = doc->Items->at(TableID[ta->BottomLinkID]);
- else
- ta->BottomLink = 0;
- }
- }
- if (groupID.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupID.begin(); it != groupID.end(); ++it)
- {
- if (it.value() >= doc->Items->count())
- {
- it.key()->isGroupControl = false;
- continue;
- }
- it.key()->groupsLastItem = doc->Items->at(it.value());
- }
- }
- doc->GroupCounter = GrMax + 1;
- QDir::setCurrent(CurDirP);
- return (!sReader.hasError());
-}
-
-void ScriXmlDoc::ReadPattern(QXmlStreamReader &reader, ScribusDoc *doc, const QString& fileName, int& GrMax, bool styleFound, bool newVersion)
-{
- QString tmp, tmpf, tmf;
- QList<PageItem*> TableItems;
- QMap<int, ImageLoadRequest> loadRequests;
- QMap<int,int> TableID;
- QMap<int,int> arrowID;
- QMap<int, int> groupMap;
- QMap<PageItem*, int> groupID;
- ScImageEffectList imageEffects;
- ScPattern pat;
- struct CopyPasteBuffer OB;
- bool savedAlignGrid = doc->useRaster;
- bool savedAlignGuides = doc->SnapGuides;
- bool isGroupControl = false;
- bool doOverprint = false;
- bool isFile = !fileName.isEmpty();
- doc->useRaster = false;
- doc->SnapGuides = false;
- QXmlStreamAttributes attrs = reader.attributes();
- QString patClipPath;
- QString patName = attrs.value("Name").toString();
- double patScaleX = attrAsDbl(attrs, "scaleX", 0.0);
- double patScaleY = attrAsDbl(attrs, "scaleY", 0.0);
- double patWidth = attrAsDbl(attrs, "width", 0.0);
- double patHeight = attrAsDbl(attrs, "height", 0.0);
- double patxoffset = attrAsDbl(attrs, "xoffset", 0.0);
- double patyoffset = attrAsDbl(attrs, "yoffset", 0.0);
- int patOwnLink = 0;
- int groupsLastItem = 0;
- int x = doc->GroupCounter;
- uint ac = doc->Items->count();
- QString fileDir = QDir::homePath();
- StoryText storyText;
- LastStyles lastStyles;
- int LatexDPI = 0;
- bool LatexPream = true;
- QString LatexConfig;
- bool inlineF = false;
- QByteArray inlineImageData;
- QString inlineImageExt;
- QString gradName;
- QString StrokePattern;
- double patternScaleXS = 1.0;
- double patternScaleYS = 1.0;
- double patternOffsetXS = 0.0;
- double patternOffsetYS = 0.0;
- double patternRotationS = 0.0;
- double patternSkewXS = 0.0;
- double patternSkewYS = 0.0;
- double patternSpace = 0.0;
- bool patternMirrorXS = false;
- bool patternMirrorYS = false;
- bool atPath = false;
- QString gradNameS;
- QString gradNameM;
- int lowResType = 1;
- int actualPageNumber = 0;
- while(!reader.atEnd() && !reader.hasError())
- {
- reader.readNext();
- if (reader.hasError())
- break;
- QString tagName1 = reader.name().toString();
- QXmlStreamAttributes attrs1 = reader.attributes();
-
- if (tagName1 == "PatternItem" && reader.isStartElement())
- {
- loadRequests.clear();
- imageEffects.clear();
- storyText = StoryText(doc);
- lastStyles = LastStyles();
- GetItemProps(attrs1, &OB, fileDir, newVersion);
- patClipPath = attrs1.value("ImageClip").toString();
- lowResType = attrAsInt (attrs1, "ImageRes", 1);
- actualPageNumber = attrAsInt (attrs1, "Pagenumber", 0);
- gradName = attrAsString(attrs1, "GRNAME", "");
- gradNameS = attrAsString(attrs1, "GRNAMES", "");
- gradNameM = attrAsString(attrs1, "GRNAMEM", "");
- StrokePattern = attrAsString(attrs, "patternS", "");
- patternScaleXS = attrAsDbl(attrs, "pScaleXS", 100.0);
- patternScaleYS = attrAsDbl(attrs, "pScaleYS", 100.0);
- patternOffsetXS = attrAsDbl(attrs, "pOffsetXS", 0.0);
- patternOffsetYS = attrAsDbl(attrs, "pOffsetYS", 0.0);
- patternRotationS = attrAsDbl(attrs, "pRotationS", 0.0);
- patternSkewXS = attrAsDbl(attrs, "pSkewXS", 0.0);
- patternSkewYS = attrAsDbl(attrs, "pSkewYS", 0.0);
- patternSpace = attrAsDbl(attrs, "pSpaceS", 0.0);
- patternMirrorXS = attrAsBool(attrs, "pMirrorXS", false);
- patternMirrorYS = attrAsBool(attrs, "pMirrorYS", false);
- atPath = attrAsBool(attrs, "pAtPathS", false);
- inlineF = attrAsBool(attrs1, "isInlineImage", false);
- inlineImageData.resize(0);
- QString dat = attrAsString(attrs1, "ImageData", "");
- inlineImageData.append(dat);
- inlineImageExt = attrAsString(attrs1, "inlineImageExt", "");
- patOwnLink = attrAsInt(attrs1, "OwnLINK", 0);
- isGroupControl = attrAsBool(attrs1, "isGroupControl", false);
- doOverprint = attrAsBool(attrs, "doOverprint", false);
- groupsLastItem = attrAsInt(attrs1, "groupsLastItem", 0);
- OB.Xpos = attrAsDbl(attrs1, "XPOS") + doc->currentPage()->xOffset();
- OB.Ypos = attrAsDbl(attrs1, "YPOS") + doc->currentPage()->yOffset();
- OB.startArrowIndex = arrowID[ attrAsInt(attrs1, "startArrowIndex", 0) ];
- OB.endArrowIndex = arrowID[ attrAsInt(attrs1, "endArrowIndex", 0)];
- OB.startArrowScale = attrAsInt(attrs1, "startArrowScale", 100);
- OB.endArrowScale = attrAsInt(attrs1, "endArrowScale", 100);
- OB.isBookmark = attrAsInt(attrs1, "BOOKMARK");
- OB.NamedLStyle = attrs1.value("NAMEDLST").toString();
- if (!doc->MLineStyles.contains(OB.NamedLStyle))
- OB.NamedLStyle = "";
- OB.itemText = "";
- OB.textAlignment = attrAsInt(attrs1, "ALIGN");
- tmf = attrAsString(attrs1, "IFONT", doc->itemToolPrefs().textFont);
- if (tmf.isEmpty())
- tmf = doc->itemToolPrefs().textFont;
- if (DoFonts[tmf].isEmpty())
- OB.IFont = doc->itemToolPrefs().textFont;
- else
- OB.IFont = DoFonts[tmf];
- OB.LayerID = attrAsInt(attrs1, "LAYER");
- OB.Language = attrAsString(attrs1, "LANGUAGE", doc->hyphLanguage());
- tmp = "";
- int numGroup = attrAsInt(attrs1, "NUMGROUP", 0);
- if ((!attrs1.value("GROUPS").isEmpty()) && (numGroup > 0))
- {
- QMap<int, int>::ConstIterator gIt;
- tmp = attrAsString(attrs1, "GROUPS", "");
- QTextStream fg(&tmp, QIODevice::ReadOnly);
- OB.Groups.clear();
- for (int cx = 0; cx < numGroup; ++cx)
- {
- fg >> x;
- gIt = groupMap.find(x);
- if (gIt != groupMap.end())
- OB.Groups.push(gIt.value());
- else
- {
- OB.Groups.push(GrMax + 1);
- groupMap.insert(x, GrMax + 1);
- GrMax = qMax(GrMax + 1, doc->GroupCounter + 1);
- }
- }
- tmp = "";
- }
- else
- OB.Groups.clear();
- tmp.clear();
- LatexDPI = attrAsInt (attrs1, "LatexDpi", 0);
- LatexPream = attrAsBool(attrs1, "LatexUsePreamble", true);
- LatexConfig = attrAsString(attrs1, "LatexConfig", "");
- }
- if (tagName1 == "ITEXT" && reader.isStartElement())
- {
- GetItemText(reader.attributes(), storyText, doc, &lastStyles, styleFound, true);
- }
- if (tagName1 == "ImageEffect" && reader.isStartElement())
- {
- struct ImageEffect ef;
- ef.effectParameters = attrAsString(attrs1, "Param", "");
- ef.effectCode = attrAsInt(attrs1, "Code");
- imageEffects.append(ef);
- }
- if (tagName1 == "PSDLayer" && reader.isStartElement())
- {
- struct ImageLoadRequest loadingInfo;
- loadingInfo.blend = attrAsString(attrs1, "Blend", "");
- loadingInfo.opacity = attrAsInt(attrs1, "Opacity", 1);
- loadingInfo.visible = attrAsBool(attrs, "Visible", false);
- loadingInfo.useMask = attrAsBool(attrs, "useMask", true);
- loadRequests.insert( attrAsInt(attrs1, "Layer"), loadingInfo);
- }
- if (tagName1 == "CSTOP" && reader.isStartElement())
- {
- QString name = attrs1.value("NAME").toString();
- double ramp = attrAsDbl(attrs1, "RAMP", 0.0);
- int shade = attrAsInt(attrs1, "SHADE", 100);
- double opa = attrAsDbl(attrs1, "TRANS", 1.0);
- OB.fill_gradient.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade);
- OB.GrColor = "";
- OB.GrColor2 = "";
- }
- if (tagName1 == "S_CSTOP" && reader.isStartElement())
- {
- QString name = attrs1.value("NAME").toString();
- double ramp = attrAsDbl(attrs1, "RAMP", 0.0);
- int shade = attrAsInt(attrs1, "SHADE", 100);
- double opa = attrAsDbl(attrs1, "TRANS", 1.0);
- OB.stroke_gradient.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade);
- OB.GrColor = "";
- OB.GrColor2 = "";
- }
- if (tagName1 == "M_CSTOP" && reader.isStartElement())
- {
- QString name = attrs1.value("NAME").toString();
- double ramp = attrAsDbl(attrs1, "RAMP", 0.0);
- int shade = attrAsInt(attrs1, "SHADE", 100);
- double opa = attrAsDbl(attrs1, "TRANS", 1.0);
- OB.mask_gradient.addStop(SetColor(doc, name, shade), ramp, 0.5, opa, name, shade);
- }
- if (tagName1=="Tabs" && reader.isStartElement())
- {
- ParagraphStyle::TabRecord tb;
- tb.tabPosition = attrAsDbl(attrs1, "Pos");
- tb.tabType = attrAsInt(attrs1, "Type");
- QStringRef tbCh = attrs1.value("Fill");
- if (tbCh.isEmpty())
- tb.tabFillChar = QChar();
- else
- tb.tabFillChar = tbCh.at(0);
- OB.TabValues.append(tb);
- }
- if (isFile && attrAsBool(attrs1, "relativePaths", false))
- {
- if (!OB.Pfile.isEmpty())
- {
- QFileInfo pfi(fileName);
- QString test = QDir::cleanPath(QDir::convertSeparators(pfi.absolutePath()+"/"+OB.Pfile));
- QFileInfo pfi2(test);
- OB.Pfile = pfi2.absoluteFilePath();
- }
- if (!OB.Pfile2.isEmpty())
- {
- QFileInfo pfi(fileName);
- QString test = QDir::cleanPath(QDir::convertSeparators(pfi.absolutePath()+"/"+OB.Pfile2));
- QFileInfo pfi2(test);
- OB.Pfile2 = pfi2.absoluteFilePath();
- }
- if (!OB.Pfile3.isEmpty())
- {
- QFileInfo pfi(fileName);
- QString test = QDir::cleanPath(QDir::convertSeparators(pfi.absolutePath()+"/"+OB.Pfile3));
- QFileInfo pfi2(test);
- OB.Pfile3 = pfi2.absoluteFilePath();
- }
- }
- if (tagName1 == "PatternItem" && reader.isEndElement())
- {
- LastStyles lastStyle;
- doc->PasteItem(&OB, true, false);
- PageItem* Neu = doc->Items->at(doc->Items->count()-1);
- Neu->OverrideCompressionMethod = OB.OverrideCompressionMethod;
- Neu->OverrideCompressionQuality = OB.OverrideCompressionQuality;
- Neu->CompressionMethodIndex = OB.CompressionMethodIndex;
- Neu->CompressionQualityIndex = OB.CompressionQualityIndex;
- Neu->doOverprint = doOverprint;
- Neu->setGradient(gradName);
- Neu->setStrokeGradient(gradNameS);
- Neu->setGradientMask(gradNameM);
- Neu->setStrokePattern(StrokePattern);
- Neu->setStrokePatternTransform(patternScaleXS, patternScaleYS, patternOffsetXS, patternOffsetYS, patternRotationS, patternSkewXS, patternSkewYS, patternSpace);
- Neu->setStrokePatternFlip(patternMirrorXS, patternMirrorYS);
- Neu->setStrokePatternToPath(atPath);
- Neu->setXYPos(Neu->xPos() - doc->currentPage()->xOffset(), Neu->yPos() - doc->currentPage()->yOffset(), true);
- storyText.setDefaultStyle(Neu->itemText.defaultStyle());
- Neu->itemText = storyText;
- if (Neu->asImageFrame() && inlineF)
- {
- if (inlineImageData.size() > 0)
- {
- Neu->tempImageFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + inlineImageExt);
- Neu->tempImageFile->open();
- QString fileName = getLongPathName(Neu->tempImageFile->fileName());
- Neu->tempImageFile->close();
- inlineImageData = qUncompress(QByteArray::fromBase64(inlineImageData));
- QFile outFil(fileName);
- if (outFil.open(QIODevice::WriteOnly))
- {
- outFil.write(inlineImageData);
- outFil.close();
- Neu->isInlineImage = true;
- Neu->Pfile = fileName;
- Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
- Neu->setImageXYOffset(OB.LocalX, OB.LocalY);
- Neu->setImageRotation(OB.LocalRot);
- Neu->IProfile = OB.IProfile;
- Neu->EmProfile = OB.EmProfile;
- Neu->IRender = OB.IRender;
- Neu->UseEmbedded = OB.UseEmbedded;
- if (!Neu->Pfile.isEmpty())
- doc->LoadPict(Neu->Pfile, doc->Items->count()-1);
- Neu->setImageXYScale(OB.LocalScX, OB.LocalScY);
- Neu->setImageShown(OB.PicArt);
- Neu->ScaleType = OB.ScaleType;
- Neu->AspectRatio = OB.AspectRatio;
- }
- }
- }
- Neu->effectsInUse = imageEffects;
- Neu->pixm.imgInfo.RequestProps = loadRequests;
- Neu->pixm.imgInfo.isRequest = (loadRequests.count() > 0);
- Neu->pixm.imgInfo.lowResType = lowResType;
- Neu->pixm.imgInfo.actualPageNumber = actualPageNumber;
- if ((Neu->effectsInUse.count() != 0) || (Neu->pixm.imgInfo.RequestProps.count() != 0) || (doc->itemToolPrefs().imageLowResType != lowResType))
- doc->LoadPict(Neu->Pfile, Neu->ItemNr, true);
- if (Neu->pixm.imgInfo.PDSpathData.contains(patClipPath))
- {
- Neu->imageClip = Neu->pixm.imgInfo.PDSpathData[patClipPath].copy();
- Neu->pixm.imgInfo.usedPath = patClipPath;
- QTransform cl;
- cl.translate(Neu->imageXOffset()*Neu->imageXScale(), Neu->imageYOffset()*Neu->imageYScale());
- cl.rotate(Neu->imageRotation());
- cl.scale(Neu->imageXScale(), Neu->imageYScale());
- Neu->imageClip.map(cl);
- }
- if (Neu->asLatexFrame())
- {
- PageItem_LatexFrame *latexitem = Neu->asLatexFrame();
- latexitem->setConfigFile(LatexConfig);
- latexitem->setDpi(LatexDPI);
- latexitem->setUsePreamble(LatexPream);
- }
- if (Neu->isTableItem)
- {
- TableItems.append(Neu);
- TableID.insert(patOwnLink, Neu->ItemNr);
- }
- Neu->isGroupControl = isGroupControl;
- if (Neu->isGroupControl)
- groupID.insert(Neu, groupsLastItem + Neu->ItemNr);
- if (Neu->asPathText())
- Neu->updatePolyClip();
- imageEffects.clear();
- loadRequests.clear();
- }
- if (tagName1 == "Pattern" && reader.isEndElement())
- break;
- }
- if (groupID.count() != 0)
- {
- QMap<PageItem*, int>::Iterator it;
- for (it = groupID.begin(); it != groupID.end(); ++it)
- {
- if (it.value() >= doc->Items->count())
- {
- it.key()->isGroupControl = false;
- continue;
- }
- it.key()->groupsLastItem = doc->Items->at(it.value());
- }
- }
- doc->useRaster = savedAlignGrid;
- doc->SnapGuides = savedAlignGuides;
- uint ae = doc->Items->count();
- if (ae > ac)
- {
- pat.setDoc(doc);
- PageItem* currItem = doc->Items->at(ac);
- pat.pattern = currItem->DrawObj_toImage();
- pat.scaleX = patScaleX;
- pat.scaleY = patScaleY;
- pat.width = patWidth;
- pat.height = patHeight;
- pat.xoffset = patxoffset;
- pat.yoffset = patyoffset;
- pat.pattern = pat.pattern.copy(-patxoffset, -patyoffset, pat.width, pat.height);
- for (uint as = ac; as < ae; ++as)
- {
- PageItem* Neu = doc->Items->takeAt(ac);
- Neu->moveBy(pat.xoffset, pat.yoffset, true);
- Neu->gXpos += pat.xoffset;
- Neu->gYpos += pat.yoffset;
- Neu->ItemNr = pat.items.count();
- pat.items.append(Neu);
- }
- if (!doc->docPatterns.contains(patName))
- doc->docPatterns.insert(patName, pat);
- }
- groupID.clear();
- doc->GroupCounter = GrMax + 1;
+ const FileFormat *fmt = LoadSavePlugin::getFormatById(FORMATID_SLA150IMPORT);
+ if (fmt)
+ {
+ fmt->setupTargets(doc, 0, doc->scMW(), 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
+ fmt->loadElements(ff, fileDir, toLayer, Xp, Yp, loc);
+ return true;
+ }
+ return false;
}
QString ScriXmlDoc::WriteElem(ScribusDoc *doc, Selection* selection)
@@ -2131,12 +416,8 @@
double xp, yp;
QString tmp, tmpy;
PageItem *item;
- //QDomDocument docu("scribus");
- //QString st="<SCRIBUSELEMUTF8></SCRIBUSELEMUTF8>";.
- //docu.setContent(st);
QString documentStr;
QString baseDir = QDir::homePath();
- //QDomElement elem=docu.documentElement();
item = selection->itemAt(0);
QList<uint> ELL;
QList<PageItem*> emG;
@@ -2149,9 +430,7 @@
qSort(ELL);
documentStr.reserve(524288);
ScXmlStreamWriter writer(&documentStr);
-// writer.writeStartDocument();
-// don't use that function here, as it inserts an unneeded version info into that xml, which
-// breaks our reading code at several places.
+ writer.setAutoFormatting(true);
writer.writeStartElement("SCRIBUSELEMUTF8");
double selectionWidth = 0;
double selectionHeight = 0;
@@ -2210,22 +489,9 @@
retImg.fill( qRgba(0, 0, 0, 0) );
ScPainter *painter = new ScPainter(&retImg, retImg.width(), retImg.height(), 1, 0);
painter->setZoomFactor(scaleI);
- QStack<PageItem*> groupStack;
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
- if (embedded->isGroupControl)
- {
- painter->save();
- FPointArray cl = embedded->PoLine.copy();
- QTransform mm;
- mm.translate(embedded->gXpos, embedded->gYpos);
- mm.rotate(embedded->rotation());
- cl.map( mm );
- painter->beginLayer(1.0 - embedded->fillTransparency(), embedded->fillBlendmode(), &cl);
- groupStack.push(embedded->groupsLastItem);
- continue;
- }
painter->save();
double x = embedded->xPos();
double y = embedded->yPos();
@@ -2234,17 +500,6 @@
embedded->DrawObj(painter, QRectF());
embedded->setXYPos(x, y, true);
painter->restore();
- if (groupStack.count() != 0)
- {
- while (embedded == groupStack.top())
- {
- painter->endLayer();
- painter->restore();
- groupStack.pop();
- if (groupStack.count() == 0)
- break;
- }
- }
}
delete painter;
QBuffer buffer;
@@ -2283,90 +538,87 @@
UsedMapped2Saved.clear();
ParagraphStyle vg;
-// if (doc->docParagraphStyles.count() > 5)
- {
- for (int co=0; co < selection->count(); ++co)
- {
- item = doc->Items->at(ELL[co]);
- if (item->itemText.defaultStyle().hasParent())
+ for (int co=0; co < selection->count(); ++co)
+ {
+ item = doc->Items->at(ELL[co]);
+ if (item->itemText.defaultStyle().hasParent())
+ {
+ int parstyle = findParagraphStyle(doc, item->itemText.defaultStyle().parent());
+ if (parstyle >= 0) UsedStyles[parstyle] = doc->paragraphStyles()[parstyle];
+ }
+ if (((item->asTextFrame()) || (item->asPathText())) && (item->itemText.length() != 0))
+ {
+#ifndef NLS_PROTO
+ for (int tx = 0; tx < item->itemText.length(); ++tx)
{
- int parstyle = findParagraphStyle(doc, item->itemText.defaultStyle().parent());
- if (parstyle >= 0) UsedStyles[parstyle] = doc->paragraphStyles()[parstyle];
- }
- if (((item->asTextFrame()) || (item->asPathText())) && (item->itemText.length() != 0))
- {
-#ifndef NLS_PROTO
- for (int tx = 0; tx < item->itemText.length(); ++tx)
+ if (item->itemText.text(tx) == SpecialChars::PARSEP)
{
- if (item->itemText.text(tx) == SpecialChars::PARSEP)
+ vg = item->itemText.paragraphStyle(tx);
+ if (vg.hasParent())
{
- vg = item->itemText.paragraphStyle(tx);
- if (vg.hasParent())
- {
- int pindex = findParagraphStyle(doc, vg.parent());
- if (pindex >= 0) UsedStyles[pindex] = doc->paragraphStyles()[pindex];
- }
+ int pindex = findParagraphStyle(doc, vg.parent());
+ if (pindex >= 0) UsedStyles[pindex] = doc->paragraphStyles()[pindex];
}
}
+ }
#endif
- }
- }
- QList<int> StyleNumb = UsedStyles.keys();
- qSort(StyleNumb);
- for (int ff = 0; ff < StyleNumb.count(); ++ff)
- {
- int actSt = StyleNumb.at(ff);
- UsedMapped2Saved.insert(actSt, NewStylesNum);
- NewStylesNum++;
- QMap<int, ParagraphStyle>::ConstIterator paraStyle = UsedStyles.find(actSt);
- writer.writeStartElement("STYLE");
- writer.writeAttribute("NAME", paraStyle->name());
- writer.writeAttribute("ALIGN", static_cast<int>(paraStyle->alignment()));
- writer.writeAttribute("LINESPMode", static_cast<int>(paraStyle->lineSpacingMode()));
- //CB #2738:
- //UsedStyles[actSt].LineSpa is something like this is using automatic from the font:
- //10.34912109375000000000. Default attribute value is then 10.3491 which then becomes //10.34909999999999996589 and then does not compare. This fixes, should we change our
- //default precision?
- writer.writeAttribute("LINESP", QString::number(paraStyle->lineSpacing(),'f',13));
- writer.writeAttribute("INDENT", paraStyle->leftMargin());
- writer.writeAttribute("FIRST", paraStyle->firstIndent());
- writer.writeAttribute("VOR", paraStyle->gapBefore());
- writer.writeAttribute("NACH", paraStyle->gapAfter());
- writer.writeAttribute("FONT", paraStyle->charStyle().font().scName());
- writer.writeAttribute("FONTSIZE", paraStyle->charStyle().fontSize() / 10.0);
- writer.writeAttribute("DROP", static_cast<int>(paraStyle->hasDropCap()));
- writer.writeAttribute("DROPLIN", paraStyle->dropCapLines());
- writer.writeAttribute("DROPDIST", paraStyle->dropCapOffset());
- writer.writeAttribute("EFFECT", paraStyle->charStyle().effects());
-
- writer.writeAttribute("FCOLOR", paraStyle->charStyle().fillColor());
- writer.writeAttribute("FSHADE", paraStyle->charStyle().fillShade());
- writer.writeAttribute("SCOLOR", paraStyle->charStyle().strokeColor());
- writer.writeAttribute("SSHADE", paraStyle->charStyle().strokeShade());
- writer.writeAttribute("BASE", static_cast<int>(paraStyle->lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing));
- writer.writeAttribute("TXTSHX", paraStyle->charStyle().shadowXOffset() / 10.0);
- writer.writeAttribute("TXTSHY", paraStyle->charStyle().shadowYOffset() / 10.0);
- writer.writeAttribute("TXTOUT", paraStyle->charStyle().outlineWidth() / 10.0);
- writer.writeAttribute("TXTULP", paraStyle->charStyle().underlineOffset() / 10.0);
- writer.writeAttribute("TXTULW", paraStyle->charStyle().underlineWidth() / 10.0);
- writer.writeAttribute("TXTSTP", paraStyle->charStyle().strikethruOffset() / 10.0);
- writer.writeAttribute("TXTSTW", paraStyle->charStyle().strikethruWidth() / 10.0);
- writer.writeAttribute("SCALEH", paraStyle->charStyle().scaleH() / 10.0);
- writer.writeAttribute("SCALEV", paraStyle->charStyle().scaleV() / 10.0);
- writer.writeAttribute("BASEO", paraStyle->charStyle().baselineOffset() / 10.0);
- writer.writeAttribute("KERN", paraStyle->charStyle().tracking() / 10.0);
- for (int a = 0; a < paraStyle->tabValues().count(); ++a)
- {
- writer.writeEmptyElement("Tabs");
- writer.writeAttribute("Type", paraStyle->tabValues().at(a).tabType);
- writer.writeAttribute("Pos", paraStyle->tabValues().at(a).tabPosition);
- QString tabCh = "";
- if (!paraStyle->tabValues().at(a).tabFillChar.isNull())
- tabCh = QString(paraStyle->tabValues().at(a).tabFillChar);
- writer.writeAttribute("Fill", tabCh);
- }
- writer.writeEndElement();
- }
+ }
+ }
+ QList<int> StyleNumb = UsedStyles.keys();
+ qSort(StyleNumb);
+ for (int ff = 0; ff < StyleNumb.count(); ++ff)
+ {
+ int actSt = StyleNumb.at(ff);
+ UsedMapped2Saved.insert(actSt, NewStylesNum);
+ NewStylesNum++;
+ QMap<int, ParagraphStyle>::ConstIterator paraStyle = UsedStyles.find(actSt);
+ writer.writeStartElement("STYLE");
+ writer.writeAttribute("NAME", paraStyle->name());
+ writer.writeAttribute("ALIGN", static_cast<int>(paraStyle->alignment()));
+ writer.writeAttribute("LINESPMode", static_cast<int>(paraStyle->lineSpacingMode()));
+ //CB #2738:
+ //UsedStyles[actSt].LineSpa is something like this is using automatic from the font:
+ //10.34912109375000000000. Default attribute value is then 10.3491 which then becomes //10.34909999999999996589 and then does not compare. This fixes, should we change our
+ //default precision?
+ writer.writeAttribute("LINESP", QString::number(paraStyle->lineSpacing(),'f',13));
+ writer.writeAttribute("INDENT", paraStyle->leftMargin());
+ writer.writeAttribute("FIRST", paraStyle->firstIndent());
+ writer.writeAttribute("VOR", paraStyle->gapBefore());
+ writer.writeAttribute("NACH", paraStyle->gapAfter());
+ writer.writeAttribute("FONT", paraStyle->charStyle().font().scName());
+ writer.writeAttribute("FONTSIZE", paraStyle->charStyle().fontSize() / 10.0);
+ writer.writeAttribute("DROP", static_cast<int>(paraStyle->hasDropCap()));
+ writer.writeAttribute("DROPLIN", paraStyle->dropCapLines());
+ writer.writeAttribute("DROPDIST", paraStyle->dropCapOffset());
+ writer.writeAttribute("EFFECT", paraStyle->charStyle().effects());
+
+ writer.writeAttribute("FCOLOR", paraStyle->charStyle().fillColor());
+ writer.writeAttribute("FSHADE", paraStyle->charStyle().fillShade());
+ writer.writeAttribute("SCOLOR", paraStyle->charStyle().strokeColor());
+ writer.writeAttribute("SSHADE", paraStyle->charStyle().strokeShade());
+ writer.writeAttribute("BASE", static_cast<int>(paraStyle->lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing));
+ writer.writeAttribute("TXTSHX", paraStyle->charStyle().shadowXOffset() / 10.0);
+ writer.writeAttribute("TXTSHY", paraStyle->charStyle().shadowYOffset() / 10.0);
+ writer.writeAttribute("TXTOUT", paraStyle->charStyle().outlineWidth() / 10.0);
+ writer.writeAttribute("TXTULP", paraStyle->charStyle().underlineOffset() / 10.0);
+ writer.writeAttribute("TXTULW", paraStyle->charStyle().underlineWidth() / 10.0);
+ writer.writeAttribute("TXTSTP", paraStyle->charStyle().strikethruOffset() / 10.0);
+ writer.writeAttribute("TXTSTW", paraStyle->charStyle().strikethruWidth() / 10.0);
+ writer.writeAttribute("SCALEH", paraStyle->charStyle().scaleH() / 10.0);
+ writer.writeAttribute("SCALEV", paraStyle->charStyle().scaleV() / 10.0);
+ writer.writeAttribute("BASEO", paraStyle->charStyle().baselineOffset() / 10.0);
+ writer.writeAttribute("KERN", paraStyle->charStyle().tracking() / 10.0);
+ for (int a = 0; a < paraStyle->tabValues().count(); ++a)
+ {
+ writer.writeEmptyElement("Tabs");
+ writer.writeAttribute("Type", paraStyle->tabValues().at(a).tabType);
+ writer.writeAttribute("Pos", paraStyle->tabValues().at(a).tabPosition);
+ QString tabCh = "";
+ if (!paraStyle->tabValues().at(a).tabFillChar.isNull())
+ tabCh = QString(paraStyle->tabValues().at(a).tabFillChar);
+ writer.writeAttribute("Fill", tabCh);
+ }
+ writer.writeEndElement();
}
QMap<QString,multiLine>::Iterator itMU;
@@ -2409,7 +661,6 @@
QMap<int, ArrowDesc> usedArrows;
QMap<int, ArrowDesc>::Iterator itar;
struct ArrowDesc arrow;
- //for (uint co=0; co<Selitems->count(); ++co)
for (int co=0; co<selection->count(); ++co)
{
item = doc->Items->at(ELL[co]);
@@ -2489,9 +740,7 @@
{
QString text, tmp, tmpy;
QString CurDirP = QDir::currentPath();
-
const ParagraphStyle& defaultStyle = item->itemText.defaultStyle();
-
int textAlignment = item->itemText.defaultStyle().alignment();
writer.writeAttribute("ALIGN", textAlignment);
SetItemProps(writer, doc, item, baseDir, false);
@@ -2502,19 +751,6 @@
writer.writeAttribute("fillRule" , item->fillRule ? "1" : "0");
writer.writeAttribute("doOverprint", item->doOverprint ? "1" : "0");
writer.writeAttribute("ImageClip" , item->pixm.imgInfo.usedPath);
-
-/* Code below is no longer needed since WriteElem adds now a preview image
- thus ScPreview no longer needs to render this stuff.
- writer.writeAttribute("NUMTEXT", item->itemText.length());
- QString txnu = "";
- for(int kt = 0; kt < item->itemText.length(); ++kt)
-#ifndef NLS_PROTO
- txnu += tmp.setNum(item->itemText.item(kt)->glyph.xoffset) + " " + tmpy.setNum(item->itemText.item(kt)->glyph.yoffset) + " ";
-#else
- txnu += "0 0 ";
-#endif
- writer.writeAttribute("TEXTCOOR", txnu);
-*/
writer.writeAttribute("BACKITEM", "-1");
writer.writeAttribute("BACKPAGE", "-1");
writer.writeAttribute("NEXTITEM", "-1");
@@ -2765,6 +1001,18 @@
}
if (item->asSymbolFrame())
writer.writeAttribute("pattern", item->pattern());
+ if (item->asGroupFrame())
+ {
+ writer.writeAttribute("groupWidth", item->groupWidth);
+ writer.writeAttribute("groupHeight", item->groupHeight);
+ for (int co = 0; co < item->groupItemList.count(); ++co)
+ {
+ PageItem* gitem = item->groupItemList.at(co);
+ writer.writeStartElement("ITEM");
+ WriteObject(writer, doc, gitem, baseDir, UsedMapped2Saved);
+ writer.writeEndElement();
+ }
+ }
#ifdef HAVE_OSG
if (item->asOSGFrame())
{
@@ -2964,7 +1212,6 @@
void ScriXmlDoc::WritePStyle (ScXmlStreamWriter& writer, const ParagraphStyle& style, const QString& nodeName)
{
-// bool styleHasTabs = (!style.isInhTabValues() && (style.tabValues().count() > 0));
writer.writeStartElement(nodeName);
if ( ! style.name().isEmpty() )
writer.writeAttribute("NAME", style.name());
@@ -3025,265 +1272,3 @@
writer.writeEndElement();
}
-
-void ScriXmlDoc::ReadLegacyCStyle (const QXmlStreamAttributes& attrs, CharStyle& newStyle, ScribusDoc* doc)
-{
- bool hasFont = attrHasValue(attrs, "CFONT");
- QString tmpf = attrAsString(attrs, "CFONT", doc->itemToolPrefs().textFont);
- bool unknown = false;
-
- ScFace dummy = ScFace::none();
- ApplicationPrefs& appPrefs = prefsManager->appPrefs;
- if (hasFont && ((!appPrefs.fontPrefs.AvailFonts.contains(tmpf)) || (!appPrefs.fontPrefs.AvailFonts[tmpf].usable())))
- {
- bool isThere = false;
- for (int dl = 0; dl < dummyScFaces.count(); ++dl)
- {
- if (dummyScFaces.at(dl).scName() == tmpf)
- {
- isThere = true;
- dummy = dummyScFaces.at(dl);
- break;
- }
- }
- if (!isThere)
- {
- //FIXME dummy = new ScFace(tmpf, "", tmpf, "", "", 1, false);
- dummyScFaces.append(dummy);
- }
- unknown = true;
- if ((!appPrefs.fontPrefs.GFontSub.contains(tmpf)) || (!appPrefs.fontPrefs.AvailFonts[appPrefs.fontPrefs.GFontSub[tmpf]].usable()))
- {
- newReplacement = true;
- ReplacedFonts.insert(tmpf, appPrefs.itemToolPrefs.textFont);
- }
- else
- ReplacedFonts.insert(tmpf, appPrefs.fontPrefs.GFontSub[tmpf]);
-// tmpf = ReplacedFonts[tmpf];
- }
- else if (hasFont)
- {
- if (!doc->UsedFonts.contains(tmpf))
- {
-// QFont fo = prefsManager->appPrefs.AvailFonts[tmpf]->Font;
-// fo.setPointSize(qRound(doc->toolSettings.defSize / 10.0));
- doc->AddFont(tmpf);
- }
- }
-
- if (hasFont)
- {
- if (unknown)
- newStyle.setFont(dummy);
- else
- newStyle.setFont((*doc->AllFonts)[tmpf]);
- }
-
- if (attrHasValue(attrs, "CSIZE"))
- newStyle.setFontSize( qRound(attrAsDbl(attrs, "CSIZE") * 10) );
-
- if (attrHasValue(attrs, "CCOLOR"))
- newStyle.setFillColor( attrAsString(attrs, "CCOLOR", CommonStrings::None) );
-
- if (attrHasValue(attrs, "CSHADE"))
- newStyle.setFillShade( attrAsInt(attrs, "CSHADE") );
-
- if (attrHasValue(attrs, "CEXTRA"))
- newStyle.setTracking( qRound(attrAsDbl(attrs, "CEXTRA") / attrAsDbl(attrs, "CSIZE", 1.0) * 1000.0) );
- else if (attrHasValue(attrs, "CKERN"))
- newStyle.setTracking( attrAsInt(attrs, "CKERN") );
-
- if (attrHasValue(attrs, "CSTROKE"))
- newStyle.setStrokeColor( attrAsString(attrs, "CSTROKE", CommonStrings::None) );
-
- if (attrHasValue(attrs, "CSHADE2"))
- newStyle.setStrokeShade( attrAsInt(attrs, "CSHADE2", 100) );
-
- if (attrHasValue(attrs, "CSCALE"))
- {
- int scaleh = qRound(attrAsDbl(attrs, "CSCALE", 100.0) * 10);
- newStyle.setScaleH(qMin(qMax(scaleh, 100), 4000));
- }
-
- if (attrHasValue(attrs, "CSCALEV"))
- {
- int scalev = qRound(attrAsDbl(attrs, "CSCALEV", 100.0) * 10);
- newStyle.setScaleV(qMin(qMax(scalev, 100), 4000));
- }
-
- if (attrHasValue(attrs, "CBASE"))
- newStyle.setBaselineOffset( qRound(attrAsDbl(attrs, "CBASE", 0.0) * 10) );
-
- if (attrHasValue(attrs, "CSHX"))
- newStyle.setShadowXOffset( qRound(attrAsDbl(attrs, "CSHX", 5.0) * 10) );
-
- if (attrHasValue(attrs, "CSHY"))
- newStyle.setShadowYOffset( qRound(attrAsDbl(attrs, "CSHY", -5.0) * 10) );
-
- if (attrHasValue(attrs, "COUT"))
- newStyle.setOutlineWidth( qRound(attrAsDbl(attrs, "COUT", 1.0) * 10) );
-
- if (attrHasValue(attrs, "CULP"))
- newStyle.setUnderlineOffset( qRound(attrAsDbl(attrs, "CULP", -0.1) * 10) );
-
- if (attrHasValue(attrs, "CULW"))
- newStyle.setUnderlineWidth( qRound(attrAsDbl(attrs, "CULW", -0.1) * 10) );
-
- if (attrHasValue(attrs, "CSTP"))
- newStyle.setStrikethruOffset( qRound(attrAsDbl(attrs, "CSTP", -0.1) * 10) );
-
- if (attrHasValue(attrs, "CSTW"))
- newStyle.setStrikethruWidth( qRound(attrAsDbl(attrs, "CSTW", -0.1) * 10) );
-
- if (attrHasValue(attrs, "CSTYLE"))
- {
- int cstyle = attrAsInt(attrs, "CSTYLE") & 2047;
- newStyle.setFeatures(static_cast<StyleFlag>(cstyle).featureList());
- }
-}
-
-void ScriXmlDoc::ReadCStyle(const QXmlStreamAttributes& attrs, CharStyle & newStyle, ScribusDoc *doc)
-{
- if ( attrHasValue(attrs, "CNAME"))
- newStyle.setName(attrAsString(attrs, "CNAME", ""));
- if ( attrHasValue(attrs, "CPARENT"))
- newStyle.setParent(attrAsString(attrs, "CPARENT", ""));
-
- if ( attrHasValue(attrs, "FONT"))
- newStyle.setFont(doc->AllFonts->findFont(attrAsString(attrs, "FONT", doc->itemToolPrefs().textFont),doc));
-
- if ( attrHasValue(attrs, "FONTSIZE"))
- newStyle.setFontSize(qRound(attrAsDbl(attrs, "FONTSIZE", 12) * 10));
-
- if ( attrHasValue(attrs, "FCOLOR"))
- newStyle.setFillColor(attrAsString(attrs, "FCOLOR", CommonStrings::None));
-
- if ( attrHasValue(attrs, "KERN"))
- newStyle.setTracking(qRound(attrAsDbl(attrs, "KERN") * 10));
-
- if ( attrHasValue(attrs, "FSHADE"))
- newStyle.setFillShade(attrAsInt(attrs, "FSHADE"));
-
- if ( attrHasValue(attrs, "EFFECTS"))
- newStyle.setFeatures(static_cast<StyleFlag>(attrAsInt(attrs, "EFFECTS")).featureList());
-
- if ( attrHasValue(attrs, "EFFECT"))
- newStyle.setFeatures(static_cast<StyleFlag>(attrAsInt(attrs, "EFFECT")).featureList());
-
- if ( attrHasValue(attrs, "FEATURES"))
- newStyle.setFeatures(attrAsString(attrs, "FEATURES", "").split( " ", QString::SkipEmptyParts));
-
- if ( attrHasValue(attrs, "SCOLOR"))
- newStyle.setStrokeColor(attrAsString(attrs, "SCOLOR", CommonStrings::None));
-
- if ( attrHasValue(attrs, "SSHADE"))
- newStyle.setStrokeShade(attrAsInt(attrs, "SSHADE"));
-
- if ( attrHasValue(attrs, "SCALEH"))
- newStyle.setScaleH(qRound(attrAsDbl(attrs, "SCALEH") * 10));
-
- if ( attrHasValue(attrs, "SCALEV"))
- newStyle.setScaleV(qRound(attrAsDbl(attrs, "SCALEV") * 10));
-
- if ( attrHasValue(attrs, "BASEO"))
- newStyle.setBaselineOffset(qRound(attrAsDbl(attrs, "BASEO") * 10));
-
- if ( attrHasValue(attrs, "TXTSHX"))
- newStyle.setShadowXOffset(qRound(attrAsDbl(attrs, "TXTSHX") * 10));
-
- if ( attrHasValue(attrs, "TXTSHY"))
- newStyle.setShadowYOffset(qRound(attrAsDbl(attrs, "TXTSHY") * 10));
-
- if ( attrHasValue(attrs, "TXTOUT"))
- newStyle.setOutlineWidth(qRound(attrAsDbl(attrs, "TXTOUT") * 10));
-
- if ( attrHasValue(attrs, "TXTULP"))
- newStyle.setUnderlineOffset(qRound(attrAsDbl(attrs, "TXTULP") * 10));
-
- if ( attrHasValue(attrs, "TXTULW"))
- newStyle.setUnderlineWidth(qRound(attrAsDbl(attrs, "TXTULW") * 10));
-
- if ( attrHasValue(attrs, "TXTSTP"))
- newStyle.setStrikethruOffset(qRound(attrAsDbl(attrs, "TXTSTP") * 10));
-
- if ( attrHasValue(attrs, "TXTSTW"))
- newStyle.setStrikethruWidth(qRound(attrAsDbl(attrs, "TXTSTW") * 10));
-
- if ( attrHasValue(attrs, "SHORTCUT"))
- newStyle.setShortcut(attrAsString(attrs, "SHORTCUT", ""));
-
- if ( attrHasValue(attrs, "wordTrack"))
- newStyle.setWordTracking(attrAsDbl(attrs, "wordTrack"));
-}
-
-void ScriXmlDoc::ReadPStyle(QXmlStreamReader& reader, ParagraphStyle &style, ScribusDoc* doc)
-{
- QXmlStreamAttributes attrs = reader.attributes();
- style.erase();
- style.setName( attrAsString(attrs, "NAME", "") );
- style.setParent( attrAsString(attrs, "PARENT", ""));
- if ( attrHasValue(attrs, "LINESPMode"))
- style.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(attrAsInt(attrs, "LINESPMode")));
- if ( attrHasValue(attrs, "LINESP"))
- style.setLineSpacing(attrAsDbl(attrs, "LINESP"));
- if ( attrHasValue(attrs, "INDENT"))
- style.setLeftMargin(attrAsDbl(attrs, "INDENT"));
- if ( attrHasValue(attrs, "RMARGIN"))
- style.setRightMargin(attrAsDbl(attrs, "RMARGIN"));
- if ( attrHasValue(attrs, "FIRST"))
- style.setFirstIndent(attrAsDbl(attrs, "FIRST"));
- if ( attrHasValue(attrs, "ALIGN"))
- style.setAlignment(static_cast<ParagraphStyle::AlignmentType>(attrAsInt(attrs, "ALIGN")));
- if ( attrHasValue(attrs, "VOR"))
- style.setGapBefore(attrAsDbl(attrs, "VOR"));
- if ( attrHasValue(attrs, "NACH"))
- style.setGapAfter(attrAsDbl(attrs, "NACH"));
- if ( attrHasValue(attrs, "DROP"))
- style.setHasDropCap(static_cast<bool>(attrAsInt(attrs, "DROP")));
- if ( attrHasValue(attrs, "DROPLIN"))
- style.setDropCapLines(attrAsInt(attrs, "DROPLIN"));
- if ( attrHasValue(attrs, "DROPDIST"))
- style.setDropCapOffset(attrAsDbl(attrs, "DROPDIST"));
- if ( attrHasValue(attrs, "PSHORTCUT"))
- style.setShortcut(attrAsString(attrs, "PSHORTCUT", ""));
-
- if ( attrHasValue(attrs, "OpticalMargins"))
- style.setOpticalMargins(attrAsInt(attrs, "OpticalMargins"));
- if ( attrHasValue(attrs, "HyphenationMode"))
- style.setHyphenationMode(attrAsInt(attrs, "HyphenationMode"));
- if ( attrHasValue(attrs, "MinWordTrack"))
- style.setMinWordTracking(attrAsDbl(attrs, "MinWordTrack"));
- if ( attrHasValue(attrs, "NormWordTrack"))
- style.charStyle().setWordTracking(attrAsDbl(attrs, "NormWordTrack"));
- if ( attrHasValue(attrs, "MinGlyphShrink"))
- style.setMinGlyphExtension(attrAsDbl(attrs, "MinGlyphShrink"));
- if ( attrHasValue(attrs, "MaxGlyphExtend"))
- style.setMaxGlyphExtension(attrAsDbl(attrs, "MaxGlyphExtend"));
-
- ReadCStyle(attrs, style.charStyle(), doc);
-
- QList<ParagraphStyle::TabRecord> tabs;
- while (!reader.atEnd() && !reader.hasError())
- {
-// QXmlStreamReader::TokenType tType = reader.readNext();
- reader.readNext();
- QString tagName = reader.name().toString();
- if (tagName == "PARA" && reader.isEndElement())
- break;
- if (tagName == "Tabs" && reader.isStartElement())
- {
- ParagraphStyle::TabRecord tab;
- QXmlStreamAttributes tabAttrs = reader.attributes();
- tab.tabPosition = attrAsDbl(tabAttrs, "Pos");
- tab.tabType = attrAsInt(tabAttrs, "Type");
- QString tbCh = attrAsString(tabAttrs, "Fill","");
- tab.tabFillChar = tbCh.isEmpty() ? QChar() : tbCh.at(0);
- tabs.append(tab);
- }
- }
- if (tabs.count() < 0)
- style.setTabValues(tabs);
-}
-
-
-
Modified: trunk/Scribus/scribus/scribusXml.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/scribusXml.h
==============================================================================
--- trunk/Scribus/scribus/scribusXml.h (original)
+++ trunk/Scribus/scribus/scribusXml.h Sat Dec 18 21:33:07 2010
@@ -49,48 +49,18 @@
\param file filename of file to test
\retval bool true = Scribus format file, false : not Scribus
*/
- 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);
+ 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);
-
- ColorList Farben;
- StyleSet<ParagraphStyle> docParagraphStyles;
- QList<Linked> LFrames;
- QStringList MNames;
- QMap<QString,QString> DoFonts;
- QMap<QString,QString> ReplacedFonts;
- QMap<uint,QString> DoVorl;
- QList<ScFace> dummyScFaces;
- uint VorlC;
- bool newReplacement;
protected:
- PrefsManager* prefsManager;
-
- bool attrHasValue(const QXmlStreamAttributes& attrs, const char* attName);
- bool attrAsBool(const QXmlStreamAttributes& attrs, const char* attName, bool defVal = false);
- int attrAsInt (const QXmlStreamAttributes& attrs, const char* attName, int defVal = 0);
- double attrAsDbl (const QXmlStreamAttributes& attrs, const char* attName, double defVal = 0.0);
- QString attrAsString (const QXmlStreamAttributes& attrs, const char* attName, const QString& defVal);
-
- void GetItemProps(const QXmlStreamAttributes& attrs, struct CopyPasteBuffer *OB, const QString& baseDir, bool newVersion);
- void GetItemText (const QXmlStreamAttributes& attrs, StoryText& story, ScribusDoc *doc, LastStyles* last, bool VorLFound, bool impo);
- void GetStyle(QXmlStreamReader& reader, ParagraphStyle &vg, StyleSet<ParagraphStyle>* tempStyles, ScribusDoc* doc, bool fl);
-
- void ReadPattern(QXmlStreamReader& reader, ScribusDoc* doc, const QString& fileName, int& GrMax, bool styleFound, bool newVersion);
- void ReadLegacyCStyle (const QXmlStreamAttributes& attrs, CharStyle& style, ScribusDoc* doc);
- void ReadCStyle (const QXmlStreamAttributes& attrs, CharStyle& style, ScribusDoc* doc);
- void ReadPStyle (QXmlStreamReader& reader, ParagraphStyle &style, ScribusDoc* doc);
-
void SetItemProps(ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem* item, const QString& baseDir, bool newFormat);
void WriteObject (ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem *item, const QString& baseDir, QMap<int, int> &UsedMapped2Saved);
void WriteITEXTs (ScXmlStreamWriter& writer, ScribusDoc *doc, PageItem *item);
void WriteLegacyCStyle (ScXmlStreamWriter& writer, const CharStyle& style);
void WriteCStyle (ScXmlStreamWriter& writer, const CharStyle& style);
void WritePStyle (ScXmlStreamWriter& writer, const ParagraphStyle& style, const QString& nodeName);
-
- QString AskForFont(SCFonts &avail, QString fStr, ScribusDoc *doc);
};
#endif // _SCRIBUS_CONFIG_
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Dec 18 21:33:07 2010
@@ -57,6 +57,7 @@
#include "pageitem_osgframe.h"
#endif
#include "pageitem_symbol.h"
+#include "pageitem_group.h"
#include "ui/pagepalette.h"
#include "pagesize.h"
#include "pagestructs.h"
@@ -480,37 +481,62 @@
CloseCMSProfiles();
ScCore->fileWatcher->stop();
ScCore->fileWatcher->removeFile(DocName);
+ QList<PageItem*> allItems;
for (int a = 0; a < DocItems.count(); ++a)
{
PageItem *currItem = DocItems.at(a);
- if (currItem->PictureIsAvailable)
- ScCore->fileWatcher->removeFile(currItem->Pfile);
- if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
- {
- QFileInfo fi(currItem->Pfile);
- ScCore->fileWatcher->removeDir(fi.absolutePath());
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ ScCore->fileWatcher->removeFile(currItem->Pfile);
+ if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
+ {
+ QFileInfo fi(currItem->Pfile);
+ ScCore->fileWatcher->removeDir(fi.absolutePath());
+ }
}
}
for (int a = 0; a < MasterItems.count(); ++a)
{
PageItem *currItem = MasterItems.at(a);
- if (currItem->PictureIsAvailable)
- ScCore->fileWatcher->removeFile(currItem->Pfile);
- if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
- {
- QFileInfo fi(currItem->Pfile);
- ScCore->fileWatcher->removeDir(fi.absolutePath());
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ ScCore->fileWatcher->removeFile(currItem->Pfile);
+ if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
+ {
+ QFileInfo fi(currItem->Pfile);
+ ScCore->fileWatcher->removeDir(fi.absolutePath());
+ }
}
}
for (int a = 0; a < FrameItems.count(); ++a)
{
PageItem *currItem = FrameItems.at(a);
- if (currItem->PictureIsAvailable)
- ScCore->fileWatcher->removeFile(currItem->Pfile);
- if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
- {
- QFileInfo fi(currItem->Pfile);
- ScCore->fileWatcher->removeDir(fi.absolutePath());
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ ScCore->fileWatcher->removeFile(currItem->Pfile);
+ if ((currItem->asImageFrame()) && (!currItem->Pfile.isEmpty()))
+ {
+ QFileInfo fi(currItem->Pfile);
+ ScCore->fileWatcher->removeDir(fi.absolutePath());
+ }
}
}
QStringList patterns = docPatterns.keys();
@@ -520,13 +546,21 @@
for (int o = 0; o < pa.items.count(); o++)
{
PageItem *currItem = pa.items.at(o);
- if (currItem->itemType() == PageItem::ImageFrame)
- {
- if ((currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->itemType() == PageItem::ImageFrame)
{
- ScCore->fileWatcher->removeFile(currItem->Pfile);
- QFileInfo fi(currItem->Pfile);
- ScCore->fileWatcher->removeDir(fi.absolutePath());
+ if ((currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
+ {
+ ScCore->fileWatcher->removeFile(currItem->Pfile);
+ QFileInfo fi(currItem->Pfile);
+ ScCore->fileWatcher->removeDir(fi.absolutePath());
+ }
}
}
}
@@ -574,6 +608,18 @@
ScCore->fileWatcher->start();
}
+QList<PageItem*> ScribusDoc::getAllItems(QList<PageItem*> &items)
+{
+ QList<PageItem*> ret;
+ for (int em = 0; em < items.count(); ++em)
+ {
+ PageItem* embedded = items.at(em);
+ ret.append(embedded);
+ if (embedded->isGroup())
+ ret += embedded->getItemList();
+ }
+ return ret;
+}
void ScribusDoc::setup(const int unitIndex, const int fp, const int firstLeft, const int orientation, const int firstPageNumber, const QString& defaultPageSize, const QString& documentName)
{
@@ -2536,17 +2582,36 @@
bool ScribusDoc::layerContainsItems(const int layerID)
{
+ QList<PageItem*> allItems;
uint masterItemsCount=MasterItems.count();
for (uint i = 0; i < masterItemsCount; ++i)
{
- if (MasterItems.at(i)->LayerID == layerID)
- return true;
+ PageItem* currItem = MasterItems.at(i);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->LayerID == layerID)
+ return true;
+ }
}
uint docItemsCount=DocItems.count();
for (uint i = 0; i < docItemsCount; ++i)
{
- if (DocItems.at(i)->LayerID == layerID)
- return true;
+ PageItem* currItem = DocItems.at(i);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->LayerID == layerID)
+ return true;
+ }
}
return false;
}
@@ -2757,103 +2822,109 @@
{
docPatterns.clear();
docPatterns = patterns;
-// for (QMap<QString, ScPattern>::Iterator it = patterns.begin(); it != patterns.end(); ++it)
-// {
-// docPatterns.insert(it.key(), it.data());
-// }
-/* for (int c=0; c<DocItems.count(); ++c)
- {
- PageItem *ite = DocItems.at(c);
- if ((!docPatterns.contains(ite->pattern())) && (ite->GrType == 8))
- {
- ite->setPattern("");
- ite->GrType = 0;
- }
- }
- for (int c=0; c<MasterItems.count(); ++c)
- {
- PageItem *ite = MasterItems.at(c);
- if ((!docPatterns.contains(ite->pattern())) && (ite->GrType == 8))
- {
- ite->setPattern("");
- ite->GrType = 0;
- }
- }
- for (int c=0; c<FrameItems.count(); ++c)
- {
- PageItem *ite = FrameItems.at(c);
- if ((!docPatterns.contains(ite->pattern())) && (ite->GrType == 8))
- {
- ite->setPattern("");
- ite->GrType = 0;
- }
- } */
}
QStringList ScribusDoc::getUsedPatterns()
{
+ QList<PageItem*> allItems;
QStringList results;
for (int c = 0; c < MasterItems.count(); ++c)
{
- if ((!results.contains(MasterItems.at(c)->pattern())) && ((MasterItems.at(c)->GrType == 8) || (MasterItems.at(c)->itemType() == PageItem::Symbol)))
- results.append(MasterItems.at(c)->pattern());
- if (!MasterItems.at(c)->strokePattern().isEmpty())
- {
- if (!results.contains(MasterItems.at(c)->strokePattern()))
- results.append(MasterItems.at(c)->strokePattern());
- }
- if (!MasterItems.at(c)->patternMask().isEmpty())
- {
- if (!results.contains(MasterItems.at(c)->patternMask()))
- results.append(MasterItems.at(c)->patternMask());
+ PageItem* currItem = MasterItems.at(c);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((!results.contains(currItem->pattern())) && ((currItem->GrType == 8) || (currItem->itemType() == PageItem::Symbol)))
+ results.append(currItem->pattern());
+ if (!currItem->strokePattern().isEmpty())
+ {
+ if (!results.contains(currItem->strokePattern()))
+ results.append(currItem->strokePattern());
+ }
+ if (!currItem->patternMask().isEmpty())
+ {
+ if (!results.contains(currItem->patternMask()))
+ results.append(currItem->patternMask());
+ }
}
}
for (int c = 0; c < DocItems.count(); ++c)
{
- if ((!results.contains(DocItems.at(c)->pattern())) && ((DocItems.at(c)->GrType == 8) || (DocItems.at(c)->itemType() == PageItem::Symbol)))
- results.append(DocItems.at(c)->pattern());
- if (!DocItems.at(c)->strokePattern().isEmpty())
- {
- if (!results.contains(DocItems.at(c)->strokePattern()))
- results.append(DocItems.at(c)->strokePattern());
- }
- if (!DocItems.at(c)->patternMask().isEmpty())
- {
- if (!results.contains(DocItems.at(c)->patternMask()))
- results.append(DocItems.at(c)->patternMask());
+ PageItem* currItem = DocItems.at(c);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((!results.contains(currItem->pattern())) && ((currItem->GrType == 8) || (currItem->itemType() == PageItem::Symbol)))
+ results.append(currItem->pattern());
+ if (!currItem->strokePattern().isEmpty())
+ {
+ if (!results.contains(currItem->strokePattern()))
+ results.append(currItem->strokePattern());
+ }
+ if (!currItem->patternMask().isEmpty())
+ {
+ if (!results.contains(currItem->patternMask()))
+ results.append(currItem->patternMask());
+ }
}
}
for (int c = 0; c < FrameItems.count(); ++c)
{
- if ((!results.contains(FrameItems.at(c)->pattern())) && ((FrameItems.at(c)->GrType == 8) || (FrameItems.at(c)->itemType() == PageItem::Symbol)))
- results.append(FrameItems.at(c)->pattern());
- if (!FrameItems.at(c)->strokePattern().isEmpty())
- {
- if (!results.contains(FrameItems.at(c)->strokePattern()))
- results.append(FrameItems.at(c)->strokePattern());
- }
- if (!FrameItems.at(c)->patternMask().isEmpty())
- {
- if (!results.contains(FrameItems.at(c)->patternMask()))
- results.append(FrameItems.at(c)->patternMask());
+ PageItem* currItem = FrameItems.at(c);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((!results.contains(currItem->pattern())) && ((currItem->GrType == 8) || (currItem->itemType() == PageItem::Symbol)))
+ results.append(currItem->pattern());
+ if (!currItem->strokePattern().isEmpty())
+ {
+ if (!results.contains(currItem->strokePattern()))
+ results.append(currItem->strokePattern());
+ }
+ if (!currItem->patternMask().isEmpty())
+ {
+ if (!results.contains(currItem->patternMask()))
+ results.append(currItem->patternMask());
+ }
}
}
for (QMap<QString, ScPattern>::Iterator it = docPatterns.begin(); it != docPatterns.end(); ++it)
{
for (int c = 0; c < it.value().items.count(); ++c)
{
- if ((it.value().items.at(c)->GrType == 8) || (it.value().items.at(c)->itemType() == PageItem::Symbol))
- {
- const QString& patName = it.value().items.at(c)->pattern();
- if (!patName.isEmpty() && !results.contains(patName))
- results.append(patName);
- }
- const QString& pat2 = it.value().items.at(c)->strokePattern();
- if (!pat2.isEmpty() && !results.contains(pat2))
- results.append(pat2);
- const QString& pat3 = it.value().items.at(c)->patternMask();
- if (!pat3.isEmpty() && !results.contains(pat3))
- results.append(pat3);
+ PageItem* currItem = it.value().items.at(c);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((currItem->GrType == 8) || (currItem->itemType() == PageItem::Symbol))
+ {
+ const QString& patName = currItem->pattern();
+ if (!patName.isEmpty() && !results.contains(patName))
+ results.append(patName);
+ }
+ const QString& pat2 = currItem->strokePattern();
+ if (!pat2.isEmpty() && !results.contains(pat2))
+ results.append(pat2);
+ const QString& pat3 = currItem->patternMask();
+ if (!pat3.isEmpty() && !results.contains(pat3))
+ results.append(pat3);
+ }
}
}
return results;
@@ -2979,49 +3050,86 @@
QStringList ScribusDoc::getUsedSymbols()
{
+ QList<PageItem*> allItems;
QStringList results;
for (int c = 0; c < MasterItems.count(); ++c)
{
- if ((!results.contains(MasterItems.at(c)->pattern())) && (MasterItems.at(c)->itemType() == PageItem::Symbol) && (!MasterItems.at(c)->pattern().isEmpty()))
- results.append(MasterItems.at(c)->pattern());
- if ((!MasterItems.at(c)->strokePattern().isEmpty()) && (MasterItems.at(c)->patternStrokePath))
- {
- if (!results.contains(MasterItems.at(c)->strokePattern()))
- results.append(MasterItems.at(c)->strokePattern());
- }
- if ((!results.contains(MasterItems.at(c)->strokePattern())) && ((!MasterItems.at(c)->strokePattern().isEmpty()) && (MasterItems.at(c)->patternStrokePath)))
- results.append(MasterItems.at(c)->pattern());
+ PageItem* currItem = MasterItems.at(c);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((!results.contains(currItem->pattern())) && (currItem->itemType() == PageItem::Symbol) && (!currItem->pattern().isEmpty()))
+ results.append(currItem->pattern());
+ if ((!currItem->strokePattern().isEmpty()) && (currItem->patternStrokePath))
+ {
+ if (!results.contains(currItem->strokePattern()))
+ results.append(currItem->strokePattern());
+ }
+ if ((!results.contains(currItem->strokePattern())) && ((!currItem->strokePattern().isEmpty()) && (currItem->patternStrokePath)))
+ results.append(currItem->pattern());
+ }
}
for (int c = 0; c < DocItems.count(); ++c)
{
- if ((!results.contains(DocItems.at(c)->pattern())) && (DocItems.at(c)->itemType() == PageItem::Symbol) && (!DocItems.at(c)->pattern().isEmpty()))
- results.append(DocItems.at(c)->pattern());
- if ((!DocItems.at(c)->strokePattern().isEmpty()) && (DocItems.at(c)->patternStrokePath))
- {
- if (!results.contains(DocItems.at(c)->strokePattern()))
- results.append(DocItems.at(c)->strokePattern());
+ PageItem* currItem = DocItems.at(c);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((!results.contains(currItem->pattern())) && (currItem->itemType() == PageItem::Symbol) && (!currItem->pattern().isEmpty()))
+ results.append(currItem->pattern());
+ if ((!currItem->strokePattern().isEmpty()) && (currItem->patternStrokePath))
+ {
+ if (!results.contains(currItem->strokePattern()))
+ results.append(currItem->strokePattern());
+ }
}
}
for (int c = 0; c < FrameItems.count(); ++c)
{
- if ((!results.contains(FrameItems.at(c)->pattern())) && (FrameItems.at(c)->itemType() == PageItem::Symbol) && (!FrameItems.at(c)->pattern().isEmpty()))
- results.append(FrameItems.at(c)->pattern());
- if ((!FrameItems.at(c)->strokePattern().isEmpty()) && (FrameItems.at(c)->patternStrokePath))
- {
- if (!results.contains(FrameItems.at(c)->strokePattern()))
- results.append(FrameItems.at(c)->strokePattern());
+ PageItem* currItem = FrameItems.at(c);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((!results.contains(currItem->pattern())) && (currItem->itemType() == PageItem::Symbol) && (!currItem->pattern().isEmpty()))
+ results.append(currItem->pattern());
+ if ((!currItem->strokePattern().isEmpty()) && (currItem->patternStrokePath))
+ {
+ if (!results.contains(currItem->strokePattern()))
+ results.append(currItem->strokePattern());
+ }
}
}
for (QMap<QString, ScPattern>::Iterator it = docPatterns.begin(); it != docPatterns.end(); ++it)
{
for (int c = 0; c < it.value().items.count(); ++c)
{
- if ((!results.contains(it.value().items.at(c)->pattern())) && (it.value().items.at(c)->itemType() == PageItem::Symbol) && (!it.value().items.at(c)->pattern().isEmpty()))
- results.append(it.value().items.at(c)->pattern());
- if ((!it.value().items.at(c)->strokePattern().isEmpty()) && (it.value().items.at(c)->patternStrokePath))
- {
- if (!results.contains(it.value().items.at(c)->strokePattern()))
- results.append(it.value().items.at(c)->strokePattern());
+ PageItem* currItem = it.value().items.at(c);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((!results.contains(currItem->pattern())) && (currItem->itemType() == PageItem::Symbol) && (!currItem->pattern().isEmpty()))
+ results.append(currItem->pattern());
+ if ((!currItem->strokePattern().isEmpty()) && (currItem->patternStrokePath))
+ {
+ if (!results.contains(currItem->strokePattern()))
+ results.append(currItem->strokePattern());
+ }
}
}
}
@@ -3057,6 +3165,7 @@
// QTime t;
// t.start();
QMap<QString,int> Really;
+ QList<PageItem*> allItems;
//QMap<QString,QFont> DocF;
//DocF = UsedFonts;
uint counter = 0;
@@ -3089,18 +3198,26 @@
it = FrameItems.at(d);
break;
}
- if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
- {
- QString fontName(it->itemText.defaultStyle().charStyle().font().replacementName());
- Really.insert(fontName, UsedFonts[fontName]);
- int start = it->firstInFrame();
- int stop = it->lastInFrame();
- for (int e = start; e <= stop; ++e)
+ if (it->isGroup())
+ allItems = it->getItemList();
+ else
+ allItems.append(it);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ it = allItems.at(ii);
+ if ((it->itemType() == PageItem::TextFrame) || (it->itemType() == PageItem::PathText))
{
- QString rep = it->itemText.charStyle(e).font().replacementName();
- if (Really.contains(rep))
- continue;
- Really.insert(rep, UsedFonts[rep]);
+ QString fontName(it->itemText.defaultStyle().charStyle().font().replacementName());
+ Really.insert(fontName, UsedFonts[fontName]);
+ int start = it->firstInFrame();
+ int stop = it->lastInFrame();
+ for (int e = start; e <= stop; ++e)
+ {
+ QString rep = it->itemText.charStyle(e).font().replacementName();
+ if (Really.contains(rep))
+ continue;
+ Really.insert(rep, UsedFonts[rep]);
+ }
}
}
}
@@ -3125,6 +3242,7 @@
void ScribusDoc::getUsedFonts(QMap<QString, QMap<uint, FPointArray> > & Really)
{
+ QList<PageItem*> allItems;
PageItem* it = NULL;
uint counter = 0;
for (uint lc = 0; lc < 3; ++lc)
@@ -3155,7 +3273,15 @@
it = FrameItems.at(d);
break;
}
- checkItemForFonts(it, Really, lc);
+ if (it->isGroup())
+ allItems = it->getItemList();
+ else
+ allItems.append(it);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ it = allItems.at(ii);
+ checkItemForFonts(it, Really, lc);
+ }
}
}
QStringList patterns = getUsedPatterns();
@@ -3164,7 +3290,16 @@
ScPattern pa = docPatterns[patterns[c]];
for (int o = 0; o < pa.items.count(); o++)
{
- checkItemForFonts(pa.items.at(o), Really, 3);
+ it = pa.items.at(o);
+ if (it->isGroup())
+ allItems = it->getItemList();
+ else
+ allItems.append(it);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ it = allItems.at(ii);
+ checkItemForFonts(it, Really, 3);
+ }
}
}
}
@@ -3346,6 +3481,7 @@
uint counter = 0;
usedProfiles.clear();
+ QList<PageItem*> allItems;
profileNames.append(docPrefsData.colorPrefs.DCMSset.DefaultSolidColorRGBProfile);
profileNames.append(docPrefsData.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile);
if( profileNames.indexOf(docPrefsData.colorPrefs.DCMSset.DefaultImageRGBProfile) < 0 )
@@ -3373,9 +3509,17 @@
it = DocItems.at(d);
else if(lc == 2)
it = FrameItems.at(d);
- if (it->IProfile.isEmpty() || profileNames.contains(it->IProfile))
- continue;
- profileNames.append(it->IProfile);
+ if (it->isGroup())
+ allItems = it->getItemList();
+ else
+ allItems.append(it);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ it = allItems.at(ii);
+ if (it->IProfile.isEmpty() || profileNames.contains(it->IProfile))
+ continue;
+ profileNames.append(it->IProfile);
+ }
}
}
@@ -4011,6 +4155,11 @@
z = itemAdd(PageItem::Symbol, PageItem::Unspecified, x, y, w, h, 0, CommonStrings::None, CommonStrings::None, true);
Items->at(z)->setPattern(Buffer->pattern);
break;
+ case PageItem::Group:
+ z = itemAdd(PageItem::Group, PageItem::Unspecified, x, y, w, h, 0, CommonStrings::None, CommonStrings::None, true);
+ Items->at(z)->groupWidth = Buffer->groupWidth;
+ Items->at(z)->groupHeight = Buffer->groupHeight;
+ break;
case PageItem::Multiple:
Q_ASSERT(false);
break;
@@ -4110,8 +4259,8 @@
}
else
{
- if (currItem->isGroupControl)
- currItem->setItemName( tr("Group%1").arg(currItem->Groups.top()));
+ if (currItem->isGroup())
+ currItem->setItemName( tr("Group%1").arg(GroupCounter));
}
currItem->TopLine = Buffer->TopLine;
@@ -4367,6 +4516,10 @@
newItem = new PageItem_Symbol(this, x, y, b, h, w, CommonStrings::None, CommonStrings::None);
Q_ASSERT(frameType==PageItem::Rectangle || frameType==PageItem::Unspecified);
break;
+ case PageItem::Group:
+ newItem = new PageItem_Group(this, x, y, b, h, w, CommonStrings::None, CommonStrings::None);
+ Q_ASSERT(frameType==PageItem::Rectangle || frameType==PageItem::Unspecified);
+ break;
default:
// qDebug() << "unknown item type";
assert (false);
@@ -4593,14 +4746,18 @@
newItem->ClipEdited = true;
break;
case PageItem::PathText:
+ break;
case PageItem::Symbol:
+ case PageItem::Group:
+ newItem->ClipEdited = true;
+ newItem->FrameType = 3;
//At this point, we cannot create a PathText item like this, only by conversion, do nothing
break;
default:
break;
}
- if (frameType==PageItem::Rectangle || itemType==PageItem::TextFrame || itemType==PageItem::ImageFrame || itemType==PageItem::LatexFrame || itemType==PageItem::OSGFrame || itemType==PageItem::Symbol)
+ if (frameType==PageItem::Rectangle || itemType==PageItem::TextFrame || itemType==PageItem::ImageFrame || itemType==PageItem::LatexFrame || itemType==PageItem::OSGFrame || itemType==PageItem::Symbol || itemType==PageItem::Group)
{
newItem->SetRectFrame();
//TODO one day hopefully, if(ScCore->usingGUI())
@@ -5382,23 +5539,6 @@
//Add new item back to selection if old item was in selection
if (removedFromSelection)
m_Selection->addItem(newItem);
- if (oldItem->Groups.count() != 0)
- {
- PageItem *currItem;
- for (int a = 0; a < Items->count(); ++a)
- {
- currItem = Items->at(a);
- if (currItem->isGroupControl)
- {
- if (currItem->groupsLastItem == oldItem)
- {
- if (UndoManager::undoEnabled() && !transactionConversion)
- transactionConversion = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::ConvertTo, "", Um::IGroup));
- currItem->setGroupsLastItem(newItem);
- }
- }
- }
- }
// If converting a text frame to another object, drop links
if (oldItem->asTextFrame() && (newType != PageItem::TextFrame))
oldItem->dropLinks();
@@ -5516,7 +5656,7 @@
Page* addedPage = TempPages.at(0);
if (Items->count() > 1)
{
- bool isGroup = true;
+ /* bool isGroup = true;
int firstElem = -1;
if (currItem->Groups.count() != 0)
firstElem = currItem->Groups.top();
@@ -5536,20 +5676,20 @@
isGroup = false;
break;
}
- }
- if (!isGroup)
- {
- itemAdd(PageItem::Polygon, PageItem::Rectangle, addedPage->xOffset(), addedPage->yOffset(), 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
+ } */
+ if ((!currItem->isGroup()) && (Items->count() > 1))
+ {
+ itemAdd(PageItem::Group, PageItem::Rectangle, addedPage->xOffset(), addedPage->yOffset(), 10, 10, 0, CommonStrings::None, CommonStrings::None, true);
PageItem *groupItem = Items->takeLast();
Items->insert(0, groupItem);
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
double maxx = -std::numeric_limits<double>::max();
double maxy = -std::numeric_limits<double>::max();
- for (int as = 0; as < Items->count(); ++as)
+ for (int as = 1; as < Items->count(); ++as)
{
PageItem* currItem = Items->at(as);
- currItem->Groups.push(GroupCounter);
+ groupItem->groupItemList.append(currItem);
double x1, x2, y1, y2;
currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
minx = qMin(minx, x1);
@@ -5557,18 +5697,27 @@
maxx = qMax(maxx, x2);
maxy = qMax(maxy, y2);
}
+ for (int em = 0; em < groupItem->groupItemList.count(); ++em)
+ {
+ PageItem* currItem = groupItem->groupItemList.at(em);
+ currItem->gXpos = currItem->xPos() - minx;
+ currItem->gYpos = currItem->yPos() - miny;
+ currItem->gWidth = maxx - minx;
+ currItem->gHeight = maxy - miny;
+ }
groupItem->setXYPos(minx, miny, true);
groupItem->setWidthHeight(maxx - minx, maxy - miny, true);
+ groupItem->groupWidth = maxx - minx;
+ groupItem->groupHeight = maxy - miny;
groupItem->SetRectFrame();
groupItem->ClipEdited = true;
groupItem->FrameType = 3;
groupItem->setTextFlowMode(PageItem::TextFlowDisabled);
groupItem->AutoName = false;
- groupItem->isGroupControl = true;
groupItem->setFillTransparency(0);
groupItem->setLineTransparency(0);
- groupItem->groupsLastItem = Items->at(Items->count()-1);
- groupItem->Groups.push(GroupCounter);
+ // groupItem->groupsLastItem = Items->at(Items->count()-1);
+ // groupItem->Groups.push(GroupCounter);
GroupCounter++;
renumberItemsInListOrder();
}
@@ -6058,58 +6207,17 @@
void ScribusDoc::updateAllItemQColors()
{
- for (int c=0; c<DocItems.count(); ++c)
+ QList<PageItem*> allItems;
+ for (int c = 0; c < DocItems.count(); ++c)
{
PageItem *ite = DocItems.at(c);
- ite->setLineQColor();
- ite->setFillQColor();
- ite->set4ColorColors(ite->GrColorP1, ite->GrColorP2, ite->GrColorP3, ite->GrColorP4);
- for (int grow = 0; grow < ite->meshGradientArray.count(); grow++)
- {
- for (int gcol = 0; gcol < ite->meshGradientArray[grow].count(); gcol++)
- {
- meshPoint mp = ite->meshGradientArray[grow][gcol];
- ite->setMeshPointColor(grow, gcol, mp.colorName, mp.shade, mp.transparency);
- }
- }
- }
- for (int c=0; c<MasterItems.count(); ++c)
- {
- PageItem *ite = MasterItems.at(c);
- ite->setLineQColor();
- ite->setFillQColor();
- ite->set4ColorColors(ite->GrColorP1, ite->GrColorP2, ite->GrColorP3, ite->GrColorP4);
- for (int grow = 0; grow < ite->meshGradientArray.count(); grow++)
- {
- for (int gcol = 0; gcol < ite->meshGradientArray[grow].count(); gcol++)
- {
- meshPoint mp = ite->meshGradientArray[grow][gcol];
- ite->setMeshPointColor(grow, gcol, mp.colorName, mp.shade, mp.transparency);
- }
- }
- }
- for (int c=0; c<FrameItems.count(); ++c)
- {
- PageItem *ite = FrameItems.at(c);
- ite->setLineQColor();
- ite->setFillQColor();
- ite->set4ColorColors(ite->GrColorP1, ite->GrColorP2, ite->GrColorP3, ite->GrColorP4);
- for (int grow = 0; grow < ite->meshGradientArray.count(); grow++)
- {
- for (int gcol = 0; gcol < ite->meshGradientArray[grow].count(); gcol++)
- {
- meshPoint mp = ite->meshGradientArray[grow][gcol];
- ite->setMeshPointColor(grow, gcol, mp.colorName, mp.shade, mp.transparency);
- }
- }
- }
- QStringList patterns = docPatterns.keys();
- for (int c = 0; c < patterns.count(); ++c)
- {
- ScPattern pa = docPatterns[patterns[c]];
- for (int o = 0; o < pa.items.count(); o++)
- {
- PageItem *ite = pa.items.at(o);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
ite->setLineQColor();
ite->setFillQColor();
ite->set4ColorColors(ite->GrColorP1, ite->GrColorP2, ite->GrColorP3, ite->GrColorP4);
@@ -6123,6 +6231,80 @@
}
}
}
+ for (int c = 0; c < MasterItems.count(); ++c)
+ {
+ PageItem *ite = MasterItems.at(c);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ ite->setLineQColor();
+ ite->setFillQColor();
+ ite->set4ColorColors(ite->GrColorP1, ite->GrColorP2, ite->GrColorP3, ite->GrColorP4);
+ for (int grow = 0; grow < ite->meshGradientArray.count(); grow++)
+ {
+ for (int gcol = 0; gcol < ite->meshGradientArray[grow].count(); gcol++)
+ {
+ meshPoint mp = ite->meshGradientArray[grow][gcol];
+ ite->setMeshPointColor(grow, gcol, mp.colorName, mp.shade, mp.transparency);
+ }
+ }
+ }
+ }
+ for (int c = 0; c < FrameItems.count(); ++c)
+ {
+ PageItem *ite = FrameItems.at(c);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ ite->setLineQColor();
+ ite->setFillQColor();
+ ite->set4ColorColors(ite->GrColorP1, ite->GrColorP2, ite->GrColorP3, ite->GrColorP4);
+ for (int grow = 0; grow < ite->meshGradientArray.count(); grow++)
+ {
+ for (int gcol = 0; gcol < ite->meshGradientArray[grow].count(); gcol++)
+ {
+ meshPoint mp = ite->meshGradientArray[grow][gcol];
+ ite->setMeshPointColor(grow, gcol, mp.colorName, mp.shade, mp.transparency);
+ }
+ }
+ }
+ }
+ QStringList patterns = docPatterns.keys();
+ for (int c = 0; c < patterns.count(); ++c)
+ {
+ ScPattern pa = docPatterns[patterns[c]];
+ for (int o = 0; o < pa.items.count(); o++)
+ {
+ PageItem *ite = pa.items.at(o);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ ite->setLineQColor();
+ ite->setFillQColor();
+ ite->set4ColorColors(ite->GrColorP1, ite->GrColorP2, ite->GrColorP3, ite->GrColorP4);
+ for (int grow = 0; grow < ite->meshGradientArray.count(); grow++)
+ {
+ for (int gcol = 0; gcol < ite->meshGradientArray[grow].count(); gcol++)
+ {
+ meshPoint mp = ite->meshGradientArray[grow][gcol];
+ ite->setMeshPointColor(grow, gcol, mp.colorName, mp.shade, mp.transparency);
+ }
+ }
+ }
+ }
+ }
}
@@ -6135,6 +6317,7 @@
void ScribusDoc::RecalcPictures(QList<PageItem*>* items, ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia)
{
+ QList<PageItem*> allItems;
uint docItemCount=items->count();
if ( docItemCount!= 0)
{
@@ -6146,19 +6329,27 @@
for (uint i=0; i < docItemCount; ++i)
{
it = items->at(i);
- if ((it->itemType() == PageItem::ImageFrame) && (it->PictureIsAvailable))
- {
- if (it->pixm.imgInfo.colorspace == ColorSpaceCMYK)
+ if (it->isGroup())
+ allItems = it->getItemList();
+ else
+ allItems.append(it);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ it = allItems.at(ii);
+ if ((it->itemType() == PageItem::ImageFrame) && (it->PictureIsAvailable))
{
- if (!PrCMYK->contains(it->IProfile))
- it->IProfile = docPrefsData.colorPrefs.DCMSset.DefaultImageCMYKProfile;
+ if (it->pixm.imgInfo.colorspace == ColorSpaceCMYK)
+ {
+ if (!PrCMYK->contains(it->IProfile))
+ it->IProfile = docPrefsData.colorPrefs.DCMSset.DefaultImageCMYKProfile;
+ }
+ else
+ {
+ if (!Pr->contains(it->IProfile))
+ it->IProfile = docPrefsData.colorPrefs.DCMSset.DefaultImageRGBProfile;
+ }
+ loadPict(it->Pfile, it, true);
}
- else
- {
- if (!Pr->contains(it->IProfile))
- it->IProfile = docPrefsData.colorPrefs.DCMSset.DefaultImageRGBProfile;
- }
- loadPict(it->Pfile, it, true);
}
if (usingGUI)
{
@@ -6194,7 +6385,7 @@
for (uint c = 0; c < docSelectionCount; ++c)
{
currItem = m_Selection->itemAt(c);
- if (((currItem->isSingleSel) && (currItem->isGroupControl)) || ((currItem->isSingleSel) && (currItem->isTableItem)))
+ if (((currItem->isSingleSel) && (currItem->isGroup())) || ((currItem->isSingleSel) && (currItem->isTableItem)))
return false;
ObjOrder.insert(currItem->ItemNr, c);
int d = Items->indexOf(currItem);
@@ -6223,7 +6414,7 @@
for (uint c = 0; c < docSelectionCount; ++c)
{
currItem = m_Selection->itemAt(c);
- if (((currItem->isSingleSel) && (currItem->isGroupControl)) || ((currItem->isSingleSel) && (currItem->isTableItem)))
+ if (((currItem->isSingleSel) && (currItem->isGroup())) || ((currItem->isSingleSel) && (currItem->isTableItem)))
return false;
ObjOrder.insert(currItem->ItemNr, c);
int d = Items->indexOf(currItem);
@@ -7647,49 +7838,17 @@
//CB Same as RecalcPicturesRes apart from the name checking, which should be able to be removed
void ScribusDoc::updatePict(QString name)
{
+ QList<PageItem*> allItems;
for (int a = 0; a < DocItems.count(); ++a)
{
PageItem *currItem = DocItems.at(a);
- if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- }
- }
- for (int a = 0; a < MasterItems.count(); ++a)
- {
- PageItem *currItem = MasterItems.at(a);
- if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- }
- }
- for (int a = 0; a <FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
- if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- }
- }
- QStringList patterns = docPatterns.keys();
- for (int c = 0; c < patterns.count(); ++c)
- {
- ScPattern pa = docPatterns[patterns[c]];
- for (int o = 0; o < pa.items.count(); o++)
- {
- PageItem *currItem = pa.items.at(o);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
{
bool fho = currItem->imageFlippedH();
@@ -7699,6 +7858,71 @@
currItem->setImageFlippedV(fvo);
}
}
+ }
+ for (int a = 0; a < MasterItems.count(); ++a)
+ {
+ PageItem *currItem = MasterItems.at(a);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ }
+ }
+ }
+ for (int a = 0; a <FrameItems.count(); ++a)
+ {
+ PageItem *currItem = FrameItems.at(a);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ }
+ }
+ }
+ QStringList patterns = docPatterns.keys();
+ for (int c = 0; c < patterns.count(); ++c)
+ {
+ ScPattern pa = docPatterns[patterns[c]];
+ for (int o = 0; o < pa.items.count(); o++)
+ {
+ PageItem *currItem = pa.items.at(o);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ }
+ }
+ }
PageItem *ite = pa.items.at(0);
docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(pa.items);
}
@@ -7708,82 +7932,17 @@
void ScribusDoc::updatePictDir(QString name)
{
+ QList<PageItem*> allItems;
for (int a = 0; a < DocItems.count(); ++a)
{
PageItem *currItem = DocItems.at(a);
- if (currItem->asImageFrame())
- {
- if ((!currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
- {
- QFileInfo fi(currItem->Pfile);
- if (fi.absolutePath() == name)
- {
- if (fi.exists())
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- ScCore->fileWatcher->addFile(currItem->Pfile);
- }
- }
- }
- }
- }
- for (int a = 0; a < MasterItems.count(); ++a)
- {
- PageItem *currItem = MasterItems.at(a);
- if (currItem->asImageFrame())
- {
- if ((!currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
- {
- QFileInfo fi(currItem->Pfile);
- if (fi.absolutePath() == name)
- {
- if (fi.exists())
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- ScCore->fileWatcher->addFile(currItem->Pfile);
- }
- }
- }
- }
- }
- for (int a = 0; a <FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
- if (currItem->asImageFrame())
- {
- if ((!currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
- {
- QFileInfo fi(currItem->Pfile);
- if (fi.absolutePath() == name)
- {
- if (fi.exists())
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- ScCore->fileWatcher->addFile(currItem->Pfile);
- }
- }
- }
- }
- }
- QStringList patterns = docPatterns.keys();
- for (int c = 0; c < patterns.count(); ++c)
- {
- ScPattern pa = docPatterns[patterns[c]];
- for (int o = 0; o < pa.items.count(); o++)
- {
- PageItem *currItem = pa.items.at(o);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
if (currItem->asImageFrame())
{
if ((!currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
@@ -7804,8 +7963,106 @@
}
}
}
- PageItem *ite = pa.items.at(0);
- docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(pa.items);
+ }
+ for (int a = 0; a < MasterItems.count(); ++a)
+ {
+ PageItem *currItem = MasterItems.at(a);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->asImageFrame())
+ {
+ if ((!currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
+ {
+ QFileInfo fi(currItem->Pfile);
+ if (fi.absolutePath() == name)
+ {
+ if (fi.exists())
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ ScCore->fileWatcher->addFile(currItem->Pfile);
+ }
+ }
+ }
+ }
+ }
+ }
+ for (int a = 0; a <FrameItems.count(); ++a)
+ {
+ PageItem *currItem = FrameItems.at(a);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->asImageFrame())
+ {
+ if ((!currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
+ {
+ QFileInfo fi(currItem->Pfile);
+ if (fi.absolutePath() == name)
+ {
+ if (fi.exists())
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ ScCore->fileWatcher->addFile(currItem->Pfile);
+ }
+ }
+ }
+ }
+ }
+ }
+ QStringList patterns = docPatterns.keys();
+ for (int c = 0; c < patterns.count(); ++c)
+ {
+ ScPattern pa = docPatterns[patterns[c]];
+ for (int o = 0; o < pa.items.count(); o++)
+ {
+ PageItem *currItem = pa.items.at(o);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->asImageFrame())
+ {
+ if ((!currItem->PictureIsAvailable) && (!currItem->Pfile.isEmpty()))
+ {
+ QFileInfo fi(currItem->Pfile);
+ if (fi.absolutePath() == name)
+ {
+ if (fi.exists())
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ ScCore->fileWatcher->addFile(currItem->Pfile);
+ }
+ }
+ }
+ }
+ }
+ PageItem *ite = pa.items.at(0);
+ docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(pa.items);
+ }
}
regionsChanged()->update(QRectF());
changed();
@@ -7818,23 +8075,48 @@
int ca = 0;
ScGuardedPtr<ScribusDoc> docPtr = guardedPtr();
m_ScMW->mainWindowProgressBar->reset();
+ QList<PageItem*> allItems;
for (int a = 0; a < DocItems.count(); ++a)
{
PageItem *currItem = DocItems.at(a);
- if (currItem->PictureIsAvailable)
- cc++;
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ cc++;
+ }
}
for (int a = 0; a < MasterItems.count(); ++a)
{
PageItem *currItem = MasterItems.at(a);
- if (currItem->PictureIsAvailable)
- cc++;
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ cc++;
+ }
}
for (int a = 0; a < FrameItems.count(); ++a)
{
PageItem *currItem = FrameItems.at(a);
- if (currItem->PictureIsAvailable)
- cc++;
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ cc++;
+ }
}
QStringList patterns = docPatterns.keys();
for (int c = 0; c < patterns.count(); ++c)
@@ -7843,83 +8125,29 @@
for (int o = 0; o < pa.items.count(); o++)
{
PageItem *currItem = pa.items.at(o);
- if (currItem->PictureIsAvailable)
- cc++;
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ cc++;
+ }
}
}
m_ScMW->mainWindowProgressBar->setMaximum((cc > 0) ? cc : 1);
for (int a = 0; a < DocItems.count(); ++a)
{
PageItem *currItem = DocItems.at(a);
- if (currItem->PictureIsAvailable)
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- if (applyNewRes)
- currItem->pixm.imgInfo.lowResType = docPrefsData.itemToolPrefs.imageLowResType;
- if (currItem->asLatexFrame())
- currItem->asLatexFrame()->rerunApplication(false);
- else
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- currItem->AdjustPictScale();
- ca++;
- m_ScMW->mainWindowProgressBar->setValue(ca);
- qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
- if (!docPtr) return;
- }
- }
- for (int a = 0; a < MasterItems.count(); ++a)
- {
- PageItem *currItem = MasterItems.at(a);
- if (currItem->PictureIsAvailable)
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- if (applyNewRes)
- currItem->pixm.imgInfo.lowResType = docPrefsData.itemToolPrefs.imageLowResType;
- if (currItem->asLatexFrame())
- currItem->asLatexFrame()->rerunApplication(false);
- else
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- currItem->AdjustPictScale();
- ca++;
- m_ScMW->mainWindowProgressBar->setValue(ca);
- qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
- if (!docPtr) return;
- }
- }
- for (int a = 0; a < FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
- if (currItem->PictureIsAvailable)
- {
- bool fho = currItem->imageFlippedH();
- bool fvo = currItem->imageFlippedV();
- if (applyNewRes)
- currItem->pixm.imgInfo.lowResType = docPrefsData.itemToolPrefs.imageLowResType;
- if (currItem->asLatexFrame())
- currItem->asLatexFrame()->rerunApplication(false);
- else
- loadPict(currItem->Pfile, currItem, true);
- currItem->setImageFlippedH(fho);
- currItem->setImageFlippedV(fvo);
- currItem->AdjustPictScale();
- ca++;
- m_ScMW->mainWindowProgressBar->setValue(ca);
- qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
- if (!docPtr) return;
- }
- }
- for (int c = 0; c < patterns.count(); ++c)
- {
- ScPattern pa = docPatterns[patterns[c]];
- for (int o = 0; o < pa.items.count(); o++)
- {
- PageItem *currItem = pa.items.at(o);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
if (currItem->PictureIsAvailable)
{
bool fho = currItem->imageFlippedH();
@@ -7939,6 +8167,100 @@
if (!docPtr) return;
}
}
+ }
+ for (int a = 0; a < MasterItems.count(); ++a)
+ {
+ PageItem *currItem = MasterItems.at(a);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ if (applyNewRes)
+ currItem->pixm.imgInfo.lowResType = docPrefsData.itemToolPrefs.imageLowResType;
+ if (currItem->asLatexFrame())
+ currItem->asLatexFrame()->rerunApplication(false);
+ else
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ currItem->AdjustPictScale();
+ ca++;
+ m_ScMW->mainWindowProgressBar->setValue(ca);
+ qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+ if (!docPtr) return;
+ }
+ }
+ }
+ for (int a = 0; a < FrameItems.count(); ++a)
+ {
+ PageItem *currItem = FrameItems.at(a);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ if (applyNewRes)
+ currItem->pixm.imgInfo.lowResType = docPrefsData.itemToolPrefs.imageLowResType;
+ if (currItem->asLatexFrame())
+ currItem->asLatexFrame()->rerunApplication(false);
+ else
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ currItem->AdjustPictScale();
+ ca++;
+ m_ScMW->mainWindowProgressBar->setValue(ca);
+ qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+ if (!docPtr) return;
+ }
+ }
+ }
+ for (int c = 0; c < patterns.count(); ++c)
+ {
+ ScPattern pa = docPatterns[patterns[c]];
+ for (int o = 0; o < pa.items.count(); o++)
+ {
+ PageItem *currItem = pa.items.at(o);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->PictureIsAvailable)
+ {
+ bool fho = currItem->imageFlippedH();
+ bool fvo = currItem->imageFlippedV();
+ if (applyNewRes)
+ currItem->pixm.imgInfo.lowResType = docPrefsData.itemToolPrefs.imageLowResType;
+ if (currItem->asLatexFrame())
+ currItem->asLatexFrame()->rerunApplication(false);
+ else
+ loadPict(currItem->Pfile, currItem, true);
+ currItem->setImageFlippedH(fho);
+ currItem->setImageFlippedV(fvo);
+ currItem->AdjustPictScale();
+ ca++;
+ m_ScMW->mainWindowProgressBar->setValue(ca);
+ qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+ if (!docPtr) return;
+ }
+ }
+ }
PageItem *ite = pa.items.at(0);
docPatterns[patterns[c]].pattern = ite->DrawObj_toImage(pa.items);
}
@@ -7950,31 +8272,56 @@
void ScribusDoc::removePict(QString name)
{
+ QList<PageItem*> allItems;
for (int a = 0; a < DocItems.count(); ++a)
{
PageItem *currItem = DocItems.at(a);
- if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
- {
- currItem->PictureIsAvailable = false;
- currItem->pixm = ScImage();
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
+ {
+ currItem->PictureIsAvailable = false;
+ currItem->pixm = ScImage();
+ }
}
}
for (int a = 0; a < MasterItems.count(); ++a)
{
PageItem *currItem = MasterItems.at(a);
- if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
- {
- currItem->PictureIsAvailable = false;
- currItem->pixm = ScImage();
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
+ {
+ currItem->PictureIsAvailable = false;
+ currItem->pixm = ScImage();
+ }
}
}
for (int a = 0; a < FrameItems.count(); ++a)
{
PageItem *currItem = FrameItems.at(a);
- if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
- {
- currItem->PictureIsAvailable = false;
- currItem->pixm = ScImage();
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
+ {
+ currItem->PictureIsAvailable = false;
+ currItem->pixm = ScImage();
+ }
}
}
QStringList patterns = docPatterns.keys();
@@ -7984,10 +8331,18 @@
for (int o = 0; o < pa.items.count(); o++)
{
PageItem *currItem = pa.items.at(o);
- if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
- {
- currItem->PictureIsAvailable = false;
- currItem->pixm = ScImage();
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if ((currItem->PictureIsAvailable) && (currItem->Pfile == name))
+ {
+ currItem->PictureIsAvailable = false;
+ currItem->pixm = ScImage();
+ }
}
}
PageItem *ite = pa.items.at(0);
@@ -8078,17 +8433,27 @@
if (tmpSelection.count() != 0)
itemSelection_DeleteItem(&tmpSelection);
tmpSelection.clear();
+ QList<PageItem*> allItems;
for (int b = 0; b < DocItems.count(); ++b)
{
- if (DocItems.at(b)->LayerID == l)
- {
- if (dl)
- {
- tmpSelection.addItem(DocItems.at(b));
- DocItems.at(b)->setLocked(false);
- }
- else
- DocItems.at(b)->setLayer(newLayerID);
+ PageItem* currItem = DocItems.at(b);
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem->LayerID == l)
+ {
+ if (dl)
+ {
+ tmpSelection.addItem(currItem);
+ currItem->setLocked(false);
+ }
+ else
+ currItem->setLayer(newLayerID);
+ }
}
}
if (tmpSelection.count() != 0)
@@ -8555,41 +8920,70 @@
void ScribusDoc::allItems_ChangePreviewResolution(int id)
{
-
bool found=false;
-
+ QList<PageItem*> allItems;
for (int c=0; c<DocItems.count(); ++c)
{
PageItem *currItem = DocItems.at(c);
- if (currItem!=NULL)
- if (currItem->asImageFrame())
- {
- currItem->pixm.imgInfo.lowResType = id;
- if (!found)
- found=true;
- }
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem!=NULL)
+ {
+ if (currItem->asImageFrame())
+ {
+ currItem->pixm.imgInfo.lowResType = id;
+ if (!found)
+ found=true;
+ }
+ }
+ }
}
for (int c=0; c<MasterItems.count(); ++c)
{
PageItem *currItem = MasterItems.at(c);
- if (currItem!=NULL)
- if (currItem->asImageFrame())
- {
- currItem->pixm.imgInfo.lowResType = id;
- if (!found)
- found=true;
- }
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem!=NULL)
+ {
+ if (currItem->asImageFrame())
+ {
+ currItem->pixm.imgInfo.lowResType = id;
+ if (!found)
+ found=true;
+ }
+ }
+ }
}
for (int c=0; c<FrameItems.count(); ++c)
{
PageItem *currItem = FrameItems.at(c);
- if (currItem!=NULL)
- if (currItem->asImageFrame())
- {
- currItem->pixm.imgInfo.lowResType = id;
- if (!found)
- found=true;
- }
+ if (currItem->isGroup())
+ allItems = currItem->getItemList();
+ else
+ allItems.append(currItem);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ currItem = allItems.at(ii);
+ if (currItem!=NULL)
+ {
+ if (currItem->asImageFrame())
+ {
+ currItem->pixm.imgInfo.lowResType = id;
+ if (!found)
+ found=true;
+ }
+ }
+ }
}
if (!found) //No image frames in the current selection!
@@ -8729,6 +9123,7 @@
//CB From view emit DelBM(currItem);
m_ScMW->DelBookMark(currItem);
Items->removeAll(currItem);
+// if (forceDeletion || !UndoManager::undoEnabled())
if (forceDeletion)
delete currItem;
}
@@ -8783,7 +9178,7 @@
for (uint i = 0; i < selectedItemCount; ++i)
{
PageItem *currItem = m_Selection->itemAt(i);
- if (currItem->isGroupControl)
+ if (currItem->isGroup())
continue;
currItem->setFillTransparency(t);
}
@@ -8817,7 +9212,7 @@
for (uint i = 0; i < selectedItemCount; ++i)
{
PageItem *currItem = m_Selection->itemAt(i);
- if (currItem->isGroupControl)
+ if (currItem->isGroup())
continue;
currItem->setFillBlendmode(t);
}
@@ -10546,52 +10941,103 @@
void ScribusDoc::invalidateAll()
{
+ QList<PageItem*> allItems;
for (int c = 0; c < DocItems.count(); ++c)
{
PageItem *ite = DocItems.at(c);
- ite->invalidateLayout();
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ ite->invalidateLayout();
+ }
}
for (int c=0; c < MasterItems.count(); ++c)
{
PageItem *ite = MasterItems.at(c);
- ite->invalidateLayout();
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ ite->invalidateLayout();
+ }
}
// for now hope that frameitems get invalidated by their parents layout() method.
}
void ScribusDoc::invalidateLayer(int layerID)
{
+ QList<PageItem*> allItems;
for (int c = 0; c < DocItems.count(); ++c)
{
PageItem *ite = DocItems.at(c);
- if (ite->LayerID == layerID)
- ite->invalidateLayout();
- }
- if (this->masterPageMode())
- {
- for (int c=0; c < MasterItems.count(); ++c)
- {
- PageItem *ite = MasterItems.at(c);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
if (ite->LayerID == layerID)
ite->invalidateLayout();
}
}
+ if (this->masterPageMode())
+ {
+ for (int c=0; c < MasterItems.count(); ++c)
+ {
+ PageItem *ite = MasterItems.at(c);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ if (ite->LayerID == layerID)
+ ite->invalidateLayout();
+ }
+ }
+ }
// for now hope that frameitems get invalidated by their parents layout() method.
}
void ScribusDoc::invalidateRegion(QRectF region)
{
+ QList<PageItem*> allItems;
for (int c=0; c<DocItems.count(); ++c)
{
PageItem *ite = DocItems.at(c);
- if (ite->getBoundingRect().intersects(region))
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ if (ite->getBoundingRect().intersects(region))
+ ite->invalidateLayout();
+ }
+ }
+ for (int c=0; c<MasterItems.count(); ++c)
+ {
+ PageItem *ite = MasterItems.at(c);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ // for now invalidate all masteritems, should be only necessary in masterpagemode
ite->invalidateLayout();
- }
- for (int c=0; c<MasterItems.count(); ++c)
- {
- PageItem *ite = MasterItems.at(c);
- // for now invalidate all masteritems, should be only necessary in masterpagemode
- ite->invalidateLayout();
+ }
}
// for now hope that frameitems get invalidated by their parents layout() method.
}
@@ -11444,32 +11890,35 @@
{
bool siz = currItem->Sizing;
currItem->Sizing = false;
- FPointArray Clip;
- Clip = currItem->PoLine;
- FPoint tp2(getMinClipF(&Clip));
- SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem, true, false, false);
- Clip.translate(-tp2.x(), -tp2.y());
- if (currItem->rotation() != 0)
- {
- FPoint npv(tp2.x(), tp2.y());
- MoveRotated(currItem, npv, true);
- }
- else
- MoveItem(tp2.x(), tp2.y(), currItem, true);
- if (!currItem->imageFlippedH())
- currItem->moveImageInFrame(-tp2.x()/currItem->imageXScale(), 0);
- if (!currItem->imageFlippedV())
- currItem->moveImageInFrame(0, -tp2.y()/currItem->imageYScale());
- FPoint tp(getMaxClipF(&Clip));
- if (currItem->imageFlippedH())
- currItem->moveImageInFrame((currItem->width() - tp.x())/currItem->imageXScale(), 0);
- if (currItem->imageFlippedV())
- currItem->moveImageInFrame(0, (currItem->height() - tp.y())/currItem->imageYScale());
- SizeItem(tp.x(), tp.y(), currItem, true, false);
+ if (!(currItem->isGroup() || currItem->isSymbol()))
+ {
+ FPointArray Clip;
+ Clip = currItem->PoLine;
+ FPoint tp2(getMinClipF(&Clip));
+ SizeItem(currItem->width() - tp2.x(), currItem->height() - tp2.y(), currItem, true, false, false);
+ Clip.translate(-tp2.x(), -tp2.y());
+ if (currItem->rotation() != 0)
+ {
+ FPoint npv(tp2.x(), tp2.y());
+ MoveRotated(currItem, npv, true);
+ }
+ else
+ MoveItem(tp2.x(), tp2.y(), currItem, true);
+ if (!currItem->imageFlippedH())
+ currItem->moveImageInFrame(-tp2.x()/currItem->imageXScale(), 0);
+ if (!currItem->imageFlippedV())
+ currItem->moveImageInFrame(0, -tp2.y()/currItem->imageYScale());
+ FPoint tp(getMaxClipF(&Clip));
+ if (currItem->imageFlippedH())
+ currItem->moveImageInFrame((currItem->width() - tp.x())/currItem->imageXScale(), 0);
+ if (currItem->imageFlippedV())
+ currItem->moveImageInFrame(0, (currItem->height() - tp.y())/currItem->imageYScale());
+ SizeItem(tp.x(), tp.y(), currItem, true, false);
+ currItem->PoLine = Clip.copy();
+ }
currItem->ClipEdited = true;
currItem->OldB2 = currItem->width();
currItem->OldH2 = currItem->height();
- currItem->PoLine = Clip.copy();
if (currItem->asPolyLine())
currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2, 1.0)));
else if (currItem->asPathText())
@@ -11552,7 +12001,7 @@
regionsChanged()->update(QRectF(gxS-5, gyS-5, gwS+10, ghS+10).unite(oldR));
}
-void ScribusDoc::scaleGroup(double scx, double scy, bool scaleText, Selection* customSelection)
+void ScribusDoc::scaleGroup(double scx, double scy, bool scaleText, Selection* customSelection, bool scaleLine)
{
Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
Q_ASSERT(itemSelection!=0);
@@ -11608,7 +12057,7 @@
FPoint h(0, bb->height(), bb->xPos(), bb->yPos(), bb->rotation(), 1, 1);
h -= g;
FPoint h1(h.x(), h.y(), 0, 0, 0, scx, scy);
- if (bb->Groups.count() != 0) // change the LineWidth only when the item is within a real Group
+ if (bb->isGroup() || scaleLine) // change the LineWidth only when the item is within a real Group
{
if (bb->lineWidth() != 0) // don't try to scale hairlines
bb->setLineWidth(qMax(bb->lineWidth()*((scx+scy)/2), 0.01));
@@ -11730,7 +12179,158 @@
// FIXME:av emit DocChanged();
}
-
+PageItem* ScribusDoc::groupObjectsSelection(Selection* customSelection)
+{
+ Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+ if (itemSelection->count() < 1)
+ return NULL;
+ int objectsLayer = itemSelection->objectsLayer();
+ if (objectsLayer == -1)
+ return NULL;
+ PageItem *currItem;
+ double x, y, w, h;
+ uint selectedItemCount = itemSelection->count();
+ itemSelection->getVisualGroupRect(&x, &y, &w, &h);
+ uint lowestItem = 999999;
+ for (uint a = 0; a < selectedItemCount; ++a)
+ {
+ currItem = itemSelection->itemAt(a);
+ currItem->gXpos = currItem->xPos() - x;
+ currItem->gYpos = currItem->yPos() - y;
+ currItem->gWidth = w;
+ currItem->gHeight = h;
+ lowestItem = qMin(lowestItem, currItem->ItemNr);
+ }
+ double minx = std::numeric_limits<double>::max();
+ double miny = std::numeric_limits<double>::max();
+ double maxx = -std::numeric_limits<double>::max();
+ double maxy = -std::numeric_limits<double>::max();
+ for (uint ep = 0; ep < selectedItemCount; ++ep)
+ {
+ PageItem* currItem = itemSelection->itemAt(ep);
+ double x1, x2, y1, y2;
+ currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
+ minx = qMin(minx, x1);
+ miny = qMin(miny, y1);
+ maxx = qMax(maxx, x2);
+ maxy = qMax(maxy, y2);
+ }
+ double gx = minx;
+ double gy = miny;
+ double gw = maxx - minx;
+ double gh = maxy - miny;
+ int z = itemAdd(PageItem::Group, PageItem::Rectangle, gx, gy, gw, gh, 0, CommonStrings::None, CommonStrings::None, true);
+ PageItem *groupItem = Items->takeAt(z);
+ Items->insert(lowestItem, groupItem);
+ groupItem->setItemName( tr("Group%1").arg(GroupCounter));
+ groupItem->AutoName = false;
+ groupItem->groupWidth = gw;
+ groupItem->groupHeight = gh;
+ groupItem->LayerID = objectsLayer;
+ for (uint c = 0; c < selectedItemCount; ++c)
+ {
+ currItem = itemSelection->itemAt(c);
+ int d = Items->indexOf(currItem);
+ groupItem->groupItemList.append(Items->takeAt(d));
+ }
+ renumberItemsInListOrder();
+ itemSelection->clear();
+ itemSelection->addItem(groupItem);
+ GroupCounter++;
+ return groupItem;
+}
+
+PageItem* ScribusDoc::groupObjectsList(QList<PageItem*> &itemList)
+{
+ if (itemList.count() < 1)
+ return NULL;
+ PageItem *currItem;
+ uint selectedItemCount = itemList.count();
+ uint lowestItem = 999999;
+ for (uint a = 0; a < selectedItemCount; ++a)
+ {
+ currItem = itemList.at(a);
+ lowestItem = qMin(lowestItem, currItem->ItemNr);
+ }
+ double minx = std::numeric_limits<double>::max();
+ double miny = std::numeric_limits<double>::max();
+ double maxx = -std::numeric_limits<double>::max();
+ double maxy = -std::numeric_limits<double>::max();
+ for (uint ep = 0; ep < selectedItemCount; ++ep)
+ {
+ currItem = itemList.at(ep);
+ double x1, x2, y1, y2;
+ currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
+ minx = qMin(minx, x1);
+ miny = qMin(miny, y1);
+ maxx = qMax(maxx, x2);
+ maxy = qMax(maxy, y2);
+ }
+ double gx = minx;
+ double gy = miny;
+ double gw = maxx - minx;
+ double gh = maxy - miny;
+ int z = itemAdd(PageItem::Group, PageItem::Rectangle, gx, gy, gw, gh, 0, CommonStrings::None, CommonStrings::None, true);
+ PageItem *groupItem = Items->takeAt(z);
+ Items->insert(lowestItem, groupItem);
+ groupItem->setItemName( tr("Group%1").arg(GroupCounter));
+ groupItem->AutoName = false;
+ groupItem->groupWidth = gw;
+ groupItem->groupHeight = gh;
+ for (uint c = 0; c < selectedItemCount; ++c)
+ {
+ currItem = itemList.at(c);
+ int d = Items->indexOf(currItem);
+ groupItem->groupItemList.append(Items->takeAt(d));
+ currItem->gXpos = currItem->xPos() - minx;
+ currItem->gYpos = currItem->yPos() - miny;
+ currItem->gWidth = maxx - minx;
+ currItem->gHeight = maxy - miny;
+ }
+ renumberItemsInListOrder();
+ GroupCounter++;
+ itemList.clear();
+ itemList.append(groupItem);
+ return groupItem;
+}
+
+void ScribusDoc::groupObjectsToItem(PageItem* groupItem, QList<PageItem*> &itemList)
+{
+ if (itemList.count() < 1)
+ return;
+ PageItem *currItem;
+ uint selectedItemCount = itemList.count();
+ double minx = std::numeric_limits<double>::max();
+ double miny = std::numeric_limits<double>::max();
+ double maxx = -std::numeric_limits<double>::max();
+ double maxy = -std::numeric_limits<double>::max();
+ for (uint ep = 0; ep < selectedItemCount; ++ep)
+ {
+ currItem = itemList.at(ep);
+ double x1, x2, y1, y2;
+ currItem->getVisualBoundingRect(&x1, &y1, &x2, &y2);
+ minx = qMin(minx, x1);
+ miny = qMin(miny, y1);
+ maxx = qMax(maxx, x2);
+ maxy = qMax(maxy, y2);
+ }
+ groupItem->groupWidth = groupItem->width();
+ groupItem->groupHeight = groupItem->height();
+ for (uint c = 0; c < selectedItemCount; ++c)
+ {
+ currItem = itemList.at(c);
+ int d = Items->indexOf(currItem);
+ groupItem->groupItemList.append(Items->takeAt(d));
+ currItem->gXpos = currItem->xPos() - groupItem->xPos();
+ currItem->gYpos = currItem->yPos() - groupItem->yPos();
+ currItem->gWidth = maxx - minx;
+ currItem->gHeight = maxy - miny;
+ }
+ renumberItemsInListOrder();
+ GroupCounter++;
+ itemList.clear();
+ itemList.append(groupItem);
+}
const PageItem * ScribusDoc::itemSelection_GroupObjects(bool changeLock, bool lock, Selection* customSelection)
{
@@ -11743,7 +12343,7 @@
PageItem *currItem;
PageItem* bb;
double x, y, w, h;
- uint selectedItemCount=itemSelection->count();
+ uint selectedItemCount = itemSelection->count();
QString tooltip = Um::ItemsInvolved + "\n";
if (selectedItemCount > Um::ItemsInvolvedLimit)
tooltip = Um::ItemsInvolved2 + "\n";
@@ -11777,7 +12377,7 @@
}
itemSelection->getVisualGroupRect(&x, &y, &w, &h);
uint lowestItem = 999999;
- uint highestItem = 0;
+// uint highestItem = 0;
for (uint a=0; a<selectedItemCount; ++a)
{
currItem = itemSelection->itemAt(a);
@@ -11786,7 +12386,7 @@
currItem->gWidth = w;
currItem->gHeight = h;
lowestItem = qMin(lowestItem, currItem->ItemNr);
- highestItem = qMax(highestItem, currItem->ItemNr);
+// highestItem = qMax(highestItem, currItem->ItemNr);
}
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
@@ -11834,45 +12434,49 @@
double gy = miny;
double gw = maxx - minx;
double gh = maxy - miny;
- PageItem *high = Items->at(highestItem);
+// PageItem *high = Items->at(highestItem);
+ bool wasUndo = UndoManager::undoEnabled();
undoManager->setUndoEnabled(false);
- int z = itemAdd(PageItem::Polygon, PageItem::Rectangle, gx, gy, gw, gh, 0, docPrefsData.itemToolPrefs.shapeFillColor, docPrefsData.itemToolPrefs.shapeLineColor, true);
+ int z = itemAdd(PageItem::Group, PageItem::Rectangle, gx, gy, gw, gh, 0, docPrefsData.itemToolPrefs.shapeFillColor, docPrefsData.itemToolPrefs.shapeLineColor, true);
PageItem *groupItem = Items->takeAt(z);
Items->insert(lowestItem, groupItem);
groupItem->setItemName( tr("Group%1").arg(GroupCounter));
groupItem->AutoName = false;
- groupItem->isGroupControl = true;
- groupItem->groupsLastItem = high;
+ groupItem->groupWidth = gw;
+ groupItem->groupHeight = gh;
+// groupItem->groupsLastItem = high;
groupItem->LayerID = objectsLayer;
- undoManager->setUndoEnabled(true);
-
- QMap<int, uint> ObjOrder;
+ undoManager->setUndoEnabled(wasUndo);
+
+// QMap<int, uint> ObjOrder;
for (uint c = 0; c < selectedItemCount; ++c)
{
currItem = itemSelection->itemAt(c);
- ObjOrder.insert(currItem->ItemNr, c);
+ // ObjOrder.insert(currItem->ItemNr, c);
int d = Items->indexOf(currItem);
- Items->takeAt(d);
- }
- QList<uint> Oindex = ObjOrder.values();
- for (int c = static_cast<int>(Oindex.count()-1); c > -1; c--)
- {
- Items->insert(lowestItem+1, itemSelection->itemAt(Oindex[c]));
- }
+ groupItem->groupItemList.append(Items->takeAt(d));
+ }
+// QList<uint> Oindex = ObjOrder.values();
+// for (int c = static_cast<int>(Oindex.count()-1); c > -1; c--)
+// {
+// Items->insert(lowestItem+1, itemSelection->itemAt(Oindex[c]));
+// }
renumberItemsInListOrder();
- itemSelection->prependItem(groupItem);
- selectedItemCount=itemSelection->count();
- SimpleState *ss = new SimpleState(Um::Group, tooltip);
- ss->set("GROUP", "group");
- ss->set("itemcount", selectedItemCount);
-
- for (uint a=0; a<selectedItemCount; ++a)
- {
- currItem = itemSelection->itemAt(a);
- currItem->Groups.push(GroupCounter);
- ss->set(QString("item%1").arg(a), currItem->uniqueNr);
- }
+ itemSelection->clear();
+ itemSelection->addItem(groupItem);
+// itemSelection->prependItem(groupItem);
+ selectedItemCount = itemSelection->count();
+// SimpleState *ss = new SimpleState(Um::Group, tooltip);
+// ss->set("GROUP", "group");
+// ss->set("itemcount", selectedItemCount);
+
+// for (uint a=0; a<selectedItemCount; ++a)
+// {
+// currItem = itemSelection->itemAt(a);
+// currItem->Groups.push(GroupCounter);
+// ss->set(QString("item%1").arg(a), currItem->uniqueNr);
+// }
GroupCounter++;
regionsChanged()->update(QRectF(gx-5, gy-5, gw+10, gh+10));
emit docChanged();
@@ -11882,7 +12486,7 @@
m_ScMW->scrActions["itemGroup"]->setEnabled(false);
m_ScMW->scrActions["itemUngroup"]->setEnabled(true);
}
- undoManager->action(this, ss, Um::SelectionGroup, Um::IGroup);
+// undoManager->action(this, ss, Um::SelectionGroup, Um::IGroup);
return groupItem;
}
@@ -11893,32 +12497,59 @@
{
uint docSelectionCount = itemSelection->count();
PageItem *currItem;
- QMap<PageItem*, int> toDelete;
- QMap<int, QList<PageItem*> > groupObjects;
+ QList<PageItem*> toDelete;
+// QMap<int, QList<PageItem*> > groupObjects;
for (uint a=0; a < docSelectionCount; ++a)
{
currItem = itemSelection->itemAt(a);
- if (currItem->Groups.count() != 0)
- {
- int groupId = currItem->Groups.pop();
- if (currItem->isGroupControl && (currItem->Groups.count() == 0))
- toDelete.insert(currItem, groupId);
- if (!currItem->isGroupControl)
- groupObjects[groupId].append(currItem);
- }
- }
+ if (currItem->isGroup())
+ toDelete.append(currItem);
+ }
+ bool wasLoad = isLoading();
// Remove group control objects
+ setLoading(true);
itemSelection->delaySignalsOn();
- QMap<PageItem*, int>::iterator it;
- for (it = toDelete.begin(); it != toDelete.end(); ++it)
- {
- itemSelection->removeItem(it.key());
- Items->removeOne(it.key());
- }
+// QList<PageItem*>::iterator it;
+ for (int b = 0; b < toDelete.count(); b++)
+ {
+ currItem = toDelete.at(b);
+ int d = Items->indexOf(currItem);
+ Items->removeAt(d);
+ itemSelection->removeItem(currItem);
+ Selection tempSelection(this, false);
+ tempSelection.delaySignalsOn();
+ int gcount = currItem->groupItemList.count() - 1;
+ for (int c = gcount; c >= 0; c--)
+ {
+ PageItem* gItem = currItem->groupItemList.at(c);
+ gItem->setXYPos(currItem->xPos() + gItem->gXpos, currItem->yPos() + gItem->gYpos, true);
+ Items->insert(d, gItem);
+ itemSelection->addItem(currItem->groupItemList.at(gcount - c));
+ tempSelection.addItem(currItem->groupItemList.at(gcount - c));
+ }
+ if ((currItem->width() != currItem->groupWidth) || (currItem->height() != currItem->groupHeight))
+ scaleGroup(currItem->width() / currItem->groupWidth, currItem->height() / currItem->groupHeight, true, &tempSelection, true);
+ QTransform ma;
+ ma.translate(currItem->xPos(), currItem->yPos());
+ ma.rotate(currItem->rotation());
+ FPoint n;
+ for (int a = 0; a < tempSelection.count(); ++a)
+ {
+ PageItem* rItem = tempSelection.itemAt(a);
+ n = FPoint(rItem->xPos() - currItem->xPos(), rItem->yPos() - currItem->yPos());
+ rItem->setXYPos(ma.m11() * n.x() + ma.m21() * n.y() + ma.dx(), ma.m22() * n.y() + ma.m12() * n.x() + ma.dy());
+ rItem->rotateBy(currItem->rotation());
+ setRedrawBounding(rItem);
+ }
+ tempSelection.clear();
+ tempSelection.delaySignalsOff();
+ delete currItem;
+ renumberItemsInListOrder();
+ }
+ setLoading(wasLoad);
itemSelection->delaySignalsOff();
- renumberItemsInListOrder();
// Create undo actions
- UndoTransaction* undoTransaction = NULL;
+/* UndoTransaction* undoTransaction = NULL;
if (UndoManager::undoEnabled() && toDelete.count() > 1)
{
undoTransaction = new UndoTransaction(undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Ungroup, "", Um::IGroup));
@@ -11957,7 +12588,7 @@
undoTransaction->commit();
delete undoTransaction;
undoTransaction = NULL;
- }
+ } */
double x, y, w, h;
itemSelection->connectItemToGUI();
itemSelection->getGroupRect(&x, &y, &w, &h);
@@ -12072,7 +12703,7 @@
PageItem *currItem = itemSelection->itemAt(i);
if (currItem)
{
- if (currItem->isGroupControl) // don't convert group control items.
+ if (currItem->isGroup()) // don't convert group control items.
restoredSelection->addItem(currItem);
else
{
@@ -12371,7 +13002,7 @@
FPoint np(ip);
if (hasNodeSelected())
{
- if ((np.x() < 0) && (!isContourLine))
+ if ((np.x() < 0) && (!isContourLine) && (!(currItem->isGroup() || currItem->isSymbol())))
{
Doc->SizeItem(currItem->width() - np.x(), currItem->height(), currItem->ItemNr, false, false, false);
if (currItem->rotation() != 0)
@@ -12386,7 +13017,7 @@
currItem->moveImageInFrame(-np.x()/currItem->imageXScale(), 0);
np.setX(0);
}
- if ((np.y() < 0) && (!isContourLine))
+ if ((np.y() < 0) && (!isContourLine) && (!(currItem->isGroup() || currItem->isSymbol())))
{
Doc->SizeItem(currItem->width(), currItem->height() - np.y(), currItem->ItemNr, false, false, false);
if (currItem->rotation() != 0)
@@ -12430,7 +13061,11 @@
Clip.setPoint(ClRe-2, np);
}
if (((ClRe == static_cast<int>(StartInd)) || (ClRe == static_cast<int>(EndInd-2))) &&
- ((currItem->itemType() == PageItem::Polygon) || (currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::ImageFrame)))
+ ((currItem->itemType() == PageItem::Polygon)
+ || (currItem->itemType() == PageItem::Group)
+ || (currItem->itemType() == PageItem::Symbol)
+ || (currItem->itemType() == PageItem::TextFrame)
+ || (currItem->itemType() == PageItem::ImageFrame)))
{
if (ClRe == static_cast<int>(StartInd))
{
@@ -12452,7 +13087,11 @@
}
}
if (((ClRe == static_cast<int>(StartInd+1)) || (ClRe == static_cast<int>(EndInd-1))) &&
- ((currItem->itemType() == PageItem::Polygon) || (currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::ImageFrame)) &&
+ ((currItem->itemType() == PageItem::Polygon)
+ || (currItem->itemType() == PageItem::Group)
+ || (currItem->itemType() == PageItem::Symbol)
+ || (currItem->itemType() == PageItem::TextFrame)
+ || (currItem->itemType() == PageItem::ImageFrame)) &&
(MoveSym))
{
uint kon = 0;
@@ -12525,7 +13164,8 @@
else
{
currItem->PoLine.setPoint(Doc->nodeEdit.ClRe, np);
- Doc->AdjustItemSize(currItem);
+ if (!(currItem->isGroup() || currItem->isSymbol()))
+ Doc->AdjustItemSize(currItem);
Doc->regionsChanged()->update(QRectF());
}
undoManager->setUndoEnabled(true);
@@ -12615,7 +13255,8 @@
if (!Doc->nodeEdit.isContourLine)
{
currItem->PoLine = Clip.copy();
- Doc->AdjustItemSize(currItem);
+ if (!(currItem->isGroup() || currItem->isSymbol()))
+ Doc->AdjustItemSize(currItem);
Doc->regionsChanged()->update(QRectF());
}
else
@@ -12738,11 +13379,21 @@
QMap<PageItem*, QString> ScribusDoc::getDocItemNames(PageItem::ItemType itemType)
{
QMap<PageItem*, QString> namesMap;
- uint docItemsCount=DocItems.count();
+ QList<PageItem*> allItems;
+ uint docItemsCount = DocItems.count();
for (uint i = 0; i < docItemsCount; ++i)
{
- if (DocItems.at(i)->itemType() == itemType && DocItems.at(i)->nextInChain()==NULL && !DocItems.at(i)->isAutoFrame())
- namesMap.insert(DocItems.at(i), DocItems.at(i)->itemName());
+ PageItem* ite = DocItems.at(i);
+ if (ite->isGroup())
+ allItems = ite->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ if (ite->itemType() == itemType && ite->nextInChain()==NULL && !ite->isAutoFrame())
+ namesMap.insert(ite, ite->itemName());
+ }
}
return namesMap;
}
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sat Dec 18 21:33:07 2010
@@ -117,6 +117,7 @@
ScribusDoc(const QString& docName, int unitIndex, const PageSize& pagesize, const MarginStruct& margins, const DocPagesSetup& pagesSetup);
~ScribusDoc();
void init();
+ QList<PageItem*> getAllItems(QList<PageItem*> &items);
void setup(const int, const int, const int, const int, const int, const QString&, const QString&);
void setLoading(const bool);
bool isLoading() const;
@@ -922,6 +923,9 @@
bool sendItemSelectionToBack();
bool bringItemSelectionToFront();
+ PageItem* groupObjectsSelection(Selection* customSelection=0);
+ PageItem* groupObjectsList(QList<PageItem*> &itemList);
+ void groupObjectsToItem(PageItem* groupItem, QList<PageItem*> &itemList);
const PageItem * itemSelection_GroupObjects (bool changeLock, bool lock, Selection* customSelection=0);
void itemSelection_UnGroupObjects(Selection* customSelection=0);
void itemSelection_convertItemsTo(const PageItem::ItemType newType, Selection* restoredSelection=0, Selection* customSelection=0);
@@ -1014,7 +1018,7 @@
void AdjustItemSize(PageItem *currItem);
void moveGroup(double x, double y, bool fromMP = false, Selection* customSelection = 0);
void rotateGroup(double angle, FPoint RCenter);
- void scaleGroup(double scx, double scy, bool scaleText=true, Selection* customSelection = 0);
+ void scaleGroup(double scx, double scy, bool scaleText=true, Selection* customSelection = 0, bool scaleLine = false);
//! \brief Get a list of frames of certain type
QMap<PageItem*, QString> getDocItemNames(PageItem::ItemType itemType);
//! \brief Returns a serializer for this document
Modified: trunk/Scribus/scribus/scribusstructs.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/scribusstructs.h
==============================================================================
--- trunk/Scribus/scribus/scribusstructs.h (original)
+++ trunk/Scribus/scribus/scribusstructs.h Sat Dec 18 21:33:07 2010
@@ -207,6 +207,8 @@
QString IFont;
int ISize;
QStack<int> Groups;
+ double groupHeight;
+ double groupWidth;
int LayerID;
bool ScaleType;
bool AspectRatio;
Modified: trunk/Scribus/scribus/sctextstruct.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/sctextstruct.cpp
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.cpp (original)
+++ trunk/Scribus/scribus/sctextstruct.cpp Sat Dec 18 21:33:07 2010
@@ -97,25 +97,9 @@
if (hasItem())
{
PageItem* dItem = d->item;
- ScribusDoc& doc(*dItem->doc());
result.append(d->item);
- if (dItem->Groups.count() != 0)
- {
- for (int ga=0; ga < doc.FrameItems.count(); ++ga)
- {
- if (doc.FrameItems.at(ga)->Groups.count() != 0)
- {
- if (doc.FrameItems.at(ga)->Groups.top() == dItem->Groups.top())
- {
- if (doc.FrameItems.at(ga)->ItemNr != dItem->ItemNr)
- {
- if (!result.contains(doc.FrameItems.at(ga)))
- result.append(doc.FrameItems.at(ga));
- }
- }
- }
- }
- }
+ if (dItem->isGroup())
+ result = dItem->getItemList();
}
return result;
}
Modified: trunk/Scribus/scribus/selection.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/selection.cpp
==============================================================================
--- trunk/Scribus/scribus/selection.cpp (original)
+++ trunk/Scribus/scribus/selection.cpp Sat Dec 18 21:33:07 2010
@@ -521,7 +521,7 @@
PageItem::ItemType itemType = (*it)->itemType();
for ( ; it!=itend ; ++it)
{
- if ((*it)->isGroupControl) // ignore GroupControl items
+ if ((*it)->isGroup()) // ignore GroupControl items
continue;
if ((*it)->itemType() != itemType)
return false;
Modified: trunk/Scribus/scribus/ui/about.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/ui/about.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/about.cpp (original)
+++ trunk/Scribus/scribus/ui/about.cpp Sat Dec 18 21:33:07 2010
@@ -114,8 +114,8 @@
buildID = new QLabel( tab );
buildID->setAlignment(Qt::AlignCenter);
buildID->setTextInteractionFlags(Qt::TextSelectableByMouse);
- QString BUILD_DAY = "28";
- QString BUILD_MONTH = CommonStrings::november;
+ QString BUILD_DAY = "18";
+ QString BUILD_MONTH = CommonStrings::december;
QString BUILD_YEAR = "2010";
QString BUILD_TIME = "";
QString BUILD_TZ = "";
Modified: trunk/Scribus/scribus/ui/contextmenu.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/ui/contextmenu.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/contextmenu.cpp (original)
+++ trunk/Scribus/scribus/ui/contextmenu.cpp Sat Dec 18 21:33:07 2010
@@ -318,27 +318,15 @@
//-->
}
//<-- Add Groups Items
- if (selectedItemCount>1)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (currItem->Groups.count() != 0)
- firstElem = currItem->Groups.top();
- for (int bx = 0; bx < selectedItemCount && isGroup==true; ++bx)
- {
- if (m_Sel.itemAt(bx)->Groups.count() != 0)
- {
- if (m_Sel.itemAt(bx)->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- addAction(m_AP->scrActions["itemGroup"]);
- }
- if (currItem->Groups.count() != 0)
+ if (selectedItemCount > 1)
+ {
+ addAction(m_AP->scrActions["itemGroup"]);
+ }
+ else
+ {
+ if (currItem->isGroup())
addAction(m_AP->scrActions["itemUngroup"]);
+ }
//-->
//<-- Add Level Item
Modified: trunk/Scribus/scribus/ui/nodeeditpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/ui/nodeeditpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/nodeeditpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/nodeeditpalette.cpp Sat Dec 18 21:33:07 2010
@@ -408,19 +408,19 @@
bool setter;
switch (typ)
{
- case 6:
- PolySplit->setEnabled(true);
- BezierClose->setEnabled(false);
- break;
- case 7:
- setter = size > 7 ? true : false;
- BezierClose->setEnabled(setter);
- PolySplit->setEnabled(setter);
- break;
- default:
- BezierClose->setEnabled(false);
- PolySplit->setEnabled(false);
- break;
+ case PageItem::Polygon:
+ PolySplit->setEnabled(true);
+ BezierClose->setEnabled(false);
+ break;
+ case PageItem::PolyLine:
+ setter = size > 7 ? true : false;
+ BezierClose->setEnabled(setter);
+ PolySplit->setEnabled(setter);
+ break;
+ default:
+ BezierClose->setEnabled(false);
+ PolySplit->setEnabled(false);
+ break;
}
}
Modified: trunk/Scribus/scribus/ui/outlinepalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/ui/outlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.cpp Sat Dec 18 21:33:07 2010
@@ -581,17 +581,11 @@
if (!pgItem->isSelected())
{
m_MainWindow->closeActiveWindowMasterPageEditor();
- //currDoc->m_Selection->setIsGUISelection(false);
currDoc->view()->SelectItemNr(pgItem->ItemNr, false, false);
}
break;
}
}
- /*if (currDoc->m_Selection->count() > 0)
- {
- currDoc->m_Selection->setIsGUISelection(true);
- currDoc->m_Selection->connectItemToGUI();
- }*/
currDoc->m_Selection->delaySignalsOff();
currDoc->view()->DrawNew();
}
@@ -617,11 +611,11 @@
case 1:
if (!currDoc->masterPageMode())
emit selectMasterPage(item->PageItemObject->OnMasterPage);
- if (item->PageItemObject->Groups.count() == 0)
+ if (item->PageItemObject->isGroup())
emit selectElement(-1, item->PageItemObject->ItemNr, false);
else
{
- if (item->PageItemObject->isGroupControl)
+ if (item->PageItemObject->isGroup())
emit selectElement(-1, item->PageItemObject->ItemNr, false);
else
emit selectElement(-1, item->PageItemObject->ItemNr, true);
@@ -636,11 +630,11 @@
case 4:
pgItem = item->PageItemObject;
m_MainWindow->closeActiveWindowMasterPageEditor();
- if (pgItem->Groups.count() == 0)
+ if (pgItem->isGroup())
emit selectElement(pgItem->OwnPage, pgItem->ItemNr, false);
else
{
- if (pgItem->isGroupControl)
+ if (pgItem->isGroup())
emit selectElement(pgItem->OwnPage, pgItem->ItemNr, false);
else
emit selectElement(pgItem->OwnPage, pgItem->ItemNr, true);
@@ -651,12 +645,7 @@
}
selectionTriggered = false;
}
-/*
-void OutlinePalette::resizeEvent(QResizeEvent *r)
-{
- reportDisplay->resize(r->size());
-}
-*/
+
void OutlinePalette::BuildTree(bool storeVals)
{
if (!m_MainWindow || m_MainWindow->scriptIsRunning())
@@ -671,7 +660,6 @@
if (storeVals)
buildReopenVals();
clearPalette();
- QList<PageItem*> subGroupList;
OutlineTreeItem * item = new OutlineTreeItem( reportDisplay, 0 );
rootObject = item;
item->setText( 0, currDoc->DocName.section( '/', -1 ) );
@@ -680,10 +668,6 @@
freeObjects = 0;
PageItem* pgItem;
QString tmp;
- for (int b = 0; b < currDoc->MasterItems.count(); ++b)
- {
- currDoc->MasterItems.at(b)->Dirty = false;
- }
for (int a = 0; a < static_cast<int>(currDoc->MasterPages.count()); ++a)
{
OutlineTreeItem *page = new OutlineTreeItem( item, pagep );
@@ -694,9 +678,9 @@
for (int b = 0; b < currDoc->MasterItems.count(); ++b)
{
pgItem = currDoc->MasterItems.at(b);
- if (((pgItem->OwnPage == a) || (pgItem->OnMasterPage == pageNam)) && (!pgItem->Dirty))
- {
- if (pgItem->Groups.count() == 0)
+ if (((pgItem->OwnPage == a) || (pgItem->OnMasterPage == pageNam)))
+ {
+ if (!pgItem->isGroup())
{
OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
@@ -704,36 +688,20 @@
object->setText(0, pgItem->itemName());
setItemIcon(object, pgItem);
object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- pgItem->Dirty = true;
}
else
{
OutlineTreeItem * object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
object->type = 1;
- if (pgItem->isGroupControl)
- object->setText(0, pgItem->itemName());
- else
- object->setText(0, tr("Group ")+tmp.setNum(pgItem->Groups.top()));
+ object->setText(0, pgItem->itemName());
object->setIcon( 0, groupIcon );
object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- pgItem->Dirty = true;
- subGroupList.clear();
- for (int ga = 0; ga < currDoc->MasterItems.count(); ++ga)
- {
- PageItem* pgItem2 = currDoc->MasterItems.at(ga);
- if ((pgItem2->Groups.count() != 0) && (pgItem2->Groups.top() == pgItem->Groups.top()) && (pgItem2 != pgItem))
- subGroupList.append(pgItem2);
- }
- parseSubGroup(1, object, &subGroupList, 1);
+ parseSubGroup(object, &pgItem->groupItemList, 1);
}
}
}
page->setText(0, currDoc->MasterPages.at(a)->pageName());
- }
- for (int b = 0; b < currDoc->DocItems.count(); ++b)
- {
- currDoc->DocItems.at(b)->Dirty = false;
}
for (int a = 0; a < static_cast<int>(currDoc->DocPages.count()); ++a)
{
@@ -744,9 +712,9 @@
for (int b = 0; b < currDoc->DocItems.count(); ++b)
{
pgItem = currDoc->DocItems.at(b);
- if ((pgItem->OwnPage == a) && (!pgItem->Dirty))
- {
- if (pgItem->Groups.count() == 0)
+ if (pgItem->OwnPage == a)
+ {
+ if (!pgItem->isGroup())
{
OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
@@ -754,28 +722,16 @@
object->setText(0, pgItem->itemName());
setItemIcon(object, pgItem);
object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- pgItem->Dirty = true;
}
else
{
OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
object->type = 3;
- if (pgItem->isGroupControl)
- object->setText(0, pgItem->itemName());
- else
- object->setText(0, tr("Group ")+tmp.setNum(pgItem->Groups.top()));
+ object->setText(0, pgItem->itemName());
object->setIcon( 0, groupIcon );
object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- pgItem->Dirty = true;
- subGroupList.clear();
- for (int ga = 0; ga < currDoc->DocItems.count(); ++ga)
- {
- PageItem* pgItem2 = currDoc->DocItems.at(ga);
- if ((pgItem2->Groups.count() != 0) && (pgItem2->Groups.top() == pgItem->Groups.top()) && (pgItem2 != pgItem))
- subGroupList.append(pgItem2);
- }
- parseSubGroup(1, object, &subGroupList, 3);
+ parseSubGroup(object, &pgItem->groupItemList, 3);
}
}
}
@@ -799,9 +755,9 @@
for (int b = 0; b < currDoc->DocItems.count(); ++b)
{
pgItem = currDoc->DocItems.at(b);
- if ((pgItem->OwnPage == -1) && (!pgItem->Dirty))
- {
- if (pgItem->Groups.count() == 0)
+ if (pgItem->OwnPage == -1)
+ {
+ if (!pgItem->isGroup())
{
OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
@@ -809,28 +765,16 @@
object->setText(0, pgItem->itemName());
setItemIcon(object, pgItem);
object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- pgItem->Dirty = true;
}
else
{
OutlineTreeItem *object = new OutlineTreeItem( page, 0 );
object->PageItemObject = pgItem;
object->type = 4;
- if (pgItem->isGroupControl)
- object->setText(0, pgItem->itemName());
- else
- object->setText(0, tr("Group ")+tmp.setNum(pgItem->Groups.top()));
+ object->setText(0, pgItem->itemName());
object->setIcon( 0, groupIcon );
object->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- pgItem->Dirty = true;
- subGroupList.clear();
- for (int ga = 0; ga < currDoc->DocItems.count(); ++ga)
- {
- PageItem* pgItem2 = currDoc->DocItems.at(ga);
- if ((pgItem2->Groups.count() != 0) && (pgItem2->Groups.top() == pgItem->Groups.top()) && (pgItem2 != pgItem))
- subGroupList.append(pgItem2);
- }
- parseSubGroup(1, object, &subGroupList, 4);
+ parseSubGroup(object, &pgItem->groupItemList, 4);
}
}
}
@@ -876,50 +820,30 @@
filterTree( filterEdit->text() );
}
-void OutlinePalette::parseSubGroup(int level, OutlineTreeItem* object, QList<PageItem*> *subGroupList, int itemType)
-{
- QList<PageItem*> *subGroup;
+void OutlinePalette::parseSubGroup(OutlineTreeItem* object, QList<PageItem*> *subGroupList, int itemType)
+{
PageItem *pgItem;
- QString tmp;
for (int b = 0; b < subGroupList->count(); ++b)
{
pgItem = subGroupList->at(b);
- if (!pgItem->Dirty)
- {
- if (static_cast<int>(pgItem->Groups.count()) <= level)
- {
- OutlineTreeItem *grp = new OutlineTreeItem( object, 0 );
- grp->PageItemObject = pgItem;
- grp->type = itemType;
- grp->setText(0, pgItem->itemName());
- setItemIcon(grp, pgItem);
- grp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- pgItem->Dirty = true;
- }
- else
- {
- OutlineTreeItem *grp = new OutlineTreeItem( object, 0 );
- grp->PageItemObject = pgItem;
- grp->type = itemType;
- if (pgItem->isGroupControl)
- grp->setText(0, pgItem->itemName());
- else
- grp->setText(0, tr("Group ")+tmp.setNum(pgItem->Groups.at(pgItem->Groups.count()-level-1)));
- grp->setIcon( 0, groupIcon );
- grp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
- pgItem->Dirty = true;
- subGroup = new QList<PageItem*>;
- subGroup->clear();
- for (int ga = 0; ga < subGroupList->count(); ++ga)
- {
- PageItem* pgItem2 = subGroupList->at(ga);
- if ((static_cast<int>(pgItem2->Groups.count()) > level) &&
- ((pgItem2->Groups.at(pgItem2->Groups.count()-level-1)) == (pgItem->Groups.at(pgItem->Groups.count()-level-1))) && (pgItem2 != pgItem))
- subGroup->append(pgItem2);
- }
- parseSubGroup(level+1, grp, subGroup, itemType);
- delete subGroup;
- }
+ if (!pgItem->isGroup())
+ {
+ OutlineTreeItem *grp = new OutlineTreeItem( object, 0 );
+ grp->PageItemObject = pgItem;
+ grp->type = itemType;
+ grp->setText(0, pgItem->itemName());
+ setItemIcon(grp, pgItem);
+ grp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ }
+ else
+ {
+ OutlineTreeItem *grp = new OutlineTreeItem( object, 0 );
+ grp->PageItemObject = pgItem;
+ grp->type = itemType;
+ grp->setText(0, pgItem->itemName());
+ grp->setIcon( 0, groupIcon );
+ grp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
+ parseSubGroup(grp, &pgItem->groupItemList, itemType);
}
}
}
@@ -931,7 +855,6 @@
else
QWidget::changeEvent(e);
}
-
void OutlinePalette::languageChange()
{
Modified: trunk/Scribus/scribus/ui/outlinepalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/ui/outlinepalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.h (original)
+++ trunk/Scribus/scribus/ui/outlinepalette.h Sat Dec 18 21:33:07 2010
@@ -63,7 +63,7 @@
void reopenTree();
QTreeWidgetItem* getListItem(int SNr, int Nr);
void setItemIcon(QTreeWidgetItem *item, PageItem *pgItem);
- void parseSubGroup(int level, OutlineTreeItem* object, QList<PageItem*> *subGroupList, int itemType);
+ void parseSubGroup(OutlineTreeItem* object, QList<PageItem*> *subGroupList, int itemType);
void buildReopenVals();
public slots:
Modified: trunk/Scribus/scribus/ui/paintmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/ui/paintmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/paintmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/paintmanager.cpp Sat Dec 18 21:33:07 2010
@@ -1318,7 +1318,10 @@
{
const FileFormat * fmt = LoadSavePlugin::getFormatById(testResult);
if( fmt )
+ {
+ fmt->setupTargets(m_doc, 0, mainWin, 0, &(PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts));
fmt->loadFile(data, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted|LoadSavePlugin::lfKeepPatterns|LoadSavePlugin::lfLoadAsPattern);
+ }
}
}
m_doc->useRaster = savedAlignGrid;
Modified: trunk/Scribus/scribus/ui/picstatus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/ui/picstatus.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/picstatus.cpp (original)
+++ trunk/Scribus/scribus/ui/picstatus.cpp Sat Dec 18 21:33:07 2010
@@ -395,7 +395,7 @@
emit selectElement(currItem->OwnPage, currItem->ItemNr, false);
else
{
- if (currItem->isGroupControl)
+ if (currItem->isGroup())
emit selectElement(currItem->OwnPage, currItem->ItemNr, false);
else
emit selectElement(currItem->OwnPage, currItem->ItemNr, true);
Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16105&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Sat Dec 18 21:33:07 2010
@@ -1535,7 +1535,7 @@
{
if (!m_ScMW || m_ScMW->scriptIsRunning() || !HaveItem)
return;
- if (CurItem->isGroupControl)
+ if (CurItem->isGroup())
{
if (mode == PageItem::TextFlowDisabled)
textFlowDisabled2->setChecked(true);
@@ -1815,7 +1815,7 @@
Xpos->setEnabled(!setter);
Ypos->setEnabled(!setter);
LayerGroup->setEnabled(!setter);
- if ((CurItem->isGroupControl) || ((CurItem->Groups.count() != 0) && (!CurItem->isSingleSel)))
+ if ((CurItem->isGroup()) && (!CurItem->isSingleSel))
{
TabStack->setItemEnabled(idXYZItem, true);
TabStack->setItemEnabled(idShapeItem, false);
@@ -1974,31 +1974,9 @@
DoGroup->setEnabled(false);
DoUnGroup->setEnabled(false);
if (doc->m_Selection->count() > 1)
- {
- bool isGroup = true;
- int firstElem = -1;
- if (CurItem->Groups.count() != 0)
- firstElem = CurItem->Groups.top();
- for (int bx = 0; bx < doc->m_Selection->count(); ++bx)
- {
- if (doc->m_Selection->itemAt(bx)->Groups.count() != 0)
- {
- if (doc->m_Selection->itemAt(bx)->Groups.top() != firstElem)
- isGroup = false;
- }
- else
- isGroup = false;
- }
- if (!isGroup)
- DoGroup->setEnabled(true);
- else
- {
- if (CurItem->isGroupControl)
- NameEdit->setEnabled(true);
- }
- if ((CurItem->Groups.count() != 0) && (isGroup))
- DoUnGroup->setEnabled(true);
- }
+ DoGroup->setEnabled(true);
+ if (doc->m_Selection->count() == 1)
+ DoUnGroup->setEnabled(CurItem->isGroup());
#ifdef HAVE_OSG
if (CurItem->asOSGFrame())
{
@@ -2098,7 +2076,7 @@
TabStack->setItemEnabled(idTransparencyItem, true);
if (HaveItem && CurItem)
{
- if ((CurItem->isGroupControl) || ((CurItem->Groups.count() != 0) && (!CurItem->isSingleSel)))
+ if ((CurItem->isGroup()) && (!CurItem->isSingleSel))
TabStack->setItemEnabled(idGroupItem, true);
}
FlipH->setCheckable( false );
@@ -2251,6 +2229,7 @@
RoundRect->setEnabled(false);
break;
case PageItem::Symbol:
+ case PageItem::Group:
TabStack->setItemEnabled(idShapeItem, false);
TabStack->setItemEnabled(idTextItem, false);
TabStack->setItemEnabled(idImageItem, false);
@@ -4024,7 +4003,7 @@
return;
if ((HaveDoc) && (HaveItem))
{
- if (CurItem->isGroupControl)
+ if (CurItem->isGroup())
{
if (textFlowDisabled2->isChecked())
mode = PageItem::TextFlowDisabled;
@@ -5228,7 +5207,7 @@
Cpal->setMeshControlPoint();
else
{
- if (currItem->isGroupControl)
+ if (currItem->isGroup())
TpalGroup->setSpecialGradient(currItem->GrMaskStartX * dur, currItem->GrMaskStartY * dur, currItem->GrMaskEndX * dur, currItem->GrMaskEndY * dur, currItem->GrMaskFocalX * dur, currItem->GrMaskFocalY * dur, currItem->GrMaskScale, currItem->GrMaskSkew);
else
Tpal->setSpecialGradient(currItem->GrMaskStartX * dur, currItem->GrMaskStartY * dur, currItem->GrMaskEndX * dur, currItem->GrMaskEndY * dur, currItem->GrMaskFocalX * dur, currItem->GrMaskFocalY * dur, currItem->GrMaskScale, currItem->GrMaskSkew);
More information about the scribus-commit
mailing list