r17407 by fschmid - More work on getting inline frames editable, changed the way inline items are referenced.
scribus-commit
scribus-commit at lists.scribus.net
Sat Mar 31 20:30:32 UTC 2012
Author: fschmid
Date: Sat Mar 31 20:30:32 2012
New Revision: 17407
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17407
Log:
More work on getting inline frames editable, changed the way inline items are referenced.
Modified:
trunk/Scribus/scribus/collect4output.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pageitem_pathtext.cpp
trunk/Scribus/scribus/pageitem_textframe.cpp
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.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/idml/importidml.cpp
trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
trunk/Scribus/scribus/pslib.cpp
trunk/Scribus/scribus/scpageoutput.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/scribusdoc.h
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/sctextstruct.cpp
trunk/Scribus/scribus/sctextstruct.h
trunk/Scribus/scribus/text/storytext.cpp
trunk/Scribus/scribus/text/storytext.h
trunk/Scribus/scribus/ui/inlinepalette.cpp
trunk/Scribus/scribus/ui/prefs_pdfexport.cpp
trunk/Scribus/scribus/ui/smlinestyle.cpp
trunk/Scribus/scribus/ui/tabpdfoptions.cpp
Modified: trunk/Scribus/scribus/collect4output.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/collect4output.cpp
==============================================================================
--- trunk/Scribus/scribus/collect4output.cpp (original)
+++ trunk/Scribus/scribus/collect4output.cpp Sat Mar 31 20:30:32 2012
@@ -176,7 +176,7 @@
int c=0;
QList<PageItem*> allItems;
PageItem* ite = NULL;
- for (uint lc = 0; lc < 3; ++lc)
+ for (uint lc = 0; lc < 2; ++lc)
{
switch (lc)
{
@@ -186,9 +186,6 @@
case 1:
counter = m_Doc->DocItems.count();
break;
- case 2:
- counter = m_Doc->FrameItems.count();
- break;
}
for (uint b = 0; b < counter; ++b)
{
@@ -200,9 +197,6 @@
case 1:
ite = m_Doc->DocItems.at(b);
break;
- case 2:
- ite = m_Doc->FrameItems.at(b);
- break;
}
if (ite->isGroup())
allItems = ite->getItemList();
@@ -217,6 +211,22 @@
if (uiCollect)
emit itemsCollected(c++);
}
+ }
+ for (QHash<int, PageItem*>::iterator itf = m_Doc->FrameItems.begin(); itf != m_Doc->FrameItems.end(); ++itf)
+ {
+ PageItem *it = itf.value();
+ if (it->isGroup())
+ allItems = it->asGroupFrame()->getItemList();
+ else
+ allItems.append(it);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ it = allItems.at(ii);
+ processItem(it);
+ }
+ allItems.clear();
+ if (uiCollect)
+ emit itemsCollected(c++);
}
for (int c = 0; c < patterns.count(); ++c)
{
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Sat Mar 31 20:30:32 2012
@@ -611,6 +611,7 @@
bool ChangedMasterItem;
QString OnMasterPage;
bool isEmbedded;
+ int inlineCharID;
//Position
double xPos() const { return Xpos; }
Modified: trunk/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ trunk/Scribus/scribus/pageitem_pathtext.cpp Sat Mar 31 20:30:32 2012
@@ -181,10 +181,10 @@
CharStyle nstyle = itemText.charStyle(a);
ParagraphStyle pstyle = itemText.paragraphStyle(a);
chstr = hl->ch;
- if ((itemText.item(a)->ch == SpecialChars::OBJECT) && (itemText.item(a)->hasObject()))
+ if ((itemText.item(a)->ch == SpecialChars::OBJECT) && (itemText.item(a)->hasObject(m_Doc)))
{
int pot = itemRenderText.length();
- itemRenderText.insertObject(pot, itemText.object(a));
+ itemRenderText.insertObject(pot, itemText.object(a)->inlineCharID);
}
else
{
@@ -216,8 +216,8 @@
hl->glyph.yadvance = 0;
layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
hl->glyph.shrink();
- if (hl->hasObject())
- totalTextLen += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH;
+ if (hl->hasObject(m_Doc))
+ totalTextLen += (hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth()) * hl->glyph.scaleH;
else
totalTextLen += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0;
}
@@ -268,8 +268,8 @@
hl->glyph.yadvance = 0;
layoutGlyphs(itemRenderText.charStyle(a), chstr, hl->glyph);
hl->glyph.shrink(); // HACK
- if (hl->hasObject())
- dx = (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH / 2.0;
+ if (hl->hasObject(m_Doc))
+ dx = (hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth()) * hl->glyph.scaleH / 2.0;
else
dx = hl->glyph.wide() / 2.0;
CurX += dx;
@@ -361,7 +361,7 @@
}
p->translate(0.0, BaseOffs);
if (hl->ch == SpecialChars::OBJECT)
- DrawObj_Embedded(p, cullingArea, itemRenderText.charStyle(a), hl->getItem());
+ DrawObj_Embedded(p, cullingArea, itemRenderText.charStyle(a), hl->getItem(m_Doc));
else
drawGlyphs(p, itemRenderText.charStyle(a), hl->glyph);
}
@@ -369,8 +369,8 @@
p->restore();
MaxChars = a+1;
CurX -= dx;
- if (hl->hasObject())
- CurX += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH + extraOffset;
+ if (hl->hasObject(m_Doc))
+ CurX += (hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth()) * hl->glyph.scaleH + extraOffset;
else if (hl->ch == SpecialChars::BLANK)
CurX += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0 + wordExtra + extraOffset;
else
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sat Mar 31 20:30:32 2012
@@ -1576,16 +1576,16 @@
chs = (10 * ((DropCapDrop + fontAscent) / realCharAscent));
hl->setEffects(hl->effects() | ScStyle_DropCap);
hl->glyph.yoffset -= DropCapDrop;
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
- {
- chs = qRound((hl->getItem()->height() + hl->getItem()->lineWidth()) * 10);
- chsd = qRound((hl->getItem()->height() + hl->getItem()->lineWidth()) * 10);
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ {
+ chs = qRound((hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * 10);
+ chsd = qRound((hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * 10);
}
}
else // ! dropCapMode
{
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
- chs = qRound((hl->getItem()->height() + hl->getItem()->lineWidth()) * 10);
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ chs = qRound((hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * 10);
else
chs = charStyle.fontSize();
}
@@ -1603,9 +1603,9 @@
hl->glyph.yadvance = 0;
oldCurY = layoutGlyphs(*hl, chstr, hl->glyph);
// find out width, ascent and descent of char
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
- {
- wide = hl->getItem()->width() + hl->getItem()->lineWidth();
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ {
+ wide = hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth();
hl->glyph.xadvance = wide * hl->glyph.scaleH;
}
else
@@ -1699,13 +1699,13 @@
if (DropCmode)
{
// drop caps are wider...
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
- {
- double itemHeight = hl->getItem()->height() + hl->getItem()->lineWidth();
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ {
+ double itemHeight = hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth();
if (itemHeight == 0)
itemHeight = charStyle.font().height(style.charStyle().fontSize() / 10.0);
- wide = hl->getItem()->width() + hl->getItem()->lineWidth();
- asce = hl->getItem()->height() + hl->getItem()->lineWidth();
+ wide = hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth();
+ asce = hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth();
realAsce = calculateLineSpacing (style, this) * DropLines;
hl->glyph.scaleH /= hl->glyph.scaleV;
hl->glyph.scaleV = (realAsce / itemHeight);
@@ -1737,7 +1737,7 @@
wide *= wordtracking;
}
// find ascent / descent
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
desc = realDesc = 0;
else
{
@@ -1745,9 +1745,9 @@
realDesc = charStyle.font().realCharDescent(chstr[0], hlcsize10) * scaleV - offset;
current.rememberShrinkStretch(hl->ch, wide, style);
}
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
- {
- asce = hl->getItem()->height() + hl->getItem()->lineWidth();
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ {
+ asce = hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth();
realAsce = asce * scaleV + offset;
}
else
@@ -1972,15 +1972,15 @@
diff = realAsce - (current.yPos - lastLineY);
else if (style.lineSpacingMode() != ParagraphStyle::FixedLineSpacing)
{
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
- diff = (hl->getItem()->height() + hl->getItem()->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ diff = (hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
else
diff = charStyle.font().realCharAscent(QChar('l'), hlcsize10) * scaleV + offset - (current.yPos - lastLineY);
}
else
{
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
- diff = (hl->getItem()->height() + hl->getItem()->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ diff = (hl->getItem(m_Doc)->height() + hl->getItem(m_Doc)->lineWidth()) * scaleV + offset - (current.yPos - lastLineY);
}
if (diff >= 1 || (!DropCmode && diff > 0))
{
@@ -2118,7 +2118,7 @@
current.rememberBreak(a, breakPos, style.rightMargin());
}
}
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
current.rememberBreak(a, breakPos, style.rightMargin());
// CJK break
if(a > current.line.firstItem)
@@ -2983,10 +2983,10 @@
asce = charStyleS.font().ascent(charStyleS.fontSize() / 10.0);
wide = hls->glyph.wide();
QRectF scr;
- if ((hls->ch == SpecialChars::OBJECT) && (hls->hasObject()))
+ if ((hls->ch == SpecialChars::OBJECT) && (hls->hasObject(m_Doc)))
{
- double ww = (hls->getItem()->width() + hls->getItem()->lineWidth()) * hls->glyph.scaleH;
- double hh = (hls->getItem()->height() + hls->getItem()->lineWidth()) * hls->glyph.scaleV;
+ double ww = (hls->getItem(m_Doc)->width() + hls->getItem(m_Doc)->lineWidth()) * hls->glyph.scaleH;
+ double hh = (hls->getItem(m_Doc)->height() + hls->getItem(m_Doc)->lineWidth()) * hls->glyph.scaleV;
scr = QRectF(xcoZli, ls.y - hh, ww , hh);
previousWasObject = true;
}
@@ -3085,8 +3085,8 @@
{
p->save();//SA4
p->translate(CurX, ls.y);
- if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject()))
- DrawObj_Embedded(p, cullingArea, charStyle, hl->getItem());
+ if ((hl->ch == SpecialChars::OBJECT) && (hl->hasObject(m_Doc)))
+ DrawObj_Embedded(p, cullingArea, charStyle, hl->getItem(m_Doc));
else
drawGlyphs(p, charStyle, hl->glyph);
p->restore();//RE4
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Sat Mar 31 20:30:32 2012
@@ -941,9 +941,9 @@
for (uint ax = 0; ax < ar; ++ax)
ind2PDFabr[ax] = tmpf[ax];
QList<PageItem*> allItems;
- for (int c = 0; c < doc.FrameItems.count(); ++c)
- {
- pgit = doc.FrameItems.at(c);
+ for (QHash<int, PageItem*>::iterator itf = doc.FrameItems.begin(); itf != doc.FrameItems.end(); ++itf)
+ {
+ pgit = itf.value();
if (pgit->isGroup())
allItems = pgit->asGroupFrame()->getItemList();
else
@@ -5361,14 +5361,14 @@
}
}
*/
- if (hl->hasObject())
+ if (hl->hasObject(&doc))
{
if (!ite->asPathText())
{
tmp += "ET\n"+tmp2;
tmp2 = "";
}
- QList<PageItem*> emG = hl->getGroupedItems();
+ QList<PageItem*> emG = hl->getGroupedItems(&doc);
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Sat Mar 31 20:30:32 2012
@@ -375,6 +375,7 @@
case PageItem::RegularPolygon:
case PageItem::Arc:
case PageItem::Spiral:
+ case PageItem::Table:
Q_ASSERT(false);
break;
case PageItem::LatexFrame:
@@ -1286,9 +1287,9 @@
if (item->prevInChain() == 0 && item->itemText.length() > 0)
item->itemText.fixLegacyFormatting();
}
- for (int i = 0; i < m_Doc->FrameItems.count(); ++i)
- {
- PageItem* item = m_Doc->FrameItems.at(i);
+ for (QHash<int, PageItem*>::iterator itf = m_Doc->FrameItems.begin(); itf != m_Doc->FrameItems.end(); ++itf)
+ {
+ PageItem *item = itf.value();
if (item->prevInChain() == 0 && item->itemText.length() > 0)
item->itemText.fixLegacyFormatting();
}
@@ -2040,9 +2041,9 @@
if (item->prevInChain() == 0 && item->itemText.length() > 0)
item->itemText.fixLegacyFormatting();
}
- for (int i = 0; i < m_Doc->FrameItems.count(); ++i)
- {
- PageItem* item = m_Doc->FrameItems.at(i);
+ for (QHash<int, PageItem*>::iterator itf = m_Doc->FrameItems.begin(); itf != m_Doc->FrameItems.end(); ++itf)
+ {
+ PageItem *item = itf.value();
if (item->prevInChain() == 0 && item->itemText.length() > 0)
item->itemText.fixLegacyFormatting();
}
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&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 Mar 31 20:30:32 2012
@@ -671,7 +671,7 @@
cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
cItem->setRotation(cItem->rotation() - gItem->rotation());
}
- m_Doc->FrameItems.removeOne(cItem);
+ m_Doc->FrameItems.remove(m_Doc->FrameItems.key(cItem));
}
gItem->groupItemList = gpL;
}
@@ -1854,7 +1854,7 @@
if (tagName == "FRAMEOBJECT")
{
- doc->FrameItems.append(doc->Items->takeAt(doc->Items->indexOf(newItem)));
+ doc->addToInlineFrames(doc->Items->takeAt(doc->Items->indexOf(newItem)));
}
info.item = newItem;
@@ -2317,10 +2317,15 @@
}
int pos = obj->itemText.length();
- if (ch == SpecialChars::OBJECT) {
- if (iobj >= 0) {
- if (iobj < doc->FrameItems.count())
- obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+ if (ch == SpecialChars::OBJECT)
+ {
+ if (iobj >= 0)
+ {
+ if (iobj < FrameItems.count())
+ {
+ int fIndex = doc->addToInlineFrames(FrameItems.at(iobj));
+ obj->itemText.insertObject(pos, fIndex);
+ }
else
qDebug() << QString("scribus134format: invalid inline frame used in text object : %1").arg(iobj);
}
@@ -2578,6 +2583,7 @@
case PageItem::Arc:
case PageItem::Spiral:
case PageItem::Multiple:
+ case PageItem::Table:
Q_ASSERT(false);
break;
}
@@ -3277,7 +3283,7 @@
}
if (tagName == "FRAMEOBJECT")
{
- m_Doc->FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
+ FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
}
}
}
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&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 Mar 31 20:30:32 2012
@@ -124,6 +124,7 @@
QMap<int, int> itemNext;
QMap<int, int> itemRemapM;
QMap<int, int> itemNextM;
+ QList<PageItem*> FrameItems;
int itemCount;
int itemCountM;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Sat Mar 31 20:30:32 2012
@@ -932,7 +932,7 @@
m_Doc->LastAuto = Neu;
if (pg.tagName()=="FRAMEOBJECT")
{
- m_Doc->FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(Neu)));
+ FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(Neu)));
}
if (Neu->isTableItem)
{
@@ -944,7 +944,7 @@
else if (pg.tagName()=="FRAMEOBJECT")
{
TableItemsF.append(Neu);
- TableIDF.insert(pg.attribute("OwnLINK", "0").toInt(), m_Doc->FrameItems.indexOf(Neu));
+ TableIDF.insert(pg.attribute("OwnLINK", "0").toInt(), FrameItems.indexOf(Neu));
}
else
{
@@ -989,19 +989,19 @@
{
PageItem* ta = TableItemsF.at(ttc);
if (ta->TopLinkID != -1)
- ta->TopLink = m_Doc->FrameItems.at(TableIDF[ta->TopLinkID]);
+ ta->TopLink = FrameItems.at(TableIDF[ta->TopLinkID]);
else
ta->TopLink = 0;
if (ta->LeftLinkID != -1)
- ta->LeftLink = m_Doc->FrameItems.at(TableIDF[ta->LeftLinkID]);
+ ta->LeftLink = FrameItems.at(TableIDF[ta->LeftLinkID]);
else
ta->LeftLink = 0;
if (ta->RightLinkID != -1)
- ta->RightLink = m_Doc->FrameItems.at(TableIDF[ta->RightLinkID]);
+ ta->RightLink = FrameItems.at(TableIDF[ta->RightLinkID]);
else
ta->RightLink = 0;
if (ta->BottomLinkID != -1)
- ta->BottomLink = m_Doc->FrameItems.at(TableIDF[ta->BottomLinkID]);
+ ta->BottomLink = FrameItems.at(TableIDF[ta->BottomLinkID]);
else
ta->BottomLink = 0;
}
@@ -1109,9 +1109,9 @@
if (item->prevInChain() == 0 && item->itemText.length() > 0)
item->itemText.fixLegacyFormatting();
}
- for (int i = 0; i < m_Doc->FrameItems.count(); ++i)
- {
- PageItem* item = m_Doc->FrameItems.at(i);
+ for (QHash<int, PageItem*>::iterator itf = m_Doc->FrameItems.begin(); itf != m_Doc->FrameItems.end(); ++itf)
+ {
+ PageItem *item = itf.value();
if (item->prevInChain() == 0 && item->itemText.length() > 0)
item->itemText.fixLegacyFormatting();
}
@@ -1269,12 +1269,17 @@
last->ParaStyle = pstylename;
int pos = obj->itemText.length();
- if (ch == SpecialChars::OBJECT) {
- if (iobj >= 0) {
- if (iobj < doc->FrameItems.count())
- obj->itemText.insertObject(pos, doc->FrameItems.at(iobj));
+ if (ch == SpecialChars::OBJECT)
+ {
+ if (iobj >= 0)
+ {
+ if (iobj < FrameItems.count())
+ {
+ int fIndex = doc->addToInlineFrames(FrameItems.at(iobj));
+ obj->itemText.insertObject(pos, fIndex);
+ }
else
- qDebug() << QString("scribus13format: invalid inline frame used in text object : %1").arg(iobj);
+ qDebug() << QString("scribus134format: invalid inline frame used in text object : %1").arg(iobj);
}
}
else {
@@ -2269,7 +2274,7 @@
}
if (pg.tagName()=="FRAMEOBJECT")
{
- m_Doc->FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(Neu)));
+ FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(Neu)));
}
}
counter++;
@@ -2371,9 +2376,9 @@
if (item->prevInChain() == 0 && item->itemText.length() > 0)
item->itemText.fixLegacyFormatting();
}
- for (int i = 0; i < m_Doc->FrameItems.count(); ++i)
- {
- PageItem* item = m_Doc->FrameItems.at(i);
+ for (QHash<int, PageItem*>::iterator itf = m_Doc->FrameItems.begin(); itf != m_Doc->FrameItems.end(); ++itf)
+ {
+ PageItem *item = itf.value();
if (item->prevInChain() == 0 && item->itemText.length() > 0)
item->itemText.fixLegacyFormatting();
}
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.h
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.h (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.h Sat Mar 31 20:30:32 2012
@@ -59,6 +59,7 @@
QMap<int, int> itemRemap;
QMap<int, int> itemNext;
+ QList<PageItem*> FrameItems;
int itemCount;
bool newReplacement;
QMap<QString,QString> ReplacedFonts;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&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 Mar 31 20:30:32 2012
@@ -597,7 +597,7 @@
cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
cItem->setRotation(cItem->rotation() - gItem->rotation());
}
- m_Doc->FrameItems.removeOne(cItem);
+ m_Doc->FrameItems.remove(m_Doc->FrameItems.key(cItem));
}
gItem->groupItemList = gpL;
}
@@ -1076,7 +1076,7 @@
cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
cItem->setRotation(cItem->rotation() - gItem->rotation());
}
- m_Doc->FrameItems.removeOne(cItem);
+ m_Doc->FrameItems.remove(m_Doc->FrameItems.key(cItem));
}
gItem->groupItemList = gpL;
}
@@ -1726,7 +1726,7 @@
cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
cItem->setRotation(cItem->rotation() - gItem->rotation());
}
- m_Doc->FrameItems.removeOne(cItem);
+ m_Doc->FrameItems.remove(m_Doc->FrameItems.key(cItem));
}
gItem->groupItemList = gpL;
}
@@ -3212,7 +3212,10 @@
if (tagName == "FRAMEOBJECT")
{
- doc->FrameItems.append(doc->Items->takeAt(doc->Items->indexOf(newItem)));
+ if (newItem->inlineCharID == -1)
+ FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
+ else
+ doc->FrameItems.insert(newItem->inlineCharID, doc->Items->takeAt(doc->Items->indexOf(newItem)));
}
info.item = newItem;
@@ -3842,16 +3845,20 @@
if (ch == SpecialChars::OBJECT)
{
if (LinkID.contains(iobj))
- obj->itemText.insertObject(pos, LinkID[iobj]);
+ {
+ if (FrameItems.contains(LinkID[iobj]))
+ {
+ int fIndex = doc->addToInlineFrames(LinkID[iobj]);
+ obj->itemText.insertObject(pos, fIndex);
+ }
+ }
else
- qDebug() << QString("scribus150format: invalid inline frame used in text object : %1").arg(iobj);
- // if (iobj >= 0)
- // {
- // if (iobj < doc->FrameItems.count())
- // obj->itemText.insertObject(pos, LinkID[iobj]);
- // else
- // qDebug() << QString("scribus150format: invalid inline frame used in text object : %1").arg(iobj);
- // }
+ {
+ if (doc->FrameItems.contains(iobj))
+ obj->itemText.insertObject(pos, iobj);
+ else
+ qDebug() << QString("scribus150format: invalid inline frame used in text object : %1").arg(iobj);
+ }
}
else if (ch == SpecialChars::SHYPHEN && pos > 0)
{
@@ -4722,6 +4729,10 @@
currItem->GrMaskSkew = attrs.valueAsDouble("GRSKEWM", 0.0);
if (!GrNameM.isEmpty())
currItem->setGradientMask(GrNameM);
+ if (attrs.hasAttribute("InID"))
+ currItem->inlineCharID = attrs.valueAsInt("InID", -1);
+ else
+ currItem->inlineCharID = -1;
//currItem->setRedrawBounding();
//currItem->OwnPage = view->OnPage(currItem);
@@ -5338,7 +5349,10 @@
}
if (tagName == "FRAMEOBJECT")
{
- m_Doc->FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
+ if (newItem->inlineCharID == -1)
+ FrameItems.append(m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
+ else
+ m_Doc->FrameItems.insert(newItem->inlineCharID, m_Doc->Items->takeAt(m_Doc->Items->indexOf(newItem)));
}
if (groupStack.count() > 0)
{
@@ -5569,7 +5583,7 @@
cItem->gYpos = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
cItem->setRotation(cItem->rotation() - gItem->rotation());
}
- m_Doc->FrameItems.removeOne(cItem);
+ m_Doc->FrameItems.remove(m_Doc->FrameItems.key(cItem));
}
gItem->groupItemList = gpL;
}
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&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 Mar 31 20:30:32 2012
@@ -169,6 +169,7 @@
QMap<int, int> itemRemapM;
QMap<int, int> itemNextM;
QMap<int,PageItem*> LinkID;
+ QList<PageItem*> FrameItems;
QMap<PageItem*, QString> itemsWeld; //item* and master name
int itemCount;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&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 Mar 31 20:30:32 2012
@@ -76,8 +76,8 @@
uint chr = currItem->itemText.text(e).unicode();
if (chr == 25)
{
- if ((currItem->itemText.item(e)->hasObject()) && (!emF.contains(currItem->itemText.item(e)->getItem())))
- emF.append(currItem->itemText.item(e)->getItem());
+ if ((currItem->itemText.item(e)->hasObject(m_Doc)) && (!emF.contains(currItem->itemText.item(e)->getItem(m_Doc))))
+ emF.append(currItem->itemText.item(e)->getItem(m_Doc));
}
}
}
@@ -1398,7 +1398,7 @@
putCStyle(docu, lastStyle);
tmpnum.setNum(ch.unicode());
docu.writeAttribute("Unicode", tmpnum);
- docu.writeAttribute("COBJ", qHash(item->itemText.object(k)));
+ docu.writeAttribute("COBJ", item->itemText.object(k)->inlineCharID);
}
else if (ch == SpecialChars::PARSEP) // stores also the paragraphstyle for preceding chars
putPStyle(docu, item->itemText.paragraphStyle(k), "para");
@@ -1470,6 +1470,7 @@
{
uint ObCount = maxC;
QList<PageItem*> *items = NULL;
+ QList<PageItem*> itemList;
PageItem *item = NULL;
uint objects = 0;
switch (master)
@@ -1484,7 +1485,10 @@
if (some_items != NULL)
items = some_items;
else
- items = &doc->FrameItems;
+ {
+ itemList = doc->FrameItems.values();
+ items = &itemList;
+ }
break;
case ItemSelectionGroup:
case ItemSelectionPattern:
@@ -1523,6 +1527,8 @@
docu.writeStartElement("ITEM");
break;
}
+ if (master == ItemSelectionFrame)
+ docu.writeAttribute("InID", item->inlineCharID);
if (master == ItemSelectionElements)
{
docu.writeAttribute("XPOS", item->xPos() - doc->currentPage()->xOffset());
Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Sat Mar 31 20:30:32 2012
@@ -2577,8 +2577,8 @@
currItem->gYpos = 0;
currItem->gWidth = currItem->width();
currItem->gHeight = currItem->height();
- m_Doc->FrameItems.append(currItem);
- item->itemText.insertObject(currItem);
+ int fIndex = m_Doc->addToInlineFrames(currItem);
+ item->itemText.insertObject(fIndex);
item->itemText.applyStyle(posC, newStyle);
data = "";
posC = item->itemText.length();
@@ -2658,8 +2658,8 @@
currItem->gWidth = currItem->width();
currItem->gHeight = currItem->height();
m_Doc->dontResize = false;
- m_Doc->FrameItems.append(currItem);
- item->itemText.insertObject(currItem);
+ int fIndex = m_Doc->addToInlineFrames(currItem);
+ item->itemText.insertObject(fIndex);
item->itemText.applyStyle(posC, newStyle);
data = "";
posC = item->itemText.length();
Modified: trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp Sat Mar 31 20:30:32 2012
@@ -1049,10 +1049,10 @@
sca.translate(Item->xPos(), Item->yPos());
finalMat *= sca;
}
- if (hl->hasObject())
+ if (hl->hasObject(m_Doc))
{
ob.appendChild(processInlineItem(CurX + hl->glyph.xoffset, ls.y + hl->glyph.yoffset, finalMat, hl, false, trans));
- CurX += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH;
+ CurX += (hl->getItem(m_Doc)->width() + hl->getItem(m_Doc)->lineWidth()) * hl->glyph.scaleH;
}
else
{
@@ -1278,7 +1278,7 @@
else
trafo *= QTransform( a, 6 * b, 0, -1, hl->PtransX, hl->PtransY );
}
- if (hl->hasObject())
+ if (hl->hasObject(m_Doc))
{
QTransform finalMat = chma * chma2 * chma3 * chma4 * chma6 * trafo;
ob.appendChild(processInlineItem(0, 0, finalMat, hl, true, trans));
@@ -1444,7 +1444,7 @@
QDomElement SVGExPlug::processInlineItem(double xpos, double ypos, QTransform &finalMat, ScText *hl, bool pathT, QString trans)
{
const CharStyle & charStyle(*hl);
- QList<PageItem*> emG = hl->getGroupedItems();
+ QList<PageItem*> emG = hl->getGroupedItems(m_Doc);
QDomElement layerGroup = docu.createElement("g");
if (pathT)
layerGroup.setAttribute("transform", MatrixToStr(finalMat));
Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp (original)
+++ trunk/Scribus/scribus/pslib.cpp Sat Mar 31 20:30:32 2012
@@ -2245,7 +2245,7 @@
SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
}
- if (hl->hasObject())
+ if (hl->hasObject(Doc))
{
PS_save();
PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
@@ -2278,7 +2278,7 @@
PS_translate(0, -c->BaseOffs);
if (style.scaleH() != 1000)
PS_scale(style.scaleH() / 1000.0, 1);
- QList<PageItem*> emG = hl->getGroupedItems();
+ QList<PageItem*> emG = hl->getGroupedItems(Doc);
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
@@ -3433,7 +3433,7 @@
SetColor(style.fillColor(), style.fillShade(), &h, &s, &v, &k, gcr);
PS_setcmykcolor_stroke(h / 255.0, s / 255.0, v / 255.0, k / 255.0);
}
- if (hl->hasObject())
+ if (hl->hasObject(Doc))
{
PS_save();
PutStream( MatrixToStr(1.0, 0.0, 0.0, -1.0, -hl->PDx, 0.0) + "\n");
@@ -3466,7 +3466,7 @@
PS_translate(0, -ite->BaseOffs);
if (style.scaleH() != 1000)
PS_scale(style.scaleH() / 1000.0, 1);
- QList<PageItem*> emG = hl->getGroupedItems();
+ QList<PageItem*> emG = hl->getGroupedItems(Doc);
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
@@ -5389,9 +5389,9 @@
}
}
*/
- if (hl->hasObject())
- {
- QList<PageItem*> emG = hl->getGroupedItems();
+ if (hl->hasObject(Doc))
+ {
+ QList<PageItem*> emG = hl->getGroupedItems(Doc);
for (int em = 0; em < emG.count(); ++em)
{
PageItem* embedded = emG.at(em);
Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Sat Mar 31 20:30:32 2012
@@ -1277,8 +1277,8 @@
hl->glyph.yadvance = 0;
item->layoutGlyphs(itemText.charStyle(a), chstr, hl->glyph);
hl->glyph.shrink();
- if (hl->hasObject())
- totalTextLen += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH;
+ if (hl->hasObject(m_doc))
+ totalTextLen += (hl->getItem(m_doc)->width() + hl->getItem(m_doc)->lineWidth()) * hl->glyph.scaleH;
else
totalTextLen += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0;
}
@@ -1386,15 +1386,15 @@
}
painter->translate(0.0, item->pathTextBaseOffset());
if (hl->ch == SpecialChars::OBJECT)
- drawItem_Embedded(hl->getItem(), painter, clip, itemText.charStyle(a), hl->getItem());
+ drawItem_Embedded(hl->getItem(m_doc), painter, clip, itemText.charStyle(a), hl->getItem(m_doc));
else
drawGlyphs(item, painter, itemText.charStyle(a), hl->glyph, clip);
painter->setWorldMatrix(savWM);
painter->restore();
CurX -= dx;
- if (hl->hasObject())
- CurX += (hl->getItem()->width() + hl->getItem()->lineWidth()) * hl->glyph.scaleH;
+ if (hl->hasObject(m_doc))
+ CurX += (hl->getItem(m_doc)->width() + hl->getItem(m_doc)->lineWidth()) * hl->glyph.scaleH;
else
CurX += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0 + extraOffset;
}
@@ -1838,7 +1838,7 @@
painter->save();
painter->translate(CurX, ls.y);
if (hl->ch == SpecialChars::OBJECT)
- drawItem_Embedded(item, painter, clip, charStyle, hl->getItem());
+ drawItem_Embedded(item, painter, clip, charStyle, hl->getItem(m_doc));
else
drawGlyphs(item, painter, charStyle, hl->glyph, clip);
painter->restore();
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Mar 31 20:30:32 2012
@@ -289,7 +289,7 @@
int ScribusMainWindow::initScMW(bool primaryMainWindow)
{
int retVal=0;
-
+ qsrand(1234);
QByteArray stylesheet;
if (loadRawText(ScPaths::getApplicationDataDir() + "/stylesheet.css", stylesheet))
{
@@ -4066,9 +4066,9 @@
bookmarkPalette->BView->ChangeItem(ite->BMnr, ite->ItemNr);
} */
}
- for (int azz=0; azz<doc->FrameItems.count(); ++azz)
- {
- PageItem *ite = doc->FrameItems.at(azz);
+ for (QHash<int, PageItem*>::iterator itf = doc->FrameItems.begin(); itf != doc->FrameItems.end(); ++itf)
+ {
+ PageItem *ite = itf.value();
// qDebug() << QString("load F: %1 %2 %3").arg(azz).arg((uint)ite).arg(ite->itemType());
if(ite->nextInChain() == NULL)
ite->layout();
@@ -5140,18 +5140,14 @@
doc->m_Selection->setGroupRect();
doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
PageItem* currItem3 = doc->Items->at(ac);
- for (int as = ac; as < doc->Items->count(); ++as)
- {
- PageItem* currItem2 = doc->Items->at(as);
- currItem2->isEmbedded = true;
- currItem2->setIsAnnotation(false);
- currItem2->isBookmark = false;
- currItem2->gXpos = currItem2->xPos() - gx;
- currItem2->gYpos = currItem2->yPos() - gy;
- currItem2->gWidth = gw;
- currItem2->gHeight = gh;
- doc->FrameItems.append(currItem2);
- }
+ currItem3->isEmbedded = true;
+ currItem3->setIsAnnotation(false);
+ currItem3->isBookmark = false;
+ currItem3->gXpos = currItem3->xPos() - gx;
+ currItem3->gYpos = currItem3->yPos() - gy;
+ currItem3->gWidth = gw;
+ currItem3->gHeight = gh;
+ int fIndex = doc->addToInlineFrames(currItem3);
int acc = doc->Items->count();
for (int as = ac; as < acc; ++as)
{
@@ -5166,7 +5162,7 @@
doc->maxCanvasCoordinate = maxSize;
if (outlinePalette->isVisible())
outlinePalette->BuildTree();
- currItem->itemText.insertObject(currItem3);
+ currItem->itemText.insertObject(fIndex);
undoManager->setUndoEnabled(true);
doc->m_Selection->delaySignalsOff();
inlinePalette->unsetDoc();
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sat Mar 31 20:30:32 2012
@@ -591,9 +591,9 @@
}
allItems.clear();
}
- for (int a = 0; a < FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
+ for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *currItem = itf.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -648,11 +648,12 @@
{
delete DocItems.takeFirst();
}
- while (!FrameItems.isEmpty())
- {
- delete FrameItems.takeFirst();
- }
-// FrameItems.clear();
+ QList<PageItem*> tmList = FrameItems.values();
+ while (!tmList.isEmpty())
+ {
+ delete tmList.takeFirst();
+ }
+ FrameItems.clear();
while (!MasterPages.isEmpty())
{
@@ -1035,10 +1036,14 @@
}
if (itemlist == &MasterItems)
itemlist = &DocItems;
- else if (itemlist == &DocItems)
- itemlist = &FrameItems;
else
itemlist = NULL;
+ }
+ for (QHash<int, PageItem*>::const_iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *currItem = itf.value();
+ if (currItem)
+ currItem->getNamedResources(lists);
}
for (int i = 0; i < docParagraphStyles.count(); ++i)
docParagraphStyles[i].getNamedResources(lists);
@@ -1223,7 +1228,6 @@
#ifndef QT_NO_CONCURRENT
QtConcurrent::blockingMap(DocItems, ResMapped(newNames));
QtConcurrent::blockingMap(MasterItems, ResMapped(newNames));
- QtConcurrent::blockingMap(FrameItems, ResMapped(newNames));
#else
QList<PageItem*> * itemlist = & MasterItems;
@@ -1237,12 +1241,16 @@
}
if (itemlist == &MasterItems)
itemlist = &DocItems;
- else if (itemlist == &DocItems)
- itemlist = &FrameItems;
else
itemlist = NULL;
}
#endif
+ for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *currItem = itf.value();
+ if (currItem)
+ currItem->replaceNamedResources(newNames);
+ }
// replace names in styles...
for (int i=docParagraphStyles.count()-1; i >= 0; --i)
{
@@ -3291,9 +3299,9 @@
}
allItems.clear();
}
- for (int c = 0; c < FrameItems.count(); ++c)
- {
- PageItem* currItem = FrameItems.at(c);
+ for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *currItem = itf.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -3511,9 +3519,9 @@
}
allItems.clear();
}
- for (int c = 0; c < FrameItems.count(); ++c)
- {
- PageItem* currItem = FrameItems.at(c);
+ for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *currItem = itf.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -3590,7 +3598,7 @@
//QMap<QString,QFont> DocF;
//DocF = UsedFonts;
uint counter = 0;
- for (uint lc = 0; lc < 3; ++lc)
+ for (uint lc = 0; lc < 2; ++lc)
{
switch (lc)
{
@@ -3600,9 +3608,6 @@
case 1:
counter = DocItems.count();
break;
- case 2:
- counter = FrameItems.count();
- break;
}
PageItem* it = NULL;
for (uint d = 0; d < counter; ++d)
@@ -3614,9 +3619,6 @@
break;
case 1:
it = DocItems.at(d);
- break;
- case 2:
- it = FrameItems.at(d);
break;
}
if (it->isGroup())
@@ -3669,6 +3671,58 @@
allItems.clear();
}
}
+ for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *it = itf.value();
+ if (it->isGroup())
+ allItems = it->asGroupFrame()->getItemList();
+ else
+ allItems.append(it);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ it = allItems.at(ii);
+ if (it->isTable())
+ {
+ for (int row = 0; row < it->asTable()->rows(); ++row)
+ {
+ for (int col = 0; col < it->asTable()->columns(); col ++)
+ {
+ TableCell cell = it->asTable()->cellAt(row, col);
+ if (cell.row() == row && cell.column() == col)
+ {
+ PageItem* textFrame = cell.textFrame();
+ QString fontName(textFrame->itemText.defaultStyle().charStyle().font().replacementName());
+ Really.insert(fontName, UsedFonts[fontName]);
+ int start = textFrame->firstInFrame();
+ int stop = textFrame->lastInFrame();
+ for (int e = start; e <= stop; ++e)
+ {
+ QString rep = textFrame->itemText.charStyle(e).font().replacementName();
+ if (Really.contains(rep))
+ continue;
+ Really.insert(rep, UsedFonts[rep]);
+ }
+ }
+ }
+ }
+ }
+ 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)
+ {
+ QString rep = it->itemText.charStyle(e).font().replacementName();
+ if (Really.contains(rep))
+ continue;
+ Really.insert(rep, UsedFonts[rep]);
+ }
+ }
+ }
+ allItems.clear();
+ }
QMap<QString,int>::Iterator itfo, itnext;
for (itfo = UsedFonts.begin(); itfo != UsedFonts.end(); itfo = itnext)
{
@@ -3692,7 +3746,7 @@
QList<PageItem*> allItems;
PageItem* it = NULL;
uint counter = 0;
- for (uint lc = 0; lc < 3; ++lc)
+ for (uint lc = 0; lc < 2; ++lc)
{
switch (lc)
{
@@ -3702,9 +3756,6 @@
case 1:
counter = DocItems.count();
break;
- case 2:
- counter = FrameItems.count();
- break;
}
for (uint d = 0; d < counter; ++d)
{
@@ -3715,9 +3766,6 @@
break;
case 1:
it = DocItems.at(d);
- break;
- case 2:
- it = FrameItems.at(d);
break;
}
if (it->isGroup())
@@ -3747,6 +3795,36 @@
}
allItems.clear();
}
+ }
+ for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *ite = itf.value();
+ if (ite->isGroup())
+ allItems = ite->asGroupFrame()->getItemList();
+ else
+ allItems.append(ite);
+ for (int ii = 0; ii < allItems.count(); ii++)
+ {
+ ite = allItems.at(ii);
+ if (ite->isTable())
+ {
+ for (int row = 0; row < ite->asTable()->rows(); ++row)
+ {
+ for (int col = 0; col < ite->asTable()->columns(); col ++)
+ {
+ TableCell cell = ite->asTable()->cellAt(row, col);
+ if (cell.row() == row && cell.column() == col)
+ {
+ PageItem* textFrame = cell.textFrame();
+ checkItemForFonts(textFrame, Really, 3);
+ }
+ }
+ }
+ }
+ else
+ checkItemForFonts(ite, Really, 3);
+ }
+ allItems.clear();
}
QStringList patterns = getUsedPatterns();
for (int c = 0; c < patterns.count(); ++c)
@@ -3960,22 +4038,18 @@
if( profileNames.indexOf(docPrefsData.colorPrefs.DCMSset.DefaultPrinterProfile) < 0 )
profileNames.append(docPrefsData.colorPrefs.DCMSset.DefaultPrinterProfile);
- for (uint lc = 0; lc < 3; ++lc)
+ for (uint lc = 0; lc < 2; ++lc)
{
if (lc == 0)
counter = MasterItems.count();
else if(lc == 1)
counter = DocItems.count();
- else if(lc == 2)
- counter = FrameItems.count();
for (uint d = 0; d < counter; ++d)
{
if (lc == 0)
it = MasterItems.at(d);
else if(lc == 1)
it = DocItems.at(d);
- else if(lc == 2)
- it = FrameItems.at(d);
if (it->isGroup())
allItems = it->asGroupFrame()->getItemList();
else
@@ -3989,6 +4063,22 @@
}
allItems.clear();
}
+ }
+ for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *it = itf.value();
+ if (it->isGroup())
+ allItems = it->asGroupFrame()->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);
+ }
+ allItems.clear();
}
for( QStringList::Iterator pIter = profileNames.begin(); pIter != profileNames.end(); pIter++ )
@@ -4377,13 +4467,57 @@
#ifndef QT_NO_CONCURRENT
QtConcurrent::blockingMap(DocItems, &ScribusDoc::recalculateColorItem);
QtConcurrent::blockingMap(MasterItems, &ScribusDoc::recalculateColorItem);
- QtConcurrent::blockingMap(FrameItems, &ScribusDoc::recalculateColorItem);
#else
recalculateColorsList(&DocItems);
recalculateColorsList(&MasterItems);
- recalculateColorsList(&FrameItems);
#endif
+ QList<PageItem*> itemList = FrameItems.values();
+ recalculateColorsList(&itemList);
+ QList<PageItem*> allItems;
+ for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it)
+ {
+ PageItem *ite = it.value();
+ if (ite->isGroup())
+ allItems = ite->asGroupFrame()->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 grow = 0; grow < ite->meshGradientPatches.count(); grow++)
+ {
+ meshGradientPatch patch = ite->meshGradientPatches[grow];
+ ite->setMeshPointColor(grow, 1, patch.TL.colorName, patch.TL.shade, patch.TL.transparency, true);
+ ite->setMeshPointColor(grow, 2, patch.TR.colorName, patch.TR.shade, patch.TR.transparency, true);
+ ite->setMeshPointColor(grow, 3, patch.BR.colorName, patch.BR.shade, patch.BR.transparency, true);
+ ite->setMeshPointColor(grow, 4, patch.BL.colorName, patch.BL.shade, patch.BL.transparency, true);
+ }
+ QList<VColorStop*> cstops = ite->fill_gradient.colorStops();
+ for (uint cst = 0; cst < ite->fill_gradient.Stops(); ++cst)
+ ite->SetQColor(&cstops.at(cst)->color, cstops.at(cst)->name, cstops.at(cst)->shade);
+ cstops = ite->stroke_gradient.colorStops();
+ for (uint cst = 0; cst < ite->stroke_gradient.Stops(); ++cst)
+ ite->SetQColor(&cstops.at(cst)->color, cstops.at(cst)->name, cstops.at(cst)->shade);
+ cstops = ite->mask_gradient.colorStops();
+ for (uint cst = 0; cst < ite->mask_gradient.Stops(); ++cst)
+ ite->SetQColor(&cstops.at(cst)->color, cstops.at(cst)->name, cstops.at(cst)->shade);
+ if (ite->GrType == 13)
+ ite->createConicalMesh();
+ }
+ allItems.clear();
+ }
QStringList patterns = docPatterns.keys();
for (int c = 0; c < patterns.count(); ++c)
{
@@ -5286,9 +5420,9 @@
// #10379: Scribus crash when opening .sla document
// OwnPage is not meaningful for inline frame
- for (int i = 0; i < FrameItems.count(); ++i)
- {
- currItem = FrameItems.at(i);
+ for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it)
+ {
+ currItem = it.value();
currItem->OwnPage = -1;
}
}
@@ -6397,13 +6531,56 @@
{
RecalcPictures(&MasterItems, Pr, PrCMYK, dia);
RecalcPictures(&DocItems, Pr, PrCMYK, dia);
- RecalcPictures(&FrameItems, Pr, PrCMYK, dia);
+ QList<PageItem*> itemList = FrameItems.values();
+ RecalcPictures(&itemList, Pr, PrCMYK, dia);
+ QList<PageItem*> allItems;
+ uint docItemCount = FrameItems.count();
+ if ( docItemCount!= 0)
+ {
+ bool usingGUI=ScCore->usingGUI();
+ int counter = 0;
+ if (usingGUI && dia != NULL)
+ counter = dia->value();
+ for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+ {
+ PageItem *it = itf.value();
+ if (it->isGroup())
+ allItems = it->asGroupFrame()->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 (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);
+ }
+ }
+ allItems.clear();
+ if (usingGUI)
+ {
+ ++counter;
+ if (dia != NULL)
+ dia->setValue(counter);
+ }
+ }
+ }
}
void ScribusDoc::RecalcPictures(QList<PageItem*>* items, ProfilesL *Pr, ProfilesL *PrCMYK, QProgressBar *dia)
{
QList<PageItem*> allItems;
- uint docItemCount=items->count();
+ uint docItemCount = items->count();
if ( docItemCount!= 0)
{
bool usingGUI=ScCore->usingGUI();
@@ -8568,9 +8745,9 @@
}
allItems.clear();
}
- for (int a = 0; a <FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
+ for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it)
+ {
+ PageItem *currItem = it.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -8707,9 +8884,9 @@
}
allItems.clear();
}
- for (int a = 0; a <FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
+ for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it)
+ {
+ PageItem *currItem = it.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -8812,7 +8989,6 @@
lowRes = docPrefsData.itemToolPrefs.imageLowResType;
QtConcurrent::blockingMap(DocItems, PicResMapped(applyNewRes, lowRes));
QtConcurrent::blockingMap(MasterItems, PicResMapped(applyNewRes, lowRes));
- QtConcurrent::blockingMap(FrameItems, PicResMapped(applyNewRes, lowRes));
#else
int cc = 0;
for (int a = 0; a < DocItems.count(); ++a)
@@ -8845,9 +9021,9 @@
}
allItems.clear();
}
- for (int a = 0; a < FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
+ for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it)
+ {
+ PageItem *currItem = it.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -8942,9 +9118,10 @@
}
allItems.clear();
}
- for (int a = 0; a < FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
+#endif
+ for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it)
+ {
+ PageItem *currItem = it.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -8973,7 +9150,6 @@
}
allItems.clear();
}
-#endif
for (int c = 0; c < patterns.count(); ++c)
{
ScPattern pa = docPatterns[patterns[c]];
@@ -9069,9 +9245,9 @@
}
allItems.clear();
}
- for (int a = 0; a < FrameItems.count(); ++a)
- {
- PageItem *currItem = FrameItems.at(a);
+ for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it)
+ {
+ PageItem *currItem = it.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -9854,9 +10030,9 @@
}
allItems.clear();
}
- for (int c=0; c<FrameItems.count(); ++c)
- {
- PageItem *currItem = FrameItems.at(c);
+ for (QHash<int, PageItem*>::iterator it = FrameItems.begin(); it != FrameItems.end(); ++it)
+ {
+ PageItem *currItem = it.value();
if (currItem->isGroup())
allItems = currItem->asGroupFrame()->getItemList();
else
@@ -14901,3 +15077,15 @@
{
m_ScMW->view->requestMode(modeEditWeldPoint);
}
+
+int ScribusDoc::addToInlineFrames(PageItem *item)
+{
+ int fIndex = qrand();
+ while (FrameItems.contains(fIndex))
+ {
+ fIndex = qrand();
+ }
+ item->inlineCharID = fIndex;
+ FrameItems.insert(fIndex, item);
+ return fIndex;
+}
Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Sat Mar 31 20:30:32 2012
@@ -1132,6 +1132,7 @@
// unncessary signals when doing updates on multiple items
void beginUpdate();
void endUpdate();
+ int addToInlineFrames(PageItem *item);
protected:
void addSymbols();
@@ -1158,7 +1159,7 @@
ScGuardedObject<ScribusDoc> m_guardedObject;
Serializer *m_serializer;
QString currentEditedSymbol;
-
+
public: // Public attributes
bool is12doc; //public for now, it will be removed later
int NrItems;
@@ -1188,7 +1189,7 @@
QList<PageItem*>* Items;
QList<PageItem*> MasterItems;
QList<PageItem*> DocItems;
- QList<PageItem*> FrameItems;
+ QHash<int, PageItem*> FrameItems;
Selection* const m_Selection;
/** \brief Number of Columns */
double PageSp;
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sat Mar 31 20:30:32 2012
@@ -3622,10 +3622,10 @@
}
if (chstr == SpecialChars::OBJECT)
{
- if (hl->hasObject())
+ if (hl->hasObject(Doc))
{
Selection tempSelection(this, false);
- tempSelection.addItem(hl->getItem(), true);
+ tempSelection.addItem(hl->getItem(Doc), true);
ScriXmlDoc *ss = new ScriXmlDoc();
QString dataS = ss->WriteElem(Doc, &tempSelection);
delete ss;
Modified: trunk/Scribus/scribus/sctextstruct.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/sctextstruct.cpp
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.cpp (original)
+++ trunk/Scribus/scribus/sctextstruct.cpp Sat Mar 31 20:30:32 2012
@@ -34,19 +34,19 @@
parstyle = NULL;
}
-bool ScText::hasObject() const
+bool ScText::hasObject(ScribusDoc *doc) const
{
if (this->ch == SpecialChars::OBJECT)
- return this->embedded != NULL;
+ return ((embedded > 0) && (doc->FrameItems.contains(embedded)));
return false;
}
-QList<PageItem*> ScText::getGroupedItems()
+QList<PageItem*> ScText::getGroupedItems(ScribusDoc *doc)
{
QList<PageItem*> result;
- if (this->embedded != NULL)
+ if ((embedded > 0) && (doc->FrameItems.contains(embedded)))
{
- PageItem* dItem = this->embedded;
+ PageItem* dItem = doc->FrameItems[embedded];
result.append(dItem);
if (dItem->isGroup())
result = dItem->getItemList();
@@ -54,7 +54,9 @@
return result;
}
-PageItem* ScText::getItem()
+PageItem* ScText::getItem(ScribusDoc *doc)
{
- return embedded;
+ if ((embedded > 0) && (doc->FrameItems.contains(embedded)))
+ return doc->FrameItems[embedded];
+ return NULL;
}
Modified: trunk/Scribus/scribus/sctextstruct.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/sctextstruct.h
==============================================================================
--- trunk/Scribus/scribus/sctextstruct.h (original)
+++ trunk/Scribus/scribus/sctextstruct.h Sat Mar 31 20:30:32 2012
@@ -28,6 +28,7 @@
#include "styles/paragraphstyle.h"
class PageItem;
+class ScribusDoc;
/* Struktur fuer Pageitem Text */
@@ -108,12 +109,12 @@
float PtransY;
float PRot;
float PDx;
- PageItem *embedded;
+ int embedded;
QChar ch;
ScText() :
CharStyle(),
parstyle(NULL), glyph(),
- PtransX(0.0f), PtransY(0.0f), PRot(0.0f), PDx(0.0f), embedded(NULL), ch() {}
+ PtransX(0.0f), PtransY(0.0f), PRot(0.0f), PDx(0.0f), embedded(0), ch() {}
ScText(const ScText& other) :
CharStyle(other),
parstyle(NULL), glyph(other.glyph),
@@ -134,9 +135,9 @@
}
~ScText();
- bool hasObject() const;
- QList<PageItem*> getGroupedItems();
- PageItem* getItem();
+ bool hasObject(ScribusDoc *doc) const;
+ QList<PageItem*> getGroupedItems(ScribusDoc *doc);
+ PageItem* getItem(ScribusDoc *doc);
};
#endif
Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Sat Mar 31 20:30:32 2012
@@ -440,12 +440,10 @@
item->setContext(cStyleContext);
d->insert(index, item);
d->len++;
- if (item->ch == SpecialChars::PARSEP) {
+ if (item->ch == SpecialChars::PARSEP)
insertParSep(index);
- }
- if (d->cursorPosition >= index) {
+ if (d->cursorPosition >= static_cast<uint>(index))
d->cursorPosition += 1;
- }
++inserted;
}
}
@@ -498,31 +496,31 @@
invalidate(pos, pos + len);
}
-void StoryText::insertObject(PageItem* ob)
+void StoryText::insertObject(int ob)
{
insertObject(d->cursorPosition, ob);
}
-void StoryText::insertObject(int pos, PageItem* ob)
+void StoryText::insertObject(int pos, int ob)
{
if (pos < 0)
pos += length()+1;
insertChars(pos, SpecialChars::OBJECT);
const_cast<StoryText *>(this)->d->at(pos)->embedded = ob;
- ob->isEmbedded = true; // this might not be enough...
- ob->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object
-}
-
-void StoryText::replaceObject(int pos, PageItem* ob)
+ doc->FrameItems[ob]->isEmbedded = true; // this might not be enough...
+ doc->FrameItems[ob]->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object
+}
+
+void StoryText::replaceObject(int pos, int ob)
{
if (pos < 0)
pos += length()+1;
replaceChar(pos, SpecialChars::OBJECT);
const_cast<StoryText *>(this)->d->at(pos)->embedded = ob;
- ob->isEmbedded = true; // this might not be enough...
- ob->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object
+ doc->FrameItems[ob]->isEmbedded = true; // this might not be enough...
+ doc->FrameItems[ob]->OwnPage = -1; // #10379: OwnPage is not meaningful for inline object
}
@@ -596,7 +594,7 @@
StoryText* that = const_cast<StoryText *>(this);
if (that->d->at(pos)->ch == SpecialChars::OBJECT)
- return that->d->at(pos)->hasObject();
+ return that->d->at(pos)->hasObject(doc);
return false;
}
@@ -609,7 +607,7 @@
assert(pos < length());
StoryText* that = const_cast<StoryText *>(this);
- return that->d->at(pos)->getItem();
+ return that->d->at(pos)->getItem(doc);
}
const CharStyle & StoryText::charStyle() const
@@ -722,7 +720,7 @@
if (len == 0)
return;
- int lastParStart = pos == 0? 0 : -1;
+// int lastParStart = pos == 0? 0 : -1;
ScText* itText;
for (uint i=pos; i < pos+len; ++i) {
itText = d->at(i);
@@ -1840,8 +1838,7 @@
else
items->removeAll(obj);
}
- obj->doc()->FrameItems.append(obj);
- story->insertObject(-1, obj);
+ story->insertObject(-1, obj->doc()->addToInlineFrames(obj));
}
};
Modified: trunk/Scribus/scribus/text/storytext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/text/storytext.h
==============================================================================
--- trunk/Scribus/scribus/text/storytext.h (original)
+++ trunk/Scribus/scribus/text/storytext.h Sat Mar 31 20:30:32 2012
@@ -122,11 +122,11 @@
// Insert chars ar specific position
void insertChars(int pos, QString txt, bool applyNeighbourStyle = false);
// Insert inline object at current cursor position
- void insertObject(PageItem* obj);
+ void insertObject(int obj);
// Insert object at specific position
- void insertObject(int pos, PageItem* obj);
+ void insertObject(int pos, int obj);
void replaceChar(int pos, QChar ch);
- void replaceObject(int pos, PageItem* obj);
+ void replaceObject(int pos, int obj);
void hyphenateWord(int pos, uint len, char* hyphens);
Modified: trunk/Scribus/scribus/ui/inlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/ui/inlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/inlinepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/inlinepalette.cpp Sat Mar 31 20:30:32 2012
@@ -164,9 +164,9 @@
{
InlineViewWidget->clear();
InlineViewWidget->setWordWrap(true);
- for (int a = 0; a < currDoc->FrameItems.count(); a++)
+ for (QHash<int, PageItem*>::iterator it = currDoc->FrameItems.begin(); it != currDoc->FrameItems.end(); ++it)
{
- PageItem* currItem = currDoc->FrameItems.at(a);
+ PageItem *currItem = it.value();
QPixmap pm = QPixmap::fromImage(currItem->DrawObj_toImage(48));
QPixmap pm2(50, 50);
pm2.fill(palette().color(QPalette::Base));
Modified: trunk/Scribus/scribus/ui/prefs_pdfexport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/ui/prefs_pdfexport.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_pdfexport.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_pdfexport.cpp Sat Mar 31 20:30:32 2012
@@ -245,9 +245,9 @@
// Build a list of all Fonts used in Annotations;
PageItem *pgit;
QList<PageItem*> allItems;
- for (int a = 0; a < m_doc->FrameItems.count(); ++a)
- {
- PageItem *currItem = m_doc->FrameItems.at(a);
+ for (QHash<int, PageItem*>::iterator it = m_doc->FrameItems.begin(); it != m_doc->FrameItems.end(); ++it)
+ {
+ PageItem *currItem = it.value();
if (currItem->isGroup())
allItems = currItem->getItemList();
else
Modified: trunk/Scribus/scribus/ui/smlinestyle.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/ui/smlinestyle.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smlinestyle.cpp (original)
+++ trunk/Scribus/scribus/ui/smlinestyle.cpp Sat Mar 31 20:30:32 2012
@@ -256,9 +256,9 @@
ite->NamedLStyle = replacement[ite->NamedLStyle];
}
}
- for (int d1 = 0; d1 < doc_->FrameItems.count(); ++d1)
- {
- ite = doc_->FrameItems.at(d1);
+ for (QHash<int, PageItem*>::iterator it = doc_->FrameItems.begin(); it != doc_->FrameItems.end(); ++it)
+ {
+ ite = it.value();
if (!ite->NamedLStyle.isEmpty())
{
if (!doc_->MLineStyles.contains(ite->NamedLStyle))
Modified: trunk/Scribus/scribus/ui/tabpdfoptions.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17407&path=/trunk/Scribus/scribus/ui/tabpdfoptions.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/tabpdfoptions.cpp (original)
+++ trunk/Scribus/scribus/ui/tabpdfoptions.cpp Sat Mar 31 20:30:32 2012
@@ -1070,9 +1070,9 @@
// Build a list of all Fonts used in Annotations;
PageItem *pgit;
QList<PageItem*> allItems;
- for (int a = 0; a < doc->FrameItems.count(); ++a)
- {
- PageItem *currItem = doc->FrameItems.at(a);
+ for (QHash<int, PageItem*>::iterator it = doc->FrameItems.begin(); it != doc->FrameItems.end(); ++it)
+ {
+ PageItem *currItem = it.value();
if (currItem->isGroup())
allItems = currItem->getItemList();
else
More information about the scribus-commit
mailing list