summaryrefslogtreecommitdiff
path: root/src/xmlcomposer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xmlcomposer.cpp')
-rw-r--r--src/xmlcomposer.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/xmlcomposer.cpp b/src/xmlcomposer.cpp
index 6072375..dd178fb 100644
--- a/src/xmlcomposer.cpp
+++ b/src/xmlcomposer.cpp
@@ -37,8 +37,8 @@
*/
#include "usuals.h"
-#include "rtfanalyser.h"
-#include "rtffixups.h"
+#include "xmlcomposer.h"
+#include "xmlfixups.h"
#include "domhelpers.h"
#include "tags.h"
@@ -46,7 +46,7 @@
* CONSTRUCTION
*/
-XmlComposer::XmlComposer(const RtfParserOptions& options)
+XmlComposer::XmlComposer(const XmlComposerOptions& options)
{
m_document = NULL;
memcpy(&m_options, &options, sizeof(options));
@@ -84,7 +84,7 @@ void XmlComposer::clear()
* HANDLER OVERRIDES
*/
-void XmlComposer::startDocument(RtfReader* reader)
+void XmlComposer::startDocument(RtfParser* reader)
{
LevelHandler::startDocument(reader);
ASSERT(m_curLevel != NULL);
@@ -110,28 +110,28 @@ void XmlComposer::endDocument()
LevelHandler::endDocument();
// Pass 0: Cleanup the tree
- RtfFixups::removeDuplicates(m_document);
- RtfFixups::consolidateStartTags(m_document);
- RtfFixups::consolidateEndTags(m_document);
+ XmlFixups::combineDuplicates(m_document);
+ XmlFixups::consolidateStartTags(m_document);
+ XmlFixups::consolidateEndTags(m_document);
// Pass 1: Block breakout
- 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);
+ XmlFixups::breakTables(m_document);
+ XmlFixups::breakTags(m_document, kElTable, kElRow);
+ XmlFixups::breakTags(m_document, kElRow, kElCell);
+ XmlFixups::wrapTags(m_document, kElCell, kElDest);
+ XmlFixups::breakBlocks(m_document);
+ XmlFixups::breakLists(m_document);
// Pass 2: Fixups
- 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);
+ XmlFixups::fixLists(m_document);
+ XmlFixups::fixStyles(m_document);
+ XmlFixups::fixBlocks(m_document);
+ XmlFixups::removeTags(m_document);
+ XmlFixups::breakBreak(m_document, kElDoc, kElPage);
+ XmlFixups::breakBreak(m_document, kElDoc, kElSect);
// Pass 3: Final cleanup
- RtfFixups::removeDuplicates(m_document);
+ XmlFixups::combineDuplicates(m_document);
return;
}
@@ -331,6 +331,7 @@ wstring XmlComposer::formatInt(int num)
#define HAS_PARAM (flags & kHasParam)
#define DEFAULT_CONTROLWORD processDefault(cw, flags, param)
#define DUMMY 1 == 1
+#define NUM_ATTR(x) formatInt(x)
/* ----------------------------------------------------------------------------------
@@ -362,7 +363,7 @@ void XmlComposer::BaseAnalyser::applyParaFormatting(RtfFormatting* format,
// Is it a list?
int list = format->paraList();
if(list != -1)
- el.setAttribute(kAtList, list);
+ el.setAttribute(kAtList, NUM_ATTR(list));
else
el.removeAttribute(kAtList);
@@ -375,7 +376,7 @@ void XmlComposer::BaseAnalyser::applyParaFormatting(RtfFormatting* format,
// Paragraph styles
int style = format->paraStyle();
if(style != -1)
- el.setAttribute(kElStyle, style);
+ el.setAttribute(kElStyle, NUM_ATTR(style));
else
el.removeAttribute(kElStyle);
@@ -835,7 +836,7 @@ ON_CONTROLWORD(ListOverrideTable)
else if(cw == "levelstartat" && HAS_PARAM)
{
if(curList != NULL)
- curList.setAttribute(kAtStart, param);
+ curList.setAttribute(kAtStart, NUM_ATTR(param));
}
else
@@ -853,7 +854,7 @@ ON_CONTROLWORD(ListOverrideTable)
if(curList != NULL)
{
parent.appendChild(curList);
- curList.setAttribute(kAtList, lsId);
+ curList.setAttribute(kAtList, NUM_ATTR(lsId));
}
}