diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rtfformatting.h | 10 | ||||
-rw-r--r-- | src/tags.h | 1 | ||||
-rw-r--r-- | src/xmlcomposer.cpp | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/rtfformatting.h b/src/rtfformatting.h index cab1e4f..78f4cc2 100644 --- a/src/rtfformatting.h +++ b/src/rtfformatting.h @@ -80,7 +80,8 @@ public: return m_style == format.m_style && m_list == format.m_list && m_inTbl == format.m_inTbl && - m_align == format.m_align; + m_align == format.m_align && + m_indent == format.m_indent; } void copy(const RtfFormatting& format) @@ -101,6 +102,7 @@ public: m_list = format.m_list; m_inTbl = format.m_inTbl; m_align = format.m_align; + m_indent = format.m_indent; } void resetText() @@ -120,6 +122,7 @@ public: m_style = m_list = -1; m_inTbl = false; m_align = LEFT; + m_indent = 0; } bool textIsBold() const @@ -152,6 +155,8 @@ public: { return m_inTbl; } int paraAlign() const { return m_align; } + int paraIndent() const + { return m_indent; } void textSetBold(bool bold) { m_bold = bold; } @@ -183,6 +188,8 @@ public: { m_inTbl = inTable; } void paraSetAlign(int align) { m_align = align; } + void paraSetIndent(int indent) + { m_indent = indent; } enum { @@ -215,6 +222,7 @@ protected: int m_list; bool m_inTbl; int m_align; + int m_indent; }; #endif // __RTFFORMATTING_H__ @@ -106,6 +106,7 @@ static const char* kAtTo = "to"; static const char* kAtSize = "size"; static const char* kAtHref = "href"; static const char* kAtAlign = "align"; +static const char* kAtIndent = "indent"; // Values static const char* kValDisc = "disc"; diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp index c081764..f10ce0c 100644 --- a/src/xmlcomposer.cpp +++ b/src/xmlcomposer.cpp @@ -384,6 +384,7 @@ void XmlComposer::BaseAnalyser::applyParaFormatting(RtfFormatting* format, if(DO_EXTRAS()) { + // Paragraph alignment switch(format->paraAlign()) { case RtfFormatting::CENTER: @@ -396,6 +397,10 @@ void XmlComposer::BaseAnalyser::applyParaFormatting(RtfFormatting* format, el.setAttribute(kAtAlign, kValJustify); break; }; + + // Paragraph left indent + if(format->paraIndent() != 0) + el.setAttribute(kAtIndent, formatInt(format->paraIndent())); } // These fix elements are later picked up in XmlFixups::fixBlocks @@ -484,6 +489,10 @@ bool XmlComposer::BaseAnalyser::processTextContent(const string& cw, int flags, else if(cw == "qj") format.paraSetAlign(RtfFormatting::JUSTIFY); + // Paragraph indent + else if(cw == "li") + format.paraSetIndent(param / 20); // Convert from twips to points + // A line break else if(cw == "line") el = m_composer->createElement(kElLine); |