summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUGS5
-rw-r--r--ChangeLog3
-rw-r--r--configure.in4
-rw-r--r--src/Makefile.am8
-rw-r--r--src/basehandler.cpp90
-rw-r--r--src/basehandler.h69
-rw-r--r--src/levelhandler.cpp2
-rw-r--r--src/levelhandler.h12
-rw-r--r--src/rtfformatting.h6
-rw-r--r--src/rtfparser.cpp24
-rw-r--r--src/rtfparser.h16
-rw-r--r--src/rtfx.cpp10
-rw-r--r--src/tags.h9
-rw-r--r--src/xmlcomposehelpers.cpp10
-rw-r--r--src/xmlcomposehelpers.h19
-rw-r--r--src/xmlcomposer.cpp49
-rw-r--r--src/xmlcomposer.h12
-rw-r--r--src/xmlfixups.cpp30
-rw-r--r--src/xmlfixups.h14
-rw-r--r--win32/rtfx.dsp16
20 files changed, 125 insertions, 283 deletions
diff --git a/BUGS b/BUGS
index bb2d389..ebe310c 100644
--- a/BUGS
+++ b/BUGS
@@ -1,2 +1,3 @@
-SCROUNGE-NTFS TODOS AND BUGS
-- No support for searching out drive info yet
+RTFX Bugs
+ - No font support
+ - No color support
diff --git a/ChangeLog b/ChangeLog
index 137b6f9..934a4bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+Version 0.9.3
+ - Code cleanup
+
Version 0.9.2
- Updated windows version to new sablot library
- Added support for foot notes
diff --git a/configure.in b/configure.in
index 2e5f435..21f472a 100644
--- a/configure.in
+++ b/configure.in
@@ -36,8 +36,8 @@ dnl Nate Nielsen <nielsen@memberwebs.com>
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(rtfx, 0.9.2, nielsen@memberwebs.com)
-AM_INIT_AUTOMAKE(rtfx, 0.9.2)
+AC_INIT(rtfx, 0.9.3, nielsen@memberwebs.com)
+AM_INIT_AUTOMAKE(rtfx, 0.9.3)
LDFLAGS="$LDFLAGS -L/usr/local/lib"
CPPFLAGS="$CPPFLAGS -I/usr/local/include"
diff --git a/src/Makefile.am b/src/Makefile.am
index 4261c60..317aa41 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,10 +1,10 @@
bin_PROGRAMS = rtfx
-rtfx_SOURCES = rtfx.cpp basehandler.cpp basehandler.h levelhandler.cpp levelhandler.h \
- reference.h rtfanalyser.cpp rtfanalyser.h rtfparsehelpers.cpp rtfformatting.h \
- rtfparsehelpers.h rtfreader.cpp rtfreader.h sablo.h sablotr.cpp usuals.h \
- rtffixups.h rtffixups.cpp domhelpers.h domhelpers.cpp tags.h
+rtfx_SOURCES = rtfx.cpp levelhandler.cpp levelhandler.h \
+ reference.h xmlcomposer.cpp xmlcomposer.h xmlcomposehelpers.cpp rtfformatting.h \
+ xmlcomposehelpers.h rtfparser.cpp rtfparser.h sablo.h sablotr.cpp usuals.h \
+ xmlfixups.h xmlfixups.cpp domhelpers.h domhelpers.cpp tags.h
rtfx_LDADD = -lsablot -lexpat $(LIB_ICONV)
rtfx_CFLAGS = -O0 -I${top_srcdir} -I/usr/local/include
rtfx_LDFLAGS = -L/usr/local/lib
diff --git a/src/basehandler.cpp b/src/basehandler.cpp
deleted file mode 100644
index 53e5a18..0000000
--- a/src/basehandler.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-XXXXXXXXXXXXXXXXXXXXXXXXXXXx/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-// DELETE
-
-#include "usuals.h"
-#include "basehandler.h"
-
-BaseHandler::BaseHandler()
-{
- m_reader = NULL;
-}
-
-BaseHandler::~BaseHandler()
-{
- clear();
-}
-
-void BaseHandler::clear()
-{
- m_reader = NULL;
-}
-
-void BaseHandler::startDocument(RtfReader* reader)
-{
- clear();
- m_reader = reader;
-}
-
-void BaseHandler::endDocument()
-{
- // We leave document and levels here so it they
- // can be accessed later
- m_reader = NULL;
-}
-
-void BaseHandler::controlWord(const string& cw, int flags, int param)
-{
-
-}
-
-void BaseHandler::groupStart()
-{
-
-}
-
-void BaseHandler::groupEnd()
-{
-
-}
-
-void BaseHandler::charData(wstring data)
-{
-
-}
diff --git a/src/basehandler.h b/src/basehandler.h
deleted file mode 100644
index 3becdf1..0000000
--- a/src/basehandler.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2004, Nate Nielsen
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- * * Redistributions in binary form must reproduce the
- * above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or
- * other materials provided with the distribution.
- * * The names of contributors to this software may not be
- * used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- * DAMAGE.
- *
- *
- * CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
- *
- */
-
-// DELETE
-
-// BaseHandler
-// Implements an RtfHandler for other classes (LevelHandler
-// and RtfParser) to override.
-
-#ifndef __BASEHANDLER_H__
-#define __BASEHANDLER_H__
-
-#include "rtfreader.h"
-
-class BaseHandler :
- public RtfHandler
-{
-public:
- BaseHandler();
- virtual ~BaseHandler();
-
- virtual void startDocument(RtfReader* reader);
- virtual void endDocument();
- virtual void controlWord(const string& cw, int flags, int param);
- virtual void groupStart();
- virtual void groupEnd();
- virtual void charData(wstring data);
-
-protected:
- virtual void clear();
- RtfReader* m_reader;
-};
-
-#endif // __BASEHANDLER_H__
diff --git a/src/levelhandler.cpp b/src/levelhandler.cpp
index cdd3337..20751b2 100644
--- a/src/levelhandler.cpp
+++ b/src/levelhandler.cpp
@@ -44,7 +44,7 @@
*/
LevelHandler::LevelHandler()
{
- m_reader = NULL;
+ m_parser = NULL;
}
LevelHandler::~LevelHandler()
diff --git a/src/levelhandler.h b/src/levelhandler.h
index bee1a8e..8a183f2 100644
--- a/src/levelhandler.h
+++ b/src/levelhandler.h
@@ -36,25 +36,21 @@
*
*/
-// LevelHandler
-// Keeps track of levels (braces) in the RTF file.
-//
-
#ifndef __LEVELHANDLER_H__
#define __LEVELHANDLER_H__
-#include "rtfreader.h"
+#include "rtfparser.h"
#include "reference.h"
-#include "rtfparsehelpers.h"
+#include "xmlcomposehelpers.h"
/*
* LevelHandler
*
- * A base class that manages a set of Levels (see XMLComposeHelpers.cpp)
+ * A base class that manages a set of Levels (see xmlcomposehelpers.cpp)
* based on the RTF groups seen.
*/
class LevelHandler
- : public RTFHandler
+ : public RtfHandler
{
public:
LevelHandler();
diff --git a/src/rtfformatting.h b/src/rtfformatting.h
index bb49cf1..b718245 100644
--- a/src/rtfformatting.h
+++ b/src/rtfformatting.h
@@ -36,8 +36,8 @@
*
*/
-#ifndef __RTFTEXPROPERTIES_H__
-#define __RTFTEXPROPERTIES_H__
+#ifndef __RTFFORMATTING_H__
+#define __RTFFORMATTING_H__
/*
* RtfFormatting
@@ -171,4 +171,4 @@ protected:
// TODO: Character styles
};
-#endif // __RTFTEXPROPERTIES_H__
+#endif // __RTFFORMATTING_H__
diff --git a/src/rtfparser.cpp b/src/rtfparser.cpp
index 78945b6..738ab50 100644
--- a/src/rtfparser.cpp
+++ b/src/rtfparser.cpp
@@ -36,20 +36,18 @@
*
*/
-// RENAME RTFParser.cpp
-
#include "usuals.h"
#include <stdlib.h>
#include <stdio.h>
-#include "rtfreader.h"
+#include "rtfparser.h"
/* ----------------------------------------------------------------------------------
* CONSTRUCTION
*/
-RTFParser::RTFParser()
+RtfParser::RtfParser()
{
m_handler = NULL;
m_depth = 0;
@@ -59,7 +57,7 @@ RTFParser::RTFParser()
m_uniEatStack.push(0);
}
-RTFParser::~RTFParser()
+RtfParser::~RtfParser()
{
}
@@ -69,7 +67,7 @@ RTFParser::~RTFParser()
* PUBLIC METHODS
*/
-bool RTFParser::parse(string fileName)
+bool RtfParser::parse(string fileName)
{
FILE* file = fopen(fileName.c_str(), "r");
if(!file)
@@ -82,7 +80,7 @@ bool RTFParser::parse(string fileName)
return ret;
}
-bool RTFParser::parse(FILE* file)
+bool RtfParser::parse(FILE* file)
{
int ch = 0;
@@ -186,7 +184,7 @@ done:
* HANDLER CALLS
*/
-void RTFParser::flushData(RtfContext& cx)
+void RtfParser::flushData(RtfContext& cx)
{
if(!cx.data.empty())
{
@@ -197,7 +195,7 @@ void RTFParser::flushData(RtfContext& cx)
}
}
-void RTFParser::sendData(RtfContext& cx, wchar_t ch)
+void RtfParser::sendData(RtfContext& cx, wchar_t ch)
{
// Skip unicode chars we've been asked to
if(m_uniEat > 0)
@@ -207,7 +205,7 @@ void RTFParser::sendData(RtfContext& cx, wchar_t ch)
cx.data.append(1, ch);
}
-void RTFParser::sendData(RtfContext& cx, wstring data)
+void RtfParser::sendData(RtfContext& cx, wstring data)
{
// Skip any unicode chars we've been asked to
if(m_uniEat > 0)
@@ -225,7 +223,7 @@ void RTFParser::sendData(RtfContext& cx, wstring data)
}
}
-void RTFParser::sendControlWord(RtfContext& cx, string cw, int flags, int param)
+void RtfParser::sendControlWord(RtfContext& cx, string cw, int flags, int param)
{
flushData(cx);
@@ -238,7 +236,7 @@ void RTFParser::sendControlWord(RtfContext& cx, string cw, int flags, int param)
* PARSE HELPERS
*/
-bool RTFParser::parseHexChar(RtfContext& cx, int num)
+bool RtfParser::parseHexChar(RtfContext& cx, int num)
{
string data;
@@ -283,7 +281,7 @@ bool RTFParser::parseHexChar(RtfContext& cx, int num)
return true;
}
-bool RTFParser::parseControlWord(RtfContext& cx)
+bool RtfParser::parseControlWord(RtfContext& cx)
{
bool isAsterisk = false;
string controlword;
diff --git a/src/rtfparser.h b/src/rtfparser.h
index 6b9e10d..e1636fc 100644
--- a/src/rtfparser.h
+++ b/src/rtfparser.h
@@ -36,10 +36,8 @@
*
*/
-// RENAME RTFParser.h
-
-#ifndef __RTFREADER_H__
-#define __RTFREADER_H__
+#ifndef __RTFPARSER_H__
+#define __RTFPARSER_H__
#include "usuals.h"
#include <stack>
@@ -48,7 +46,7 @@
class RtfHandler;
/*
- * RTFParser
+ * RtfParser
*
* A class that parses the RTF into it's tags and groups etc... It feeds its
* parsed data into into a handler interface (see below) for processing.
@@ -111,9 +109,9 @@ private:
};
/*
- * RTFHandler
+ * RtfHandler
*
- * An interface called by RTFParser with tags and groups etc... parsed from
+ * An interface called by RtfParser with tags and groups etc... parsed from
* an RTF file.
*/
class RtfHandler
@@ -121,7 +119,7 @@ class RtfHandler
public:
// Called at the beginning of the document
- virtual void startDocument(RtfReader* reader) = 0;
+ virtual void startDocument(RtfParser* reader) = 0;
// Called at the end of the document
virtual void endDocument() = 0;
@@ -148,4 +146,4 @@ public:
};
};
-#endif // __RTFREADER_H__
+#endif // __RTFPARSER_H__
diff --git a/src/rtfx.cpp b/src/rtfx.cpp
index a620498..cbecdb9 100644
--- a/src/rtfx.cpp
+++ b/src/rtfx.cpp
@@ -41,8 +41,8 @@
#include <stdio.h>
#include <errno.h>
-#include "rtfreader.h"
-#include "rtfanalyser.h"
+#include "rtfparser.h"
+#include "xmlcomposer.h"
int usage()
{
@@ -66,14 +66,12 @@ int main(int argc, char* argv[])
return 1;
}
- // Default options
- RtfParserOptions options;
-
// Reads RTF tags and blocks
RtfParser rtf;
// Interprets tags and blocks from RTFParser
- XMLComposer composer(options);
+ XmlComposerOptions options;
+ XmlComposer composer(options);
rtf.setHandler(&composer);
bool ret = rtf.parse(file);
diff --git a/src/tags.h b/src/tags.h
index 1b4b284..ef2cd03 100644
--- a/src/tags.h
+++ b/src/tags.h
@@ -39,6 +39,9 @@
#ifndef __TAGS_H__
#define __TAGS_H__
+static const char* kNSPrefix = "xmlns";
+
+// Tags used internally
static const char* kElDest = "i_dest";
static const char* kElBlock = "i_block";
static const char* kAtFix = "i_fix";
@@ -46,6 +49,7 @@ static const char* kAtCell = "i_cell";
static const char* kElListtable = "i_listtable";
static const char* kElListdef = "i_listdef";
+// All the main tags
static const char* kElPara = "para";
static const char* kElDoc = "document";
static const char* kElTab = "tab";
@@ -73,6 +77,7 @@ static const char* kElTable = "table";
static const char* kElFootNote = "footnote";
static const char* kElRef = "ref";
+// Attributes
static const char* kAtList = "list";
static const char* kAtName = "name";
static const char* kAtBold = "bold";
@@ -88,6 +93,7 @@ static const char* kAtId = "id";
static const char* kAtIndex = "id";
static const char* kAtTo = "to";
+// Values
static const wchar_t* kValDisc = L"disc";
static const wchar_t* kValLowerAlpha = L"lower-alpha";
static const wchar_t* kValUpperAlpha = L"upper-alpha";
@@ -96,11 +102,8 @@ static const wchar_t* kValUpperRoman = L"upper-roman";
static const wchar_t* kValArabic = L"arabic";
static const wchar_t* kValNull = L"";
static const wchar_t* kValFootNote = L"footnote";
-
static const wchar_t* kValList = L"list";
static const wchar_t* kValPara = L"para";
static const wchar_t* kValTable = L"table";
-static const char* kNSPrefix = "xmlns";
-
#endif // __TAGS_H__
diff --git a/src/xmlcomposehelpers.cpp b/src/xmlcomposehelpers.cpp
index 6612df9..1f1d952 100644
--- a/src/xmlcomposehelpers.cpp
+++ b/src/xmlcomposehelpers.cpp
@@ -37,7 +37,11 @@
*/
#include "usuals.h"
-#include "rtfparsehelpers.h"
+#include "xmlcomposehelpers.h"
+
+/* ----------------------------------------------------------------------------------
+ * CONSTRUCTION
+ */
Level::Level()
{
@@ -64,6 +68,10 @@ Level::~Level()
m_destination->done();
}
+/* ----------------------------------------------------------------------------------
+ * LEVEL OPERATIONS
+ */
+
LevelPtr Level::pushLevel()
{
LevelPtr level = new Level(*this);
diff --git a/src/xmlcomposehelpers.h b/src/xmlcomposehelpers.h
index 9d36ef5..64f1fc4 100644
--- a/src/xmlcomposehelpers.h
+++ b/src/xmlcomposehelpers.h
@@ -36,18 +36,15 @@
*
*/
-// RENAME: XMLComposeHelpers.h
-// Possibly merge with XMLComposer.h
-
-#ifndef __RTFPARSEHELPERS_H__
-#define __RTFPARSEHELPERS_H__
+#ifndef __XMLCOMPOSEHELPERS_H__
+#define __XMLCOMPOSEHELPERS_H__
#include "usuals.h"
#include "reference.h"
#include "sablo.h"
#include "rtfformatting.h"
-class XMLComposer;
+class XmlComposer;
/*
* Destination
@@ -68,8 +65,8 @@ public:
virtual void done() {};
protected:
- XMLComposer* m_composer;
- friend class XMLComposer;
+ XmlComposer* m_composer;
+ friend class XmlComposer;
};
/*
@@ -95,8 +92,8 @@ public:
virtual void done() {};
protected:
- XMLComposer* m_composer;
- friend class XMLComposer;
+ XmlComposer* m_composer;
+ friend class XmlComposer;
};
class Level;
@@ -168,4 +165,4 @@ protected:
AnalyserPtr m_analyser; // Analyser for this level
};
-#endif //__RTFPARSEHELPERS_H__
+#endif //__XMLCOMPOSEHELPERS_H__
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));
}
}
diff --git a/src/xmlcomposer.h b/src/xmlcomposer.h
index 4e5c739..97eb533 100644
--- a/src/xmlcomposer.h
+++ b/src/xmlcomposer.h
@@ -36,10 +36,8 @@
*
*/
-// RENAME: xmlcomposer.h
-
-#ifndef __RTFPARSER_H__
-#define __RTFPARSER_H__
+#ifndef __XMLCOMPOSER_H__
+#define __XMLCOMPOSER_H__
#include "levelhandler.h"
@@ -123,7 +121,7 @@ public:
DOM::Document getDocument()
{ return m_document; }
- const RtfParserOptions& getOptions()
+ const XmlComposerOptions& getOptions()
{ return m_options; }
@@ -140,7 +138,7 @@ protected:
protected:
DOM::DOMImplementation m_impl; // For creating the document
DOM::Document m_document; // The current document
- RtfParserOptions m_options; // Configurable options for parsing
+ XmlComposerOptions m_options; // Configurable options for parsing
int m_autocount[AUTOCOUNT_MAX]; // Auto counters for the document
@@ -295,4 +293,4 @@ protected:
END_ANALYSER
};
-#endif // __RTFPARSER_H__
+#endif // __XMLCOMPOSER_H__
diff --git a/src/xmlfixups.cpp b/src/xmlfixups.cpp
index 6efe6f4..707294d 100644
--- a/src/xmlfixups.cpp
+++ b/src/xmlfixups.cpp
@@ -37,7 +37,7 @@
*/
#include "usuals.h"
-#include "rtffixups.h"
+#include "xmlfixups.h"
#include "domhelpers.h"
#include "tags.h"
@@ -60,7 +60,7 @@ static const char* kConsolidateStart[] =
{ kElStylesheet, kElInfo, NULL };
-void RtfFixups::breakBreak(DOM::Document& doc, const string& contain,
+void XmlFixups::breakBreak(DOM::Document& doc, const string& contain,
const string& tag)
{
DOM::NodeList els = doc.getElementsByTagName(tag);
@@ -74,7 +74,7 @@ void RtfFixups::breakBreak(DOM::Document& doc, const string& contain,
}
}
-bool RtfFixups::breakElement(const DOM::Element& el, const string& contain)
+bool XmlFixups::breakElement(const DOM::Element& el, const string& contain)
{
ASSERT(el != NULL);
@@ -149,7 +149,7 @@ bool RtfFixups::breakElement(const DOM::Element& el, const string& contain)
return breakElement((DOM::Element&)e, contain);
}
-void RtfFixups::breakBlocks(DOM::Document& document)
+void XmlFixups::breakBlocks(DOM::Document& document)
{
// First break out all the paragraphs to the destination level
DOM::NodeList blocks = document.getElementsByTagName(kElBlock);
@@ -216,7 +216,7 @@ void RtfFixups::breakBlocks(DOM::Document& document)
}
}
-void RtfFixups::wrapTags(DOM::Document& doc, const string& tagName,
+void XmlFixups::wrapTags(DOM::Document& doc, const string& tagName,
const string& wrapName)
{
DOM::NodeList tags = doc.getElementsByTagName(tagName);
@@ -235,7 +235,7 @@ void RtfFixups::wrapTags(DOM::Document& doc, const string& tagName,
}
}
-void RtfFixups::breakTags(DOM::Document& doc, const string& parentName,
+void XmlFixups::breakTags(DOM::Document& doc, const string& parentName,
const string& tagName)
{
DOM::NodeList parents = doc.getElementsByTagName(parentName);
@@ -332,7 +332,7 @@ void RtfFixups::breakTags(DOM::Document& doc, const string& parentName,
}
}
-void RtfFixups::breakLists(DOM::Document& doc)
+void XmlFixups::breakLists(DOM::Document& doc)
{
DOM::NodeList destinations = doc.getElementsByTagName(kElDest);
if(destinations != NULL)
@@ -394,7 +394,7 @@ void RtfFixups::breakLists(DOM::Document& doc)
}
}
-void RtfFixups::fixStyles(const DOM::Document doc)
+void XmlFixups::fixStyles(const DOM::Document doc)
{
// Get all stylesheet styles
DOM::NodeList styles = doc.getElementsByTagName(kElStyle);
@@ -440,7 +440,7 @@ void RtfFixups::fixStyles(const DOM::Document doc)
}
-void RtfFixups::breakTables(DOM::Document& doc)
+void XmlFixups::breakTables(DOM::Document& doc)
{
// Break rows out to destinations
DOM::NodeList rows = doc.getElementsByTagName(kElRow);
@@ -526,7 +526,7 @@ void RtfFixups::breakTables(DOM::Document& doc)
}
}
-void RtfFixups::removeTags(const DOM::Document& doc)
+void XmlFixups::removeTags(const DOM::Document& doc)
{
// Go through the list of nodes
for(const char** t = kRemoveTags; *t != NULL; t++)
@@ -551,7 +551,7 @@ void RtfFixups::removeTags(const DOM::Document& doc)
}
}
-void RtfFixups::fixLists(const DOM::Document doc)
+void XmlFixups::fixLists(const DOM::Document doc)
{
// Get all the lists
DOM::NodeList lists = doc.getElementsByTagName(kElList);
@@ -586,7 +586,7 @@ void RtfFixups::fixLists(const DOM::Document doc)
}
}
-void RtfFixups::fixBlocks(const DOM::Document doc)
+void XmlFixups::fixBlocks(const DOM::Document doc)
{
// Get all the blocks
DOM::NodeList blocks = doc.getElementsByTagName(kElBlock);
@@ -638,7 +638,7 @@ void RtfFixups::fixBlocks(const DOM::Document doc)
}
}
-void RtfFixups::consolidateEndTags(DOM::Document& doc)
+void XmlFixups::consolidateEndTags(DOM::Document& doc)
{
DOM::Element top = doc.getDocumentElement();
ASSERT(top != NULL);
@@ -670,7 +670,7 @@ void RtfFixups::consolidateEndTags(DOM::Document& doc)
}
}
-void RtfFixups::consolidateStartTags(DOM::Document& doc)
+void XmlFixups::consolidateStartTags(DOM::Document& doc)
{
DOM::Element top = doc.getDocumentElement();
ASSERT(top != NULL);
@@ -705,7 +705,7 @@ void RtfFixups::consolidateStartTags(DOM::Document& doc)
}
}
-void RtfFixups::combineDuplicates(const DOM::Document& doc)
+void XmlFixups::combineDuplicates(const DOM::Document& doc)
{
bool found;
diff --git a/src/xmlfixups.h b/src/xmlfixups.h
index 1716925..f00bb66 100644
--- a/src/xmlfixups.h
+++ b/src/xmlfixups.h
@@ -36,23 +36,23 @@
*
*/
-#ifndef __RTFFIXUPS_H__
-#define __RTFFIXUPS_H__
+#ifndef __XMLFIXUPS_H__
+#define __XMLFIXUPS_H__
#include "sablo.h"
/*
- * XMLFixups
+ * 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
+ * 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
+ * These functions are called from XmlComposer::endDocument and massage the
* resulting XML DOM into shape.
*/
-class XMLFixups
+class XmlFixups
{
public:
// Replace blocks with 'fix' elements like paragraphs
@@ -133,4 +133,4 @@ public:
static void consolidateEndTags(DOM::Document& doc);
};
-#endif // __RTFFIXUPS_H__
+#endif // __XMLFIXUPS_H__
diff --git a/win32/rtfx.dsp b/win32/rtfx.dsp
index c124300..06aa8d1 100644
--- a/win32/rtfx.dsp
+++ b/win32/rtfx.dsp
@@ -102,19 +102,19 @@ SOURCE=..\src\levelhandler.cpp
# End Source File
# Begin Source File
-SOURCE=..\src\rtfanalyser.cpp
+SOURCE=..\src\xmlcomposer.cpp
# End Source File
# Begin Source File
-SOURCE=..\src\rtffixups.cpp
+SOURCE=..\src\xmlfixups.cpp
# End Source File
# Begin Source File
-SOURCE=..\src\rtfparsehelpers.cpp
+SOURCE=..\src\xmlcomposehelpers.cpp
# End Source File
# Begin Source File
-SOURCE=..\src\rtfreader.cpp
+SOURCE=..\src\rtfparser.cpp
# End Source File
# Begin Source File
@@ -147,11 +147,11 @@ SOURCE=..\src\reference.h
# End Source File
# Begin Source File
-SOURCE=..\src\rtfanalyser.h
+SOURCE=..\src\xmlcomposer.h
# End Source File
# Begin Source File
-SOURCE=..\src\rtffixups.h
+SOURCE=..\src\xmlfixups.h
# End Source File
# Begin Source File
@@ -159,11 +159,11 @@ SOURCE=..\src\rtfformatting.h
# End Source File
# Begin Source File
-SOURCE=..\src\rtfparsehelpers.h
+SOURCE=..\src\xmlcomposehelpers.h
# End Source File
# Begin Source File
-SOURCE=..\src\rtfreader.h
+SOURCE=..\src\rtfparser.h
# End Source File
# Begin Source File