diff options
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | doc/rtfx.xsd | 19 | ||||
| -rw-r--r-- | src/domcxx.h | 4 | ||||
| -rw-r--r-- | src/rtfformatting.h | 8 | ||||
| -rw-r--r-- | src/tags.h | 1 | ||||
| -rw-r--r-- | src/xmlcomposer.cpp | 18 | 
6 files changed, 43 insertions, 8 deletions
@@ -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; @@ -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);  | 
