summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--doc/rtfx.xsd14
-rw-r--r--src/tags.h1
-rw-r--r--src/xmlcomposer.cpp101
-rw-r--r--src/xmlcomposer.h5
5 files changed, 76 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index f150e72..42c31c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ Version 0.9.6
- Now has option for pretty printing output XML
- Displays version with '-v' argument
- Fixed problems with Unicode
+ - Support for bookmarks.
Version 0.9.5
- Allow conversions on stdin and stdout
diff --git a/doc/rtfx.xsd b/doc/rtfx.xsd
index 6ee37ee..df8da43 100644
--- a/doc/rtfx.xsd
+++ b/doc/rtfx.xsd
@@ -378,6 +378,7 @@
<xs:element ref="span"/>
<xs:element ref="highlight"/>
<xs:element ref="link"/>
+ <xs:element ref="bookmark"/>
</xs:choice>
</xs:group>
@@ -546,4 +547,17 @@
</xs:complexType>
</xs:element>
+ <xs:element name="bookmark">
+ <xs:annotation>
+ <xs:documentation>A bookmark.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:string" use="required">
+ <xs:annotation>
+ <xs:documentation>The ID of the bookmark.</xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+
</xs:schema>
diff --git a/src/tags.h b/src/tags.h
index fefcdc9..be140d1 100644
--- a/src/tags.h
+++ b/src/tags.h
@@ -85,6 +85,7 @@ static const char* kElCell = "cell";
static const char* kElRow = "row";
static const char* kElTable = "table";
static const char* kElFootNote = "footnote";
+static const char* kElBookmark = "bookmark";
static const char* kElRef = "ref";
static const char* kElFont = "font";
static const char* kElOptions = "options";
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp
index 93ae306..b23a06c 100644
--- a/src/xmlcomposer.cpp
+++ b/src/xmlcomposer.cpp
@@ -1093,6 +1093,59 @@ ON_CONTROLWORD(Field)
DEFAULT_CONTROLWORD;
}
+
+// FootNote Analyser ----------------------------------------------------------------
+
+ON_INITIALIZE(FootNote)
+{
+ int ac = m_composer->getAutoCount(AUTOCOUNT_FOOTNOTE);
+
+ AN_ELEMENT(kElFootNote);
+ AN_ATTRIBUTE(kAtId, ac);
+ AN_DESTINATION(Content);
+}
+
+ON_CONTROLWORD(FootNote)
+{
+ // Inside foot notes there's no link to the foot note
+ if(cw == "chftn")
+ {
+ // Only put actual text when in extras mode
+ if(DO_EXTRAS())
+ {
+ DestinationPtr dest = m_composer->getDestination();
+ ASSERT(dest != NULL);
+ int ac = m_composer->getAutoCount(AUTOCOUNT_FOOTNOTE);
+ dest->charData(formatInt(ac));
+ }
+
+ return;
+ }
+
+ // Process text content in the foot note
+ else if(processTextContent(cw, flags, param))
+ DUMMY;
+ else if(processTextAutoContent(cw, flags, param))
+ DUMMY;
+ else if(processTextFormatting(cw, flags, param))
+ DUMMY;
+ else
+ DEFAULT_CONTROLWORD;
+}
+
+ON_DONE(FootNote)
+{
+ m_composer->incrementAutoCount(AUTOCOUNT_FOOTNOTE);
+}
+
+// Bookmark Analyzer ----------------------------------------------------------------
+
+ON_INITIALIZE(Bookmark)
+{
+ AN_ELEMENT(kElBookmark);
+ AN_DESTINATION_ARG(Attribute, kAtId);
+}
+
// Root Analyser --------------------------------------------------------------------
ON_INITIALIZE(Root)
@@ -1122,6 +1175,8 @@ ON_CONTROLWORD(Root)
AN_ANALYSER(Skip);
else if(cw == "footnote")
AN_ANALYSER(FootNote);
+ else if(cw == "bkmkstart")
+ AN_ANALYSER(Bookmark);
else if(cw == "pict")
{
AN_ANALYSER(Skip);
@@ -1271,52 +1326,6 @@ ON_CHARDATA(Content)
AN_POP_ELEMENT();
}
-
-// FootNote Analyser ----------------------------------------------------------------
-
-ON_INITIALIZE(FootNote)
-{
- int ac = m_composer->getAutoCount(AUTOCOUNT_FOOTNOTE);
-
- AN_ELEMENT(kElFootNote);
- AN_ATTRIBUTE(kAtId, ac);
- AN_DESTINATION(Content);
-}
-
-ON_CONTROLWORD(FootNote)
-{
- // Inside foot notes there's no link to the foot note
- if(cw == "chftn")
- {
- // Only put actual text when in extras mode
- if(DO_EXTRAS())
- {
- DestinationPtr dest = m_composer->getDestination();
- ASSERT(dest != NULL);
- int ac = m_composer->getAutoCount(AUTOCOUNT_FOOTNOTE);
- dest->charData(formatInt(ac));
- }
-
- return;
- }
-
- // Process text content in the foot note
- else if(processTextContent(cw, flags, param))
- DUMMY;
- else if(processTextAutoContent(cw, flags, param))
- DUMMY;
- else if(processTextFormatting(cw, flags, param))
- DUMMY;
- else
- DEFAULT_CONTROLWORD;
-}
-
-ON_DONE(FootNote)
-{
- m_composer->incrementAutoCount(AUTOCOUNT_FOOTNOTE);
-}
-
-
// Raw Destination ------------------------------------------------------------------
ON_CHARDATA(Raw)
diff --git a/src/xmlcomposer.h b/src/xmlcomposer.h
index c9c321c..f2c9336 100644
--- a/src/xmlcomposer.h
+++ b/src/xmlcomposer.h
@@ -321,6 +321,11 @@ protected:
CONTROLWORD
DONE
END_ANALYSER
+
+ // Handles bookmarks
+ ANALYSER(Bookmark)
+ INITIALIZE
+ END_ANALYSER
};
#endif // __XMLCOMPOSER_H__