summaryrefslogtreecommitdiff
path: root/src/xmlfixups.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlfixups.h')
-rw-r--r--src/xmlfixups.h55
1 files changed, 36 insertions, 19 deletions
diff --git a/src/xmlfixups.h b/src/xmlfixups.h
index f00bb66..01c2d67 100644
--- a/src/xmlfixups.h
+++ b/src/xmlfixups.h
@@ -40,6 +40,7 @@
#define __XMLFIXUPS_H__
#include "sablo.h"
+#include "domhelpers.h"
/*
* XmlFixups
@@ -55,14 +56,7 @@
class XmlFixups
{
public:
- // 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);
+ XmlFixups();
/*
* Breaks a paragraph up through a previous level. Calls itself
@@ -83,19 +77,19 @@ public:
* <b>test of </b> your concentration.
* </dest>
*/
- static bool breakElement(const DOM::Element& el, const string& contain);
+ 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);
+ 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);
+ 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);
+ void breakLists(DOM::Document& document);
// Used to find and create tables and perform initial break out
- static void breakTables(DOM::Document& document);
+ void breakTables(DOM::Document& document);
/*
@@ -115,22 +109,45 @@ public:
* <para style="10"> This is <b> a </b></para>
* <para><b>test of </b> your concentration.</para>
*/
- static void breakBlocks(DOM::Document& document);
+ 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);
+ void wrapTags(DOM::Document& document, const string& tagName, const string& wrapName);
// Remove certain tags from document
- static void removeTags(const DOM::Document& doc);
+ void removeTags(const DOM::Document& doc);
// Combines certain adjacent duplicate tags
- static void combineDuplicates(const DOM::Document& doc);
+ void combineDuplicates(const DOM::Document& doc);
// Consolidates a certain tag types at the beginning of the document
- static void consolidateStartTags(DOM::Document& doc);
+ void consolidateStartTags(DOM::Document& doc);
// Consolidates a certain tag types at the end of the document
- static void consolidateEndTags(DOM::Document& doc);
+ void consolidateEndTags(DOM::Document& doc);
+
+
+ // The main pass 2 function
+ void runPassTwo(const DOM::Document& doc);
+
+ // Replace blocks with 'fix' elements like paragraphs
+ void fixBlock(const DOM::Document& doc, DOM::Element& block);
+
+
+protected:
+
+ enum
+ {
+ PASS_0,
+ PASS_1,
+ PASS_TWO
+ };
+
+ // Our tables cached for efficiency
+ StringSet m_duplicates;
+ StringSet m_removes;
+ StringSet m_consolidateStart;
+ StringSet m_consolidateEnd;
};
#endif // __XMLFIXUPS_H__