r18769 by fschmid - Fixed Bug #11983: Line spacing issue in VIVA XML file

scribus-commit scribus-commit at lists.scribus.net
Fri Jan 24 18:54:21 UTC 2014


Author: fschmid
Date: Fri Jan 24 18:54:21 2014
New Revision: 18769

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18769
Log:
Fixed Bug #11983: Line spacing issue in VIVA XML file

Modified:
    trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
    trunk/Scribus/scribus/plugins/import/viva/importviva.h

Modified: trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18769&path=/trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/viva/importviva.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/viva/importviva.cpp Fri Jan 24 18:54:21 2014
@@ -1618,7 +1618,7 @@
 			if (eo.hasAttribute("vt:story-attribute-set"))
 			{
 				applyParagraphAttrs(newStyle, AttributeSets[eo.attribute("vt:story-attribute-set")]);
-				applyCharacterAttrs(newStyle.charStyle(), AttributeSets[eo.attribute("vt:story-attribute-set")]);
+				applyCharacterAttrs(newStyle.charStyle(), newStyle, AttributeSets[eo.attribute("vt:story-attribute-set")]);
 			}
 			for(QDomNode stx = eo.firstChild(); !stx.isNull(); stx = stx.nextSibling() )
 			{
@@ -1658,7 +1658,7 @@
 										{
 											CharStyle tmpCStyle = tmpStyle.charStyle();
 											if (stcet.hasAttribute("vt:character-attribute-set"))
-												applyCharacterAttrs(tmpCStyle, AttributeSets[stcet.attribute("vt:character-attribute-set")]);
+												applyCharacterAttrs(tmpCStyle, tmpStyle, AttributeSets[stcet.attribute("vt:character-attribute-set")]);
 											for(QDomNode stcesp = stcet.firstChild(); !stcesp.isNull(); stcesp = stcesp.nextSibling() )
 											{
 												QDomElement stcespt = stcesp.toElement();
@@ -2010,7 +2010,7 @@
 				parseAttributeSetXML(stxe, attrs);
 			}
 			applyParagraphAttrs(newStyle, attrs);
-			applyCharacterAttrs(newStyle.charStyle(), attrs);
+			applyCharacterAttrs(newStyle.charStyle(), newStyle, attrs);
 			StyleSet<ParagraphStyle>tmp;
 			tmp.create(newStyle);
 			m_Doc->redefineStyles(tmp, false);
@@ -2046,6 +2046,8 @@
 		newStyle.setLineSpacingMode(ParagraphStyle::FixedLineSpacing);
 		newStyle.setLineSpacing(parseUnit(pAttrs.lineSpacing.value));
 	}
+	else
+		newStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
 	if (pAttrs.firstLineIndent.valid)
 		newStyle.setFirstIndent(parseUnit(pAttrs.firstLineIndent.value));
 	if (pAttrs.indent.valid)
@@ -2094,10 +2096,17 @@
 	}
 }
 
-void VivaPlug::applyCharacterAttrs(CharStyle &tmpCStyle, AttributeSet &pAttrs)
+void VivaPlug::applyCharacterAttrs(CharStyle &tmpCStyle, ParagraphStyle &newStyle, AttributeSet &pAttrs)
 {
 	if (pAttrs.fontSize.valid)
+	{
 		tmpCStyle.setFontSize(pAttrs.fontSize.value.toInt() * 10);
+		if (pAttrs.lineSpacing.valid)
+		{
+			if (pAttrs.fontSize.value.toInt() > parseUnit(pAttrs.lineSpacing.value))
+				newStyle.setLineSpacingMode(ParagraphStyle::AutomaticLineSpacing);
+		}
+	}
 	if (pAttrs.fontFullName.valid)
 		tmpCStyle.setFont((*m_Doc->AllFonts)[pAttrs.fontFullName.value]);
 	if (pAttrs.fontColor.valid)

Modified: trunk/Scribus/scribus/plugins/import/viva/importviva.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18769&path=/trunk/Scribus/scribus/plugins/import/viva/importviva.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/viva/importviva.h (original)
+++ trunk/Scribus/scribus/plugins/import/viva/importviva.h Fri Jan 24 18:54:21 2014
@@ -143,7 +143,7 @@
 	void parseAttributeSetsXML(const QDomElement& obNode);
 	void parseStylesheetsXML(const QDomElement& obNode);
 	void applyParagraphAttrs(ParagraphStyle &newStyle, AttributeSet &pAttrs);
-	void applyCharacterAttrs(CharStyle &tmpCStyle, AttributeSet &pAttrs);
+	void applyCharacterAttrs(CharStyle &tmpCStyle, ParagraphStyle &newStyle, AttributeSet &pAttrs);
 	QString constructFontName(QString fontBaseName, QString fontStyle);
 	QPointF intersectBoundingRect(PageItem *item, QLineF gradientVector);
 




More information about the scribus-commit mailing list