From ae28df20927567f2d62b575ed4aef2d127569265 Mon Sep 17 00:00:00 2001 From: Stef Date: Thu, 22 Jul 2004 22:30:48 +0000 Subject: - Comments and formatting changes. --- src/xmlfixups.h | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 4 deletions(-) (limited to 'src/xmlfixups.h') 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: + * + * + * This is a + * test of your concentration. + * + * + * Becomes: + * + * + * This is a + * test of your concentration. + * + */ 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: + * + * + * This is a + * test of your concentration. + * + * + * Becomes: + * + * This is a + * test of your concentration. + */ 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); }; -- cgit v1.2.3