summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xmlcomposer.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp
index 6b1b725..f94ce29 100644
--- a/src/xmlcomposer.cpp
+++ b/src/xmlcomposer.cpp
@@ -364,6 +364,13 @@ void XmlComposer::BaseAnalyser::applyParaFormatting(RtfFormatting* format,
if(format == NULL)
format = &(m_composer->getTextFormatting());
+ /*
+ * NOTE: All attributes set in this method must be reversible
+ * by calling again with different formatting. This is called
+ * multiple times per paragraph. Once when the paragraph is
+ * created, and again after the formatting has been finalized.
+ */
+
string fix = kValPara;
// Is it a list?
@@ -391,6 +398,9 @@ void XmlComposer::BaseAnalyser::applyParaFormatting(RtfFormatting* format,
// Paragraph alignment
switch(format->paraAlign())
{
+ case RtfFormatting::LEFT:
+ el.removeAttribute(kAtAlign);
+ break;
case RtfFormatting::CENTER:
el.setAttribute(kAtAlign, kValCenter);
break;
@@ -403,7 +413,9 @@ void XmlComposer::BaseAnalyser::applyParaFormatting(RtfFormatting* format,
};
// Paragraph left indent
- if(format->paraIndent() != 0)
+ if(format->paraIndent() == 0)
+ el.removeAttribute(kAtIndent);
+ else
el.setAttribute(kAtIndent, formatInt(format->paraIndent()));
}
@@ -439,6 +451,10 @@ bool XmlComposer::BaseAnalyser::processTextContent(const string& cw, int flags,
applyParaFormatting(&format, el);
}
+ // Clears all paragraph formatting
+ if(cw == "pard")
+ format.resetPara();
+
// Cells (used later in applyParaFormatting)
else if(cw == "intbl")
format.paraSetTable(true);
@@ -544,10 +560,7 @@ bool XmlComposer::BaseAnalyser::processTextFormatting(const string& cw, int flag
// Clears all paragraph formatting
if(cw == "pard")
- {
format.resetPara();
- // applyParaFormatting();
- }
// Rest are pretty much self-explanatory
else if(cw == "plain")