summaryrefslogtreecommitdiff
path: root/src/lib/WT602Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/WT602Parser.cpp')
-rw-r--r--src/lib/WT602Parser.cpp40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/lib/WT602Parser.cpp b/src/lib/WT602Parser.cpp
index 7b70bda..96a0da6 100644
--- a/src/lib/WT602Parser.cpp
+++ b/src/lib/WT602Parser.cpp
@@ -19,12 +19,8 @@
#include <vector>
#include <utility>
-#include <libwpd/WPXDocumentInterface.h>
-#include <libwpd/WPXPropertyList.h>
-#include <libwpd/WPXPropertyListVector.h>
-#include <libwpd/WPXString.h>
-
-#include <libwpd-stream/libwpd-stream.h>
+#include <librevenge/librevenge.h>
+#include <librevenge-stream/librevenge-stream.h>
#include "WT602MemoryStream.h"
#include "WT602Parser.h"
@@ -50,17 +46,17 @@ class WT602SectionMap
typedef std::pair<unsigned, unsigned> Section_t;
public:
- explicit WT602SectionMap(WPXInputStream *input);
+ explicit WT602SectionMap(librevenge::RVNGInputStream *input);
bool isPresent(WT602Section section) const;
- WPXInputStreamPtr getSectionStream(WPXInputStream *input, WT602Section section) const;
+ RVNGInputStreamPtr getSectionStream(librevenge::RVNGInputStream *input, WT602Section section) const;
private:
std::vector<Section_t> m_sections;
};
-WT602SectionMap::WT602SectionMap(WPXInputStream *const input)
+WT602SectionMap::WT602SectionMap(librevenge::RVNGInputStream *const input)
: m_sections(SECTION_COUNT)
{
std::fill_n(m_sections.begin(), SECTION_COUNT, std::make_pair(0, 0));
@@ -93,16 +89,16 @@ bool WT602SectionMap::isPresent(const WT602Section section) const
return false;
}
-WPXInputStreamPtr WT602SectionMap::getSectionStream(WPXInputStream *const input, const WT602Section section) const
+RVNGInputStreamPtr WT602SectionMap::getSectionStream(librevenge::RVNGInputStream *const input, const WT602Section section) const
{
- WPXInputStreamPtr strm;
+ RVNGInputStreamPtr strm;
if (isPresent(section))
{
const Section_t &limits = m_sections[section];
const unsigned length = limits.second - limits.first;
- input->seek(limits.first, WPX_SEEK_SET);
+ input->seek(limits.first, librevenge::RVNG_SEEK_SET);
const unsigned char *const data = readNBytes(input, length);
strm.reset(new WT602MemoryStream(data, length));
@@ -116,7 +112,7 @@ WPXInputStreamPtr WT602SectionMap::getSectionStream(WPXInputStream *const input,
namespace libtext602
{
-WT602Parser::WT602Parser(WPXInputStream *const input, WPXDocumentInterface *const document)
+WT602Parser::WT602Parser(librevenge::RVNGInputStream *const input, librevenge::RVNGTextInterface *const document)
: m_header(input)
, m_input(input)
, m_document(document)
@@ -128,9 +124,9 @@ bool WT602Parser::parse()
{
m_sectionMap.reset(new WT602SectionMap(m_input));
- m_document->setDocumentMetaData(WPXPropertyList());
+ m_document->setDocumentMetaData(librevenge::RVNGPropertyList());
m_document->startDocument();
- m_document->openPageSpan(WPXPropertyList());
+ m_document->openPageSpan(librevenge::RVNGPropertyList());
readText();
@@ -142,8 +138,8 @@ bool WT602Parser::parse()
void WT602Parser::readText()
{
- const WPXInputStreamPtr textInput(getSection(WT602_SECTION_TEXT));
- const WPXInputStreamPtr textInfoInput(getSection(WT602_SECTION_TEXT_INFO));
+ const RVNGInputStreamPtr textInput(getSection(WT602_SECTION_TEXT));
+ const RVNGInputStreamPtr textInfoInput(getSection(WT602_SECTION_TEXT_INFO));
const unsigned textLength = readU32(textInput.get());
const unsigned spanCount = readU32(textInfoInput.get());
@@ -151,7 +147,7 @@ void WT602Parser::readText()
if (0 != textLength)
{
- m_document->openParagraph(WPXPropertyList(), WPXPropertyListVector());
+ m_document->openParagraph(librevenge::RVNGPropertyList());
for (unsigned i = 0; i != spanCount; ++i)
{
@@ -165,12 +161,12 @@ void WT602Parser::readText()
if (0x100 & flags)
{
m_document->closeParagraph();
- m_document->openParagraph(WPXPropertyList(), WPXPropertyListVector());
+ m_document->openParagraph(librevenge::RVNGPropertyList());
}
if (0 != length)
{
- WPXPropertyList props;
+ librevenge::RVNGPropertyList props;
if (0x2 & format)
props.insert("fo:font-weight", "bold");
@@ -183,7 +179,7 @@ void WT602Parser::readText()
std::string text(reinterpret_cast<const char *>(data), length);
m_document->openSpan(props);
- m_document->insertText(WPXString(text.c_str()));
+ m_document->insertText(librevenge::RVNGString(text.c_str()));
m_document->closeSpan();
}
}
@@ -192,7 +188,7 @@ void WT602Parser::readText()
}
}
-WPXInputStreamPtr WT602Parser::getSection(const WT602Section section) const
+RVNGInputStreamPtr WT602Parser::getSection(const WT602Section section) const
{
return m_sectionMap->getSectionStream(m_input, section);
}