From 3c0341fb5cf37c363e7788a7f4ab7c2bead47f2d Mon Sep 17 00:00:00 2001 From: David Tardon Date: Sat, 7 Dec 2013 20:25:36 +0100 Subject: switch to librevenge --- build/win32/libpgplus.dsp | 8 +- build/win32/ppp2raw.dsp | 16 +- build/win32/ppp2xhtml.dsp | 16 +- configure.ac | 29 +- inc/libpgplus/Makefile.am | 3 +- inc/libpgplus/PGPLUSDocument.h | 13 +- inc/libpgplus/PGPLUSStringVector.h | 60 ---- inc/libpgplus/libpgplus.h | 3 +- libpgplus-0.0.pc.in | 2 +- libpgplus.spec.in | 4 +- src/conv/raw/Makefile.am | 6 +- src/conv/raw/ppp2raw.cpp | 191 +----------- src/conv/svg/Makefile.am | 6 +- src/conv/svg/ppp2xhtml.cpp | 12 +- src/lib/Makefile.am | 10 +- src/lib/PGPLUSCollector.cpp | 2 +- src/lib/PGPLUSCollector.h | 11 +- src/lib/PGPLUSDocument.cpp | 21 +- src/lib/PGPLUSParser.cpp | 4 +- src/lib/PGPLUSParser.h | 10 +- src/lib/PGPLUSSVGGenerator.cpp | 603 ------------------------------------- src/lib/PGPLUSSVGGenerator.h | 88 ------ src/lib/PGPLUSStringVector.cpp | 93 ------ src/lib/libpgplus_utils.cpp | 12 +- src/lib/libpgplus_utils.h | 14 +- src/lib/makefile.mk | 43 --- 26 files changed, 92 insertions(+), 1188 deletions(-) delete mode 100644 inc/libpgplus/PGPLUSStringVector.h delete mode 100644 src/lib/PGPLUSSVGGenerator.cpp delete mode 100644 src/lib/PGPLUSSVGGenerator.h delete mode 100644 src/lib/PGPLUSStringVector.cpp delete mode 100644 src/lib/makefile.mk diff --git a/build/win32/libpgplus.dsp b/build/win32/libpgplus.dsp index 318ed46..7f5d34b 100644 --- a/build/win32/libpgplus.dsp +++ b/build/win32/libpgplus.dsp @@ -40,8 +40,8 @@ RSC=rc.exe # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /I "libwpd-0.9" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "libwpd-0.9" /D "NDEBUG" /D "WIN32" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /FD /c +# ADD BASE CPP /nologo /W3 /GX /O2 /I "librevenge-0.0" /D "WIN32" /D "NDEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "librevenge-0.0" /D "NDEBUG" /D "WIN32" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -64,8 +64,8 @@ LIB32=link.exe -lib # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "libwpd-0.9" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GR /GX /ZI /Od /I "libwpd-0.9" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /FD /GZ /c +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "librevenge-0.0" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /GR /GX /ZI /Od /I "librevenge-0.0" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" diff --git a/build/win32/ppp2raw.dsp b/build/win32/ppp2raw.dsp index d360ec3..f554991 100644 --- a/build/win32/ppp2raw.dsp +++ b/build/win32/ppp2raw.dsp @@ -44,16 +44,16 @@ RSC=rc.exe MTL=midl.exe # ADD BASE MTL /nologo /win32 # ADD MTL /nologo /win32 -# ADD BASE CPP /nologo /MT /W3 /GX /Zi /I "..\..\src\lib" /I "libwpd-0.9" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c -# ADD CPP /nologo /MT /W3 /GX /I "..\..\src\lib" /I "libwpd-0.9" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /c +# ADD BASE CPP /nologo /MT /W3 /GX /Zi /I "..\..\src\lib" /I "librevenge-0.0" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c +# ADD CPP /nologo /MT /W3 /GX /I "..\..\src\lib" /I "librevenge-0.0" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 libpgplus-0.0.lib libwpd-stream-0.9.lib libwpd-0.9.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\ppp2raw.exe" /libpath:"Release\lib" -# ADD LINK32 libpgplus-0.0.lib libwpd-stream-0.9.lib libwpd-0.9.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\ppp2raw.exe" /libpath:"Release\lib" +# ADD BASE LINK32 libpgplus-0.0.lib librevenge-stream-0.0.lib librevenge-0.0.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\ppp2raw.exe" /libpath:"Release\lib" +# ADD LINK32 libpgplus-0.0.lib librevenge-stream-0.0.lib librevenge-0.0.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\ppp2raw.exe" /libpath:"Release\lib" # SUBTRACT LINK32 /nodefaultlib !ELSEIF "$(CFG)" == "ppp2raw - Win32 Debug" @@ -72,16 +72,16 @@ LINK32=link.exe MTL=midl.exe # ADD BASE MTL /nologo /win32 # ADD MTL /nologo /win32 -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "\..\..\src\lib" /I "libwpd-0.9" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_CONSOLE" /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\src\lib" /I "libwpd-0.9" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_CONSOLE" /GZ /c +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "\..\..\src\lib" /I "librevenge-0.0" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_CONSOLE" /GZ /c +# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\src\lib" /I "librevenge-0.0" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_CONSOLE" /GZ /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 libpgplus-0.0.lib libwpd-stream-0.9.lib libwpd-0.9.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\ppp2raw.exe" /libpath:"Debug\lib" -# ADD LINK32 libpgplus-0.0.lib libwpd-stream-0.9.lib libwpd-0.9.lib kernel32.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\ppp2raw.exe" /libpath:"Debug\lib" +# ADD BASE LINK32 libpgplus-0.0.lib librevenge-stream-0.0.lib librevenge-0.0.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\ppp2raw.exe" /libpath:"Debug\lib" +# ADD LINK32 libpgplus-0.0.lib librevenge-stream-0.0.lib librevenge-0.0.lib kernel32.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\ppp2raw.exe" /libpath:"Debug\lib" # SUBTRACT LINK32 /nodefaultlib !ENDIF diff --git a/build/win32/ppp2xhtml.dsp b/build/win32/ppp2xhtml.dsp index a61471f..3817a7a 100644 --- a/build/win32/ppp2xhtml.dsp +++ b/build/win32/ppp2xhtml.dsp @@ -44,16 +44,16 @@ RSC=rc.exe MTL=midl.exe # ADD BASE MTL /nologo /win32 # ADD MTL /nologo /win32 -# ADD BASE CPP /nologo /MT /W3 /GX /Zi /I "..\..\src\lib" /I "libwpd-0.9" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c -# ADD CPP /nologo /MT /W3 /GX /I "..\..\src\lib" /I "libwpd-0.9" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /c +# ADD BASE CPP /nologo /MT /W3 /GX /Zi /I "..\..\src\lib" /I "librevenge-0.0" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c +# ADD CPP /nologo /MT /W3 /GX /I "..\..\src\lib" /I "librevenge-0.0" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 libpgplus-0.0.lib libwpd-stream-0.9.lib libwpd-0.9.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\ppp2xhtml.exe" /libpath:"Release\lib" -# ADD LINK32 libpgplus-0.0.lib libwpd-stream-0.9.lib libwpd-0.9.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\ppp2xhtml.exe" /libpath:"Release\lib" +# ADD BASE LINK32 libpgplus-0.0.lib librevenge-stream-0.0.lib librevenge-0.0.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\ppp2xhtml.exe" /libpath:"Release\lib" +# ADD LINK32 libpgplus-0.0.lib librevenge-stream-0.0.lib librevenge-0.0.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\ppp2xhtml.exe" /libpath:"Release\lib" # SUBTRACT LINK32 /nodefaultlib !ELSEIF "$(CFG)" == "ppp2xhtml - Win32 Debug" @@ -72,16 +72,16 @@ LINK32=link.exe MTL=midl.exe # ADD BASE MTL /nologo /win32 # ADD MTL /nologo /win32 -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\src\lib" /I "libwpd-0.9" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_CONSOLE" /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\src\lib" /I "libwpd-0.9" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_CONSOLE" /GZ /c +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\src\lib" /I "librevenge-0.0" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_CONSOLE" /GZ /c +# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\..\src\lib" /I "librevenge-0.0" /D "_DEBUG" /D "DEBUG" /D "WIN32" /D "_CONSOLE" /GZ /c # ADD BASE RSC /l 0x409 # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe -# ADD BASE LINK32 libpgplus-0.0.lib libwpd-stream-0.9.lib libwpd-0.9.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\ppp2xhtml.exe" /libpath:"Debug\lib" -# ADD LINK32 libpgplus-0.0.lib libwpd-stream-0.9.lib libwpd-0.9.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\ppp2xhtml.exe" /libpath:"Debug\lib" +# ADD BASE LINK32 libpgplus-0.0.lib librevenge-stream-0.0.lib librevenge-0.0.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\ppp2xhtml.exe" /libpath:"Debug\lib" +# ADD LINK32 libpgplus-0.0.lib librevenge-stream-0.0.lib librevenge-0.0.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\ppp2xhtml.exe" /libpath:"Debug\lib" # SUBTRACT LINK32 /nodefaultlib !ENDIF diff --git a/configure.ac b/configure.ac index 22003c8..7ac4aa0 100644 --- a/configure.ac +++ b/configure.ac @@ -33,19 +33,11 @@ AC_PROG_LIBTOOL AC_LIBTOOL_WIN32_DLL PKG_PROG_PKG_CONFIG([0.20]) -# =========== -# Find libwpd -# =========== -PKG_CHECK_MODULES([WPD],[ - libwpd-0.9 - libwpd-stream-0.9 -]) - -# =========== -# Find libwpg -# =========== -PKG_CHECK_MODULES([WPG],[ - libwpg-0.2 +# =============== +# Find librevenge +# =============== +PKG_CHECK_MODULES([REVENGE],[ + librevenge-0.0 ]) # ================================= @@ -186,6 +178,17 @@ AS_IF([test "x$with_docs" != "xno"], [ ], [build_docs=no]) AM_CONDITIONAL([WITH_LIBPGPLUS_DOCS], [test "x$build_docs" != "xno"]) +PKG_CHECK_MODULES([REVENGE_GENERATORS],[ + librevenge-generators-0.0 +]) +PKG_CHECK_MODULES([REVENGE_STREAM],[ + librevenge-stream-0.0 +]) +AC_SUBST([REVENGE_GENERATORS_CFLAGS]) +AC_SUBST([REVENGE_GENERATORS_LIBS]) +AC_SUBST([REVENGE_STREAM_CFLAGS]) +AC_SUBST([REVENGE_STREAM_LIBS]) + # ===================== # Prepare all .in files # ===================== diff --git a/inc/libpgplus/Makefile.am b/inc/libpgplus/Makefile.am index def5536..b3a1e9b 100644 --- a/inc/libpgplus/Makefile.am +++ b/inc/libpgplus/Makefile.am @@ -1,4 +1,3 @@ EXTRA_DIST = \ libpgplus.h \ - PGPLUSDocument.h \ - PGPLUSStringVector.h + PGPLUSDocument.h diff --git a/inc/libpgplus/PGPLUSDocument.h b/inc/libpgplus/PGPLUSDocument.h index 7ca2be1..acb4001 100644 --- a/inc/libpgplus/PGPLUSDocument.h +++ b/inc/libpgplus/PGPLUSDocument.h @@ -29,11 +29,8 @@ #ifndef __PGPLUSDOCUMENT_H__ #define __PGPLUSDOCUMENT_H__ -#include -#include -#include "PGPLUSStringVector.h" - -class WPXInputStream; +#include +#include namespace libpgplus { @@ -41,11 +38,9 @@ class PGPLUSDocument { 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, PGPLUSStringVector &output); + static bool parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter); }; } // namespace libpgplus diff --git a/inc/libpgplus/PGPLUSStringVector.h b/inc/libpgplus/PGPLUSStringVector.h deleted file mode 100644 index b18ec59..0000000 --- a/inc/libpgplus/PGPLUSStringVector.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* libpgplus - * 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 - * - * 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 __PGPLUSSTRINGVECTOR_H__ -#define __PGPLUSSTRINGVECTOR_H__ - -#include - -namespace libpgplus -{ -class PGPLUSStringVectorImpl; - -class PGPLUSStringVector -{ -public: - PGPLUSStringVector(); - PGPLUSStringVector(const PGPLUSStringVector &vec); - ~PGPLUSStringVector(); - - PGPLUSStringVector &operator=(const PGPLUSStringVector &vec); - - unsigned size() const; - bool empty() const; - const WPXString &operator[](unsigned idx) const; - void append(const WPXString &str); - void clear(); - -private: - PGPLUSStringVectorImpl *m_pImpl; -}; - -} // namespace libpgplus - -#endif /* __PGPLUSSTRINGVECTOR_H__ */ -/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/inc/libpgplus/libpgplus.h b/inc/libpgplus/libpgplus.h index 17453e2..adbf3bc 100644 --- a/inc/libpgplus/libpgplus.h +++ b/inc/libpgplus/libpgplus.h @@ -30,8 +30,7 @@ #define __LIBPGPLUS_H__ #include "PGPLUSDocument.h" -#include -#include +#include #endif /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/libpgplus-0.0.pc.in b/libpgplus-0.0.pc.in index 7c602d5..ee53e2c 100644 --- a/libpgplus-0.0.pc.in +++ b/libpgplus-0.0.pc.in @@ -6,6 +6,6 @@ includedir=@includedir@ Name: libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@ Description: Library for parsing the PagePlus file format structure Version: @VERSION@ -Requires: libwpd-0.9 libwpd-stream-0.9 libwpg-0.2 +Requires: librevenge-0.0 Libs: -L${libdir} -lpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@ Cflags: -I${includedir}/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@ diff --git a/libpgplus.spec.in b/libpgplus.spec.in index 5d098c2..ca4d166 100644 --- a/libpgplus.spec.in +++ b/libpgplus.spec.in @@ -11,7 +11,7 @@ Source: %{name}-%{version}.tar.gz Group: System Environment/Libraries URL: http://libpgplus.sf.net/ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot -BuildRequires: libwpd-devel >= 0.9.0, gcc-c++, libstdc++-devel, pkgconfig >= 0.9.0 +BuildRequires: librevenge-devel, gcc-c++, libstdc++-devel, pkgconfig >= 0.9.0 License: LGPL Prefix: %{prefix} @@ -29,7 +29,7 @@ Currently supported: raw svg %package devel Requires: %{name} >= %{version} -Requires: libwpd-devel >= 0.9.0 +Requires: librevenge-devel Summary: Files for developing with libpgplus. Group: Development/Libraries diff --git a/src/conv/raw/Makefile.am b/src/conv/raw/Makefile.am index a1d95a4..5009787 100644 --- a/src/conv/raw/Makefile.am +++ b/src/conv/raw/Makefile.am @@ -1,14 +1,14 @@ bin_PROGRAMS = ppp2raw -AM_CXXFLAGS = -I$(top_srcdir)/inc -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib $(WPD_CFLAGS) $(WPG_CFLAGS) $(DEBUG_CXXFLAGS) +AM_CXXFLAGS = -I$(top_srcdir)/inc -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib $(REVENGE_CFLAGS) $(REVENGE_GENERATORS_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(DEBUG_CXXFLAGS) ppp2raw_DEPENDENCIES = @PPP2RAW_WIN32_RESOURCE@ if STATIC_TOOLS -ppp2raw_LDADD = ../../lib/@PGPLUS_OBJDIR@/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.a @PPP2RAW_WIN32_RESOURCE@ +ppp2raw_LDADD = ../../lib/@PGPLUS_OBJDIR@/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.a $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS) @PPP2RAW_WIN32_RESOURCE@ ppp2raw_LDFLAGS = -all-static else -ppp2raw_LDADD = ../../lib/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.la @PPP2RAW_WIN32_RESOURCE@ +ppp2raw_LDADD = ../../lib/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.la $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS)@PPP2RAW_WIN32_RESOURCE@ endif ppp2raw_SOURCES = \ diff --git a/src/conv/raw/ppp2raw.cpp b/src/conv/raw/ppp2raw.cpp index 9033b1f..b16e1c4 100644 --- a/src/conv/raw/ppp2raw.cpp +++ b/src/conv/raw/ppp2raw.cpp @@ -24,190 +24,9 @@ #include #include -#include -#include -#include - -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()); -} - +#include +#include +#include namespace { @@ -241,7 +60,7 @@ int main(int argc, char *argv[]) if (!file) return printUsage(); - WPXFileStream input(file); + librevenge::RVNGFileStream input(file); if (!libpgplus::PGPLUSDocument::isSupported(&input)) { @@ -249,7 +68,7 @@ int main(int argc, char *argv[]) return 1; } - RawPainter painter; + librevenge::RVNGRawDrawingGenerator painter(false); libpgplus::PGPLUSDocument::parse(&input, &painter); return 0; diff --git a/src/conv/svg/Makefile.am b/src/conv/svg/Makefile.am index 29305b5..6485f00 100644 --- a/src/conv/svg/Makefile.am +++ b/src/conv/svg/Makefile.am @@ -1,14 +1,14 @@ bin_PROGRAMS = ppp2xhtml -AM_CXXFLAGS = -I$(top_srcdir)/inc -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib $(WPD_CFLAGS) $(WPG_CFLAGS) $(DEBUG_CXXFLAGS) +AM_CXXFLAGS = -I$(top_srcdir)/inc -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib $(REVENGE_CFLAGS) $(REVENGE_GENERATORS_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(DEBUG_CXXFLAGS) ppp2xhtml_DEPENDENCIES = @PPP2XHTML_WIN32_RESOURCE@ if STATIC_TOOLS -ppp2xhtml_LDADD = ../../lib/@PGPLUS_OBJDIR@/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.a @PPP2XHTML_WIN32_RESOURCE@ +ppp2xhtml_LDADD = ../../lib/@PGPLUS_OBJDIR@/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.a $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS)@PPP2XHTML_WIN32_RESOURCE@ ppp2xhtml_LDFLAGS = -all-static else -ppp2xhtml_LDADD = ../../lib/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.la @PPP2XHTML_WIN32_RESOURCE@ +ppp2xhtml_LDADD = ../../lib/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.la $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS)@PPP2XHTML_WIN32_RESOURCE@ endif ppp2xhtml_SOURCES = \ diff --git a/src/conv/svg/ppp2xhtml.cpp b/src/conv/svg/ppp2xhtml.cpp index 7b54a16..b3f0c8c 100644 --- a/src/conv/svg/ppp2xhtml.cpp +++ b/src/conv/svg/ppp2xhtml.cpp @@ -33,8 +33,9 @@ #include #include #include -#include -#include +#include +#include +#include namespace { @@ -68,7 +69,7 @@ int main(int argc, char *argv[]) if (!file) return printUsage(); - WPXFileStream input(file); + librevenge::RVNGFileStream input(file); if (!libpgplus::PGPLUSDocument::isSupported(&input)) { @@ -76,8 +77,9 @@ int main(int argc, char *argv[]) return 1; } - libpgplus::PGPLUSStringVector output; - if (!libpgplus::PGPLUSDocument::generateSVG(&input, output)) + librevenge::RVNGStringVector output; + librevenge::RVNGSVGDrawingGenerator generator(output, ""); + if (!libpgplus::PGPLUSDocument::parse(&input, &generator)) { std::cerr << "ERROR: SVG Generation failed!" << std::endl; return 1; diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index d508970..abff7bf 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -7,21 +7,18 @@ endif lib_LTLIBRARIES = libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@.la libpgplus_@PGPLUS_MAJOR_VERSION@_@PGPLUS_MINOR_VERSION@_includedir = $(includedir)/libpgplus-@PGPLUS_MAJOR_VERSION@.@PGPLUS_MINOR_VERSION@/libpgplus -AM_CXXFLAGS = -I$(top_srcdir)/inc $(WPD_CFLAGS) $(WPG_CFLAGS) $(DEBUG_CXXFLAGS) +AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(DEBUG_CXXFLAGS) -libpgplus_@PGPLUS_MAJOR_VERSION@_@PGPLUS_MINOR_VERSION@_la_LIBADD = $(WPD_LIBS) $(WPG_LIBS) @LIBPGPLUS_WIN32_RESOURCE@ +libpgplus_@PGPLUS_MAJOR_VERSION@_@PGPLUS_MINOR_VERSION@_la_LIBADD = $(REVENGE_LIBS) @LIBPGPLUS_WIN32_RESOURCE@ libpgplus_@PGPLUS_MAJOR_VERSION@_@PGPLUS_MINOR_VERSION@_la_DEPENDENCIES = @LIBPGPLUS_WIN32_RESOURCE@ libpgplus_@PGPLUS_MAJOR_VERSION@_@PGPLUS_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic -no_undefined libpgplus_@PGPLUS_MAJOR_VERSION@_@PGPLUS_MINOR_VERSION@_la_SOURCES = \ PGPLUSCollector.cpp \ PGPLUSDocument.cpp \ PGPLUSParser.cpp \ - PGPLUSStringVector.cpp \ - PGPLUSSVGGenerator.cpp \ libpgplus_utils.cpp \ PGPLUSCollector.h \ PGPLUSParser.h \ - PGPLUSSVGGenerator.h \ libpgplus_utils.h if OS_WIN32 @@ -34,8 +31,7 @@ endif EXTRA_DIST = \ - libpgplus.rc.in \ - makefile.mk + libpgplus.rc.in # These may be in the builddir too BUILD_EXTRA_DIST = \ diff --git a/src/lib/PGPLUSCollector.cpp b/src/lib/PGPLUSCollector.cpp index 31f99ac..c06d1c3 100644 --- a/src/lib/PGPLUSCollector.cpp +++ b/src/lib/PGPLUSCollector.cpp @@ -29,7 +29,7 @@ #include "PGPLUSCollector.h" -libpgplus::PGPLUSCollector::PGPLUSCollector(libwpg::WPGPaintInterface *painter) : +libpgplus::PGPLUSCollector::PGPLUSCollector(librevenge::RVNGDrawingInterface *painter) : m_painter(painter) { } diff --git a/src/lib/PGPLUSCollector.h b/src/lib/PGPLUSCollector.h index a692d63..cae4a58 100644 --- a/src/lib/PGPLUSCollector.h +++ b/src/lib/PGPLUSCollector.h @@ -29,12 +29,7 @@ #ifndef __PGPLUSCOLLECTOR_H__ #define __PGPLUSCOLLECTOR_H__ -namespace libwpg -{ - -class WPGPaintInterface; - -} // namespace libwpg +#include namespace libpgplus { @@ -42,7 +37,7 @@ namespace libpgplus class PGPLUSCollector { public: - PGPLUSCollector(::libwpg::WPGPaintInterface *painter); + PGPLUSCollector(librevenge::RVNGDrawingInterface *painter); virtual ~PGPLUSCollector(); // collector functions @@ -53,7 +48,7 @@ private: // helper functions - libwpg::WPGPaintInterface *m_painter; + librevenge::RVNGDrawingInterface *m_painter; }; } // namespace libpgplus diff --git a/src/lib/PGPLUSDocument.cpp b/src/lib/PGPLUSDocument.cpp index 7273642..cb2f503 100644 --- a/src/lib/PGPLUSDocument.cpp +++ b/src/lib/PGPLUSDocument.cpp @@ -23,7 +23,6 @@ #include #include #include -#include "PGPLUSSVGGenerator.h" #include "libpgplus_utils.h" /** @@ -32,36 +31,22 @@ 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 PagePlus Document that libpgplus is able to parse */ -bool libpgplus::PGPLUSDocument::isSupported(WPXInputStream *input) +bool libpgplus::PGPLUSDocument::isSupported(librevenge::RVNGInputStream *input) { return false; } /** 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 +RVNGPaintInterface class implementation when needed. This is often commonly called the 'main parsing routine'. \param input The input stream \param painter A PGPLUSPainterInterface implementation \return A value that indicates whether the parsing was successful */ -bool libpgplus::PGPLUSDocument::parse(::WPXInputStream *input, libwpg::WPGPaintInterface *painter) +bool libpgplus::PGPLUSDocument::parse(::librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter) { return false; } -/** -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 libpgplus::PGPLUSDocument::generateSVG(::WPXInputStream *input, libpgplus::PGPLUSStringVector &output) -{ - libpgplus::PGPLUSSVGGenerator generator(output); - bool result = libpgplus::PGPLUSDocument::parse(input, &generator); - return result; -} - /* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/src/lib/PGPLUSParser.cpp b/src/lib/PGPLUSParser.cpp index 1b29a3f..5b0dfd8 100644 --- a/src/lib/PGPLUSParser.cpp +++ b/src/lib/PGPLUSParser.cpp @@ -29,11 +29,11 @@ #include #include #include -#include +#include #include "PGPLUSParser.h" #include "PGPLUSCollector.h" -libpgplus::PGPLUSParser::PGPLUSParser(WPXInputStream *input, PGPLUSCollector *collector) +libpgplus::PGPLUSParser::PGPLUSParser(librevenge::RVNGInputStream *input, PGPLUSCollector *collector) : m_input(input), m_collector(collector) { } diff --git a/src/lib/PGPLUSParser.h b/src/lib/PGPLUSParser.h index 4107bba..6067d10 100644 --- a/src/lib/PGPLUSParser.h +++ b/src/lib/PGPLUSParser.h @@ -29,10 +29,8 @@ #ifndef __PGPLUSPARSER_H__ #define __PGPLUSPARSER_H__ -#include -#include - -class WPXInputStream; +#include +#include namespace libpgplus { @@ -41,7 +39,7 @@ class PGPLUSCollector; class PGPLUSParser { public: - explicit PGPLUSParser(WPXInputStream *input, PGPLUSCollector *collector); + explicit PGPLUSParser(librevenge::RVNGInputStream *input, PGPLUSCollector *collector); virtual ~PGPLUSParser(); bool parse(); private: @@ -49,7 +47,7 @@ private: PGPLUSParser(const PGPLUSParser &); PGPLUSParser &operator=(const PGPLUSParser &); - WPXInputStream *m_input; + librevenge::RVNGInputStream *m_input; PGPLUSCollector *m_collector; }; diff --git a/src/lib/PGPLUSSVGGenerator.cpp b/src/lib/PGPLUSSVGGenerator.cpp deleted file mode 100644 index 240cf8d..0000000 --- a/src/lib/PGPLUSSVGGenerator.cpp +++ /dev/null @@ -1,603 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* libpgplus - * 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 - * Copyright (C) 2011 Eilidh McAdam - * - * 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. - */ - -#include "PGPLUSSVGGenerator.h" -#include -#include -#include -#include - -static std::string doubleToString(const double value) -{ - WPXProperty *prop = WPXPropertyFactory::newDoubleProp(value); - std::string retVal = prop->getStr().cstr(); - delete prop; - return retVal; -} - -static unsigned stringToColour(const ::WPXString &s) -{ - std::string str(s.cstr()); - if (str[0] == '#') - { - if (str.length() != 7) - return 0; - else - str.erase(str.begin()); - } - else - return 0; - - std::istringstream istr(str); - unsigned val = 0; - istr >> std::hex >> val; - return val; -} - -libpgplus::PGPLUSSVGGenerator::PGPLUSSVGGenerator(libpgplus::PGPLUSStringVector &vec): m_gradient(), m_style(), m_gradientIndex(1), m_patternIndex(1), m_shadowIndex(1), m_outputSink(), m_vec(vec) -{ -} - -libpgplus::PGPLUSSVGGenerator::~PGPLUSSVGGenerator() -{ -} - -void libpgplus::PGPLUSSVGGenerator::startGraphics(const WPXPropertyList &propList) -{ - m_outputSink << "getDouble())) << "\" "; - if (propList["svg:height"]) - m_outputSink << "height=\"" << doubleToString(72*(propList["svg:height"]->getDouble())) << "\""; - m_outputSink << " >\n"; -} - -void libpgplus::PGPLUSSVGGenerator::endGraphics() -{ - m_outputSink << "\n"; - m_vec.append(m_outputSink.str().c_str()); - m_outputSink.str(""); -} - -void libpgplus::PGPLUSSVGGenerator::setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient) -{ - m_style.clear(); - m_style = propList; - - m_gradient = gradient; - if(m_style["draw:shadow"] && m_style["draw:shadow"]->getStr() == "visible") - { - unsigned shadowColour = 0; - double shadowRed = 0.0; - double shadowGreen = 0.0; - double shadowBlue = 0.0; - if (m_style["draw:shadow-color"]) - { - shadowColour = stringToColour(m_style["draw:shadow-color"]->getStr()); - shadowRed = (double)((shadowColour & 0x00ff0000) >> 16)/255.0; - shadowGreen = (double)((shadowColour & 0x0000ff00) >> 8)/255.0; - shadowBlue = (double)(shadowColour & 0x000000ff)/255.0; - } - m_outputSink << "\n"; - m_outputSink << ""; - m_outputSink << "getDouble()) << "\" "; - m_outputSink << "dy=\"" << doubleToString(72*m_style["draw:shadow-offset-y"]->getDouble()) << "\"/>"; - m_outputSink << "getDouble() < 1) - m_outputSink << " 0 0 0 " << doubleToString(m_style["draw:shadow-opacity"]->getDouble()/m_style["draw:opacity"]->getDouble()) << " 0\"/>"; - else - m_outputSink << " 0 0 0 " << doubleToString(m_style["draw:shadow-opacity"]->getDouble()) << " 0\"/>"; - m_outputSink << ""; - } - - if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "gradient") - { - double angle = (m_style["draw:angle"] ? m_style["draw:angle"]->getDouble() : 0.0); - angle *= -1.0; - while(angle < 0) - angle += 360; - while(angle > 360) - angle -= 360; - - if (!m_gradient.count()) - { - if (m_style["draw:style"] && - (m_style["draw:style"]->getStr() == "radial" || - m_style["draw:style"]->getStr() == "rectangular" || - m_style["draw:style"]->getStr() == "square" || - m_style["draw:style"]->getStr() == "ellipsoid")) - { - m_outputSink << "\n"; - m_outputSink << " getStr().cstr() << "\""; - else if (m_style["draw:cx"]) - m_outputSink << " cx=\"" << m_style["draw:cx"]->getStr().cstr() << "\""; - - if (m_style["svg:cy"]) - m_outputSink << " cy=\"" << m_style["svg:cy"]->getStr().cstr() << "\""; - else if (m_style["draw:cy"]) - m_outputSink << " cy=\"" << m_style["draw:cy"]->getStr().cstr() << "\""; - m_outputSink << " r=\"" << (1 - (m_style["draw:border"] ? m_style["draw:border"]->getDouble() : 0))*100.0 << "%\" >\n"; - m_outputSink << " >\n"; - - if (m_style["draw:start-color"] && m_style["draw:end-color"]) - { - m_outputSink << " getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << (m_style["libwpg:end-opacity"] ? m_style["libwpg:end-opacity"]->getDouble() : 1) << "\" />" << std::endl; - - m_outputSink << " getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << (m_style["libwpg:start-opacity"] ? m_style["libwpg:start-opacity"]->getDouble() : 1) << "\" />" << std::endl; - } - m_outputSink << " \n"; - m_outputSink << "\n"; - } - else if (m_style["draw:style"] && m_style["draw:style"]->getStr() == "linear") - { - m_outputSink << "\n"; - m_outputSink << " \n"; - - if (m_style["draw:start-color"] && m_style["draw:end-color"]) - { - m_outputSink << " getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << (m_style["libwpg:start-opacity"] ? m_style["libwpg:start-opacity"]->getDouble() : 1) << "\" />" << std::endl; - - m_outputSink << " getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << (m_style["libwpg:end-opacity"] ? m_style["libwpg:end-opacity"]->getDouble() : 1) << "\" />" << std::endl; - } - m_outputSink << " \n"; - - // not a simple horizontal gradient - if(angle != 270) - { - m_outputSink << " \n"; - m_outputSink << " \n"; - } - - m_outputSink << "\n"; - } - else if (m_style["draw:style"] && m_style["draw:style"]->getStr() == "axial") - { - m_outputSink << "\n"; - m_outputSink << " \n"; - - if (m_style["draw:start-color"] && m_style["draw:end-color"]) - { - m_outputSink << " getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << (m_style["libwpg:end-opacity"] ? m_style["libwpg:end-opacity"]->getDouble() : 1) << "\" />" << std::endl; - - m_outputSink << " getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << (m_style["libwpg:start-opacity"] ? m_style["libwpg:start-opacity"]->getDouble() : 1) << "\" />" << std::endl; - - m_outputSink << " getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << (m_style["libwpg:end-opacity"] ? m_style["libwpg:end-opacity"]->getDouble() : 1) << "\" />" << std::endl; - } - m_outputSink << " \n"; - - // not a simple horizontal gradient - if(angle != 270) - { - m_outputSink << " \n"; - m_outputSink << " \n"; - } - - m_outputSink << "\n"; - } - } - else - { - if (m_style["draw:style"] && m_style["draw:style"]->getStr() == "radial") - { - m_outputSink << "\n"; - m_outputSink << " getStr().cstr() << "\" cy=\"" << m_style["svg:cy"]->getStr().cstr() << "\" r=\"" << m_style["svg:r"]->getStr().cstr() << "\" >\n"; - for(unsigned c = 0; c < m_gradient.count(); c++) - { - m_outputSink << " getStr().cstr() << "\""; - - m_outputSink << " stop-color=\"" << m_gradient[c]["svg:stop-color"]->getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << m_gradient[c]["svg:stop-opacity"]->getDouble() << "\" />" << std::endl; - - } - m_outputSink << " \n"; - m_outputSink << "\n"; - } - else - { - m_outputSink << "\n"; - m_outputSink << " \n"; - for(unsigned c = 0; c < m_gradient.count(); c++) - { - m_outputSink << " getStr().cstr() << "\""; - - m_outputSink << " stop-color=\"" << m_gradient[c]["svg:stop-color"]->getStr().cstr() << "\""; - m_outputSink << " stop-opacity=\"" << m_gradient[c]["svg:stop-opacity"]->getDouble() << "\" />" << std::endl; - - } - m_outputSink << " \n"; - - // not a simple horizontal gradient - if(angle != 270) - { - m_outputSink << " \n"; - m_outputSink << " \n"; - } - - m_outputSink << "\n"; - } - } - } - else if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap") - { - if (m_style["draw:fill-image"] && m_style["libwpg:mime-type"]) - { - m_outputSink << "\n"; - m_outputSink << " getDouble())) << "\" "; - else - m_outputSink << "width=\"100\" "; - - if (m_style["svg:height"]) - m_outputSink << "height=\"" << doubleToString(72*(m_style["svg:height"]->getDouble())) << "\">" << std::endl; - else - m_outputSink << "height=\"100\">" << std::endl; - m_outputSink << "getDouble())) << "\" "; - else - m_outputSink << "x=\"0\" "; - - if (m_style["svg:y"]) - m_outputSink << "y=\"" << doubleToString(72*(m_style["svg:y"]->getDouble())) << "\" "; - else - m_outputSink << "y=\"0\" "; - - if (m_style["svg:width"]) - m_outputSink << "width=\"" << doubleToString(72*(m_style["svg:width"]->getDouble())) << "\" "; - else - m_outputSink << "width=\"100\" "; - - if (m_style["svg:height"]) - m_outputSink << "height=\"" << doubleToString(72*(m_style["svg:height"]->getDouble())) << "\" "; - else - m_outputSink << "height=\"100\" "; - - m_outputSink << "xlink:href=\"data:" << m_style["libwpg:mime-type"]->getStr().cstr() << ";base64,"; - m_outputSink << m_style["draw:fill-image"]->getStr().cstr(); - m_outputSink << "\" />\n"; - m_outputSink << " \n"; - m_outputSink << "\n"; - } - } -} - -void libpgplus::PGPLUSSVGGenerator::startLayer(const ::WPXPropertyList &propList) -{ - m_outputSink << "getInt() << "\""; - if (propList["svg:fill-rule"]) - m_outputSink << " fill-rule=\"" << propList["svg:fill-rule"]->getStr().cstr() << "\""; - m_outputSink << " >\n"; -} - -void libpgplus::PGPLUSSVGGenerator::endLayer() -{ - m_outputSink << "\n"; -} - -void libpgplus::PGPLUSSVGGenerator::drawRectangle(const ::WPXPropertyList &propList) -{ - m_outputSink << "getDouble()) << "\" y=\"" << doubleToString(72*propList["svg:y"]->getDouble()) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*propList["svg:width"]->getDouble()) << "\" height=\"" << doubleToString(72*propList["svg:height"]->getDouble()) << "\" "; - if((propList["svg:rx"] && propList["svg:rx"]->getInt() !=0) || (propList["svg:ry"] && propList["svg:ry"]->getInt() !=0)) - m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getDouble()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getDouble()) << "\" "; - writeStyle(); - m_outputSink << "/>\n"; -} - -void libpgplus::PGPLUSSVGGenerator::drawEllipse(const WPXPropertyList &propList) -{ - m_outputSink << "getDouble()) << "\" cy=\"" << doubleToString(72*propList["svg:cy"]->getDouble()) << "\" "; - m_outputSink << "rx=\"" << doubleToString(72*propList["svg:rx"]->getDouble()) << "\" ry=\"" << doubleToString(72*propList["svg:ry"]->getDouble()) << "\" "; - writeStyle(); - if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getDouble() != 0.0) - m_outputSink << " transform=\" translate(" << doubleToString(72*propList["svg:cx"]->getDouble()) << ", " << doubleToString(72*propList["svg:cy"]->getDouble()) - << ") rotate(" << doubleToString(-propList["libwpg:rotate"]->getDouble()) - << ") translate(" << doubleToString(-72*propList["svg:cx"]->getDouble()) - << ", " << doubleToString(-72*propList["svg:cy"]->getDouble()) - << ")\" "; - m_outputSink << "/>\n"; -} - -void libpgplus::PGPLUSSVGGenerator::drawPolyline(const ::WPXPropertyListVector &vertices) -{ - drawPolySomething(vertices, false); -} - -void libpgplus::PGPLUSSVGGenerator::drawPolygon(const ::WPXPropertyListVector &vertices) -{ - drawPolySomething(vertices, true); -} - -void libpgplus::PGPLUSSVGGenerator::drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed) -{ - if(vertices.count() < 2) - return; - - if(vertices.count() == 2) - { - m_outputSink << "getDouble())) << "\" y1=\"" << doubleToString(72*(vertices[0]["svg:y"]->getDouble())) << "\" "; - m_outputSink << "x2=\"" << doubleToString(72*(vertices[1]["svg:x"]->getDouble())) << "\" y2=\"" << doubleToString(72*(vertices[1]["svg:y"]->getDouble())) << "\"\n"; - writeStyle(); - m_outputSink << "/>\n"; - } - else - { - if (isClosed) - m_outputSink << "getDouble())) << " " << doubleToString(72*(vertices[i]["svg:y"]->getDouble())); - if (i < vertices.count()-1) - m_outputSink << ", "; - } - m_outputSink << "\"\n"; - writeStyle(isClosed); - m_outputSink << "/>\n"; - } -} - -void libpgplus::PGPLUSSVGGenerator::drawPath(const ::WPXPropertyListVector &path) -{ - m_outputSink << "getStr() == "M") - { - m_outputSink << "\nM"; - m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble())); - } - else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "L") - { - m_outputSink << "\nL"; - m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble())); - } - else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "C") - { - m_outputSink << "\nC"; - m_outputSink << doubleToString(72*(propList["svg:x1"]->getDouble())) << "," << doubleToString(72*(propList["svg:y1"]->getDouble())) << " "; - m_outputSink << doubleToString(72*(propList["svg:x2"]->getDouble())) << "," << doubleToString(72*(propList["svg:y2"]->getDouble())) << " "; - m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble())); - } - else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Q") - { - m_outputSink << "\nQ"; - m_outputSink << doubleToString(72*(propList["svg:x1"]->getDouble())) << "," << doubleToString(72*(propList["svg:y1"]->getDouble())) << " "; - m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble())); - } - else if (propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "A") - { - m_outputSink << "\nA"; - m_outputSink << doubleToString(72*(propList["svg:rx"]->getDouble())) << "," << doubleToString(72*(propList["svg:ry"]->getDouble())) << " "; - m_outputSink << doubleToString(propList["libwpg:rotate"] ? propList["libwpg:rotate"]->getDouble() : 0) << " "; - m_outputSink << (propList["libwpg:large-arc"] ? propList["libwpg:large-arc"]->getInt() : 1) << ","; - m_outputSink << (propList["libwpg:sweep"] ? propList["libwpg:sweep"]->getInt() : 1) << " "; - m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble())); - } - else if ((i >= path.count()-1 && i > 2) && propList["libwpg:path-action"] && propList["libwpg:path-action"]->getStr() == "Z" ) - { - isClosed = true; - m_outputSink << "\nZ"; - } - } - - m_outputSink << "\" \n"; - writeStyle(isClosed); - m_outputSink << "/>\n"; -} - -void libpgplus::PGPLUSSVGGenerator::drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData) -{ - if (!propList["libwpg:mime-type"] || propList["libwpg:mime-type"]->getStr().len() <= 0) - return; - WPXString base64 = binaryData.getBase64Data(); - m_outputSink << "getDouble())) << "\" y=\"" << doubleToString(72*(propList["svg:y"]->getDouble())) << "\" "; - m_outputSink << "width=\"" << doubleToString(72*(propList["svg:width"]->getDouble())) << "\" height=\"" << doubleToString(72*(propList["svg:height"]->getDouble())) << "\" "; - m_outputSink << "xlink:href=\"data:" << propList["libwpg:mime-type"]->getStr().cstr() << ";base64,"; - m_outputSink << base64.cstr(); - m_outputSink << "\" />\n"; -} - -void libpgplus::PGPLUSSVGGenerator::startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector & /* path */) -{ - m_outputSink << "getDouble())) << "\" y=\"" << doubleToString(72*(propList["svg:y"]->getDouble())) << "\""; - if (propList["libwpg:rotate"] && propList["libwpg:rotate"]->getDouble() != 0.0) - m_outputSink << " transform=\"translate(" << doubleToString(72*propList["svg:x"]->getDouble()) << ", " << doubleToString(72*propList["svg:y"]->getDouble()) - << ") rotate(" << doubleToString(-propList["libwpg:rotate"]->getDouble()) - << ") translate(" << doubleToString(-72*propList["svg:x"]->getDouble()) - << ", " << doubleToString(-72*propList["svg:y"]->getDouble()) - << ")\""; - m_outputSink << ">\n"; - -} - -void libpgplus::PGPLUSSVGGenerator::endTextObject() -{ - m_outputSink << "\n"; -} - -void libpgplus::PGPLUSSVGGenerator::startTextSpan(const ::WPXPropertyList &propList) -{ - m_outputSink << "getStr().cstr() << "\" "; - if (propList["fo:font-style"]) - m_outputSink << "font-style=\"" << propList["fo:font-style"]->getStr().cstr() << "\" "; - if (propList["fo:font-weight"]) - m_outputSink << "font-weight=\"" << propList["fo:font-weight"]->getStr().cstr() << "\" "; - if (propList["fo:font-variant"]) - m_outputSink << "font-variant=\"" << propList["fo:font-variant"]->getStr().cstr() << "\" "; - if (propList["fo:font-size"]) - m_outputSink << "font-size=\"" << doubleToString(propList["fo:font-size"]->getDouble()) << "\" "; - if (propList["fo:color"]) - m_outputSink << "fill=\"" << propList["fo:color"]->getStr().cstr() << "\" "; - if (propList["fo:text-transform"]) - m_outputSink << "text-transform=\"" << propList["fo:text-transform"]->getStr().cstr() << "\" "; - if (propList["svg:fill-opacity"]) - m_outputSink << "fill-opacity=\"" << doubleToString(propList["svg:fill-opacity"]->getDouble()) << "\" "; - if (propList["svg:stroke-opacity"]) - m_outputSink << "stroke-opacity=\"" << doubleToString(propList["svg:stroke-opacity"]->getDouble()) << "\" "; - m_outputSink << ">\n"; -} - -void libpgplus::PGPLUSSVGGenerator::endTextSpan() -{ - m_outputSink << "\n"; -} - -void libpgplus::PGPLUSSVGGenerator::insertText(const ::WPXString &str) -{ - WPXString tempUTF8(str, true); - m_outputSink << tempUTF8.cstr() << "\n"; -} - -// create "style" attribute based on current pen and brush -void libpgplus::PGPLUSSVGGenerator::writeStyle(bool /* isClosed */) -{ - m_outputSink << "style=\""; - - if (m_style["svg:stroke-width"]) - { - double width = m_style["svg:stroke-width"]->getDouble(); - if (width == 0.0 && m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() != "none") - width = 0.2 / 72.0; // reasonable hairline - m_outputSink << "stroke-width: " << doubleToString(72*width) << "; "; - } - if ((m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() != "none")) - { - if (m_style["svg:stroke-color"]) - m_outputSink << "stroke: " << m_style["svg:stroke-color"]->getStr().cstr() << "; "; - if(m_style["svg:stroke-opacity"] && m_style["svg:stroke-opacity"]->getInt()!= 1) - m_outputSink << "stroke-opacity: " << doubleToString(m_style["svg:stroke-opacity"]->getDouble()) << "; "; - } - - if (m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() == "solid") - m_outputSink << "stroke-dasharray: solid; "; - else if (m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() == "dash") - { - int dots1 = m_style["draw:dots1"]->getInt(); - int dots2 = m_style["draw:dots2"]->getInt(); - double dots1len = m_style["draw:dots1-length"]->getDouble(); - double dots2len = m_style["draw:dots2-length"]->getDouble(); - double gap = m_style["draw:distance"]->getDouble(); - m_outputSink << "stroke-dasharray: "; - for (int i = 0; i < dots1; i++) - { - if (i) - m_outputSink << ", "; - m_outputSink << (int)dots1len; - m_outputSink << ", "; - m_outputSink << (int)gap; - } - for (int j = 0; j < dots2; j++) - { - m_outputSink << ", "; - m_outputSink << (int)dots2len; - m_outputSink << ", "; - m_outputSink << (int)gap; - } - m_outputSink << "; "; - } - - if (m_style["svg:stroke-linecap"]) - m_outputSink << "stroke-linecap: " << m_style["svg:stroke-linecap"]->getStr().cstr() << "; "; - - if (m_style["svg:stroke-linejoin"]) - m_outputSink << "stroke-linejoin: " << m_style["svg:stroke-linejoin"]->getStr().cstr() << "; "; - - if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none") - m_outputSink << "fill: none; "; - else if(m_style["svg:fill-rule"]) - m_outputSink << "fill-rule: " << m_style["svg:fill-rule"]->getStr().cstr() << "; "; - - if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "gradient") - m_outputSink << "fill: url(#grad" << m_gradientIndex-1 << "); "; - - if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap") - m_outputSink << "fill: url(#img" << m_patternIndex-1 << "); "; - - if(m_style["draw:shadow"] && m_style["draw:shadow"]->getStr() == "visible") - m_outputSink << "filter:url(#shadow" << m_shadowIndex-1 << "); "; - - if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "solid") - if (m_style["draw:fill-color"]) - m_outputSink << "fill: " << m_style["draw:fill-color"]->getStr().cstr() << "; "; - if(m_style["draw:opacity"] && m_style["draw:opacity"]->getDouble() < 1) - m_outputSink << "fill-opacity: " << doubleToString(m_style["draw:opacity"]->getDouble()) << "; "; - m_outputSink << "\""; // style -} -/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/src/lib/PGPLUSSVGGenerator.h b/src/lib/PGPLUSSVGGenerator.h deleted file mode 100644 index 94723ce..0000000 --- a/src/lib/PGPLUSSVGGenerator.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* libpgplus - * 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) 2011 Fridrich Strba - * Copyright (C) 2011 Eilidh McAdam - * - * 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 __PGPLUSSVGGENERATOR_H__ -#define __PGPLUSSVGGENERATOR_H__ - -#include -#include -#include -#include -#include -#include - -namespace libpgplus -{ - -class PGPLUSSVGGenerator : public libwpg::WPGPaintInterface -{ -public: - PGPLUSSVGGenerator(PGPLUSStringVector &vec); - ~PGPLUSSVGGenerator(); - - 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); - -private: - ::WPXPropertyListVector m_gradient; - ::WPXPropertyList m_style; - int m_gradientIndex; - int m_patternIndex; - int m_shadowIndex; - void writeStyle(bool isClosed=true); - void drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed); - - std::ostringstream m_outputSink; - PGPLUSStringVector &m_vec; -}; - -} // namespace libpgplus - -#endif // __PGPLUSSVGGENERATOR_H__ -/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/src/lib/PGPLUSStringVector.cpp b/src/lib/PGPLUSStringVector.cpp deleted file mode 100644 index eb4dfdc..0000000 --- a/src/lib/PGPLUSStringVector.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* libpgplus - * 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 - * - * - * 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. - */ - -#include -#include - -namespace libpgplus -{ -class PGPLUSStringVectorImpl -{ -public: - PGPLUSStringVectorImpl() : m_strings() {} - PGPLUSStringVectorImpl(const PGPLUSStringVectorImpl &impl) : m_strings(impl.m_strings) {} - ~PGPLUSStringVectorImpl() {} - std::vector m_strings; -}; - -} // namespace libpgplus - -libpgplus::PGPLUSStringVector::PGPLUSStringVector() - : m_pImpl(new PGPLUSStringVectorImpl()) -{ -} - -libpgplus::PGPLUSStringVector::PGPLUSStringVector(const PGPLUSStringVector &vec) - : m_pImpl(new PGPLUSStringVectorImpl(*(vec.m_pImpl))) -{ -} - -libpgplus::PGPLUSStringVector::~PGPLUSStringVector() -{ -} - -libpgplus::PGPLUSStringVector &libpgplus::PGPLUSStringVector::operator=(const PGPLUSStringVector &vec) -{ - if (m_pImpl) - delete m_pImpl; - m_pImpl = new PGPLUSStringVectorImpl(*(vec.m_pImpl)); - return *this; -} - -unsigned libpgplus::PGPLUSStringVector::size() const -{ - return (unsigned)(m_pImpl->m_strings.size()); -} - -bool libpgplus::PGPLUSStringVector::empty() const -{ - return m_pImpl->m_strings.empty(); -} - -const WPXString &libpgplus::PGPLUSStringVector::operator[](unsigned idx) const -{ - return m_pImpl->m_strings[idx]; -} - -void libpgplus::PGPLUSStringVector::append(const WPXString &str) -{ - m_pImpl->m_strings.push_back(str); -} - -void libpgplus::PGPLUSStringVector::clear() -{ - m_pImpl->m_strings.clear(); -} - -/* vim:set shiftwidth=2 softtabstop=2 expandtab: */ diff --git a/src/lib/libpgplus_utils.cpp b/src/lib/libpgplus_utils.cpp index c84e107..967df74 100644 --- a/src/lib/libpgplus_utils.cpp +++ b/src/lib/libpgplus_utils.cpp @@ -32,9 +32,9 @@ #define PGPLUS_NUM_ELEMENTS(array) sizeof(array)/sizeof(array[0]) -uint8_t libpgplus::readU8(WPXInputStream *input) +uint8_t libpgplus::readU8(librevenge::RVNGInputStream *input) { - if (!input || input->atEOS()) + if (!input || input->isEnd()) throw EndOfStreamException(); unsigned long numBytesRead; uint8_t const *p = input->read(sizeof(uint8_t), numBytesRead); @@ -44,14 +44,14 @@ uint8_t libpgplus::readU8(WPXInputStream *input) throw EndOfStreamException(); } -uint16_t libpgplus::readU16(WPXInputStream *input) +uint16_t libpgplus::readU16(librevenge::RVNGInputStream *input) { uint16_t p0 = (uint16_t)readU8(input); uint16_t p1 = (uint16_t)readU8(input); return (uint16_t)(p0|(p1<<8)); } -uint32_t libpgplus::readU32(WPXInputStream *input) +uint32_t libpgplus::readU32(librevenge::RVNGInputStream *input) { uint32_t p0 = (uint32_t)readU8(input); uint32_t p1 = (uint32_t)readU8(input); @@ -60,12 +60,12 @@ uint32_t libpgplus::readU32(WPXInputStream *input) return (uint32_t)(p0|(p1<<8)|(p2<<16)|(p3<<24)); } -int32_t libpgplus::readS32(WPXInputStream *input) +int32_t libpgplus::readS32(librevenge::RVNGInputStream *input) { return (int32_t)readU32(input); } -uint64_t libpgplus::readU64(WPXInputStream *input) +uint64_t libpgplus::readU64(librevenge::RVNGInputStream *input) { uint64_t p0 = (uint64_t)readU8(input); uint64_t p1 = (uint64_t)readU8(input); diff --git a/src/lib/libpgplus_utils.h b/src/lib/libpgplus_utils.h index f0d79c2..1c65880 100644 --- a/src/lib/libpgplus_utils.h +++ b/src/lib/libpgplus_utils.h @@ -31,8 +31,8 @@ #include #include -#include -#include +#include +#include #ifdef _MSC_VER @@ -78,11 +78,11 @@ typedef unsigned __int64 uint64_t; namespace libpgplus { -uint8_t readU8(WPXInputStream *input); -uint16_t readU16(WPXInputStream *input); -uint32_t readU32(WPXInputStream *input); -uint64_t readU64(WPXInputStream *input); -int32_t readS32(WPXInputStream *input); +uint8_t readU8(librevenge::RVNGInputStream *input); +uint16_t readU16(librevenge::RVNGInputStream *input); +uint32_t readU32(librevenge::RVNGInputStream *input); +uint64_t readU64(librevenge::RVNGInputStream *input); +int32_t readS32(librevenge::RVNGInputStream *input); class EndOfStreamException { diff --git a/src/lib/makefile.mk b/src/lib/makefile.mk deleted file mode 100644 index 2676554..0000000 --- a/src/lib/makefile.mk +++ /dev/null @@ -1,43 +0,0 @@ -EXTERNAL_WARNINGS_NOT_ERRORS := TRUE - -PRJ=..$/..$/..$/..$/..$/.. - -PRJNAME=libpgplus -TARGET=pgpluslib -ENABLE_EXCEPTIONS=TRUE -LIBTARGET=NO - -.INCLUDE : settings.mk - -.IF "$(GUI)$(COM)"=="WNTMSC" -CFLAGS+=-GR -.ENDIF -.IF "$(COM)"=="GCC" -CFLAGSCXX+=-frtti -.ENDIF - -.IF "$(SYSTEM_LIBWPD)" == "YES" -INCPRE+=$(WPD_CFLAGS) -I.. -.ELSE -INCPRE+=$(SOLARVER)$/$(INPATH)$/inc$/libwpd -.ENDIF - -.IF "$(SYSTEM_LIBWPG)" == "YES" -INCPRE+=$(WPG_CFLAGS) -I.. -.ELSE -INCPRE+=$(SOLARVER)$/$(INPATH)$/inc$/libwpg -.ENDIF - -SLOFILES= \ - $(SLO)$/PGPLUSCollector.obj \ - $(SLO)$/PGPLUSDocument.obj \ - $(SLO)$/PGPLUSParser.obj \ - $(SLO)$/PGPLUSStringVector.obj \ - $(SLO)$/PGPLUSSVGGenerator.obj \ - $(SLO)$/libpgplus_utils.obj - -LIB1ARCHIV=$(LB)$/libpgpluslib.a -LIB1TARGET=$(SLB)$/$(TARGET).lib -LIB1OBJFILES= $(SLOFILES) - -.INCLUDE : target.mk -- cgit v1.2.3