r20665 by fschmid -

scribus-commit scribus-commit at lists.scribus.net
Wed Jan 6 12:05:19 UTC 2016


Author: fschmid
Date: Wed Jan  6 12:05:19 2016
New Revision: 20665

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20665
Log:
Fixed Bug #12995: Non-printing characters (Page Break, Column Break) are not imported from ODT files

Modified:
    trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
    trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h

Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20665&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp	(original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp	Wed Jan  6 12:05:19 2016
@@ -369,6 +369,8 @@
 					currStyle.textAlign = AttributeValue(spe.attribute("fo:text-align", ""));
 					currStyle.lineHeight = AttributeValue(spe.attribute("fo:line-height", ""));
 					currStyle.parBackgroundColor = AttributeValue(spe.attribute("fo:background-color", ""));
+					currStyle.breakAfter = AttributeValue(spe.attribute("fo:break-after", ""));
+					currStyle.breakBefore = AttributeValue(spe.attribute("fo:break-before", ""));
 					if (spe.hasChildNodes())
 					{
 						for(QDomElement spt = spe.firstChildElement(); !spt.isNull(); spt = spt.nextSiblingElement() )
@@ -443,6 +445,8 @@
 					currStyle.textAlign = AttributeValue(spe.attribute("fo:text-align", ""));
 					currStyle.lineHeight = AttributeValue(spe.attribute("fo:line-height", ""));
 					currStyle.parBackgroundColor = AttributeValue(spe.attribute("fo:background-color", ""));
+					currStyle.breakAfter = AttributeValue(spe.attribute("fo:break-after", ""));
+					currStyle.breakBefore = AttributeValue(spe.attribute("fo:break-before", ""));
 					if (spe.hasChildNodes())
 					{
 						for(QDomElement spt = spe.firstChildElement(); !spt.isNull(); spt = spt.nextSiblingElement() )
@@ -668,6 +672,16 @@
 			}
 		}
 	}
+	if (pStyle.breakBefore == "column")
+	{
+		QString txt = SpecialChars::COLBREAK;
+		insertChars(item, txt, tmpStyle, tmpCStyle, posC);
+	}
+	else if (pStyle.breakBefore == "page")
+	{
+		QString txt = SpecialChars::FRAMEBREAK;
+		insertChars(item, txt, tmpStyle, tmpCStyle, posC);
+	}
 	applyParagraphStyle(tmpStyle, pStyle);
 	if (elem.hasChildNodes())
 	{
@@ -730,6 +744,16 @@
 		else
 			tmpStyle.setLineSpacing(tmpOStyle.lineHeight * tmpOStyle.fontSize);
 	} */
+	if (pStyle.breakAfter == "column")
+	{
+		QString txt = SpecialChars::COLBREAK;
+		insertChars(item, txt, tmpStyle, tmpCStyle, posC);
+	}
+	else if (pStyle.breakAfter == "page")
+	{
+		QString txt = SpecialChars::FRAMEBREAK;
+		insertChars(item, txt, tmpStyle, tmpCStyle, posC);
+	}
 	item->itemText.insertChars(posC, SpecialChars::PARSEP);
 	item->itemText.applyStyle(posC, tmpStyle);
 	posC = item->itemText.length();
@@ -950,6 +974,10 @@
 					actStyle.tabDists = AttributeValue(currStyle.tabDists.value);
 				if (currStyle.tabTypes.valid)
 					actStyle.tabTypes = AttributeValue(currStyle.tabTypes.value);
+				if (currStyle.breakAfter.valid)
+					actStyle.breakAfter = AttributeValue(currStyle.breakAfter.value);
+				if (currStyle.breakBefore.valid)
+					actStyle.breakBefore = AttributeValue(currStyle.breakBefore.value);
 			}
 		}
 		if (actStyle.textBackgroundColor.valid)
@@ -1078,6 +1106,10 @@
 				}
 			}
 		}
+		if (actStyle.breakAfter.valid)
+			tmpOStyle.breakAfter = actStyle.breakAfter.value;
+		if (actStyle.breakBefore.valid)
+			tmpOStyle.breakBefore = actStyle.breakBefore.value;
 	}
 }
 

Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20665&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h	(original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h	Wed Jan  6 12:05:19 2016
@@ -55,7 +55,9 @@
 	  margin_left(0.0),
 	  margin_right(0.0),
 	  verticalAlignment(0),
-	  tabStops()
+	  tabStops(),
+	  breakBefore("auto"),
+	  breakAfter("auto")
 	  {}
 	QString							CurrColorText;
 	QString							CurrColorBText;
@@ -82,6 +84,8 @@
 	double							margin_right;
 	int								verticalAlignment;
 	QList<ParagraphStyle::TabRecord> tabStops;
+	QString							breakBefore;
+	QString							breakAfter;
 };
 
 class ODTIm
@@ -121,6 +125,8 @@
 			AttributeValue verticalAlignment;
 			AttributeValue tabDists;
 			AttributeValue tabTypes;
+			AttributeValue breakBefore;
+			AttributeValue breakAfter;
 		};
 		bool parseRawDocReference(QString designMap);
 		bool parseRawDocReferenceXML(QDomDocument &designMapDom);




More information about the scribus-commit mailing list