summaryrefslogtreecommitdiff
path: root/src/xmlcomposer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlcomposer.cpp')
-rw-r--r--src/xmlcomposer.cpp112
1 files changed, 28 insertions, 84 deletions
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp
index 967fd3c..9be1eeb 100644
--- a/src/xmlcomposer.cpp
+++ b/src/xmlcomposer.cpp
@@ -39,76 +39,8 @@
#include "usuals.h"
#include "rtfanalyser.h"
#include "rtffixups.h"
-
-const char* kElDest = "i_dest";
-const char* kElBlock = "i_block";
-const char* kAtFix = "i_fix";
-const char* kAtCell = "i_cell";
-const char* kElListtable = "i_listtable";
-const char* kElListdef = "i_listdef";
-
-const char* kElPara = "para";
-const char* kElDoc = "document";
-const char* kElTab = "tab";
-const char* kElSect = "sect";
-const char* kElPage = "page";
-const char* kElStyle = "style";
-const char* kElLine = "line";
-const char* kElList = "list";
-const char* kElStylesheet = "stylesheet";
-const char* kElInfo = "info";
-const char* kElTitle = "title";
-const char* kElAuthor = "author";
-const char* kElOperator = "operator";
-const char* kElB = "b";
-const char* kElHide = "hide";
-const char* kElI = "i";
-const char* kElStrike = "strike";
-const char* kElU = "u";
-const char* kElColor = "color";
-const char* kElCell = "cell";
-const char* kElRow = "row";
-const char* kElTable = "table";
-
-const char* kAtList = "list";
-const char* kAtName = "name";
-const char* kAtBold = "bold";
-const char* kAtHidden = "hide";
-const char* kAtItalic = "italic";
-const char* kAtStrike = "strike";
-const char* kAtUnderline = "underline";
-const char* kAtColor = "color";
-const char* kAtType = "type";
-const char* kAtOrdered = "ordered";
-const char* kAtStart = "start";
-const char* kAtId = "id";
-const char* kAtIndex = "id";
-
-const wchar_t* kValDisc = L"disc";
-const wchar_t* kValLowerAlpha = L"lower-alpha";
-const wchar_t* kValUpperAlpha = L"upper-alpha";
-const wchar_t* kValLowerRoman = L"lower-roman";
-const wchar_t* kValUpperRoman = L"upper-roman";
-const wchar_t* kValArabic = L"arabic";
-const wchar_t* kValNull = L"";
-
-const wchar_t* kValList = L"list";
-const wchar_t* kValPara = L"para";
-const wchar_t* kValTable = L"table";
-
-const char* kNoDuplicates[] =
- { kElB, kElU, kElI, kElColor, kElHide, kElColor, NULL };
-
-const char* kRemoveTags[] =
- { kElDest, kElListdef, kElListtable, NULL };
-
-const char* kBlockTags[] =
- { kElTable, kElPara, NULL };
-
-const char* kHideList[] =
- { kAtId, kAtList, NULL };
-
-const char* kNSPrefix = "xmlns";
+#include "domhelpers.h"
+#include "tags.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -168,19 +100,19 @@ void RtfParser::endDocument()
LevelHandler::endDocument();
// Cleanup the tree
- removeDuplicates(m_document);
- breakTables(m_document);
- breakTags(m_document, kElTable, kElRow);
- breakTags(m_document, kElRow, kElCell);
- wrapTags(m_document, kElCell, kElDest);
- breakBlocks(m_document);
- breakLists(m_document);
- fixLists(m_document);
- fixStyles(m_document);
- fixBlocks(m_document);
- removeTags(m_document);
- breakBreak(m_document, kElDoc, kElPage);
- breakBreak(m_document, kElDoc, kElSect);
+ RtfFixups::removeDuplicates(m_document);
+ RtfFixups::breakTables(m_document);
+ RtfFixups::breakTags(m_document, kElTable, kElRow);
+ RtfFixups::breakTags(m_document, kElRow, kElCell);
+ RtfFixups::wrapTags(m_document, kElCell, kElDest);
+ RtfFixups::breakBlocks(m_document);
+ RtfFixups::breakLists(m_document);
+ RtfFixups::fixLists(m_document);
+ RtfFixups::fixStyles(m_document);
+ RtfFixups::fixBlocks(m_document);
+ RtfFixups::removeTags(m_document);
+ RtfFixups::breakBreak(m_document, kElDoc, kElPage);
+ RtfFixups::breakBreak(m_document, kElDoc, kElSect);
return;
}
@@ -414,7 +346,7 @@ DOM::Element RtfParser::ParseAnalyser::getCurrentBlock()
if(node.hasChildNodes())
node = node.getLastChild();
- return m_parser->getPriorElement(node, kElBlock);
+ return DOMHelpers::getPriorElement(node, kElBlock);
}
@@ -997,5 +929,17 @@ ON_CHARDATA(Attribute)
element.setAttribute(name, cur);
}
+wstring RtfParser::formatInt(int num)
+{
+ char buff[16];
+
+ // Certain OSs don't support swprintf :(
+ sprintf(buff, "%d", num);
+ wstring n;
+ for(char* s = buff; *s; s++)
+ n.append(1, *s);
+
+ return n;
+}