summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2005-06-07 17:57:14 +0000
committerStef Walter <stef@memberwebs.com>2005-06-07 17:57:14 +0000
commit8803295019b0fe0b56c08899adf3f8231effb0f5 (patch)
tree0cf83c42731e7d90fcbc6e50eaaa2e2bd65e3c32
parentc386abd496f61f4628446f27b771529699c0ea45 (diff)
Add <highlight> tag for highlighted text.
-rw-r--r--ChangeLog1
-rw-r--r--doc/rtfx.xsd19
-rw-r--r--src/domcxx.h4
-rw-r--r--src/rtfformatting.h8
-rw-r--r--src/tags.h1
-rw-r--r--src/xmlcomposer.cpp18
6 files changed, 43 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index f3816ce..10ded87 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Version 0.9.6
- Add character styles
+ - Add <highlight> tag for highlighted text
Version 0.9.5
- Allow conversions on stdin and stdout
diff --git a/doc/rtfx.xsd b/doc/rtfx.xsd
index a0a209d..42f9bd2 100644
--- a/doc/rtfx.xsd
+++ b/doc/rtfx.xsd
@@ -366,6 +366,7 @@
<xs:element ref="ref"/>
<xs:element ref="font"/>
<xs:element ref="span"/>
+ <xs:element ref="highlight"/>
</xs:choice>
</xs:group>
@@ -497,8 +498,24 @@
<xs:documentation>Style name for the content.</xs:documentation>
</xs:annotation>
</xs:attribute>
-
</xs:complexType>
</xs:element>
+ <xs:element name="highlight">
+ <xs:annotation>
+ <xs:documentation>Highlighted text</xs:documentation>
+ </xs:annotation>
+
+ <xs:complexType mixed="true">
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="inline"/>
+ </xs:choice>
+ <xs:attribute name="color" type="xs:string" use="optional">
+ <xs:annotation>
+ <xs:documentation>The color of the highlight</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+
</xs:schema>
diff --git a/src/domcxx.h b/src/domcxx.h
index abdd622..2e7e9ec 100644
--- a/src/domcxx.h
+++ b/src/domcxx.h
@@ -54,8 +54,8 @@ namespace DOM
extern "C"
{
#define this _this
- #include <domc.h>
- #include <dom.h>
+ #include "domc.h"
+ #include "dom.h"
#undef this
}
diff --git a/src/rtfformatting.h b/src/rtfformatting.h
index 3085198..db687eb 100644
--- a/src/rtfformatting.h
+++ b/src/rtfformatting.h
@@ -68,6 +68,7 @@ public:
m_hidden == format.m_hidden &&
m_underline == format.m_underline &&
m_color == format.m_color &&
+ m_highlight == format.m_highlight &&
m_suscript == format.m_suscript &&
m_font == format.m_font &&
m_fsize == format.m_fsize &&
@@ -89,6 +90,7 @@ public:
m_hidden = format.m_hidden;
m_underline = format.m_underline;
m_color = format.m_color;
+ m_highlight = format.m_highlight;
m_suscript = format.m_suscript;
m_font = format.m_font;
m_fsize = format.m_fsize;
@@ -104,6 +106,7 @@ public:
m_bold = m_italic = m_strike =
m_underline = m_hidden = false;
m_color = -1;
+ m_highlight = -1;
m_suscript = 0;
m_fsize = -1;
m_font = -1;
@@ -128,6 +131,8 @@ public:
{ return m_hidden; }
int textColor() const
{ return m_color; }
+ int textHighlight() const
+ { return m_highlight; }
int textSuScript() const
{ return m_suscript; }
int textFont() const
@@ -155,6 +160,8 @@ public:
{ m_hidden = hidden; }
void textSetColor(int color)
{ m_color = color; }
+ void textSetHighlight(int color)
+ { m_highlight = color; }
void textSetSuScript(int suscript)
{ m_suscript = suscript; }
void textSetFont(int font)
@@ -184,6 +191,7 @@ protected:
bool m_hidden;
int m_suscript;
int m_color;
+ int m_highlight;
int m_font;
int m_fsize;
int m_charstyle;
diff --git a/src/tags.h b/src/tags.h
index 6435383..002e902 100644
--- a/src/tags.h
+++ b/src/tags.h
@@ -80,6 +80,7 @@ static const char* kElStrike = "strike";
static const char* kElU = "u";
static const char* kElSuper = "super";
static const char* kElSub = "sub";
+static const char* kElHighlight = "highlight";
static const char* kElCell = "cell";
static const char* kElRow = "row";
static const char* kElTable = "table";
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp
index 10b476f..0bcfbcc 100644
--- a/src/xmlcomposer.cpp
+++ b/src/xmlcomposer.cpp
@@ -519,13 +519,15 @@ bool XmlComposer::BaseAnalyser::processTextFormatting(const string& cw, int flag
format.textSetSuScript(RtfFormatting::SUPERSCRIPT);
else if(cw == "sub")
format.textSetSuScript(RtfFormatting::SUBSCRIPT);
- else if(cw == "cf" && HAS_PARAM)
- format.textSetColor(param);
- else if(cw == "f" && HAS_PARAM)
+ else if(cw == "cf" && (flags & HAS_PARAM))
+ format.textSetColor(param);
+ else if(cw == "highlight" && (flags & HAS_PARAM))
+ format.textSetHighlight(param);
+ else if(cw == "f" && (flags & HAS_PARAM))
format.textSetFont(param);
- else if(cw == "fs" && HAS_PARAM)
+ else if(cw == "fs" && (flags & HAS_PARAM))
format.textSetFontSize(param);
- else if(cw == "cs" && HAS_PARAM)
+ else if(cw == "cs" && (flags & HAS_PARAM))
format.textSetStyle(param);
else
return false;
@@ -1131,6 +1133,12 @@ ON_CHARDATA(Content)
elements++;
}
+ if(format.textHighlight() != -1)
+ {
+ AN_ELEMENT(kElHighlight);
+ elements++;
+ }
+
if(format.textSuScript() == RtfFormatting::SUPERSCRIPT)
{
AN_ELEMENT(kElSuper);