summaryrefslogtreecommitdiff
path: root/src/xmlfixups.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlfixups.h')
-rw-r--r--src/xmlfixups.h80
1 files changed, 76 insertions, 4 deletions
diff --git a/src/xmlfixups.h b/src/xmlfixups.h
index a250c5a..1716925 100644
--- a/src/xmlfixups.h
+++ b/src/xmlfixups.h
@@ -41,23 +41,95 @@
#include "sablo.h"
-class RtfFixups
+/*
+ * XMLFixups
+ *
+ * Because RTF is so 'different' (read: brain dead) we need to do all sorts
+ * of antics to get it into a nice XML format. Some of the XML Composition
+ * is done in XMLComposer, but whatever can't be done there as we're parsing
+ * gets done here after the fact.
+ *
+ * These functions are called from XMLComposer::endDocument and massage the
+ * resulting XML DOM into shape.
+ */
+class XMLFixups
{
public:
- // Cleanup Functions
+ // Replace blocks with 'fix' elements like paragraphs
static void fixBlocks(DOM::Document doc);
+
+ // Pass 2 list fixups
static void fixLists(const DOM::Document doc);
+
+ // Pass 2 style fixups
static void fixStyles(const DOM::Document doc);
+
+ /*
+ * Breaks a paragraph up through a previous level. Calls itself
+ * recursively to break paragraphs totally free up to containing
+ * destination.
+ *
+ * For example:
+ *
+ * <dest>
+ * This is <b> a <block fix="para"/>
+ * test of </b> your concentration.
+ * </dest>
+ *
+ * Becomes:
+ *
+ * <dest>
+ * This is <b> a </b><block fix="para"/>
+ * <b>test of </b> your concentration.
+ * </dest>
+ */
static bool breakElement(const DOM::Element& el, const string& contain);
+
+ // Break all tags of a given type to a previous level (see above)
static void breakBreak(DOM::Document& doc, const string& contain, const string& tag);
+
+ // Used to break tables cells and rows into blocks (but more complicated)
+ static void breakTags(DOM::Document& doc, const string& parentName, const string& tagName);
+
+ // Fixes and combines list elements with the same id
static void breakLists(DOM::Document& document);
+
+ // Used to find and create tables and perform initial break out
static void breakTables(DOM::Document& document);
- static void breakTags(DOM::Document& doc, const string& parentName, const string& tagName);
+
+
+ /*
+ * Changes from a marker based paragraph system to a contained
+ * paragraph system. Also applies paragraph attributes to the
+ * appropriate paragraph.
+ *
+ * For example:
+ *
+ * <dest>
+ * This <blockattr style="10"> is <b> a <block fix="para"/>
+ * test of </b> your concentration.
+ * </dest>
+ *
+ * Becomes:
+ *
+ * <para style="10"> This is <b> a </b></para>
+ * <para><b>test of </b> your concentration.</para>
+ */
static void breakBlocks(DOM::Document& document);
+
+ // Wrap certain tags in a wrapper tag of given name
static void wrapTags(DOM::Document& document, const string& tagName, const string& wrapName);
+
+ // Remove certain tags from document
static void removeTags(const DOM::Document& doc);
- static void removeDuplicates(const DOM::Document& doc);
+
+ // Combines certain adjacent duplicate tags
+ static void combineDuplicates(const DOM::Document& doc);
+
+ // Consolidates a certain tag types at the beginning of the document
static void consolidateStartTags(DOM::Document& doc);
+
+ // Consolidates a certain tag types at the end of the document
static void consolidateEndTags(DOM::Document& doc);
};