summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2005-06-08 00:33:16 +0000
committerStef Walter <stef@memberwebs.com>2005-06-08 00:33:16 +0000
commit1d1ffe40fdd0bea28d10230a09d5478d95a68128 (patch)
treef9bbed6cb9dda3844962cd08e4fe58e313fc15c1
parent519fae2932fd293b6a3368749a87c3c34698a277 (diff)
Add 'indent' attriute to <para> tags for paragraph indent.
-rw-r--r--ChangeLog1
-rw-r--r--src/rtfformatting.h10
-rw-r--r--src/tags.h1
-rw-r--r--src/xmlcomposer.cpp9
4 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ae94e22..a82f430 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ Version 0.9.6
- Add <highlight> tag for highlighted text
- Add <link> tag for hyperlink fields
- Add 'align' attribute to <para> tags for paragraph alignment
+ - Add 'indent' attriute to <para> tags for paragraph indent
Version 0.9.5
- Allow conversions on stdin and stdout
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__
diff --git a/src/tags.h b/src/tags.h
index a1638ca..fefcdc9 100644
--- a/src/tags.h
+++ b/src/tags.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);