r18831 by fschmid - ODG-Importer: Fixed Bug #12076: Text import issue with ODG files
scribus-commit
scribus-commit at lists.scribus.net
Fri Feb 21 21:41:23 UTC 2014
Author: fschmid
Date: Fri Feb 21 21:41:22 2014
New Revision: 18831
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18831
Log:
ODG-Importer: Fixed Bug #12076: Text import issue with ODG files
Modified:
trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
trunk/Scribus/scribus/ui/storyeditor.cpp
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18831&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Fri Feb 21 21:41:22 2014
@@ -1319,6 +1319,76 @@
txt += sp.text().trimmed();
else if (kind == "unit")
txt += " " + sp.text().trimmed();
+ }
+ else if (sp.tagName() == "text:list-item")
+ {
+ for(QDomElement paral = sp.firstChildElement(); !paral.isNull(); paral = paral.nextSiblingElement())
+ {
+ ObjStyle plStyle = tmpOStyle;
+ if (paral.hasAttribute("text:style-name"))
+ resovleStyle(plStyle, paral.attribute("text:style-name"));
+ ParagraphStyle tmpStyle = newStyle;
+ tmpStyle.setAlignment(plStyle.textAlign);
+ tmpStyle.setLeftMargin(plStyle.margin_left);
+ tmpStyle.setRightMargin(plStyle.margin_right);
+ tmpStyle.setFirstIndent(plStyle.textIndent);
+ tmpStyle.setGapAfter(plStyle.margin_bottom);
+ tmpStyle.setGapBefore(plStyle.margin_top);
+ for(QDomNode spnl = paral.firstChild(); !spnl.isNull(); spnl = spnl.nextSibling())
+ {
+ CharStyle tmpCStyle = tmpStyle.charStyle();
+ QDomElement spl = spnl.toElement();
+ ObjStyle clStyle = plStyle;
+ if (spnl.isElement() && (spl.tagName() == "text:span"))
+ {
+ if (spl.hasAttribute("text:style-name"))
+ resovleStyle(clStyle, spl.attribute("text:style-name"));
+ }
+ tmpCStyle.setFont((*m_Doc->AllFonts)[clStyle.fontName]);
+ tmpCStyle.setFontSize(clStyle.fontSize * 10);
+ tmpCStyle.setFillColor(clStyle.CurrColorText);
+ maxFsize = qMax(maxFsize, clStyle.fontSize);
+ if ((clStyle.textPos.startsWith("super")) || (clStyle.textPos.startsWith("sub")))
+ {
+ StyleFlag styleEffects = tmpCStyle.effects();
+ if (clStyle.textPos.startsWith("super"))
+ styleEffects |= ScStyle_Superscript;
+ else
+ styleEffects |= ScStyle_Subscript;
+ tmpCStyle.setFeatures(styleEffects.featureList());
+ }
+ if (spnl.isElement())
+ {
+ if (spl.tagName() == "text:span")
+ {
+ if (spl.tagName() == "text:s")
+ txt = " ";
+ else if (spl.tagName() == "text:tab")
+ txt = SpecialChars::TAB;
+ else if (spl.tagName() == "text:line-break")
+ txt = SpecialChars::LINEBREAK;
+ else
+ txt = spl.text().trimmed();
+ }
+ }
+ else if (spnl.isText())
+ {
+ QDomText t = spnl.toText();
+ txt = t.data().trimmed();
+ }
+ if (txt.length() > 0)
+ {
+ item->itemText.insertChars(posC, txt);
+ item->itemText.applyStyle(posC, tmpStyle);
+ item->itemText.applyCharStyle(posC, txt.length(), tmpCStyle);
+ posC = item->itemText.length();
+ txt = "";
+ }
+ }
+ item->itemText.insertChars(posC, SpecialChars::PARSEP);
+ item->itemText.applyStyle(posC, tmpStyle);
+ posC = item->itemText.length();
+ }
}
}
else if (spn.isText())
Modified: trunk/Scribus/scribus/ui/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18831&path=/trunk/Scribus/scribus/ui/storyeditor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/storyeditor.cpp (original)
+++ trunk/Scribus/scribus/ui/storyeditor.cpp Fri Feb 21 21:41:22 2014
@@ -2892,7 +2892,7 @@
if (!m_textChanged)
return;
PageItem *nextItem = m_item;
-#if 0
+//#if 0
if (m_item->asTextFrame())
{
while (nextItem != 0)
@@ -2903,7 +2903,7 @@
break;
}
}
-#endif
+//#endif
m_item->invalidateLayout();
PageItem* nb2 = nextItem;
nb2->itemText.clear();
@@ -2952,7 +2952,7 @@
Editor->saveItemText(nextItem);
// #9180 : force relayout here, it appears that relayout is sometime disabled
// to speed up selection, but re layout() cannot be avoided here
- nextItem->invalidateLayout();
+ nextItem->asTextFrame()->invalidateLayout(true);
nextItem->layout();
#if 0
QList<PageItem*> FrameItemsDel;
More information about the scribus-commit
mailing list