[Libreoffice-commits] libmspub.git: configure.ac inc/libmspub libmspub.pc.in src/conv src/lib
Fridrich Å trba
fridrich.strba at bluewin.ch
Thu Nov 7 20:48:43 CET 2013
configure.ac | 62 +--
inc/libmspub/MSPUBDocument.h | 12
inc/libmspub/MSPUBStringVector.h | 60 ---
inc/libmspub/Makefile.am | 3
inc/libmspub/libmspub.h | 2
libmspub.pc.in | 2
src/conv/raw/Makefile.am | 18 -
src/conv/raw/pub2raw.cpp | 191 ------------
src/conv/svg/Makefile.am | 16 -
src/conv/svg/pub2xhtml.cpp | 12
src/lib/.gitignore | 2
src/lib/BorderArtInfo.h | 4
src/lib/EmbeddedFontInfo.h | 8
src/lib/Fill.cpp | 38 +-
src/lib/Fill.h | 12
src/lib/MSPUBCollector.cpp | 116 +++----
src/lib/MSPUBCollector.h | 26 -
src/lib/MSPUBDocument.cpp | 35 --
src/lib/MSPUBParser.cpp | 244 +++++++--------
src/lib/MSPUBParser.h | 80 ++---
src/lib/MSPUBParser2k.cpp | 78 ++--
src/lib/MSPUBParser2k.h | 24 -
src/lib/MSPUBParser97.cpp | 40 +-
src/lib/MSPUBParser97.h | 12
src/lib/MSPUBSVGGenerator.cpp | 616 ---------------------------------------
src/lib/MSPUBSVGGenerator.h | 88 -----
src/lib/MSPUBStringVector.cpp | 6
src/lib/Makefile.am | 10
src/lib/PolygonUtils.cpp | 116 +++----
src/lib/PolygonUtils.h | 6
src/lib/Shapes.h | 20 -
src/lib/libmspub_utils.cpp | 36 +-
src/lib/libmspub_utils.h | 28 -
33 files changed, 527 insertions(+), 1496 deletions(-)
New commits:
commit 4cfda485b13728ea31de466d986a171251e1f3fa
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Thu Nov 7 20:47:48 2013 +0100
Port to librevenge
Change-Id: I975b5a248bee8ce74a32bf48606a1516c0692308
diff --git a/configure.ac b/configure.ac
index f4a68da..eb4ab8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,8 +6,8 @@ AC_PREREQ([2.65])
# Version informations
# ====================
m4_define([libmspub_version_major],[0])
-m4_define([libmspub_version_minor],[0])
-m4_define([libmspub_version_micro],[6])
+m4_define([libmspub_version_minor],[1])
+m4_define([libmspub_version_micro],[0])
m4_define([libmspub_version],[libmspub_version_major.libmspub_version_minor.libmspub_version_micro])
# =============
@@ -35,21 +35,36 @@ AC_CANONICAL_HOST
PKG_PROG_PKG_CONFIG([0.20])
-# ====================
-# Find additional apps
-# ====================
-PKG_CHECK_MODULES([WPD],[
- libwpd-0.9
- libwpd-stream-0.9
+# ===============
+# Find librevenge
+# ===============
+PKG_CHECK_MODULES([REVENGE],[
+ librevenge-0.0
])
-AC_SUBST(WPD_CFLAGS)
-AC_SUBST(WPD_LIBS)
+AC_SUBST([REVENGE_CFLAGS])
+AC_SUBST([REVENGE_LIBS])
-PKG_CHECK_MODULES([WPG],[
- libwpg-0.2
+# =====
+# Tools
+# =====
+AC_ARG_ENABLE([tools],
+ [AS_HELP_STRING([--disable-tools], [Build conversion tools])],
+ [enable_tools="$enableval"],
+ [enable_tools=yes]
+)
+AS_IF([test "x$enable_tools" = "xyes"], [
+ PKG_CHECK_MODULES([REVENGE_STREAM],[
+ librevenge-stream-0.0
+ ])
+ PKG_CHECK_MODULES([REVENGE_GENERATORS],[
+ librevenge-generators-0.0
+ ])
])
-AC_SUBST(WPG_CFLAGS)
-AC_SUBST(WPG_LIBS)
+AC_SUBST([REVENGE_STREAM_CFLAGS])
+AC_SUBST([REVENGE_STREAM_LIBS])
+AC_SUBST([REVENGE_GENERATORS_CFLAGS])
+AC_SUBST([REVENGE_GENERATORS_LIBS])
+AM_CONDITIONAL(BUILD_TOOLS, [test "x$enable_tools" = "xyes"])
# =========
# Find zlib
@@ -151,9 +166,9 @@ AM_CONDITIONAL([PLATFORM_WIN32], [test "x$platform_win32" = "xyes"])
# Check for cflags
# ================
AC_ARG_ENABLE([werror],
- [AS_HELP_STRING([--disable-werror], [Treat all warnings as errors, usefull for development])],
+ [AS_HELP_STRING([--enable-werror], [Treat all warnings as errors, usefull for development])],
[enable_werror="$enableval"],
- [enable_werror=yes]
+ [enable_werror=no]
)
AS_IF([test x"$enable_werror" != "xno"], [
CFLAGS="$CFLAGS -Werror"
@@ -240,21 +255,6 @@ LIBMSPUB_CXXFLAGS="$LIBMSPUB_CFLAGS"
AC_SUBST(LIBMSPUB_CXXFLAGS)
AC_SUBST(DEBUG_CXXFLAGS)
-# ============
-# Static tools
-# ============
-AC_ARG_ENABLE([static-tools],
- [AS_HELP_STRING([--enable-static-tools], [Link tools (binaries) statically])],
- [enable_static_tools="$enableval"],
- [enable_static_tools=no]
-)
-AS_IF([test "x$enable_static_tools" = "xyes"], [
- enable_static="yes"
-], [
- AC_DISABLE_STATIC
-])
-AM_CONDITIONAL(STATIC_TOOLS, [test "x$enable_static_tools" = "xyes"])
-
# =============
# Documentation
# =============
diff --git a/inc/libmspub/MSPUBDocument.h b/inc/libmspub/MSPUBDocument.h
index 645ec2c..284d202 100644
--- a/inc/libmspub/MSPUBDocument.h
+++ b/inc/libmspub/MSPUBDocument.h
@@ -30,11 +30,7 @@
#ifndef __MSPUBDOCUMENT_H__
#define __MSPUBDOCUMENT_H__
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
-#include "MSPUBStringVector.h"
-
-class WPXInputStream;
+#include <librevenge/librevenge.h>
namespace libmspub
{
@@ -42,11 +38,9 @@ class MSPUBDocument
{
public:
- static bool isSupported(WPXInputStream *input);
-
- static bool parse(WPXInputStream *input, libwpg::WPGPaintInterface *painter);
+ static bool isSupported(librevenge::RVNGInputStream *input);
- static bool generateSVG(::WPXInputStream *input, MSPUBStringVector &output);
+ static bool parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
};
} // namespace libmspub
diff --git a/inc/libmspub/MSPUBStringVector.h b/inc/libmspub/MSPUBStringVector.h
deleted file mode 100644
index b3b659a..0000000
--- a/inc/libmspub/MSPUBStringVector.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* libmspub
- * Version: MPL 1.1 / GPLv2+ / LGPLv2+
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License or as specified alternatively below. You may obtain a copy of
- * the License at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Major Contributor(s):
- * Copyright (C) 2012 Fridrich Strba <fridrich.strba at bluewin.ch>
- *
- * All Rights Reserved.
- *
- * For minor contributions see the git repository.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
- * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
- * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
- * instead of those above.
- */
-
-#ifndef __MSPUBSTRINGVECTOR_H__
-#define __MSPUBSTRINGVECTOR_H__
-
-#include <libwpd/libwpd.h>
-
-namespace libmspub
-{
-class MSPUBStringVectorImpl;
-
-class MSPUBStringVector
-{
-public:
- MSPUBStringVector();
- MSPUBStringVector(const MSPUBStringVector &vec);
- ~MSPUBStringVector();
-
- MSPUBStringVector &operator=(const MSPUBStringVector &vec);
-
- unsigned size() const;
- bool empty() const;
- const WPXString &operator[](unsigned idx) const;
- void append(const WPXString &str);
- void clear();
-
-private:
- MSPUBStringVectorImpl *m_pImpl;
-};
-
-} // namespace libmspub
-
-#endif /* __MSPUBSTRINGVECTOR_H__ */
-/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/inc/libmspub/Makefile.am b/inc/libmspub/Makefile.am
index b00eb61..3d3628c 100644
--- a/inc/libmspub/Makefile.am
+++ b/inc/libmspub/Makefile.am
@@ -1,4 +1,3 @@
EXTRA_DIST = \
libmspub.h \
- MSPUBDocument.h \
- MSPUBStringVector.h
+ MSPUBDocument.h
diff --git a/inc/libmspub/libmspub.h b/inc/libmspub/libmspub.h
index 5c0da72..0a4724d 100644
--- a/inc/libmspub/libmspub.h
+++ b/inc/libmspub/libmspub.h
@@ -30,8 +30,6 @@
#define __LIBMSPUB_H__
#include "MSPUBDocument.h"
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
#endif
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/libmspub.pc.in b/libmspub.pc.in
index be16580..726357d 100644
--- a/libmspub.pc.in
+++ b/libmspub.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: libmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@
Description: Library for parsing the Microsoft Publisher file format structure
Version: @VERSION@
-Requires: libwpd-0.9 libwpd-stream-0.9 libwpg-0.2
+Requires: librevenge-0.0
Libs: -L${libdir} -lmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@
Cflags: -I${includedir}/libmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@
diff --git a/src/conv/raw/Makefile.am b/src/conv/raw/Makefile.am
index b5df257..d8a25dd 100644
--- a/src/conv/raw/Makefile.am
+++ b/src/conv/raw/Makefile.am
@@ -1,15 +1,19 @@
bin_PROGRAMS = pub2raw
-AM_CXXFLAGS = -I$(top_srcdir)/inc $(WPG_CFLAGS) $(WPD_CFLAGS) $(DEBUG_CXXFLAGS)
+AM_CXXFLAGS = -I$(top_srcdir)/inc \
+ $(REVENGE_GENERATORS_CFLAGS) \
+ $(REVENGE_CFLAGS) \
+ $(REVENGE_STREAM_LIBS) \
+ $(DEBUG_CXXFLAGS)
pub2raw_DEPENDENCIES = @PUB2RAW_WIN32_RESOURCE@
-if STATIC_TOOLS
-pub2raw_LDADD = ../../lib/@MSPUB_OBJDIR@/libmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@.a $(WPD_LIBS) @PUB2RAW_WIN32_RESOURCE@
-pub2raw_LDFLAGS = -all-static
-else
-pub2raw_LDADD = ../../lib/libmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@.la $(WPD_LIBS) @PUB2RAW_WIN32_RESOURCE@
-endif
+pub2raw_LDADD = \
+ ../../lib/libmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@.la \
+ $(REVENGE_GENERATORS_LIBS) \
+ $(REVENGE_LIBS) \
+ $(REVENGE_STREAM_LIBS) \
+ @PUB2RAW_WIN32_RESOURCE@
pub2raw_SOURCES = \
pub2raw.cpp
diff --git a/src/conv/raw/pub2raw.cpp b/src/conv/raw/pub2raw.cpp
index d2bd245..dceb472 100644
--- a/src/conv/raw/pub2raw.cpp
+++ b/src/conv/raw/pub2raw.cpp
@@ -31,192 +31,11 @@
#include <stdio.h>
#include <string.h>
-#include <libwpd-stream/libwpd-stream.h>
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
+#include <librevenge-stream/librevenge-stream.h>
+#include <librevenge-generators/librevenge-generators.h>
+#include <librevenge/librevenge.h>
#include <libmspub/libmspub.h>
-class RawPainter : public libwpg::WPGPaintInterface
-{
-public:
- RawPainter();
-
- void startGraphics(const ::WPXPropertyList &propList);
- void endGraphics();
- void startLayer(const ::WPXPropertyList &propList);
- void endLayer();
- void startEmbeddedGraphics(const ::WPXPropertyList &propList);
- void endEmbeddedGraphics();
-
- void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient);
-
- void drawRectangle(const ::WPXPropertyList &propList);
- void drawEllipse(const ::WPXPropertyList &propList);
- void drawPolyline(const ::WPXPropertyListVector &vertices);
- void drawPolygon(const ::WPXPropertyListVector &vertices);
- void drawPath(const ::WPXPropertyListVector &path);
- void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData);
- void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path);
- void endTextObject();
- void startTextLine(const ::WPXPropertyList &propList);
- void endTextLine();
- void startTextSpan(const ::WPXPropertyList &propList);
- void endTextSpan();
- void insertText(const ::WPXString &str);
-};
-
-WPXString getPropString(const WPXPropertyList &propList)
-{
- WPXString propString;
- WPXPropertyList::Iter i(propList);
- if (!i.last())
- {
- propString.append(i.key());
- propString.append(": ");
- propString.append(i()->getStr().cstr());
- for (; i.next(); )
- {
- propString.append(", ");
- propString.append(i.key());
- propString.append(": ");
- propString.append(i()->getStr().cstr());
- }
- }
-
- return propString;
-}
-
-WPXString getPropString(const WPXPropertyListVector &itemList)
-{
- WPXString propString;
-
- propString.append("(");
- WPXPropertyListVector::Iter i(itemList);
-
- if (!i.last())
- {
- propString.append("(");
- propString.append(getPropString(i()));
- propString.append(")");
-
- for (; i.next();)
- {
- propString.append(", (");
- propString.append(getPropString(i()));
- propString.append(")");
- }
-
- }
- propString.append(")");
-
- return propString;
-}
-
-RawPainter::RawPainter(): libwpg::WPGPaintInterface()
-{
-}
-
-void RawPainter::startGraphics(const ::WPXPropertyList &propList)
-{
- printf("RawPainter::startGraphics(%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::endGraphics()
-{
- printf("RawPainter::endGraphics\n");
-}
-
-void RawPainter::startLayer(const ::WPXPropertyList &propList)
-{
- printf("RawPainter::startLayer (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::endLayer()
-{
- printf("RawPainter::endLayer\n");
-}
-
-void RawPainter::startEmbeddedGraphics(const ::WPXPropertyList &propList)
-{
- printf("RawPainter::startEmbeddedGraphics (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::endEmbeddedGraphics()
-{
- printf("RawPainter::endEmbeddedGraphics \n");
-}
-
-void RawPainter::setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient)
-{
- printf("RawPainter::setStyle(%s, gradient: (%s))\n", getPropString(propList).cstr(), getPropString(gradient).cstr());
-}
-
-void RawPainter::drawRectangle(const ::WPXPropertyList &propList)
-{
- printf("RawPainter::drawRectangle (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::drawEllipse(const ::WPXPropertyList &propList)
-{
- printf("RawPainter::drawEllipse (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::drawPolyline(const ::WPXPropertyListVector &vertices)
-{
- printf("RawPainter::drawPolyline (%s)\n", getPropString(vertices).cstr());
-}
-
-void RawPainter::drawPolygon(const ::WPXPropertyListVector &vertices)
-{
- printf("RawPainter::drawPolygon (%s)\n", getPropString(vertices).cstr());
-}
-
-void RawPainter::drawPath(const ::WPXPropertyListVector &path)
-{
- printf("RawPainter::drawPath (%s)\n", getPropString(path).cstr());
-}
-
-void RawPainter::drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData & /*binaryData*/)
-{
- printf("RawPainter::drawGraphicObject (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path)
-{
- printf("RawPainter::startTextObject (%s, path: (%s))\n", getPropString(propList).cstr(), getPropString(path).cstr());
-}
-
-void RawPainter::endTextObject()
-{
- printf("RawPainter::endTextObject\n");
-}
-
-void RawPainter::startTextLine(const ::WPXPropertyList &propList)
-{
- printf("RawPainter::startTextLine (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::endTextLine()
-{
- printf("RawPainter::endTextLine\n");
-}
-
-void RawPainter::startTextSpan(const ::WPXPropertyList &propList)
-{
- printf("RawPainter::startTextSpan (%s)\n", getPropString(propList).cstr());
-}
-
-void RawPainter::endTextSpan()
-{
- printf("RawPainter::endTextSpan\n");
-}
-
-void RawPainter::insertText(const ::WPXString &str)
-{
- printf("RawPainter::insertText (%s)\n", str.cstr());
-}
-
-
namespace
{
@@ -249,7 +68,7 @@ int main(int argc, char *argv[])
if (!file)
return printUsage();
- WPXFileStream input(file);
+ librevenge::RVNGFileStream input(file);
if (!libmspub::MSPUBDocument::isSupported(&input))
{
@@ -257,7 +76,7 @@ int main(int argc, char *argv[])
return 1;
}
- RawPainter painter;
+ librevenge::RVNGRawDrawingGenerator painter;
libmspub::MSPUBDocument::parse(&input, &painter);
return 0;
diff --git a/src/conv/svg/Makefile.am b/src/conv/svg/Makefile.am
index f392237..2c03601 100644
--- a/src/conv/svg/Makefile.am
+++ b/src/conv/svg/Makefile.am
@@ -1,15 +1,17 @@
bin_PROGRAMS = pub2xhtml
-AM_CXXFLAGS = -I$(top_srcdir)/inc $(WPG_CFLAGS) $(WPD_CFLAGS) $(DEBUG_CXXFLAGS)
+AM_CXXFLAGS = -I$(top_srcdir)/inc \
+ $(REVENGE_CFLAGS) \
+ $(REVENGE_STREAM_LIBS) \
+ $(DEBUG_CXXFLAGS)
pub2xhtml_DEPENDENCIES = @PUB2XHTML_WIN32_RESOURCE@
-if STATIC_TOOLS
-pub2xhtml_LDADD = ../../lib/@MSPUB_OBJDIR@/libmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@.a $(WPD_LIBS) @PUB2XHTML_WIN32_RESOURCE@
-pub2xhtml_LDFLAGS = -all-static
-else
-pub2xhtml_LDADD = ../../lib/libmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@.la $(WPD_LIBS) @PUB2XHTML_WIN32_RESOURCE@
-endif
+pub2xhtml_LDADD = \
+ ../../lib/libmspub- at MSPUB_MAJOR_VERSION@. at MSPUB_MINOR_VERSION@.la \
+ $(REVENGE_LIBS) \
+ $(REVENGE_STREAM_LIBS) \
+ @PUB2XHTML_WIN32_RESOURCE@
pub2xhtml_SOURCES = \
pub2xhtml.cpp
diff --git a/src/conv/svg/pub2xhtml.cpp b/src/conv/svg/pub2xhtml.cpp
index 20aa5d8..3955d52 100644
--- a/src/conv/svg/pub2xhtml.cpp
+++ b/src/conv/svg/pub2xhtml.cpp
@@ -33,8 +33,8 @@
#include <fstream>
#include <stdio.h>
#include <string.h>
-#include <libwpd-stream/libwpd-stream.h>
-#include <libwpd/libwpd.h>
+#include <librevenge-stream/librevenge-stream.h>
+#include <librevenge/librevenge.h>
#include <libmspub/libmspub.h>
namespace
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
if (!in_file)
return printUsage();
- WPXFileStream input(in_file);
+ librevenge::RVNGFileStream input(in_file);
std::ofstream o;
if (out_file)
o.open(out_file);
@@ -89,13 +89,13 @@ int main(int argc, char *argv[])
return 1;
}
- libmspub::MSPUBStringVector outputStrings;
- if (!libmspub::MSPUBDocument::generateSVG(&input, outputStrings))
+ librevenge::RVNGStringVector outputStrings;
+ librevenge::RVNGSVGDrawingGenerator generator(outputStrings, "");
+ if (!libmspub::MSPUBDocument::parse(&input, &generator))
{
std::cerr << "ERROR: SVG Generation failed!" << std::endl;
return 1;
}
-
if (outputStrings.empty())
{
std::cerr << "ERROR: No SVG document generated!" << std::endl;
diff --git a/src/lib/.gitignore b/src/lib/.gitignore
index c086f3e..7e58a36 100644
--- a/src/lib/.gitignore
+++ b/src/lib/.gitignore
@@ -6,4 +6,4 @@
*.rc
Makefile
Makefile.in
-libwpg.h
+librevenge.h
diff --git a/src/lib/BorderArtInfo.h b/src/lib/BorderArtInfo.h
index 87c4be9..ff5bb50 100644
--- a/src/lib/BorderArtInfo.h
+++ b/src/lib/BorderArtInfo.h
@@ -30,7 +30,7 @@
#define __BORDERARTINFO_H__
#include <vector>
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
#include "MSPUBTypes.h"
namespace libmspub
@@ -38,7 +38,7 @@ namespace libmspub
struct BorderImgInfo
{
ImgType m_type;
- WPXBinaryData m_imgBlob;
+ librevenge::RVNGBinaryData m_imgBlob;
BorderImgInfo(ImgType type) :
m_type(type), m_imgBlob()
{
diff --git a/src/lib/EmbeddedFontInfo.h b/src/lib/EmbeddedFontInfo.h
index 80ee343..e75aee1 100644
--- a/src/lib/EmbeddedFontInfo.h
+++ b/src/lib/EmbeddedFontInfo.h
@@ -29,15 +29,15 @@
#ifndef __EMBEDDEDFONTINFO_H__
#define __EMBEDDEDFONTINFO_H__
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
namespace libmspub
{
struct EmbeddedFontInfo
{
- WPXString m_name;
- WPXBinaryData m_blob;
- EmbeddedFontInfo(const WPXString &name) :
+ librevenge::RVNGString m_name;
+ librevenge::RVNGBinaryData m_blob;
+ EmbeddedFontInfo(const librevenge::RVNGString &name) :
m_name(name), m_blob()
{
}
diff --git a/src/lib/Fill.cpp b/src/lib/Fill.cpp
index d9202c4..dc33802 100644
--- a/src/lib/Fill.cpp
+++ b/src/lib/Fill.cpp
@@ -41,13 +41,13 @@ ImgFill::ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture,
{
}
-WPXPropertyListVector ImgFill::getProperties(WPXPropertyList *out) const
+librevenge::RVNGPropertyListVector ImgFill::getProperties(librevenge::RVNGPropertyList *out) const
{
out->insert("draw:fill", "bitmap");
if (m_imgIndex > 0 && m_imgIndex <= m_owner->m_images.size())
{
- const std::pair<ImgType, WPXBinaryData> &img = m_owner->m_images[m_imgIndex - 1];
- out->insert("libwpg:mime-type", mimeByImgType(img.first));
+ const std::pair<ImgType, librevenge::RVNGBinaryData> &img = m_owner->m_images[m_imgIndex - 1];
+ out->insert("librevenge:mime-type", mimeByImgType(img.first));
out->insert("draw:fill-image", img.second.getBase64Data());
out->insert("draw:fill-image-ref-point", "top-left");
if (! m_isTexture)
@@ -56,30 +56,30 @@ WPXPropertyListVector ImgFill::getProperties(WPXPropertyList *out) const
}
if (m_rotation != 0)
{
- WPXString sValue;
+ librevenge::RVNGString sValue;
sValue.sprintf("%d", m_rotation);
- out->insert("libwpg:rotate", sValue);
+ out->insert("librevenge:rotate", sValue);
}
}
- return WPXPropertyListVector();
+ return librevenge::RVNGPropertyListVector();
}
PatternFill::PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg) : ImgFill(imgIndex, owner, true, 0), m_fg(fg), m_bg(bg)
{
}
-WPXPropertyListVector PatternFill::getProperties(WPXPropertyList *out) const
+librevenge::RVNGPropertyListVector PatternFill::getProperties(librevenge::RVNGPropertyList *out) const
{
Color fgColor = m_fg.getFinalColor(m_owner->m_paletteColors);
Color bgColor = m_bg.getFinalColor(m_owner->m_paletteColors);
out->insert("draw:fill", "bitmap");
if (m_imgIndex > 0 && m_imgIndex <= m_owner->m_images.size())
{
- const std::pair<ImgType, WPXBinaryData> &img = m_owner->m_images[m_imgIndex - 1];
+ const std::pair<ImgType, librevenge::RVNGBinaryData> &img = m_owner->m_images[m_imgIndex - 1];
const ImgType &type = img.first;
- const WPXBinaryData *data = &img.second;
+ const librevenge::RVNGBinaryData *data = &img.second;
// fix broken MSPUB DIB by putting in correct fg and bg colors
- WPXBinaryData fixedImg;
+ librevenge::RVNGBinaryData fixedImg;
if (type == DIB && data->size() >= 0x36 + 8)
{
fixedImg.append(data->getDataBuffer(), 0x36);
@@ -94,27 +94,27 @@ WPXPropertyListVector PatternFill::getProperties(WPXPropertyList *out) const
fixedImg.append(data->getDataBuffer() + 0x36 + 8, data->size() - 0x36 - 8);
data = &fixedImg;
}
- out->insert("libwpg:mime-type", mimeByImgType(type));
+ out->insert("librevenge:mime-type", mimeByImgType(type));
out->insert("draw:fill-image", data->getBase64Data());
out->insert("draw:fill-image-ref-point", "top-left");
}
- return WPXPropertyListVector();
+ return librevenge::RVNGPropertyListVector();
}
SolidFill::SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner) : Fill(owner), m_color(color), m_opacity(opacity)
{
}
-WPXPropertyListVector SolidFill::getProperties(WPXPropertyList *out) const
+librevenge::RVNGPropertyListVector SolidFill::getProperties(librevenge::RVNGPropertyList *out) const
{
Color fillColor = m_color.getFinalColor(m_owner->m_paletteColors);
out->insert("draw:fill", "solid");
out->insert("draw:fill-color", MSPUBCollector::getColorString(fillColor));
- WPXString val;
+ librevenge::RVNGString val;
val.sprintf("%d%%", (int)(m_opacity * 100));
out->insert("draw:opacity", val);
out->insert("svg:fill-rule", "nonzero");
- return WPXPropertyListVector();
+ return librevenge::RVNGPropertyListVector();
}
GradientFill::GradientFill(const MSPUBCollector *owner, double angle, int type) : Fill(owner), m_stops(), m_angle(angle), m_type(type), m_fillLeftVal(0.0), m_fillTopVal(0.0), m_fillRightVal(0.0), m_fillBottomVal(0.0)
@@ -149,9 +149,9 @@ void GradientFill::completeComplexFill()
}
}
-WPXPropertyListVector GradientFill::getProperties(WPXPropertyList *out) const
+librevenge::RVNGPropertyListVector GradientFill::getProperties(librevenge::RVNGPropertyList *out) const
{
- WPXPropertyListVector ret;
+ librevenge::RVNGPropertyListVector ret;
out->insert("draw:fill", "gradient");
out->insert("svg:fill-rule", "nonzero");
out->insert("draw:angle", -m_angle); // draw:angle is clockwise in odf format
@@ -180,8 +180,8 @@ WPXPropertyListVector GradientFill::getProperties(WPXPropertyList *out) const
for (unsigned i = 0; i < m_stops.size(); ++i)
{
Color c = m_stops[i].m_colorReference.getFinalColor(m_owner->m_paletteColors);
- WPXPropertyList stopProps;
- WPXString sValue;
+ librevenge::RVNGPropertyList stopProps;
+ librevenge::RVNGString sValue;
sValue.sprintf("%d%%", m_stops[i].m_offsetPercent);
stopProps.insert("svg:offset", sValue);
stopProps.insert("svg:stop-color", MSPUBCollector::getColorString(c));
diff --git a/src/lib/Fill.h b/src/lib/Fill.h
index 7bded34..76ce7cb 100644
--- a/src/lib/Fill.h
+++ b/src/lib/Fill.h
@@ -33,7 +33,7 @@
#include <vector>
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
#include "ColorReference.h"
@@ -46,7 +46,7 @@ protected:
const MSPUBCollector *m_owner;
public:
Fill(const MSPUBCollector *owner);
- virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const = 0;
+ virtual librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const = 0;
virtual ~Fill() { }
private:
Fill(const Fill &) : m_owner(NULL) { }
@@ -63,7 +63,7 @@ protected:
int m_rotation;
public:
ImgFill(unsigned imgIndex, const MSPUBCollector *owner, bool isTexture, int rotation);
- virtual WPXPropertyListVector getProperties(WPXPropertyList *out) const;
+ virtual librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const;
private:
ImgFill(const ImgFill &) : Fill(NULL), m_imgIndex(0), m_isTexture(false), m_rotation(0) { }
ImgFill &operator=(const ImgFill &);
@@ -75,7 +75,7 @@ class PatternFill : public ImgFill
ColorReference m_bg;
public:
PatternFill(unsigned imgIndex, const MSPUBCollector *owner, ColorReference fg, ColorReference bg);
- WPXPropertyListVector getProperties(WPXPropertyList *out) const;
+ librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const;
private:
PatternFill(const PatternFill &) : ImgFill(0, NULL, true, 0), m_fg(0x08000000), m_bg(0x08000000) { }
PatternFill &operator=(const ImgFill &);
@@ -87,7 +87,7 @@ class SolidFill : public Fill
double m_opacity;
public:
SolidFill(ColorReference color, double opacity, const MSPUBCollector *owner);
- WPXPropertyListVector getProperties(WPXPropertyList *out) const;
+ librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const;
private:
SolidFill(const SolidFill &) : Fill(NULL), m_color(0x08000000), m_opacity(1) { }
SolidFill &operator=(const SolidFill &);
@@ -115,7 +115,7 @@ public:
void addColor(ColorReference c, unsigned offsetPercent, double opacity);
void addColorReverse(ColorReference c, unsigned offsetPercent, double opacity);
void completeComplexFill();
- WPXPropertyListVector getProperties(WPXPropertyList *out) const;
+ librevenge::RVNGPropertyListVector getProperties(librevenge::RVNGPropertyList *out) const;
private:
GradientFill(const GradientFill &) : Fill(NULL), m_stops(), m_angle(0), m_type(7), m_fillLeftVal(0.0), m_fillTopVal(0.0), m_fillRightVal(0.0), m_fillBottomVal(0.0) { }
GradientFill &operator=(const GradientFill &);
diff --git a/src/lib/MSPUBCollector.cpp b/src/lib/MSPUBCollector.cpp
index 2d6b819..16d9ae7 100644
--- a/src/lib/MSPUBCollector.cpp
+++ b/src/lib/MSPUBCollector.cpp
@@ -39,7 +39,7 @@
#include "PolygonUtils.h"
#include "Coordinate.h"
-WPXBinaryData &libmspub::MSPUBCollector::addEOTFont(const WPXString &name)
+librevenge::RVNGBinaryData &libmspub::MSPUBCollector::addEOTFont(const librevenge::RVNGString &name)
{
m_embeddedFonts.push_back(EmbeddedFontInfo(name));
return m_embeddedFonts.back().m_blob;
@@ -104,7 +104,7 @@ void libmspub::MSPUBCollector::setShapeStretchBorderArt(unsigned seqNum)
m_shapeInfosBySeqNum[seqNum].m_stretchBorderArt = true;
}
-void libmspub::MSPUBCollector::setRectCoordProps(Coordinate coord, WPXPropertyList *props) const
+void libmspub::MSPUBCollector::setRectCoordProps(Coordinate coord, librevenge::RVNGPropertyList *props) const
{
int xs = coord.m_xs, ys = coord.m_ys, xe = coord.m_xe, ye = coord.m_ye;
double x_center = m_width / 2;
@@ -166,7 +166,7 @@ void libmspub::MSPUBCollector::setNextPage(unsigned pageSeqNum)
#define M_PI 3.14159265358979323846
#endif
-libmspub::MSPUBCollector::MSPUBCollector(libwpg::WPGPaintInterface *painter) :
+libmspub::MSPUBCollector::MSPUBCollector(librevenge::RVNGDrawingInterface *painter) :
m_painter(painter), m_contentChunkReferences(), m_width(0), m_height(0),
m_widthSet(false), m_heightSet(false),
m_numPages(0), m_textStringsById(), m_pagesBySeqNum(),
@@ -309,7 +309,7 @@ void no_op()
{
}
-void endShapeGroup(libwpg::WPGPaintInterface *painter)
+void endShapeGroup(librevenge::RVNGDrawingInterface *painter)
{
painter->endLayer();
}
@@ -386,11 +386,11 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
std::vector<int> adjustValues = getShapeAdjustValues(info);
if (isGroup)
{
- m_painter->startLayer(WPXPropertyList());
+ m_painter->startLayer(librevenge::RVNGPropertyList());
return boost::bind(&endShapeGroup, m_painter);
}
- WPXPropertyList graphicsProps;
- WPXPropertyListVector graphicsPropsVector;
+ librevenge::RVNGPropertyList graphicsProps;
+ librevenge::RVNGPropertyListVector graphicsPropsVector;
if (info.m_fill)
{
graphicsPropsVector = info.m_fill->getProperties(&graphicsProps);
@@ -414,7 +414,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
}
}
- WPXString fill = graphicsProps["draw:fill"] ? graphicsProps["draw:fill"]->getStr() : "none";
+ librevenge::RVNGString fill = graphicsProps["draw:fill"] ? graphicsProps["draw:fill"]->getStr() : "none";
bool hasFill = fill != "none";
boost::optional<std::vector<TextParagraph> > maybeText = getShapeText(info);
bool hasText = !!maybeText;
@@ -433,7 +433,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
m_painter->startLayer(calcClipPath(info.m_clipPath, x, y, height, width, foldedTransform, info.getCustomShape()));
}
else
- m_painter->startLayer(WPXPropertyList());
+ m_painter->startLayer(librevenge::RVNGPropertyList());
}
graphicsProps.insert("draw:stroke", "none");
const Coordinate &coord = info.m_coordinates.get_value_or(Coordinate());
@@ -473,14 +473,14 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
Color obc = info.m_pictureRecolor.get().getFinalColor(m_paletteColors);
graphicsProps.insert("draw:color-mode", "greyscale");
graphicsProps.insert("draw:red",
- static_cast<double>(obc.r) / 255.0, WPX_PERCENT);
+ static_cast<double>(obc.r) / 255.0, librevenge::RVNG_PERCENT);
graphicsProps.insert("draw:blue",
- static_cast<double>(obc.b) / 255.0, WPX_PERCENT);
+ static_cast<double>(obc.b) / 255.0, librevenge::RVNG_PERCENT);
graphicsProps.insert("draw:green",
- static_cast<double>(obc.g) / 255.0, WPX_PERCENT);
+ static_cast<double>(obc.g) / 255.0, librevenge::RVNG_PERCENT);
}
if (!!info.m_pictureBrightness)
- graphicsProps.insert("draw:luminance", static_cast<double>(info.m_pictureBrightness.get() + 32768.0) / 65536.0, WPX_PERCENT);
+ graphicsProps.insert("draw:luminance", static_cast<double>(info.m_pictureBrightness.get() + 32768.0) / 65536.0, librevenge::RVNG_PERCENT);
bool shadowPropsInserted = false;
if (!!info.m_shadow)
{
@@ -492,7 +492,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
graphicsProps.insert("draw:shadow-offset-x", static_cast<double>(s.m_offsetXInEmu) / EMUS_IN_INCH);
graphicsProps.insert("draw:shadow-offset-y", static_cast<double>(s.m_offsetYInEmu) / EMUS_IN_INCH);
graphicsProps.insert("draw:shadow-color", getColorString(s.m_color.getFinalColor(m_paletteColors)));
- graphicsProps.insert("draw:shadow-opacity", s.m_opacity, WPX_PERCENT);
+ graphicsProps.insert("draw:shadow-opacity", s.m_opacity, librevenge::RVNG_PERCENT);
}
// TODO: Emulate shadows that don't conform
// to LibreOffice's range of possible shadows.
@@ -560,30 +560,30 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
const BorderArtInfo &ba = m_borderImages[maybeBorderImg.get()];
if (!ba.m_offsets.empty())
{
- WPXPropertyList baProps;
+ librevenge::RVNGPropertyList baProps;
baProps.insert("draw:stroke", "none");
baProps.insert("draw:fill", "solid");
baProps.insert("draw:fill-color", "#ffffff");
- m_painter->setStyle(baProps, WPXPropertyListVector());
- WPXPropertyList topRectProps;
+ m_painter->setStyle(baProps, librevenge::RVNGPropertyListVector());
+ librevenge::RVNGPropertyList topRectProps;
topRectProps.insert("svg:x", x);
topRectProps.insert("svg:y", y);
topRectProps.insert("svg:height", borderImgWidth);
topRectProps.insert("svg:width", width);
m_painter->drawRectangle(topRectProps);
- WPXPropertyList rightRectProps;
+ librevenge::RVNGPropertyList rightRectProps;
rightRectProps.insert("svg:x", x + width - borderImgWidth);
rightRectProps.insert("svg:y", y);
rightRectProps.insert("svg:height", height);
rightRectProps.insert("svg:width", borderImgWidth);
m_painter->drawRectangle(rightRectProps);
- WPXPropertyList botRectProps;
+ librevenge::RVNGPropertyList botRectProps;
botRectProps.insert("svg:x", x);
botRectProps.insert("svg:y", y + height - borderImgWidth);
botRectProps.insert("svg:height", borderImgWidth);
botRectProps.insert("svg:width", width);
m_painter->drawRectangle(botRectProps);
- WPXPropertyList leftRectProps;
+ librevenge::RVNGPropertyList leftRectProps;
leftRectProps.insert("svg:x", x);
leftRectProps.insert("svg:y", y);
leftRectProps.insert("svg:height", height);
@@ -747,7 +747,7 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
{
const Dash &dash = info.m_dash.get();
graphicsProps.insert("draw:stroke", "dash");
- graphicsProps.insert("draw:distance", dash.m_distance, WPX_INCH);
+ graphicsProps.insert("draw:distance", dash.m_distance, librevenge::RVNG_INCH);
switch (dash.m_dotStyle)
{
case ROUND_DOT:
@@ -761,14 +761,14 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
}
for (unsigned i = 0; i < dash.m_dots.size(); ++i)
{
- WPXString dots;
+ librevenge::RVNGString dots;
dots.sprintf("draw:dots%d", i + 1);
graphicsProps.insert(dots.cstr(), static_cast<int>(dash.m_dots[i].m_count));
if (!!dash.m_dots[i].m_length)
{
- WPXString length;
+ librevenge::RVNGString length;
length.sprintf("draw:dots%d-length", i + 1);
- graphicsProps.insert(length.cstr(), dash.m_dots[i].m_length.get(), WPX_INCH);
+ graphicsProps.insert(length.cstr(), dash.m_dots[i].m_length.get(), librevenge::RVNG_INCH);
}
}
}
@@ -792,12 +792,12 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
Coordinate textCoord = isShapeTypeRectangle(type) ?
getFudgedCoordinates(coord, lines, false, borderPosition) : coord;
m_painter->setStyle(graphicsProps, graphicsPropsVector);
- WPXPropertyList props;
+ librevenge::RVNGPropertyList props;
setRectCoordProps(textCoord, &props);
double textRotation = thisTransform.getRotation();
if (textRotation != 0)
{
- props.insert("libwpg:rotate", textRotation * 180 / M_PI);
+ props.insert("librevenge:rotate", textRotation * 180 / M_PI);
}
Margins margins = info.m_margins.get_value_or(Margins());
props.insert("fo:padding-left", (double)margins.m_left / EMUS_IN_INCH);
@@ -832,22 +832,22 @@ boost::function<void(void)> libmspub::MSPUBCollector::paintShape(const ShapeInfo
if (ngap > 0)
props.insert("fo:column-gap", (double)ngap / EMUS_IN_INCH);
}
- m_painter->startTextObject(props, WPXPropertyListVector());
+ m_painter->startTextObject(props, librevenge::RVNGPropertyListVector());
for (unsigned i_lines = 0; i_lines < text.size(); ++i_lines)
{
- WPXPropertyList paraProps = getParaStyleProps(text[i_lines].style, text[i_lines].style.m_defaultCharStyleIndex);
- m_painter->startTextLine(paraProps);
+ librevenge::RVNGPropertyList paraProps = getParaStyleProps(text[i_lines].style, text[i_lines].style.m_defaultCharStyleIndex);
+ m_painter->openParagraph(paraProps, librevenge::RVNGPropertyListVector());
for (unsigned i_spans = 0; i_spans < text[i_lines].spans.size(); ++i_spans)
{
- WPXString textString;
+ librevenge::RVNGString textString;
appendCharacters(textString, text[i_lines].spans[i_spans].chars,
getCalculatedEncoding());
- WPXPropertyList charProps = getCharStyleProps(text[i_lines].spans[i_spans].style, text[i_lines].style.m_defaultCharStyleIndex);
- m_painter->startTextSpan(charProps);
+ librevenge::RVNGPropertyList charProps = getCharStyleProps(text[i_lines].spans[i_spans].style, text[i_lines].style.m_defaultCharStyleIndex);
+ m_painter->openSpan(charProps);
m_painter->insertText(textString);
- m_painter->endTextSpan();
+ m_painter->closeSpan();
}
- m_painter->endTextLine();
+ m_painter->closeParagraph();
}
m_painter->endTextObject();
}
@@ -927,23 +927,23 @@ void libmspub::MSPUBCollector::setShapeLineBackColor(unsigned shapeSeqNum,
}
void libmspub::MSPUBCollector::writeImage(double x, double y,
- double height, double width, ImgType type, const WPXBinaryData &blob,
+ double height, double width, ImgType type, const librevenge::RVNGBinaryData &blob,
boost::optional<Color> oneBitColor) const
{
- WPXPropertyList props;
+ librevenge::RVNGPropertyList props;
if (!!oneBitColor)
{
Color obc = oneBitColor.get();
props.insert("draw:color-mode", "greyscale");
- props.insert("draw:red", static_cast<double>(obc.r) / 255.0, WPX_PERCENT);
- props.insert("draw:blue", static_cast<double>(obc.b) / 255.0, WPX_PERCENT);
- props.insert("draw:green", static_cast<double>(obc.g) / 255.0, WPX_PERCENT);
+ props.insert("draw:red", static_cast<double>(obc.r) / 255.0, librevenge::RVNG_PERCENT);
+ props.insert("draw:blue", static_cast<double>(obc.b) / 255.0, librevenge::RVNG_PERCENT);
+ props.insert("draw:green", static_cast<double>(obc.g) / 255.0, librevenge::RVNG_PERCENT);
}
props.insert("svg:x", x);
props.insert("svg:y", y);
props.insert("svg:width", width);
props.insert("svg:height", height);
- props.insert("libwpg:mime-type", mimeByImgType(type));
+ props.insert("librevenge:mime-type", mimeByImgType(type));
m_painter->drawGraphicObject(props, blob);
}
@@ -1148,11 +1148,11 @@ void libmspub::MSPUBCollector::addFont(std::vector<unsigned char> name)
m_fonts.push_back(name);
}
-WPXPropertyList libmspub::MSPUBCollector::getParaStyleProps(const ParagraphStyle &style, boost::optional<unsigned> defaultParaStyleIndex) const
+librevenge::RVNGPropertyList libmspub::MSPUBCollector::getParaStyleProps(const ParagraphStyle &style, boost::optional<unsigned> defaultParaStyleIndex) const
{
ParagraphStyle _nothing;
const ParagraphStyle &defaultStyle = !!defaultParaStyleIndex && defaultParaStyleIndex.get() < m_defaultParaStyles.size() ? m_defaultParaStyles[defaultParaStyleIndex.get()] : _nothing;
- WPXPropertyList ret;
+ librevenge::RVNGPropertyList ret;
Alignment align = style.m_align.get_value_or(
defaultStyle.m_align.get_value_or(LEFT));
switch (align)
@@ -1179,11 +1179,11 @@ WPXPropertyList libmspub::MSPUBCollector::getParaStyleProps(const ParagraphStyle
{
if (lineSpacingType == LINE_SPACING_SP)
{
- ret.insert("fo:line-height", lineSpacing, WPX_PERCENT);
+ ret.insert("fo:line-height", lineSpacing, librevenge::RVNG_PERCENT);
}
else if (lineSpacingType == LINE_SPACING_PT)
{
- ret.insert("fo:line-height", lineSpacing, WPX_POINT);
+ ret.insert("fo:line-height", lineSpacing, librevenge::RVNG_POINT);
}
}
unsigned spaceAfterEmu = style.m_spaceAfterEmu.get_value_or(
@@ -1231,7 +1231,7 @@ WPXPropertyList libmspub::MSPUBCollector::getParaStyleProps(const ParagraphStyle
return ret;
}
-WPXPropertyList libmspub::MSPUBCollector::getCharStyleProps(const CharacterStyle &style, boost::optional<unsigned> defaultCharStyleIndex) const
+librevenge::RVNGPropertyList libmspub::MSPUBCollector::getCharStyleProps(const CharacterStyle &style, boost::optional<unsigned> defaultCharStyleIndex) const
{
CharacterStyle _nothing = CharacterStyle(false, false, false);
if (!defaultCharStyleIndex)
@@ -1239,7 +1239,7 @@ WPXPropertyList libmspub::MSPUBCollector::getCharStyleProps(const CharacterStyle
defaultCharStyleIndex = 0;
}
const CharacterStyle &defaultCharStyle = defaultCharStyleIndex.get() < m_defaultCharStyles.size() ? m_defaultCharStyles[defaultCharStyleIndex.get()] : _nothing;
- WPXPropertyList ret;
+ librevenge::RVNGPropertyList ret;
if (style.italic ^ defaultCharStyle.italic)
{
ret.insert("fo:font-style", "italic");
@@ -1276,7 +1276,7 @@ WPXPropertyList libmspub::MSPUBCollector::getCharStyleProps(const CharacterStyle
if (!!style.fontIndex &&
style.fontIndex.get() < m_fonts.size())
{
- WPXString str;
+ librevenge::RVNGString str;
appendCharacters(str, m_fonts[style.fontIndex.get()],
getCalculatedEncoding());
ret.insert("style:font-name", str);
@@ -1284,14 +1284,14 @@ WPXPropertyList libmspub::MSPUBCollector::getCharStyleProps(const CharacterStyle
else if (!!defaultCharStyle.fontIndex &&
defaultCharStyle.fontIndex.get() < m_fonts.size())
{
- WPXString str;
+ librevenge::RVNGString str;
appendCharacters(str, m_fonts[defaultCharStyle.fontIndex.get()],
getCalculatedEncoding());
ret.insert("style:font-name", str);
}
else if (!m_fonts.empty())
{
- WPXString str;
+ librevenge::RVNGString str;
appendCharacters(str, m_fonts[0],
getCalculatedEncoding());
ret.insert("style:font-name", str);
@@ -1310,9 +1310,9 @@ WPXPropertyList libmspub::MSPUBCollector::getCharStyleProps(const CharacterStyle
return ret;
}
-WPXString libmspub::MSPUBCollector::getColorString(const Color &color)
+librevenge::RVNGString libmspub::MSPUBCollector::getColorString(const Color &color)
{
- WPXString ret;
+ librevenge::RVNGString ret;
ret.sprintf("#%.2x%.2x%.2x",(unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b);
MSPUB_DEBUG_MSG(("String for r: 0x%x, g: 0x%x, b: 0x%x is %s\n", color.r, color.g, color.b, ret.cstr()));
return ret;
@@ -1357,7 +1357,7 @@ boost::optional<unsigned> libmspub::MSPUBCollector::getMasterPageSeqNum(unsigned
void libmspub::MSPUBCollector::writePage(unsigned pageSeqNum) const
{
const PageInfo &pageInfo = m_pagesBySeqNum.find(pageSeqNum)->second;
- WPXPropertyList pageProps;
+ librevenge::RVNGPropertyList pageProps;
if (m_widthSet)
{
pageProps.insert("svg:width", m_width);
@@ -1369,7 +1369,7 @@ void libmspub::MSPUBCollector::writePage(unsigned pageSeqNum) const
const std::vector<ShapeGroupElement *> &shapeGroupsOrdered = pageInfo.m_shapeGroupsOrdered;
if (!shapeGroupsOrdered.empty())
{
- m_painter->startGraphics(pageProps);
+ m_painter->startPage(pageProps);
boost::optional<unsigned> masterSeqNum = getMasterPageSeqNum(pageSeqNum);
bool hasMaster = !!masterSeqNum;
if (hasMaster)
@@ -1382,7 +1382,7 @@ void libmspub::MSPUBCollector::writePage(unsigned pageSeqNum) const
writePageShapes(masterSeqNum.get());
}
writePageShapes(pageSeqNum);
- m_painter->endGraphics();
+ m_painter->endPage();
}
}
@@ -1495,16 +1495,16 @@ void libmspub::MSPUBCollector::setHeightInEmu(unsigned long heightInEmu)
m_heightSet = true;
}
-bool libmspub::MSPUBCollector::addImage(unsigned index, ImgType type, WPXBinaryData img)
+bool libmspub::MSPUBCollector::addImage(unsigned index, ImgType type, librevenge::RVNGBinaryData img)
{
while (m_images.size() < index)
{
- m_images.push_back(std::pair<ImgType, WPXBinaryData>(UNKNOWN, WPXBinaryData()));
+ m_images.push_back(std::pair<ImgType, librevenge::RVNGBinaryData>(UNKNOWN, librevenge::RVNGBinaryData()));
}
if (index > 0)
{
MSPUB_DEBUG_MSG(("Image at index %u and of type 0x%x added.\n", index, type));
- m_images[index - 1] = std::pair<ImgType, WPXBinaryData>(type, img);
+ m_images[index - 1] = std::pair<ImgType, librevenge::RVNGBinaryData>(type, img);
}
else
{
@@ -1513,7 +1513,7 @@ bool libmspub::MSPUBCollector::addImage(unsigned index, ImgType type, WPXBinaryD
return index > 0;
}
-WPXBinaryData *libmspub::MSPUBCollector::addBorderImage(ImgType type,
+librevenge::RVNGBinaryData *libmspub::MSPUBCollector::addBorderImage(ImgType type,
unsigned borderArtIndex)
{
while (borderArtIndex >= m_borderImages.size())
diff --git a/src/lib/MSPUBCollector.h b/src/lib/MSPUBCollector.h
index 56bf28d..959afab 100644
--- a/src/lib/MSPUBCollector.h
+++ b/src/lib/MSPUBCollector.h
@@ -41,8 +41,8 @@
#include <boost/bind.hpp>
#include <boost/function.hpp>
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
+#include <librevenge/librevenge.h>
+#include <librevenge/librevenge.h>
#include "MSPUBTypes.h"
#include "libmspub_utils.h"
@@ -73,16 +73,16 @@ class MSPUBCollector
public:
typedef std::list<ContentChunkReference>::const_iterator ccr_iterator_t;
- MSPUBCollector(::libwpg::WPGPaintInterface *painter);
+ MSPUBCollector(::librevenge::RVNGDrawingInterface *painter);
virtual ~MSPUBCollector();
// collector functions
bool addPage(unsigned seqNum);
bool addTextString(const std::vector<TextParagraph> &str, unsigned id);
void addTextShape(unsigned stringId, unsigned seqNum);
- bool addImage(unsigned index, ImgType type, WPXBinaryData img);
+ bool addImage(unsigned index, ImgType type, librevenge::RVNGBinaryData img);
void setBorderImageOffset(unsigned index, unsigned offset);
- WPXBinaryData *addBorderImage(ImgType type, unsigned borderArtIndex);
+ librevenge::RVNGBinaryData *addBorderImage(ImgType type, unsigned borderArtIndex);
void setShapePage(unsigned seqNum, unsigned pageSeqNum);
void setNextPage(unsigned seqNum);
@@ -115,7 +115,7 @@ public:
// Microsoft "Embedded OpenType" ... need to figure out how to convert
// this to a sane format and how to get LibreOffice to understand embedded fonts.
- WPXBinaryData &addEOTFont(const WPXString &name);
+ librevenge::RVNGBinaryData &addEOTFont(const librevenge::RVNGString &name);
void beginGroup();
bool endGroup();
@@ -158,14 +158,14 @@ private:
MSPUBCollector(const MSPUBCollector &);
MSPUBCollector &operator=(const MSPUBCollector &);
- libwpg::WPGPaintInterface *m_painter;
+ librevenge::RVNGDrawingInterface *m_painter;
std::list<ContentChunkReference> m_contentChunkReferences;
double m_width, m_height;
bool m_widthSet, m_heightSet;
unsigned short m_numPages;
std::map<unsigned, std::vector<TextParagraph> > m_textStringsById;
std::map<unsigned, PageInfo> m_pagesBySeqNum;
- std::vector<std::pair<ImgType, WPXBinaryData> > m_images;
+ std::vector<std::pair<ImgType, librevenge::RVNGBinaryData> > m_images;
std::vector<BorderArtInfo> m_borderImages;
std::vector<ColorReference> m_textColors;
std::vector<std::vector<unsigned char> > m_fonts;
@@ -195,7 +195,7 @@ private:
// helper functions
std::vector<int> getShapeAdjustValues(const ShapeInfo &info) const;
boost::optional<unsigned> getMasterPageSeqNum(unsigned pageSeqNum) const;
- void setRectCoordProps(Coordinate, WPXPropertyList *) const;
+ void setRectCoordProps(Coordinate, librevenge::RVNGPropertyList *) const;
boost::optional<std::vector<libmspub::TextParagraph> > getShapeText(const ShapeInfo &info) const;
void setupShapeStructures(ShapeGroupElement &elt);
void addBlackToPaletteIfNecessary();
@@ -204,20 +204,20 @@ private:
void writePageShapes(unsigned pageSeqNum) const;
void writePageBackground(unsigned pageSeqNum) const;
void writeImage(double x, double y, double height, double width,
- ImgType type, const WPXBinaryData &blob,
+ ImgType type, const librevenge::RVNGBinaryData &blob,
boost::optional<Color> oneBitColor) const;
bool pageIsMaster(unsigned pageSeqNum) const;
boost::function<void(void)> paintShape(const ShapeInfo &info, const Coordinate &relativeTo, const VectorTransformation2D &foldedTransform, bool isGroup, const VectorTransformation2D &thisTransform) const;
double getCalculationValue(const ShapeInfo &info, unsigned index, bool recursiveEntry, const std::vector<int> &adjustValues) const;
- WPXPropertyList getCharStyleProps(const CharacterStyle &, boost::optional<unsigned> defaultCharStyleIndex) const;
- WPXPropertyList getParaStyleProps(const ParagraphStyle &, boost::optional<unsigned> defaultParaStyleIndex) const;
+ librevenge::RVNGPropertyList getCharStyleProps(const CharacterStyle &, boost::optional<unsigned> defaultCharStyleIndex) const;
+ librevenge::RVNGPropertyList getParaStyleProps(const ParagraphStyle &, boost::optional<unsigned> defaultParaStyleIndex) const;
double getSpecialValue(const ShapeInfo &info, const CustomShape &shape, int arg, const std::vector<int> &adjustValues) const;
void ponderStringEncoding(const std::vector<TextParagraph> &str);
const char *getCalculatedEncoding() const;
public:
- static WPXString getColorString(const Color &);
+ static librevenge::RVNGString getColorString(const Color &);
};
} // namespace libmspub
diff --git a/src/lib/MSPUBDocument.cpp b/src/lib/MSPUBDocument.cpp
index 2ca247d..6ee6108 100644
--- a/src/lib/MSPUBDocument.cpp
+++ b/src/lib/MSPUBDocument.cpp
@@ -33,7 +33,6 @@
#include <boost/scoped_ptr.hpp>
#include <libmspub/libmspub.h>
-#include "MSPUBSVGGenerator.h"
#include "MSPUBCollector.h"
#include "MSPUBParser.h"
#include "MSPUBParser2k.h"
@@ -50,14 +49,14 @@ enum MSPUBVersion
MSPUB_2K2
};
-MSPUBVersion getVersion(WPXInputStream *input)
+MSPUBVersion getVersion(librevenge::RVNGInputStream *input)
{
try
{
- if (!input->isOLEStream())
+ if (!input->isStructured())
return MSPUB_UNKNOWN_VERSION;
- boost::scoped_ptr<WPXInputStream> contentsStream(input->getDocumentOLEStream("Contents"));
+ boost::scoped_ptr<librevenge::RVNGInputStream> contentsStream(input->getSubStreamByName("Contents"));
if (!contentsStream)
return MSPUB_UNKNOWN_VERSION;
@@ -100,7 +99,7 @@ Analyzes the content of an input stream to see if it can be parsed
\return A value that indicates whether the content from the input
stream is a Microsoft Publisher Document that libmspub is able to parse
*/
-bool libmspub::MSPUBDocument::isSupported(WPXInputStream *input)
+bool libmspub::MSPUBDocument::isSupported(librevenge::RVNGInputStream *input)
{
try
{
@@ -110,10 +109,10 @@ bool libmspub::MSPUBDocument::isSupported(WPXInputStream *input)
if (version == MSPUB_2K2)
{
- boost::scoped_ptr<WPXInputStream> escherStream(input->getDocumentOLEStream("Escher/EscherStm"));
+ boost::scoped_ptr<librevenge::RVNGInputStream> escherStream(input->getSubStreamByName("Escher/EscherStm"));
if (!escherStream)
return false;
- boost::scoped_ptr<WPXInputStream> quillStream(input->getDocumentOLEStream("Quill/QuillSub/CONTENTS"));
+ boost::scoped_ptr<librevenge::RVNGInputStream> quillStream(input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
if (!quillStream)
return false;
}
@@ -127,24 +126,24 @@ bool libmspub::MSPUBDocument::isSupported(WPXInputStream *input)
/**
Parses the input stream content. It will make callbacks to the functions provided by a
-WPGPaintInterface class implementation when needed. This is often commonly called the
+RVNGDrawingInterface class implementation when needed. This is often commonly called the
'main parsing routine'.
\param input The input stream
\param painter A MSPUBPainterInterface implementation
\return A value that indicates whether the parsing was successful
*/
-bool libmspub::MSPUBDocument::parse(::WPXInputStream *input, libwpg::WPGPaintInterface *painter)
+bool libmspub::MSPUBDocument::parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter)
{
try
{
MSPUBCollector collector(painter);
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
boost::scoped_ptr<MSPUBParser> parser;
switch (getVersion(input))
{
case MSPUB_2K:
{
- boost::scoped_ptr<WPXInputStream> quillStream(input->getDocumentOLEStream("Quill/QuillSub/CONTENTS"));
+ boost::scoped_ptr<librevenge::RVNGInputStream> quillStream(input->getSubStreamByName("Quill/QuillSub/CONTENTS"));
if (!quillStream)
parser.reset(new MSPUBParser97(input, &collector));
else
@@ -171,18 +170,4 @@ bool libmspub::MSPUBDocument::parse(::WPXInputStream *input, libwpg::WPGPaintInt
}
}
-/**
-Parses the input stream content and generates a valid Scalable Vector Graphics
-Provided as a convenience function for applications that support SVG internally.
-\param input The input stream
-\param output The output string whose content is the resulting SVG
-\return A value that indicates whether the SVG generation was successful.
-*/
-bool libmspub::MSPUBDocument::generateSVG(::WPXInputStream *input, libmspub::MSPUBStringVector &output)
-{
- libmspub::MSPUBSVGGenerator generator(output);
- bool result = libmspub::MSPUBDocument::parse(input, &generator);
- return result;
-}
-
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/MSPUBParser.cpp b/src/lib/MSPUBParser.cpp
index 09d43cf..7282c1e 100644
--- a/src/lib/MSPUBParser.cpp
+++ b/src/lib/MSPUBParser.cpp
@@ -31,7 +31,7 @@
#include <string>
#include <algorithm>
#include <string.h>
-#include <libwpd-stream/libwpd-stream.h>
+#include <librevenge-stream/librevenge-stream.h>
#include <zlib.h>
#include "MSPUBParser.h"
#include "MSPUBCollector.h"
@@ -51,7 +51,7 @@
#include "TableInfo.h"
#include "VerticalAlign.h"
-libmspub::MSPUBParser::MSPUBParser(WPXInputStream *input, MSPUBCollector *collector)
+libmspub::MSPUBParser::MSPUBParser(librevenge::RVNGInputStream *input, MSPUBCollector *collector)
: m_input(input), m_collector(collector),
m_blockInfo(), m_contentChunks(),
m_cellsChunkIndices(),
@@ -129,9 +129,9 @@ short libmspub::MSPUBParser::getBlockDataLength(unsigned type) // -1 for variabl
bool libmspub::MSPUBParser::parse()
{
MSPUB_DEBUG_MSG(("***NOTE***: Where applicable, the meanings of block/chunk IDs and Types printed below may be found in:\n\t***MSPUBBlockType.h\n\t***MSPUBBlockID.h\n\t***MSPUBContentChunkType.h\n*****\n"));
- if (!m_input->isOLEStream())
+ if (!m_input->isStructured())
return false;
- WPXInputStream *quill = m_input->getDocumentOLEStream("Quill/QuillSub/CONTENTS");
+ librevenge::RVNGInputStream *quill = m_input->getSubStreamByName("Quill/QuillSub/CONTENTS");
if (!quill)
{
MSPUB_DEBUG_MSG(("Couldn't get quill stream.\n"));
@@ -144,7 +144,7 @@ bool libmspub::MSPUBParser::parse()
return false;
}
delete quill;
- WPXInputStream *contents = m_input->getDocumentOLEStream("Contents");
+ librevenge::RVNGInputStream *contents = m_input->getSubStreamByName("Contents");
if (!contents)
{
MSPUB_DEBUG_MSG(("Couldn't get contents stream.\n"));
@@ -157,13 +157,13 @@ bool libmspub::MSPUBParser::parse()
return false;
}
delete contents;
- WPXInputStream *escherDelay = m_input->getDocumentOLEStream("Escher/EscherDelayStm");
+ librevenge::RVNGInputStream *escherDelay = m_input->getSubStreamByName("Escher/EscherDelayStm");
if (escherDelay)
{
parseEscherDelay(escherDelay);
delete escherDelay;
}
- WPXInputStream *escher = m_input->getDocumentOLEStream("Escher/EscherStm");
+ librevenge::RVNGInputStream *escher = m_input->getSubStreamByName("Escher/EscherStm");
if (!escher)
{
MSPUB_DEBUG_MSG(("Couldn't get escher stream.\n"));
@@ -245,7 +245,7 @@ int libmspub::MSPUBParser::getStartOffset(ImgType type, unsigned short initial)
return offset + (oneUid ? 0 : 0x10);
}
-bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input)
+bool libmspub::MSPUBParser::parseEscherDelay(librevenge::RVNGInputStream *input)
{
while (stillReading (input, (unsigned long)-1))
{
@@ -253,9 +253,9 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input)
const ImgType imgType = imgTypeByBlipType(info.type);
if (imgType != UNKNOWN)
{
- WPXBinaryData img;
+ librevenge::RVNGBinaryData img;
unsigned long toRead = info.contentsLength;
- input->seek(input->tell() + getStartOffset(imgType, info.initial), WPX_SEEK_SET);
+ input->seek(input->tell() + getStartOffset(imgType, info.initial), librevenge::RVNG_SEEK_SET);
while (toRead > 0 && stillReading(input, (unsigned long)-1))
{
unsigned long howManyRead = 0;
@@ -271,17 +271,17 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input)
{
// Reconstruct BMP header
// cf. http://en.wikipedia.org/wiki/BMP_file_format , accessed 2012-5-31
- WPXInputStream *buf = const_cast<WPXInputStream *>(img.getDataStream());
+ librevenge::RVNGInputStream *buf = const_cast<librevenge::RVNGInputStream *>(img.getDataStream());
if (img.size() < 0x2E + 4)
{
++m_lastAddedImage;
MSPUB_DEBUG_MSG(("Garbage DIB at index 0x%x\n", m_lastAddedImage));
- input->seek(info.contentsOffset + info.contentsLength, WPX_SEEK_SET);
+ input->seek(info.contentsOffset + info.contentsLength, librevenge::RVNG_SEEK_SET);
continue;
}
- buf->seek(0x0E, WPX_SEEK_SET);
+ buf->seek(0x0E, librevenge::RVNG_SEEK_SET);
unsigned short bitsPerPixel = readU16(buf);
- buf->seek(0x20, WPX_SEEK_SET);
+ buf->seek(0x20, librevenge::RVNG_SEEK_SET);
unsigned numPaletteColors = readU32(buf);
if (numPaletteColors == 0 && bitsPerPixel <= 8)
{
@@ -292,7 +292,7 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input)
}
}
- WPXBinaryData tmpImg;
+ librevenge::RVNGBinaryData tmpImg;
tmpImg.append(0x42);
tmpImg.append(0x4d);
@@ -320,18 +320,18 @@ bool libmspub::MSPUBParser::parseEscherDelay(WPXInputStream *input)
++m_lastAddedImage;
MSPUB_DEBUG_MSG(("Image of unknown type at index 0x%x\n", m_lastAddedImage));
}
- input->seek(info.contentsOffset + info.contentsLength, WPX_SEEK_SET);
+ input->seek(info.contentsOffset + info.contentsLength, librevenge::RVNG_SEEK_SET);
}
return true;
}
-bool libmspub::MSPUBParser::parseContents(WPXInputStream *input)
+bool libmspub::MSPUBParser::parseContents(librevenge::RVNGInputStream *input)
{
MSPUB_DEBUG_MSG(("MSPUBParser::parseContents\n"));
- input->seek(0x1a, WPX_SEEK_SET);
+ input->seek(0x1a, librevenge::RVNG_SEEK_SET);
unsigned trailerOffset = readU32(input);
MSPUB_DEBUG_MSG(("MSPUBParser: trailerOffset %.8x\n", trailerOffset));
- input->seek(trailerOffset, WPX_SEEK_SET);
+ input->seek(trailerOffset, librevenge::RVNG_SEEK_SET);
unsigned trailerLength = readU32(input);
for (unsigned i=0; i<3; i++)
{
@@ -368,7 +368,7 @@ bool libmspub::MSPUBParser::parseContents(WPXInputStream *input)
for (unsigned i_pal = 0; i_pal < m_paletteChunkIndices.size(); ++i_pal)
{
const ContentChunkReference &paletteChunk = m_contentChunks.at(m_paletteChunkIndices[i_pal]);
- input->seek(paletteChunk.offset, WPX_SEEK_SET);
+ input->seek(paletteChunk.offset, librevenge::RVNG_SEEK_SET);
if (! parsePaletteChunk(input, paletteChunk))
{
return false;
@@ -379,7 +379,7 @@ bool libmspub::MSPUBParser::parseContents(WPXInputStream *input)
{
const ContentChunkReference &baChunk =
m_contentChunks.at(m_borderArtChunkIndices[i_ba]);
- input->seek(baChunk.offset, WPX_SEEK_SET);
+ input->seek(baChunk.offset, librevenge::RVNG_SEEK_SET);
if (!parseBorderArtChunk(input, baChunk))
{
return false;
@@ -390,7 +390,7 @@ bool libmspub::MSPUBParser::parseContents(WPXInputStream *input)
{
const ContentChunkReference &shapeChunk =
m_contentChunks.at(m_shapeChunkIndices[i_shape]);
- input->seek(shapeChunk.offset, WPX_SEEK_SET);
+ input->seek(shapeChunk.offset, librevenge::RVNG_SEEK_SET);
if (!parseShape(input, shapeChunk))
{
return false;
@@ -401,13 +401,13 @@ bool libmspub::MSPUBParser::parseContents(WPXInputStream *input)
{
const ContentChunkReference &fontChunk =
m_contentChunks.at(m_fontChunkIndices[i_font]);
- input->seek(fontChunk.offset, WPX_SEEK_SET);
+ input->seek(fontChunk.offset, librevenge::RVNG_SEEK_SET);
if (!parseFontChunk(input, fontChunk))
{
return false;
}
}
- input->seek(documentChunk.offset, WPX_SEEK_SET);
+ input->seek(documentChunk.offset, librevenge::RVNG_SEEK_SET);
if (!parseDocumentChunk(input, documentChunk))
{
return false;
@@ -415,7 +415,7 @@ bool libmspub::MSPUBParser::parseContents(WPXInputStream *input)
for (unsigned i_page = 0; i_page < m_pageChunkIndices.size(); ++i_page)
{
const ContentChunkReference &pageChunk = m_contentChunks.at(m_pageChunkIndices[i_page]);
- input->seek(pageChunk.offset, WPX_SEEK_SET);
+ input->seek(pageChunk.offset, librevenge::RVNG_SEEK_SET);
if (!parsePageChunk(input, pageChunk))
{
return false;
@@ -423,15 +423,15 @@ bool libmspub::MSPUBParser::parseContents(WPXInputStream *input)
}
}
}
- input->seek(trailerOffset + trailerLength, WPX_SEEK_SET);
+ input->seek(trailerOffset + trailerLength, librevenge::RVNG_SEEK_SET);
return true;
}
#ifdef DEBUG
-bool libmspub::MSPUBParser::parseDocumentChunk(WPXInputStream *input, const ContentChunkReference &chunk)
+bool libmspub::MSPUBParser::parseDocumentChunk(librevenge::RVNGInputStream *input, const ContentChunkReference &chunk)
#else
-bool libmspub::MSPUBParser::parseDocumentChunk(WPXInputStream *input, const ContentChunkReference &)
+bool libmspub::MSPUBParser::parseDocumentChunk(librevenge::RVNGInputStream *input, const ContentChunkReference &)
#endif
{
MSPUB_DEBUG_MSG(("parseDocumentChunk: offset 0x%lx, end 0x%lx\n", input->tell(), chunk.end));
@@ -457,7 +457,7 @@ bool libmspub::MSPUBParser::parseDocumentChunk(WPXInputStream *input, const Cont
}
else if (info.id == DOCUMENT_PAGE_LIST)
{
- input->seek(info.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(info.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, info.dataOffset + info.dataLength))
{
MSPUBBlockInfo subInfo = parseBlock(input, true);
@@ -476,7 +476,7 @@ bool libmspub::MSPUBParser::parseDocumentChunk(WPXInputStream *input, const Cont
}
bool libmspub::MSPUBParser::parseFontChunk(
- WPXInputStream *input, const ContentChunkReference &chunk)
+ librevenge::RVNGInputStream *input, const ContentChunkReference &chunk)
{
unsigned length = readU32(input);
while (stillReading(input, chunk.offset + length))
@@ -484,21 +484,21 @@ bool libmspub::MSPUBParser::parseFontChunk(
MSPUBBlockInfo info = parseBlock(input, true);
if (info.id == FONT_CONTAINER_ARRAY)
{
- input->seek(info.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(info.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, info.dataOffset + info.dataLength))
{
MSPUBBlockInfo subInfo = parseBlock(input, true);
if (subInfo.id == 0)
{
- boost::optional<WPXString> name;
+ boost::optional<librevenge::RVNGString> name;
boost::optional<unsigned> eotOffset;
- input->seek(subInfo.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(subInfo.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, subInfo.dataOffset + subInfo.dataLength))
{
MSPUBBlockInfo subSubInfo = parseBlock(input, true);
if (subSubInfo.id == EMBEDDED_FONT_NAME)
{
- name = WPXString();
+ name = librevenge::RVNGString();
appendCharacters(name.get(), subSubInfo.stringData, "UTF-16");
}
else if (subSubInfo.id == EMBEDDED_EOT)
@@ -508,9 +508,9 @@ bool libmspub::MSPUBParser::parseFontChunk(
}
if (!!name && !!eotOffset)
{
- input->seek(eotOffset.get(), WPX_SEEK_SET);
+ input->seek(eotOffset.get(), librevenge::RVNG_SEEK_SET);
MSPUBBlockInfo eotRecord = parseBlock(input, true);
- WPXBinaryData &data = m_collector->addEOTFont(name.get());
+ librevenge::RVNGBinaryData &data = m_collector->addEOTFont(name.get());
unsigned long toRead = eotRecord.dataLength;
while (toRead > 0 && stillReading(input, (unsigned long)-1))
{
@@ -519,7 +519,7 @@ bool libmspub::MSPUBParser::parseFontChunk(
data.append(buf, howManyRead);
toRead -= howManyRead;
}
- input->seek(subInfo.dataOffset + subInfo.dataLength, WPX_SEEK_SET);
+ input->seek(subInfo.dataOffset + subInfo.dataLength, librevenge::RVNG_SEEK_SET);
}
}
}
@@ -529,7 +529,7 @@ bool libmspub::MSPUBParser::parseFontChunk(
}
bool libmspub::MSPUBParser::parseBorderArtChunk(
- WPXInputStream *input, const ContentChunkReference &chunk)
+ librevenge::RVNGInputStream *input, const ContentChunkReference &chunk)
{
unsigned length = readU32(input);
while (stillReading(input, chunk.offset + length))
@@ -537,7 +537,7 @@ bool libmspub::MSPUBParser::parseBorderArtChunk(
MSPUBBlockInfo info = parseBlock(input, true);
if (info.id == BA_ARRAY)
{
- input->seek(info.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(info.dataOffset + 4, librevenge::RVNG_SEEK_SET);
unsigned i = 0;
while (stillReading(input, info.dataOffset + info.dataLength))
{
@@ -547,7 +547,7 @@ bool libmspub::MSPUBParser::parseBorderArtChunk(
MSPUBBlockInfo subRecord = parseBlock(input, true);
if (subRecord.id == BA_IMAGE_ARRAY)
{
- input->seek(subRecord.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(subRecord.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, subRecord.dataOffset + subRecord.dataLength))
{
MSPUBBlockInfo subSubRecord = parseBlock(input, false);
@@ -556,8 +556,8 @@ bool libmspub::MSPUBParser::parseBorderArtChunk(
MSPUBBlockInfo imgRecord = parseBlock(input, false);
if (imgRecord.id == BA_IMAGE)
{
- WPXBinaryData &img = *(m_collector->addBorderImage(
- WMF, i));
+ librevenge::RVNGBinaryData &img = *(m_collector->addBorderImage(
+ WMF, i));
unsigned long toRead = imgRecord.dataLength;
while (toRead > 0 && stillReading(input, (unsigned long)-1))
{
@@ -572,7 +572,7 @@ bool libmspub::MSPUBParser::parseBorderArtChunk(
}
else if (subRecord.id == BA_OFFSET_CONTAINER)
{
- input->seek(subRecord.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(subRecord.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(
input, subRecord.dataOffset + subRecord.dataLength))
{
@@ -585,14 +585,14 @@ bool libmspub::MSPUBParser::parseBorderArtChunk(
}
}
++i;
- input->seek(entry.dataOffset + entry.dataLength, WPX_SEEK_SET);
+ input->seek(entry.dataOffset + entry.dataLength, librevenge::RVNG_SEEK_SET);
}
}
}
return true;
}
-bool libmspub::MSPUBParser::parsePageChunk(WPXInputStream *input, const ContentChunkReference &chunk)
+bool libmspub::MSPUBParser::parsePageChunk(librevenge::RVNGInputStream *input, const ContentChunkReference &chunk)
{
MSPUB_DEBUG_MSG(("parsePageChunk: offset 0x%lx, end 0x%lx, seqnum 0x%x, parent 0x%x\n", input->tell(), chunk.end, chunk.seqNum, chunk.parentSeqNum));
unsigned long length = readU32(input);
@@ -634,7 +634,7 @@ bool libmspub::MSPUBParser::parsePageChunk(WPXInputStream *input, const ContentC
return true;
}
-bool libmspub::MSPUBParser::parsePageShapeList(WPXInputStream *input, libmspub::MSPUBBlockInfo info, unsigned pageSeqNum)
+bool libmspub::MSPUBParser::parsePageShapeList(librevenge::RVNGInputStream *input, libmspub::MSPUBBlockInfo info, unsigned pageSeqNum)
{
MSPUB_DEBUG_MSG(("parsePageShapeList: page seqnum 0x%x\n", pageSeqNum));
while (stillReading(input, info.dataOffset + info.dataLength))
@@ -648,7 +648,7 @@ bool libmspub::MSPUBParser::parsePageShapeList(WPXInputStream *input, libmspub::
return true;
}
-bool libmspub::MSPUBParser::parseShape(WPXInputStream *input,
+bool libmspub::MSPUBParser::parseShape(librevenge::RVNGInputStream *input,
const ContentChunkReference &chunk)
{
MSPUB_DEBUG_MSG(("parseShape: seqNum 0x%x\n", chunk.seqNum));
@@ -702,14 +702,14 @@ bool libmspub::MSPUBParser::parseShape(WPXInputStream *input,
std::vector<unsigned> columnOffsetsInEmu;
unsigned rowFirstOffset = 0;
unsigned columnFirstOffset = 0;
- input->seek(rcao, WPX_SEEK_SET);
+ input->seek(rcao, librevenge::RVNG_SEEK_SET);
unsigned arrayLength = readU32(input);
while(stillReading(input, rcao + arrayLength))
{
MSPUBBlockInfo info = parseBlock(input, true);
if (info.id == 0)
{
- input->seek(info.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(info.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, info.dataOffset + info.dataLength))
{
MSPUBBlockInfo subInfo = parseBlock(input, true);
@@ -831,7 +831,7 @@ bool libmspub::MSPUBParser::parseShape(WPXInputStream *input,
}
}
-libmspub::QuillChunkReference libmspub::MSPUBParser::parseQuillChunkReference(WPXInputStream *input)
+libmspub::QuillChunkReference libmspub::MSPUBParser::parseQuillChunkReference(librevenge::RVNGInputStream *input)
{
libmspub::QuillChunkReference ret;
readU16(input); //FIXME: Can we do something sensible if this is not 0x18 ?
@@ -843,7 +843,7 @@ libmspub::QuillChunkReference libmspub::MSPUBParser::parseQuillChunkReference(WP
name[4] = '\0';
ret.name = name;
ret.id = readU16(input);
- input->seek(input->tell() + 4, WPX_SEEK_SET); //Seek past what is normally 0x01000000. We don't know what this represents.
+ input->seek(input->tell() + 4, librevenge::RVNG_SEEK_SET); //Seek past what is normally 0x01000000. We don't know what this represents.
char name2[5];
for (int i = 0; i < 4; ++i)
{
@@ -857,11 +857,11 @@ libmspub::QuillChunkReference libmspub::MSPUBParser::parseQuillChunkReference(WP
}
std::vector<unsigned> libmspub::MSPUBParser::parseTableCellDefinitions(
- WPXInputStream *input, const QuillChunkReference &chunk)
+ librevenge::RVNGInputStream *input, const QuillChunkReference &chunk)
{
std::vector<unsigned> ret;
unsigned numElements = readU32(input) + 1;
- input->seek(chunk.offset + 0xC, WPX_SEEK_SET);
+ input->seek(chunk.offset + 0xC, librevenge::RVNG_SEEK_SET);
for (unsigned i = 0; i < numElements; ++i)
{
ret.push_back(readU32(input));
@@ -874,14 +874,14 @@ std::vector<unsigned> libmspub::MSPUBParser::parseTableCellDefinitions(
return ret;
}
-bool libmspub::MSPUBParser::parseQuill(WPXInputStream *input)
+bool libmspub::MSPUBParser::parseQuill(librevenge::RVNGInputStream *input)
{
MSPUB_DEBUG_MSG(("MSPUBParser::parseQuill\n"));
unsigned chunkReferenceListOffset = 0x18;
std::list<QuillChunkReference> chunkReferences;
while (chunkReferenceListOffset != 0xffffffff)
{
- input->seek(chunkReferenceListOffset + 2, WPX_SEEK_SET);
+ input->seek(chunkReferenceListOffset + 2, librevenge::RVNG_SEEK_SET);
unsigned short numChunks = readU16(input);
chunkReferenceListOffset = readU32(input);
for (unsigned i = 0; i < numChunks; ++i)
@@ -914,9 +914,9 @@ bool libmspub::MSPUBParser::parseQuill(WPXInputStream *input)
}
else if (i->name == "STRS")
{
- input->seek(i->offset, WPX_SEEK_SET);
+ input->seek(i->offset, librevenge::RVNG_SEEK_SET);
unsigned numLengths = readU32(input); //Assuming the first DWORD is the number of children and that the next is the remaining length before children start. We are unsure that this is correct.
- input->seek(4 + i->offset + readU32(input), WPX_SEEK_SET);
+ input->seek(4 + i->offset + readU32(input), librevenge::RVNG_SEEK_SET);
for (unsigned j = 0; j < numLengths; ++j)
{
unsigned length = readU32(input);
@@ -928,7 +928,7 @@ bool libmspub::MSPUBParser::parseQuill(WPXInputStream *input)
}
else if (i->name == "SYID")
{
- input->seek(i->offset, WPX_SEEK_SET);
+ input->seek(i->offset, librevenge::RVNG_SEEK_SET);
readU32(input); // Don't know what the first DWORD means.
unsigned numIDs = readU32(input);
for (unsigned j = 0; j < numIDs; ++j)
@@ -939,19 +939,19 @@ bool libmspub::MSPUBParser::parseQuill(WPXInputStream *input)
}
else if (i->name == "PL ")
{
- input->seek(i->offset, WPX_SEEK_SET);
+ input->seek(i->offset, librevenge::RVNG_SEEK_SET);
parseColors(input, *i);
}
else if (i->name == "FDPC")
{
- input->seek(i->offset, WPX_SEEK_SET);
+ input->seek(i->offset, librevenge::RVNG_SEEK_SET);
std::vector<TextSpanReference> thisBlockSpans = parseCharacterStyles(input, *i);
spans.insert(spans.end(), thisBlockSpans.begin(), thisBlockSpans.end());
parsedFdpc |= !thisBlockSpans.empty();
}
else if (i->name == "FDPP")
{
- input->seek(i->offset, WPX_SEEK_SET);
+ input->seek(i->offset, librevenge::RVNG_SEEK_SET);
std::vector<TextParagraphReference> thisBlockParas = parseParagraphStyles(input, *i);
paras.insert(paras.end(), thisBlockParas.begin(), thisBlockParas.end());
parsedFdpp |= !thisBlockParas.empty();
@@ -960,27 +960,27 @@ bool libmspub::MSPUBParser::parseQuill(WPXInputStream *input)
{
if (whichStsh++ == 1)
{
- input->seek(i->offset, WPX_SEEK_SET);
+ input->seek(i->offset, librevenge::RVNG_SEEK_SET);
parseDefaultStyle(input, *i);
parsedStsh = true;
}
}
else if (i->name == "FONT")
{
- input->seek(i->offset, WPX_SEEK_SET);
+ input->seek(i->offset, librevenge::RVNG_SEEK_SET);
parseFonts(input, *i);
parsedFont = true;
}
else if (i->name == "TCD ")
{
- input->seek(i->offset, WPX_SEEK_SET);
+ input->seek(i->offset, librevenge::RVNG_SEEK_SET);
std::vector<unsigned> ends = parseTableCellDefinitions(input, *i);
m_collector->setNextTableCellTextEnds(ends);
}
}
if (parsedStrs && parsedSyid && parsedFdpc && parsedFdpp && parsedStsh && parsedFont && textChunkReference != chunkReferences.end())
{
- input->seek(textChunkReference->offset, WPX_SEEK_SET);
+ input->seek(textChunkReference->offset, librevenge::RVNG_SEEK_SET);
unsigned bytesRead = 0;
std::vector<TextSpanReference>::iterator currentTextSpan = spans.begin();
std::vector<TextParagraphReference>::iterator currentTextPara = paras.begin();
@@ -1041,11 +1041,11 @@ bool libmspub::MSPUBParser::parseQuill(WPXInputStream *input)
return true;
}
-void libmspub::MSPUBParser::parseFonts(WPXInputStream *input, const QuillChunkReference &)
+void libmspub::MSPUBParser::parseFonts(librevenge::RVNGInputStream *input, const QuillChunkReference &)
{
readU32(input);
unsigned numElements = readU32(input);
- input->seek(input->tell() + 12 + 4 * numElements, WPX_SEEK_SET);
+ input->seek(input->tell() + 12 + 4 * numElements, librevenge::RVNG_SEEK_SET);
for (unsigned i = 0; i < numElements; ++i)
{
unsigned short nameLength = readU16(input);
@@ -1059,11 +1059,11 @@ void libmspub::MSPUBParser::parseFonts(WPXInputStream *input, const QuillChunkRe
}
}
-void libmspub::MSPUBParser::parseDefaultStyle(WPXInputStream *input, const QuillChunkReference &chunk)
+void libmspub::MSPUBParser::parseDefaultStyle(librevenge::RVNGInputStream *input, const QuillChunkReference &chunk)
{
readU32(input);
unsigned numElements = readU32(input);
- input->seek(input->tell() + 12, WPX_SEEK_SET);
+ input->seek(input->tell() + 12, librevenge::RVNG_SEEK_SET);
std::vector<unsigned> offsets;
offsets.reserve(numElements);
for (unsigned i = 0; i < numElements; ++i)
@@ -1072,7 +1072,7 @@ void libmspub::MSPUBParser::parseDefaultStyle(WPXInputStream *input, const Quill
}
for (unsigned i = 0; i < numElements; ++i)
{
- input->seek(chunk.offset + 20 + offsets[i], WPX_SEEK_SET);
+ input->seek(chunk.offset + 20 + offsets[i], librevenge::RVNG_SEEK_SET);
readU16(input);
if (i % 2 == 0)
{
@@ -1087,10 +1087,10 @@ void libmspub::MSPUBParser::parseDefaultStyle(WPXInputStream *input, const Quill
}
-void libmspub::MSPUBParser::parseColors(WPXInputStream *input, const QuillChunkReference &)
+void libmspub::MSPUBParser::parseColors(librevenge::RVNGInputStream *input, const QuillChunkReference &)
{
unsigned numEntries = readU32(input);
- input->seek(input->tell() + 8, WPX_SEEK_SET);
+ input->seek(input->tell() + 8, librevenge::RVNG_SEEK_SET);
for (unsigned i = 0; i < numEntries; ++i)
{
unsigned blocksOffset = input->tell();
@@ -1106,11 +1106,11 @@ void libmspub::MSPUBParser::parseColors(WPXInputStream *input, const QuillChunkR
}
}
-std::vector<libmspub::MSPUBParser::TextParagraphReference> libmspub::MSPUBParser::parseParagraphStyles(WPXInputStream *input, const QuillChunkReference &chunk)
+std::vector<libmspub::MSPUBParser::TextParagraphReference> libmspub::MSPUBParser::parseParagraphStyles(librevenge::RVNGInputStream *input, const QuillChunkReference &chunk)
{
std::vector<TextParagraphReference> ret;
unsigned short numEntries = readU16(input);
- input->seek(input->tell() + 6, WPX_SEEK_SET);
+ input->seek(input->tell() + 6, librevenge::RVNG_SEEK_SET);
std::vector<unsigned> textOffsets;
textOffsets.reserve(numEntries);
std::vector<unsigned short> chunkOffsets;
@@ -1126,7 +1126,7 @@ std::vector<libmspub::MSPUBParser::TextParagraphReference> libmspub::MSPUBParser
unsigned currentSpanBegin = 0;
for (unsigned short i = 0; i < numEntries; ++i)
{
- input->seek(chunk.offset + chunkOffsets[i], WPX_SEEK_SET);
+ input->seek(chunk.offset + chunkOffsets[i], librevenge::RVNG_SEEK_SET);
ParagraphStyle style = getParagraphStyle(input);
ret.push_back(TextParagraphReference(currentSpanBegin, textOffsets[i], style));
currentSpanBegin = textOffsets[i] + 1;
@@ -1134,10 +1134,10 @@ std::vector<libmspub::MSPUBParser::TextParagraphReference> libmspub::MSPUBParser
return ret;
}
-std::vector<libmspub::MSPUBParser::TextSpanReference> libmspub::MSPUBParser::parseCharacterStyles(WPXInputStream *input, const QuillChunkReference &chunk)
+std::vector<libmspub::MSPUBParser::TextSpanReference> libmspub::MSPUBParser::parseCharacterStyles(librevenge::RVNGInputStream *input, const QuillChunkReference &chunk)
{
unsigned short numEntries = readU16(input);
- input->seek(input->tell() + 6, WPX_SEEK_SET);
+ input->seek(input->tell() + 6, librevenge::RVNG_SEEK_SET);
std::vector<unsigned> textOffsets;
textOffsets.reserve(numEntries);
std::vector<unsigned short> chunkOffsets;
@@ -1154,14 +1154,14 @@ std::vector<libmspub::MSPUBParser::TextSpanReference> libmspub::MSPUBParser::par
unsigned currentSpanBegin = 0;
for (unsigned short i = 0; i < numEntries; ++i)
{
- input->seek(chunk.offset + chunkOffsets[i], WPX_SEEK_SET);
+ input->seek(chunk.offset + chunkOffsets[i], librevenge::RVNG_SEEK_SET);
CharacterStyle style = getCharacterStyle(input);
currentSpanBegin = textOffsets[i] + 1;
ret.push_back(TextSpanReference(currentSpanBegin, textOffsets[i], style));
}
return ret;
}
-libmspub::ParagraphStyle libmspub::MSPUBParser::getParagraphStyle(WPXInputStream *input)
+libmspub::ParagraphStyle libmspub::MSPUBParser::getParagraphStyle(librevenge::RVNGInputStream *input)
{
ParagraphStyle ret;
@@ -1218,19 +1218,19 @@ libmspub::ParagraphStyle libmspub::MSPUBParser::getParagraphStyle(WPXInputStream
ret.m_rightIndentEmu = info.data;
break;
case PARAGRAPH_TABS:
- input->seek(info.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(info.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while(stillReading(input, info.dataOffset + info.dataLength))
{
MSPUBBlockInfo tabArrayInfo = parseBlock(input, true);
if (tabArrayInfo.id == TAB_ARRAY)
{
- input->seek(tabArrayInfo.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(tabArrayInfo.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, tabArrayInfo.dataOffset + tabArrayInfo.dataLength))
{
MSPUBBlockInfo tabEntryInfo = parseBlock(input, true);
if (tabEntryInfo.type == GENERAL_CONTAINER)
{
- input->seek(tabEntryInfo.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(tabEntryInfo.dataOffset + 4, librevenge::RVNG_SEEK_SET);
MSPUBBlockInfo tabInfo = parseBlock(input, true);
if (tabInfo.id == TAB_AMOUNT)
{
@@ -1244,7 +1244,7 @@ libmspub::ParagraphStyle libmspub::MSPUBParser::getParagraphStyle(WPXInputStream
case PARAGRAPH_LIST_INFO:
{
isList = true;
- input->seek(info.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(info.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, info.dataOffset + info.dataLength))
{
MSPUBBlockInfo listSubInfo = parseBlock(input, true);
@@ -1291,7 +1291,7 @@ libmspub::ParagraphStyle libmspub::MSPUBParser::getParagraphStyle(WPXInputStream
return ret;
}
-libmspub::CharacterStyle libmspub::MSPUBParser::getCharacterStyle(WPXInputStream *input)
+libmspub::CharacterStyle libmspub::MSPUBParser::getCharacterStyle(librevenge::RVNGInputStream *input)
{
bool seenUnderline = false, seenBold1 = false, seenBold2 = false, seenItalic1 = false, seenItalic2 = false;
int textSize1 = -1, /* textSize2 = -1,*/ colorIndex = -1;
@@ -1351,16 +1351,16 @@ libmspub::CharacterStyle libmspub::MSPUBParser::getCharacterStyle(WPXInputStream
return CharacterStyle(seenUnderline, seenItalic1 && seenItalic2, seenBold1 && seenBold2, dTextSize, getColorIndexByQuillEntry(colorIndex), fontIndex, sst);
}
-unsigned libmspub::MSPUBParser::getFontIndex(WPXInputStream *input, const MSPUBBlockInfo &info)
+unsigned libmspub::MSPUBParser::getFontIndex(librevenge::RVNGInputStream *input, const MSPUBBlockInfo &info)
{
MSPUB_DEBUG_MSG(("In getFontIndex\n"));
- input->seek(info.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(info.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, info.dataOffset + info.dataLength))
{
MSPUBBlockInfo subInfo = parseBlock(input, true);
if (subInfo.type == GENERAL_CONTAINER)
{
- input->seek(subInfo.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(subInfo.dataOffset + 4, librevenge::RVNG_SEEK_SET);
if (stillReading(input, subInfo.dataOffset + subInfo.dataLength))
{
MSPUBBlockInfo subSubInfo = parseBlock(input, true);
@@ -1372,9 +1372,9 @@ unsigned libmspub::MSPUBParser::getFontIndex(WPXInputStream *input, const MSPUBB
return 0;
}
-int libmspub::MSPUBParser::getColorIndex(WPXInputStream *input, const MSPUBBlockInfo &info)
+int libmspub::MSPUBParser::getColorIndex(librevenge::RVNGInputStream *input, const MSPUBBlockInfo &info)
{
- input->seek(info.dataOffset + 4, WPX_SEEK_SET);
+ input->seek(info.dataOffset + 4, librevenge::RVNG_SEEK_SET);
while (stillReading(input, info.dataOffset + info.dataLength))
{
MSPUBBlockInfo subInfo = parseBlock(input, true);
@@ -1389,7 +1389,7 @@ int libmspub::MSPUBParser::getColorIndex(WPXInputStream *input, const MSPUBBlock
return -1;
}
-bool libmspub::MSPUBParser::parseEscher(WPXInputStream *input)
+bool libmspub::MSPUBParser::parseEscher(librevenge::RVNGInputStream *input)
{
MSPUB_DEBUG_MSG(("MSPUBParser::parseEscher\n"));
libmspub::EscherContainerInfo fakeroot;
@@ -1408,7 +1408,7 @@ bool libmspub::MSPUBParser::parseEscher(WPXInputStream *input)
while (stillReading(input, bsc.contentsOffset + bsc.contentsLength))
{
unsigned begin = input->tell();
- input->seek(begin + 10, WPX_SEEK_SET);
+ input->seek(begin + 10, librevenge::RVNG_SEEK_SET);
if (! (readU32(input) == 0 && readU32(input) == 0 && readU32(input) == 0 && readU32(input) == 0))
{
m_escherDelayIndices.push_back(currentDelayIndex++);
@@ -1417,10 +1417,10 @@ bool libmspub::MSPUBParser::parseEscher(WPXInputStream *input)
{
m_escherDelayIndices.push_back(-1);
}
- input->seek(begin + 44, WPX_SEEK_SET);
+ input->seek(begin + 44, librevenge::RVNG_SEEK_SET);
}
}
- input->seek(dgg.contentsOffset + dgg.contentsLength + getEscherElementTailLength(OFFICE_ART_DGG_CONTAINER), WPX_SEEK_SET);
+ input->seek(dgg.contentsOffset + dgg.contentsLength + getEscherElementTailLength(OFFICE_ART_DGG_CONTAINER), librevenge::RVNG_SEEK_SET);
}
while (findEscherContainer(input, fakeroot, dg, OFFICE_ART_DG_CONTAINER))
{
@@ -1430,12 +1430,12 @@ bool libmspub::MSPUBParser::parseEscher(WPXInputStream *input)
Coordinate c1, c2;
parseShapeGroup(input, spgr, c1, c2);
}
- input->seek(input->tell() + getEscherElementTailLength(OFFICE_ART_DG_CONTAINER), WPX_SEEK_SET);
+ input->seek(input->tell() + getEscherElementTailLength(OFFICE_ART_DG_CONTAINER), librevenge::RVNG_SEEK_SET);
}
return true;
}
-void libmspub::MSPUBParser::parseShapeGroup(WPXInputStream *input, const EscherContainerInfo &spgr, Coordinate parentCoordinateSystem, Coordinate parentGroupAbsoluteCoord)
+void libmspub::MSPUBParser::parseShapeGroup(librevenge::RVNGInputStream *input, const EscherContainerInfo &spgr, Coordinate parentCoordinateSystem, Coordinate parentGroupAbsoluteCoord)
{
libmspub::EscherContainerInfo shapeOrGroup;
std::set<unsigned short> types;
@@ -1454,11 +1454,11 @@ void libmspub::MSPUBParser::parseShapeGroup(WPXInputStream *input, const EscherC
parseEscherShape(input, shapeOrGroup, parentCoordinateSystem, parentGroupAbsoluteCoord);
break;
}
- input->seek(shapeOrGroup.contentsOffset + shapeOrGroup.contentsLength + getEscherElementTailLength(shapeOrGroup.type), WPX_SEEK_SET);
+ input->seek(shapeOrGroup.contentsOffset + shapeOrGroup.contentsLength + getEscherElementTailLength(shapeOrGroup.type), librevenge::RVNG_SEEK_SET);
}
}
-void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const EscherContainerInfo &sp, Coordinate &parentCoordinateSystem, Coordinate &parentGroupAbsoluteCoord)
+void libmspub::MSPUBParser::parseEscherShape(librevenge::RVNGInputStream *input, const EscherContainerInfo &sp, Coordinate &parentCoordinateSystem, Coordinate &parentGroupAbsoluteCoord)
{
Coordinate thisParentCoordinateSystem = parentCoordinateSystem;
bool definesRelativeCoordinates = false;
@@ -1473,23 +1473,23 @@ void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
ShapeType st = RECTANGLE;
if (findEscherContainer(input, sp, cFspgr, OFFICE_ART_FSPGR))
{
- input->seek(cFspgr.contentsOffset, WPX_SEEK_SET);
+ input->seek(cFspgr.contentsOffset, librevenge::RVNG_SEEK_SET);
parentCoordinateSystem.m_xs = readU32(input);
parentCoordinateSystem.m_ys = readU32(input);
parentCoordinateSystem.m_xe = readU32(input);
parentCoordinateSystem.m_ye = readU32(input);
definesRelativeCoordinates = true;
}
- input->seek(sp.contentsOffset, WPX_SEEK_SET);
+ input->seek(sp.contentsOffset, librevenge::RVNG_SEEK_SET);
if (findEscherContainer(input, sp, cFsp, OFFICE_ART_FSP))
{
st = (ShapeType)(cFsp.initial >> 4);
std::map<unsigned short, unsigned> fspData = extractEscherValues(input, cFsp);
- input->seek(cFsp.contentsOffset + 4, WPX_SEEK_SET);
+ input->seek(cFsp.contentsOffset + 4, librevenge::RVNG_SEEK_SET);
shapeFlags = readU32(input);
isGroupLeader = shapeFlags & SF_GROUP;
}
- input->seek(sp.contentsOffset, WPX_SEEK_SET);
+ input->seek(sp.contentsOffset, librevenge::RVNG_SEEK_SET);
if (findEscherContainer(input, sp, cData, OFFICE_ART_CLIENT_DATA))
{
std::map<unsigned short, unsigned> dataValues = extractEscherValues(input, cData);
@@ -1498,7 +1498,7 @@ void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
{
m_collector->setShapeType(*shapeSeqNum, st);
m_collector->setShapeFlip(*shapeSeqNum, shapeFlags & SF_FLIP_V, shapeFlags & SF_FLIP_H);
- input->seek(sp.contentsOffset, WPX_SEEK_SET);
+ input->seek(sp.contentsOffset, librevenge::RVNG_SEEK_SET);
if (isGroupLeader)
{
m_collector->setCurrentGroupSeqNum(*shapeSeqNum);
@@ -1516,7 +1516,7 @@ void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
bool rotated90 = false;
MSPUB_DEBUG_MSG(("Found Escher data for %s of seqnum 0x%x\n", isGroupLeader ? "group" : "shape", *shapeSeqNum));
boost::optional<std::map<unsigned short, unsigned> > maybe_tertiaryFoptValues;
- input->seek(sp.contentsOffset, WPX_SEEK_SET);
+ input->seek(sp.contentsOffset, librevenge::RVNG_SEEK_SET);
if (findEscherContainer(input, sp, cTertiaryFopt, OFFICE_ART_TERTIARY_FOPT))
{
maybe_tertiaryFoptValues = extractEscherValues(input, cTertiaryFopt);
@@ -1533,7 +1533,7 @@ void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
ColorReference(*ptr_pictureRecolor));
}
}
- input->seek(sp.contentsOffset, WPX_SEEK_SET);
+ input->seek(sp.contentsOffset, librevenge::RVNG_SEEK_SET);
if (findEscherContainer(input, sp, cFopt, OFFICE_ART_FOPT))
{
FOPTValues foptValues = extractFOPTValues(input, cFopt);
@@ -1809,7 +1809,7 @@ void libmspub::MSPUBParser::parseEscherShape(WPXInputStream *input, const Escher
}
else if (cAnchor.type == OFFICE_ART_CHILD_ANCHOR)
{
- input->seek(cAnchor.contentsOffset, WPX_SEEK_SET);
+ input->seek(cAnchor.contentsOffset, librevenge::RVNG_SEEK_SET);
int coordSystemWidth = thisParentCoordinateSystem.m_xe - thisParentCoordinateSystem.m_xs;
int coordSystemHeight = thisParentCoordinateSystem.m_ye - thisParentCoordinateSystem.m_ys;
int groupWidth = parentGroupAbsoluteCoord.m_xe - parentGroupAbsoluteCoord.m_xs;
@@ -2145,7 +2145,7 @@ unsigned libmspub::MSPUBParser::getEscherElementAdditionalHeaderLength(unsigned
return 0;
}
-bool libmspub::MSPUBParser::findEscherContainerWithTypeInSet(WPXInputStream *input, const libmspub::EscherContainerInfo &parent, libmspub::EscherContainerInfo &out, std::set<unsigned short> types)
+bool libmspub::MSPUBParser::findEscherContainerWithTypeInSet(librevenge::RVNGInputStream *input, const libmspub::EscherContainerInfo &parent, libmspub::EscherContainerInfo &out, std::set<unsigned short> types)
{
while (stillReading(input, parent.contentsOffset + parent.contentsLength))
{
@@ -2155,12 +2155,12 @@ bool libmspub::MSPUBParser::findEscherContainerWithTypeInSet(WPXInputStream *inp
out = next;
return true;
}
- input->seek(next.contentsOffset + next.contentsLength + getEscherElementTailLength(next.type), WPX_SEEK_SET);
+ input->seek(next.contentsOffset + next.contentsLength + getEscherElementTailLength(next.type), librevenge::RVNG_SEEK_SET);
}
return false;
}
-bool libmspub::MSPUBParser::findEscherContainer(WPXInputStream *input, const libmspub::EscherContainerInfo &parent, libmspub::EscherContainerInfo &out, unsigned short desiredType)
+bool libmspub::MSPUBParser::findEscherContainer(librevenge::RVNGInputStream *input, const libmspub::EscherContainerInfo &parent, libmspub::EscherContainerInfo &out, unsigned short desiredType)
{
MSPUB_DEBUG_MSG(("At offset 0x%lx, attempting to find escher container of type 0x%x\n", input->tell(), desiredType));
while (stillReading(input, parent.contentsOffset + parent.contentsLength))
@@ -2171,15 +2171,15 @@ bool libmspub::MSPUBParser::findEscherContainer(WPXInputStream *input, const lib
out = next;
return true;
}
- input->seek(next.contentsOffset + next.contentsLength + getEscherElementTailLength(next.type), WPX_SEEK_SET);
+ input->seek(next.contentsOffset + next.contentsLength + getEscherElementTailLength(next.type), librevenge::RVNG_SEEK_SET);
}
return false;
}
-libmspub::FOPTValues libmspub::MSPUBParser::extractFOPTValues(WPXInputStream *input, const libmspub::EscherContainerInfo &record)
+libmspub::FOPTValues libmspub::MSPUBParser::extractFOPTValues(librevenge::RVNGInputStream *input, const libmspub::EscherContainerInfo &record)
{
FOPTValues ret;
- input->seek(record.contentsOffset, WPX_SEEK_SET);
+ input->seek(record.contentsOffset, librevenge::RVNG_SEEK_SET);
unsigned short numValues = record.initial >> 4;
std::vector<unsigned short> complexIds;
for (unsigned short i = 0; i < numValues; ++i)
@@ -2210,22 +2210,22 @@ libmspub::FOPTValues libmspub::MSPUBParser::extractFOPTValues(WPXInputStream *in
continue;
}
unsigned short numEntries = readU16(input);
- input->seek(2, WPX_SEEK_CUR);
+ input->seek(2, librevenge::RVNG_SEEK_CUR);
unsigned short entryLength = readU16(input);
if (entryLength == 0xFFF0)
{
entryLength = 4;
}
- input->seek(-6, WPX_SEEK_CUR);
+ input->seek(-6, librevenge::RVNG_SEEK_CUR);
readNBytes(input, static_cast<unsigned long>(entryLength) * numEntries + 6, ret.m_complexValues[id]);
}
return ret;
}
-std::map<unsigned short, unsigned> libmspub::MSPUBParser::extractEscherValues(WPXInputStream *input, const libmspub::EscherContainerInfo &record)
+std::map<unsigned short, unsigned> libmspub::MSPUBParser::extractEscherValues(librevenge::RVNGInputStream *input, const libmspub::EscherContainerInfo &record)
{
std::map<unsigned short, unsigned> ret;
- input->seek(record.contentsOffset + getEscherElementAdditionalHeaderLength(record.type), WPX_SEEK_SET);
+ input->seek(record.contentsOffset + getEscherElementAdditionalHeaderLength(record.type), librevenge::RVNG_SEEK_SET);
while (stillReading(input, record.contentsOffset + record.contentsLength))
{
unsigned short id = readU16(input);
@@ -2236,7 +2236,7 @@ std::map<unsigned short, unsigned> libmspub::MSPUBParser::extractEscherValues(WP
}
-bool libmspub::MSPUBParser::parseContentChunkReference(WPXInputStream *input, const libmspub::MSPUBBlockInfo block)
+bool libmspub::MSPUBParser::parseContentChunkReference(librevenge::RVNGInputStream *input, const libmspub::MSPUBBlockInfo block)
{
//input should be at block.dataOffset + 4 , that is, at the beginning of the list of sub-blocks
MSPUB_DEBUG_MSG(("Parsing chunk reference 0x%x\n", m_lastSeenSeqNum));
@@ -2331,12 +2331,12 @@ bool libmspub::MSPUBParser::isBlockDataString(unsigned type)
{
return type == STRING_CONTAINER;
}
-void libmspub::MSPUBParser::skipBlock(WPXInputStream *input, libmspub::MSPUBBlockInfo block)
+void libmspub::MSPUBParser::skipBlock(librevenge::RVNGInputStream *input, libmspub::MSPUBBlockInfo block)
{
- input->seek(block.dataOffset + block.dataLength, WPX_SEEK_SET);
+ input->seek(block.dataOffset + block.dataLength, librevenge::RVNG_SEEK_SET);
}
-libmspub::EscherContainerInfo libmspub::MSPUBParser::parseEscherContainer(WPXInputStream *input)
+libmspub::EscherContainerInfo libmspub::MSPUBParser::parseEscherContainer(librevenge::RVNGInputStream *input)
{
libmspub::EscherContainerInfo info;
info.initial = readU16(input);
@@ -2347,7 +2347,7 @@ libmspub::EscherContainerInfo libmspub::MSPUBParser::parseEscherContainer(WPXInp
return info;
}
-libmspub::MSPUBBlockInfo libmspub::MSPUBParser::parseBlock(WPXInputStream *input, bool skipHierarchicalData)
+libmspub::MSPUBBlockInfo libmspub::MSPUBParser::parseBlock(librevenge::RVNGInputStream *input, bool skipHierarchicalData)
{
libmspub::MSPUBBlockInfo info;
info.startPosition = input->tell();
@@ -2411,7 +2411,7 @@ libmspub::PageType libmspub::MSPUBParser::getPageTypeBySeqNum(unsigned seqNum)
}
}
-bool libmspub::MSPUBParser::parsePaletteChunk(WPXInputStream *input, const ContentChunkReference &chunk)
+bool libmspub::MSPUBParser::parsePaletteChunk(librevenge::RVNGInputStream *input, const ContentChunkReference &chunk)
{
unsigned length = readU32(input);
while (stillReading(input, chunk.offset + length))
@@ -2438,7 +2438,7 @@ bool libmspub::MSPUBParser::parsePaletteChunk(WPXInputStream *input, const Conte
return true;
}
-void libmspub::MSPUBParser::parsePaletteEntry(WPXInputStream *input, MSPUBBlockInfo info)
+void libmspub::MSPUBParser::parsePaletteEntry(librevenge::RVNGInputStream *input, MSPUBBlockInfo info)
{
while (stillReading(input, info.dataOffset + info.dataLength))
{
diff --git a/src/lib/MSPUBParser.h b/src/lib/MSPUBParser.h
index d7f2514..7f698e6 100644
--- a/src/lib/MSPUBParser.h
+++ b/src/lib/MSPUBParser.h
@@ -38,16 +38,14 @@
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
+#include <librevenge/librevenge.h>
+#include <librevenge/librevenge.h>
#include "MSPUBTypes.h"
#include "Fill.h"
#include "Coordinate.h"
#include "PolygonUtils.h"
-class WPXInputStream;
-
namespace libmspub
{
class MSPUBCollector;
@@ -85,7 +83,7 @@ struct FOPTValues
class MSPUBParser
{
public:
- explicit MSPUBParser(WPXInputStream *input, MSPUBCollector *collector);
+ explicit MSPUBParser(librevenge::RVNGInputStream *input, MSPUBCollector *collector);
virtual ~MSPUBParser();
virtual bool parse();
protected:
@@ -112,44 +110,44 @@ protected:
MSPUBParser();
MSPUBParser(const MSPUBParser &);
MSPUBParser &operator=(const MSPUBParser &);
- virtual bool parseContents(WPXInputStream *input);
- bool parseQuill(WPXInputStream *input);
- bool parseEscher(WPXInputStream *input);
- bool parseEscherDelay(WPXInputStream *input);
-
- MSPUBBlockInfo parseBlock(WPXInputStream *input, bool skipHierarchicalData = false);
- EscherContainerInfo parseEscherContainer(WPXInputStream *input);
-
- bool parseContentChunkReference(WPXInputStream *input, MSPUBBlockInfo block);
- QuillChunkReference parseQuillChunkReference(WPXInputStream *input);
- bool parseDocumentChunk(WPXInputStream *input, const ContentChunkReference &chunk);
- bool parsePageChunk(WPXInputStream *input, const ContentChunkReference &chunk);
- bool parsePaletteChunk(WPXInputStream *input, const ContentChunkReference &chunk);
- bool parsePageShapeList(WPXInputStream *input, MSPUBBlockInfo block, unsigned pageSeqNum);
- bool parseShape(WPXInputStream *input, const ContentChunkReference &chunk);
- bool parseBorderArtChunk(WPXInputStream *input,
+ virtual bool parseContents(librevenge::RVNGInputStream *input);
+ bool parseQuill(librevenge::RVNGInputStream *input);
+ bool parseEscher(librevenge::RVNGInputStream *input);
+ bool parseEscherDelay(librevenge::RVNGInputStream *input);
+
+ MSPUBBlockInfo parseBlock(librevenge::RVNGInputStream *input, bool skipHierarchicalData = false);
+ EscherContainerInfo parseEscherContainer(librevenge::RVNGInputStream *input);
+
+ bool parseContentChunkReference(librevenge::RVNGInputStream *input, MSPUBBlockInfo block);
+ QuillChunkReference parseQuillChunkReference(librevenge::RVNGInputStream *input);
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list