diff options
author | Stef Walter <stef@memberwebs.com> | 2004-07-23 22:45:29 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-07-23 22:45:29 +0000 |
commit | ffe6a95e60ce7a9c6f232f75526ab3d70d6192f9 (patch) | |
tree | a64e7d5020dd8a28c76fb1de00d32296af486d43 | |
parent | beb5c690f629569628df0f730e51386e06229986 (diff) |
- Initial font support.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/tags.h | 2 | ||||
-rw-r--r-- | src/xmlcomposer.cpp | 43 | ||||
-rw-r--r-- | src/xmlcomposer.h | 13 | ||||
-rw-r--r-- | test-files/sample.xml | 2 |
5 files changed, 59 insertions, 2 deletions
@@ -1,5 +1,6 @@ Version 0.9.3 - Code cleanup + - Fixed bug with non-existant destinations Version 0.9.2 - Updated windows version to new sablot library @@ -48,6 +48,7 @@ static const char* kAtFix = "i_fix"; static const char* kAtCell = "i_cell"; static const char* kElListtable = "i_listtable"; static const char* kElListdef = "i_listdef"; +static const char* kElFontTable = "i_fonttable"; // All the main tags static const char* kElPara = "para"; @@ -76,6 +77,7 @@ static const char* kElRow = "row"; static const char* kElTable = "table"; static const char* kElFootNote = "footnote"; static const char* kElRef = "ref"; +static const char* kElFont = "font"; // Attributes static const char* kAtList = "list"; diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp index 73d9521..cce87d4 100644 --- a/src/xmlcomposer.cpp +++ b/src/xmlcomposer.cpp @@ -682,6 +682,47 @@ ON_GROUPEND(Style) } +// Font Table Analyser -------------------------------------------------------------- + +ON_INITIALIZE(FontTable) +{ + AN_ELEMENT(kElFontTable); +} + +ON_GROUPSTART(FontTable) +{ + // Each group should be a style + AN_ANALYSER(Font); + + // Without any character data + AN_DESTINATION(Null); +} + + +// Font Analyser -------------------------------------------------------------------- + +ON_INITIALIZE(Font) +{ + AN_ELEMENT(kElFont); + AN_DESTINATION_ATTR(kAtName); +} + +ON_CONTROLWORD(Font) +{ + // The font id + if(cw == "f" && flags & kHasParam) + AN_ATTRIBUTE(kAtId, param); + + else + DEFAULT_CONTROLWORD; +} + +ON_GROUPSTART(Font) +{ + AN_ANALYSER(Skip); +} + + // List Table Analyser -------------------------------------------------------------- ON_INITIALIZE(ListTable) @@ -918,7 +959,7 @@ ON_CONTROLWORD(Root) else if(cw == "info") AN_ANALYSER(Info); else if(cw == "fonttbl") - AN_ANALYSER(Skip); + AN_ANALYSER(FontTable); else if(cw == "colortbl") AN_ANALYSER(Skip); else if(cw == "footnote") diff --git a/src/xmlcomposer.h b/src/xmlcomposer.h index e857ace..e14ecb7 100644 --- a/src/xmlcomposer.h +++ b/src/xmlcomposer.h @@ -243,6 +243,19 @@ protected: bool haveStyle; END_ANALYSER + // Handle the Font Table + ANALYSER(FontTable) + INITIALIZE + GROUPSTART + END_ANALYSER + + // Handle a Font in the Table + ANALYSER(Font) + INITIALIZE + CONTROLWORD + GROUPSTART + END_ANALYSER + // Handle the list definitions ANALYSER(ListTable) INITIALIZE diff --git a/test-files/sample.xml b/test-files/sample.xml index deb7ae4..963387c 100644 --- a/test-files/sample.xml +++ b/test-files/sample.xml @@ -1 +1 @@ -<?xml version="1.0" encoding="UTF-8"?><document><stylesheet><style name="Normal"/><style name="heading 1"/><style name="footnote text"/></stylesheet><info><title>This is a test RTF</title><author>Nate</author><operator>Nate</operator></info><para style="heading 1"><b>This is a test RTF</b></para><para>Hi! I’m a test file. This is some <b>bold</b> text, and some <i>italic</i> text, as well as some <u>underline</u> text. And a bit of <hide>hidden</hide> text. So we’re going to end this paragraph here and go on to a nice little list:</para><para/><list type="disc" ordered="0" start="1"><para>Item 1</para><para>Item 2</para><para>Item 3</para><para>Item 4</para></list><para/><para>And now comes a fun table:</para><para/><table><row><cell><para>Cell 1</para></cell><cell><para>Cell 2</para><para>More in cell 2</para></cell><cell><para>Cell 3</para></cell></row><row><cell><para>Next row</para></cell><cell><para>Next row </para></cell><cell><para>Next row</para></cell></row></table><para/><para>A page break:</para><page/><para>And here we’re on the next page. </para><para>This para has a <ref type="footnote" to="1"><super>1</super></ref>footnote.</para><para>And here’s yet another paragraph. </para><para/><footnote id="1"><para><super>1</super> This is the actual content of the footnote.</para></footnote></document>
\ No newline at end of file +<?xml version="1.0" encoding="UTF-8"?><document><stylesheet><style name="Normal"/><style name="heading 1"/><style name="footnote text"/></stylesheet><info><title>This is a test RTF</title><author>Nate</author><operator>Nate</operator></info><para style="heading 1"><i_fonttable><font id="0"/><font id="1"/><font id="2"/><font id="3"/><font id="10"/><font id="121"/><font id="122"/><font id="124"/><font id="125"/><font id="126"/><font id="127"/><font id="128"/><font id="129"/><font id="131"/><font id="132"/><font id="134"/><font id="135"/><font id="136"/><font id="137"/><font id="138"/><font id="139"/><font id="141"/><font id="142"/><font id="144"/><font id="145"/><font id="146"/><font id="147"/><font id="148"/><font id="149"/></i_fonttable><b>This is a test RTF</b></para><para>Hi! I’m a test file. This is some <b>bold</b> text, and some <i>italic</i> text, as well as some <u>underline</u> text. And a bit of <hide>hidden</hide> text. So we’re going to end this paragraph here and go on to a nice little list:</para><para/><list type="disc" ordered="0" start="1"><para>Item 1</para><para>Item 2</para><para>Item 3</para><para>Item 4</para></list><para/><para>And now comes a fun table:</para><para/><table><row><cell><para>Cell 1</para></cell><cell><para>Cell 2</para><para>More in cell 2</para></cell><cell><para>Cell 3</para></cell></row><row><cell><para>Next row</para></cell><cell><para>Next row </para></cell><cell><para>Next row</para></cell></row></table><para/><para>A page break:</para><page/><para>And here we’re on the next page. </para><para>This para has a <ref type="footnote" to="1"><super>1</super></ref>footnote.</para><para>And here’s yet another paragraph. </para><para/><footnote id="1"><para><super>1</super> This is the actual content of the footnote.</para></footnote></document>
\ No newline at end of file |