summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2005-06-08 17:50:40 +0000
committerStef Walter <stef@memberwebs.com>2005-06-08 17:50:40 +0000
commit182ccac47d8bb9b0c04078a893b31f99d31c9654 (patch)
tree986e430cce9f3b236df82529dbf2abfa9f29e2d0
parent773b54cdf97a9cbad83d309c0d99f157a7b0d27e (diff)
Fix problem with certain paragraph attributes leaking into adjacent paras.
-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")