r17147 by fschmid - Fixed loading and saving of inline frames, fixed copy & paste of textframes with inline frames.
scribus-commit
scribus-commit at lists.scribus.net
Fri Dec 30 10:28:18 UTC 2011
Author: fschmid
Date: Fri Dec 30 10:28:18 2011
New Revision: 17147
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17147
Log:
Fixed loading and saving of inline frames, fixed copy & paste of textframes with inline frames.
Modified:
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17147&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 Fri Dec 30 10:28:18 2011
@@ -300,7 +300,7 @@
m_Doc->MLineStyles.insert(mlName, ml);
}
}
- if (tagName == "ITEM")
+ if ((tagName == "ITEM") || (tagName == "FRAMEOBJECT"))
{
ItemInfo itemInfo;
success = readObject(m_Doc, reader, itemInfo, fileDir, true);
@@ -3565,13 +3565,19 @@
}
int pos = obj->itemText.length();
- if (ch == SpecialChars::OBJECT) {
- 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 (ch == SpecialChars::OBJECT)
+ {
+ if (LinkID.contains(iobj))
+ obj->itemText.insertObject(pos, LinkID[iobj]);
+ 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);
+ // }
}
else if (ch == SpecialChars::SHYPHEN && pos > 0)
{
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17147&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 Fri Dec 30 10:28:18 2011
@@ -61,10 +61,26 @@
writeGradients(writer, true);
ResourceCollection lists;
QList<PageItem*> emG;
+ QList<PageItem*> emF;
+ emG.clear();
+ emF.clear();
for (int cor = 0; cor < selection->count(); ++cor)
{
- selection->itemAt(cor)->getNamedResources(lists);
- emG.append(selection->itemAt(cor));
+ PageItem *currItem = selection->itemAt(cor);
+ currItem->getNamedResources(lists);
+ emG.append(currItem);
+ if ((currItem->asTextFrame()) || (currItem->asPathText()))
+ {
+ for (int e = currItem->firstInFrame(); e <= currItem->lastInFrame(); ++e)
+ {
+ uint chr = currItem->itemText.text(e).unicode();
+ if (chr == 25)
+ {
+ if ((currItem->itemText.item(e)->hasObject()) && (!emF.contains(currItem->itemText.item(e)->embedded.getItem())))
+ emF.append(currItem->itemText.item(e)->embedded.getItem());
+ }
+ }
+ }
}
QList<QString>::Iterator it;
QList<QString> names = lists.styleNames();
@@ -102,6 +118,8 @@
} */
writeLinestyles(writer);
writePatterns(writer, fileDir, true, selection);
+ if (!emF.isEmpty())
+ WriteObjects(m_Doc, writer, fileDir, 0, 0, ItemSelectionFrame, &emF);
WriteObjects(m_Doc, writer, fileDir, 0, 0, ItemSelectionElements, &emG);
writer.writeEndElement();
// writer.writeEndDocument();
@@ -1313,7 +1331,10 @@
items = &doc->DocItems;
break;
case ItemSelectionFrame:
- items = &doc->FrameItems;
+ if (some_items != NULL)
+ items = some_items;
+ else
+ items = &doc->FrameItems;
break;
case ItemSelectionGroup:
case ItemSelectionPattern:
More information about the scribus-commit
mailing list