summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-12-07 20:48:31 +0100
committerFridrich Štrba <fridrich.strba@bluewin.ch>2013-12-07 22:35:59 +0100
commitd135cb9328cf87e17a961e93d85d2e3dc629adc3 (patch)
treeaec51c473bc4df49d1e6d30a3c2df7426847463c
parent39b7288692e154003d96def9bbe56e7257ae3449 (diff)
switch to librevenge
-rw-r--r--build/win32/libpict.dsp8
-rw-r--r--build/win32/pict2raw.dsp16
-rw-r--r--build/win32/pict2svg.dsp16
-rw-r--r--configure.ac30
-rw-r--r--inc/libpict/PictImage.h11
-rw-r--r--libpict.pc.in2
-rw-r--r--libpict.spec.in4
-rw-r--r--src/conv/raw/Makefile.am6
-rw-r--r--src/conv/raw/pict2raw.cpp190
-rw-r--r--src/conv/svg/Makefile.am6
-rw-r--r--src/conv/svg/pict2svg.cpp42
-rw-r--r--src/lib/Makefile.am6
-rw-r--r--src/lib/Pict1Parser.cpp26
-rw-r--r--src/lib/Pict1Parser.h4
-rw-r--r--src/lib/Pict2Parser.cpp28
-rw-r--r--src/lib/Pict2Parser.h4
-rw-r--r--src/lib/PictBitmap.cpp4
-rw-r--r--src/lib/PictBitmap.h4
-rw-r--r--src/lib/PictColor.cpp4
-rw-r--r--src/lib/PictColor.h4
-rw-r--r--src/lib/PictHeader.cpp52
-rw-r--r--src/lib/PictHeader.h8
-rw-r--r--src/lib/PictImage.cpp36
-rw-r--r--src/lib/PictSVGGenerator.cpp342
-rw-r--r--src/lib/PictSVGGenerator.h80
-rw-r--r--src/lib/PictXParser.cpp4
-rw-r--r--src/lib/PictXParser.h11
-rw-r--r--src/lib/makefile.mk41
28 files changed, 176 insertions, 813 deletions
diff --git a/build/win32/libpict.dsp b/build/win32/libpict.dsp
index 502daa0..0ceb9d4 100644
--- a/build/win32/libpict.dsp
+++ b/build/win32/libpict.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/pict2raw.dsp b/build/win32/pict2raw.dsp
index acc50ed..0f394fb 100644
--- a/build/win32/pict2raw.dsp
+++ b/build/win32/pict2raw.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 libpict-0.0.lib libwpd-stream-0.9.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\pict2raw.exe" /libpath:"Release\lib"
-# ADD LINK32 libpict-0.0.lib libwpd-stream-0.9.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\pict2raw.exe" /libpath:"Release\lib"
+# ADD BASE LINK32 libpict-0.0.lib librevenge-stream-0.0.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\pict2raw.exe" /libpath:"Release\lib"
+# ADD LINK32 libpict-0.0.lib librevenge-stream-0.0.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\pict2raw.exe" /libpath:"Release\lib"
# SUBTRACT LINK32 /nodefaultlib
!ELSEIF "$(CFG)" == "pict2raw - 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 libpict-0.0.lib libwpd-stream-0.9.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\pict2raw.exe" /libpath:"Debug\lib"
-# ADD LINK32 libpict-0.0.lib libwpd-stream-0.9.lib kernel32.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\pict2raw.exe" /libpath:"Debug\lib"
+# ADD BASE LINK32 libpict-0.0.lib librevenge-stream-0.0.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\pict2raw.exe" /libpath:"Debug\lib"
+# ADD LINK32 libpict-0.0.lib librevenge-stream-0.0.lib kernel32.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\pict2raw.exe" /libpath:"Debug\lib"
# SUBTRACT LINK32 /nodefaultlib
!ENDIF
diff --git a/build/win32/pict2svg.dsp b/build/win32/pict2svg.dsp
index 206c7f6..0b51f04 100644
--- a/build/win32/pict2svg.dsp
+++ b/build/win32/pict2svg.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 libpict-0.0.lib libwpd-stream-0.9.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\pict2svg.exe" /libpath:"Release\lib"
-# ADD LINK32 libpict-0.0.lib libwpd-stream-0.9.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\pict2svg.exe" /libpath:"Release\lib"
+# ADD BASE LINK32 libpict-0.0.lib librevenge-stream-0.0.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\pict2svg.exe" /libpath:"Release\lib"
+# ADD LINK32 libpict-0.0.lib librevenge-stream-0.0.lib /nologo /subsystem:console /machine:IX86 /out:"Release\bin\pict2svg.exe" /libpath:"Release\lib"
# SUBTRACT LINK32 /nodefaultlib
!ELSEIF "$(CFG)" == "pict2svg - 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 libpict-0.0.lib libwpd-stream-0.9.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\pict2svg.exe" /libpath:"Debug\lib"
-# ADD LINK32 libpict-0.0.lib libwpd-stream-0.9.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\pict2svg.exe" /libpath:"Debug\lib"
+# ADD BASE LINK32 libpict-0.0.lib librevenge-stream-0.0.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\pict2svg.exe" /libpath:"Debug\lib"
+# ADD LINK32 libpict-0.0.lib librevenge-stream-0.0.lib /nologo /subsystem:console /debug /machine:IX86 /out:"Debug\bin\pict2svg.exe" /libpath:"Debug\lib"
# SUBTRACT LINK32 /nodefaultlib
!ENDIF
diff --git a/configure.ac b/configure.ac
index 522606b..5393100 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,16 +54,11 @@ else
fi
AC_SUBST(GPERF)
-# ====================
-# Find additional apps
-# ====================
-PKG_CHECK_MODULES([WPD],[
- libwpd-0.9
- libwpd-stream-0.9
-])
-
-PKG_CHECK_MODULES([WPG],[
- libwpg-0.2
+# ===============
+# Find librevenge
+# ===============
+PKG_CHECK_MODULES([REVENGE],[
+ librevenge-0.0
])
PKG_CHECK_MODULES([LIBXML],[
@@ -189,10 +184,6 @@ AS_IF([test "x$native_win32" = "xyes"], [
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wshadow -pedantic"
])
])
-LIBPICT_CXXFLAGS="${WPD_CFLAGS} ${WPG_CFLAGS}"
-LIBPICT_LIBS="${WPD_LIBS} ${WPG_LIBS}"
-AC_SUBST(LIBPICT_CXXFLAGS)
-AC_SUBST(LIBPICT_LIBS)
# ============
# Debug switch
@@ -244,6 +235,17 @@ AS_IF([test "x$with_docs" != "xno"], [
], [build_docs=no])
AM_CONDITIONAL([WITH_LIBPICT_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/libpict/PictImage.h b/inc/libpict/PictImage.h
index 4c46723..132073f 100644
--- a/inc/libpict/PictImage.h
+++ b/inc/libpict/PictImage.h
@@ -26,9 +26,8 @@
#ifndef __PICTRAPHICS_H__
#define __PICTRAPHICS_H__
-#include <libwpd/libwpd.h>
-#include <libwpd-stream/libwpd-stream.h>
-#include <libwpg/libwpg.h>
+#include <librevenge/librevenge.h>
+#include <librevenge-stream/librevenge-stream.h>
namespace libpict
@@ -37,11 +36,9 @@ class PictImage
{
public:
- static bool isSupported(WPXInputStream *input);
+ static bool isSupported(librevenge::RVNGInputStream *input);
- static bool parse(WPXInputStream *input, libwpg::WPGPaintInterface *painter);
-
- static bool generateSVG(WPXInputStream *input, WPXString &output);
+ static bool parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
};
} // namespace libpict
diff --git a/libpict.pc.in b/libpict.pc.in
index fc26c6d..2ca4b9a 100644
--- a/libpict.pc.in
+++ b/libpict.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@
Description: Library for importing and converting Corel WordPerfect(tm) Graphics images
Version: @VERSION@
-Requires: libwpd-0.9 libwpd-stream-0.9 libwpg-0.2
+Requires: librevenge-0.0
Libs: -L${libdir} -lpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@
Cflags: -I${includedir}/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@
diff --git a/libpict.spec.in b/libpict.spec.in
index 292fa99..060f6c1 100644
--- a/libpict.spec.in
+++ b/libpict.spec.in
@@ -11,7 +11,7 @@ Source: %{name}-%{version}.tar.gz
Group: System Environment/Libraries
URL: http://libpict.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 libpict.
Group: Development/Libraries
diff --git a/src/conv/raw/Makefile.am b/src/conv/raw/Makefile.am
index e95927f..8b1638f 100644
--- a/src/conv/raw/Makefile.am
+++ b/src/conv/raw/Makefile.am
@@ -1,14 +1,14 @@
bin_PROGRAMS = pict2raw
-AM_CXXFLAGS = -I$(top_srcdir)/inc $(LIBPICT_CXXFLAGS) $(DEBUG_CXXFLAGS)
+AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(REVENGE_GENERATORS_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(DEBUG_CXXFLAGS)
pict2raw_DEPENDENCIES = @PICT2RAW_WIN32_RESOURCE@
if STATIC_TOOLS
-pict2raw_LDADD = ../../lib/@Pict_OBJDIR@/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@.a $(LIBPICT_LIBS) @PICT2RAW_WIN32_RESOURCE@
+pict2raw_LDADD = ../../lib/@Pict_OBJDIR@/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@.a $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS) @PICT2RAW_WIN32_RESOURCE@
pict2raw_LDFLAGS = -all-static
else
-pict2raw_LDADD = ../../lib/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@.la $(LIBPICT_LIBS) @PICT2RAW_WIN32_RESOURCE@
+pict2raw_LDADD = ../../lib/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@.la $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS) @PICT2RAW_WIN32_RESOURCE@
endif
pict2raw_SOURCES = \
diff --git a/src/conv/raw/pict2raw.cpp b/src/conv/raw/pict2raw.cpp
index 89625c0..e0b118b 100644
--- a/src/conv/raw/pict2raw.cpp
+++ b/src/conv/raw/pict2raw.cpp
@@ -28,8 +28,9 @@
#include <stdio.h>
#include <string.h>
-#include <libwpd-stream/libwpd-stream.h>
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
+#include <librevenge-generators/librevenge-generators.h>
+#include <librevenge-stream/librevenge-stream.h>
#include <libpict/libpict.h>
#ifdef HAVE_CONFIG_H
@@ -40,187 +41,6 @@
#define VERSION "UNKNOWN VERSION"
#endif
-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
{
@@ -262,7 +82,7 @@ int main(int argc, char *argv[])
if (!file)
return printUsage();
- WPXFileStream input(file);
+ librevenge::RVNGFileStream input(file);
if (!libpict::PictImage::isSupported(&input))
{
@@ -270,7 +90,7 @@ int main(int argc, char *argv[])
return 1;
}
- RawPainter painter;
+ librevenge::RVNGRawDrawingGenerator painter(false);
libpict::PictImage::parse(&input, &painter);
return 0;
diff --git a/src/conv/svg/Makefile.am b/src/conv/svg/Makefile.am
index ecc38b5..2685c22 100644
--- a/src/conv/svg/Makefile.am
+++ b/src/conv/svg/Makefile.am
@@ -1,14 +1,14 @@
bin_PROGRAMS = pict2svg
-AM_CXXFLAGS = -I$(top_srcdir)/inc $(LIBPICT_CXXFLAGS) $(DEBUG_CXXFLAGS)
+AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(REVENGE_GENERATORS_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(DEBUG_CXXFLAGS)
pict2svg_DEPENDENCIES = @PICT2SVG_WIN32_RESOURCE@
if STATIC_TOOLS
-pict2svg_LDADD = ../../lib/@Pict_OBJDIR@/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@.a $(LIBPICT_LIBS) @PICT2SVG_WIN32_RESOURCE@
+pict2svg_LDADD = ../../lib/@Pict_OBJDIR@/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@.a $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS) @PICT2SVG_WIN32_RESOURCE@
pict2svg_LDFLAGS = -all-static
else
-pict2svg_LDADD = ../../lib/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@.la $(LIBPICT_LIBS) @PICT2SVG_WIN32_RESOURCE@
+pict2svg_LDADD = ../../lib/libpict-@PICT_MAJOR_VERSION@.@PICT_MINOR_VERSION@.la $(REVENGE_LIBS) $(REVENGE_GENERATORS_LIBS) $(REVENGE_STREAM_LIBS) @PICT2SVG_WIN32_RESOURCE@
endif
pict2svg_SOURCES = \
diff --git a/src/conv/svg/pict2svg.cpp b/src/conv/svg/pict2svg.cpp
index 28e7e69..a4a491f 100644
--- a/src/conv/svg/pict2svg.cpp
+++ b/src/conv/svg/pict2svg.cpp
@@ -27,8 +27,9 @@
#include <sstream>
#include <stdio.h>
#include <string.h>
-#include <libwpd-stream/libwpd-stream.h>
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
+#include <librevenge-generators/librevenge-generators.h>
+#include <librevenge-stream/librevenge-stream.h>
#include <libpict/libpict.h>
#ifdef HAVE_CONFIG_H
@@ -80,7 +81,7 @@ int main(int argc, char *argv[])
if (!file)
return printUsage();
- WPXFileStream input(file);
+ librevenge::RVNGFileStream input(file);
if (!libpict::PictImage::isSupported(&input))
{
@@ -88,13 +89,42 @@ int main(int argc, char *argv[])
return 1;
}
- ::WPXString output;
- if (!libpict::PictImage::generateSVG(&input, output))
+ librevenge::RVNGStringVector output;
+ librevenge::RVNGSVGDrawingGenerator generator(output, "");
+ if (!libpict::PictImage::parse(&input, &generator))
{
std::cerr << "ERROR: SVG Generation failed!" << std::endl;
return 1;
}
- std::cout << output.cstr() << std::endl;
+ if (output.empty())
+ {
+ std::cerr << "ERROR: No SVG document generated!" << std::endl;
+ return 1;
+ }
+
+ std::cout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
+ std::cout << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" << std::endl;
+ std::cout << "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">" << std::endl;
+ std::cout << "<body>" << std::endl;
+ std::cout << "<?import namespace=\"svg\" urn=\"http://www.w3.org/2000/svg\"?>" << std::endl;
+
+ for (unsigned k = 0; k<output.size(); ++k)
+ {
+ if (k>0)
+ std::cout << "<hr/>\n";
+
+ std::cout << "<!-- \n";
+ std::cout << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
+ std::cout << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"";
+ std::cout << " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
+ std::cout << " -->\n";
+
+ std::cout << output[k].cstr() << std::endl;
+ }
+
+ std::cout << "</body>" << std::endl;
+ std::cout << "</html>" << std::endl;
+
return 0;
}
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 441c5e4..324c879 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -10,16 +10,15 @@ libpict_@PICT_MAJOR_VERSION@_@PICT_MINOR_VERSION@_include_HEADERS = \
$(top_srcdir)/inc/libpict/libpict.h \
$(top_srcdir)/inc/libpict/PictImage.h
-AM_CXXFLAGS = -I$(top_srcdir)/inc $(LIBPICT_CXXFLAGS) $(DEBUG_CXXFLAGS)
+AM_CXXFLAGS = -I$(top_srcdir)/inc $(REVENGE_CFLAGS) $(REVENGE_STREAM_CFLAGS) $(DEBUG_CXXFLAGS)
-libpict_@PICT_MAJOR_VERSION@_@PICT_MINOR_VERSION@_la_LIBADD = $(LIBPICT_LIBS) @LIBPICT_WIN32_RESOURCE@
+libpict_@PICT_MAJOR_VERSION@_@PICT_MINOR_VERSION@_la_LIBADD = $(REVENGE_LIBS) @LIBPICT_WIN32_RESOURCE@
libpict_@PICT_MAJOR_VERSION@_@PICT_MINOR_VERSION@_la_DEPENDENCIES = @LIBPICT_WIN32_RESOURCE@
libpict_@PICT_MAJOR_VERSION@_@PICT_MINOR_VERSION@_la_LDFLAGS = $(version_info) -export-dynamic -no-undefined
libpict_@PICT_MAJOR_VERSION@_@PICT_MINOR_VERSION@_la_SOURCES = \
PictImage.cpp \
PictColor.cpp \
PictHeader.cpp \
- PictSVGGenerator.cpp \
PictXParser.cpp \
Pict1Parser.cpp \
Pict2Parser.cpp \
@@ -27,7 +26,6 @@ libpict_@PICT_MAJOR_VERSION@_@PICT_MINOR_VERSION@_la_SOURCES = \
libpict_utils.h \
PictColor.h \
PictHeader.h \
- PictSVGGenerator.h \
PictXParser.h \
Pict1Parser.h \
Pict2Parser.h \
diff --git a/src/lib/Pict1Parser.cpp b/src/lib/Pict1Parser.cpp
index 3168457..6f03e27 100644
--- a/src/lib/Pict1Parser.cpp
+++ b/src/lib/Pict1Parser.cpp
@@ -20,10 +20,10 @@
#include "Pict1Parser.h"
#include "libpict_utils.h"
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
+#include <librevenge/librevenge.h>
+#include <librevenge/librevenge.h>
-Pict1Parser::Pict1Parser(WPXInputStream *input, libwpg::WPGPaintInterface *painter):
+Pict1Parser::Pict1Parser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter):
PictXParser(input, painter),
m_recordSize(0)
{
@@ -156,7 +156,7 @@ bool Pict1Parser::parse()
{ 0xff, "EndOfPicture", &Pict1Parser::handleEndOfPicture, 1 }
};
- while(!m_input->atEOS())
+ while(!m_input->isEnd())
{
long initialPosition = m_input->tell();
int recordType = readU8();
@@ -188,7 +188,7 @@ bool Pict1Parser::parse()
return false;
else
{
- m_input->seek(initialPosition + m_recordSize, WPX_SEEK_SET);
+ m_input->seek(initialPosition + m_recordSize, librevenge::RVNG_SEEK_SET);
m_recordSize = 0;
}
}
@@ -290,28 +290,28 @@ void Pict1Parser::handleShortLineFrom()
void Pict1Parser::handleLongText()
{
- m_input->seek(6, WPX_SEEK_CUR);
+ m_input->seek(6, librevenge::RVNG_SEEK_CUR);
m_recordSize = (int)readU16() + 6;
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
void Pict1Parser::handleDHText()
{
- m_input->seek(2, WPX_SEEK_CUR);
+ m_input->seek(2, librevenge::RVNG_SEEK_CUR);
m_recordSize = (int)readU16() + 3;
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
void Pict1Parser::handleDVText()
{
- m_input->seek(2, WPX_SEEK_CUR);
+ m_input->seek(2, librevenge::RVNG_SEEK_CUR);
m_recordSize = (int)readU16() + 3;
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
void Pict1Parser::handleDHDVText()
{
- m_input->seek(3, WPX_SEEK_CUR);
+ m_input->seek(3, librevenge::RVNG_SEEK_CUR);
m_recordSize = (int)readU16() + 4;
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
@@ -588,7 +588,7 @@ void Pict1Parser::handleBitsRect()
unsigned short bounds_bottom = readU16();
PICT_DEBUG_MSG(("Bounds.bottom: %i\n", bounds_bottom));
readU16();
- m_input->seek(18, WPX_SEEK_CUR);
+ m_input->seek(18, librevenge::RVNG_SEEK_CUR);
m_recordSize = 29 + (0x7fff & rowBytes)*((bounds_bottom > bounds_top) ? bounds_bottom - bounds_top : bounds_top - bounds_bottom);
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
@@ -603,7 +603,7 @@ void Pict1Parser::handleBitsRgn()
unsigned short bounds_bottom = readU16();
PICT_DEBUG_MSG(("Bounds.bottom: %i\n", bounds_bottom));
readU16();
- m_input->seek(18, WPX_SEEK_CUR);
+ m_input->seek(18, librevenge::RVNG_SEEK_CUR);
m_recordSize = 29 + (0x7fff & rowBytes)*((bounds_bottom > bounds_top) ? (int)(bounds_bottom - bounds_top) : (int)(bounds_top - bounds_bottom));
m_recordSize += readU16();
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
@@ -626,7 +626,7 @@ void Pict1Parser::handlePackBitsRect()
readU16();
#endif
readU16();
- m_input->seek(18, WPX_SEEK_CUR);
+ m_input->seek(18, librevenge::RVNG_SEEK_CUR);
#if 0
m_recordSize = 29 + (0x7fff & rowBytes)*((bounds_bottom > bounds_top) ? bounds_bottom - bounds_top : bounds_top - bounds_bottom);
#endif
@@ -650,7 +650,7 @@ void Pict1Parser::handlePackBitsRgn()
readU16();
#endif
readU16();
- m_input->seek(18, WPX_SEEK_CUR);
+ m_input->seek(18, librevenge::RVNG_SEEK_CUR);
#if 0
m_recordSize = 29 + (0x7fff & rowBytes)*((bounds_bottom > bounds_top) ? bounds_bottom - bounds_top : bounds_top - bounds_bottom);
m_recordSize += readU16();
diff --git a/src/lib/Pict1Parser.h b/src/lib/Pict1Parser.h
index ad44d92..7d9bf41 100644
--- a/src/lib/Pict1Parser.h
+++ b/src/lib/Pict1Parser.h
@@ -23,13 +23,13 @@
#include "PictXParser.h"
#include "PictBitmap.h"
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
#include <vector>
class Pict1Parser : public PictXParser
{
public:
- Pict1Parser(WPXInputStream *input, libwpg::WPGPaintInterface *painter);
+ Pict1Parser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
bool parse();
private:
diff --git a/src/lib/Pict2Parser.cpp b/src/lib/Pict2Parser.cpp
index e9bb65d..9dbb7cb 100644
--- a/src/lib/Pict2Parser.cpp
+++ b/src/lib/Pict2Parser.cpp
@@ -19,10 +19,10 @@
#include "Pict2Parser.h"
#include "libpict_utils.h"
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
+#include <librevenge/librevenge.h>
+#include <librevenge/librevenge.h>
-Pict2Parser::Pict2Parser(WPXInputStream *input, libwpg::WPGPaintInterface *painter):
+Pict2Parser::Pict2Parser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter):
PictXParser(input, painter),
m_recordSize(0)
{
@@ -205,13 +205,13 @@ bool Pict2Parser::parse()
{ 0xff, "EndOfPicture", &Pict2Parser::handleEndOfPicture, 2 }
};
- while(!m_input->atEOS())
+ while(!m_input->isEnd())
{
m_recordSize = -1;
long initialPosition = m_input->tell();
// Opcodes are aligned to 2 bytes
if (initialPosition % 2)
- m_input->seek((int)(++initialPosition), WPX_SEEK_SET);
+ m_input->seek((int)(++initialPosition), librevenge::RVNG_SEEK_SET);
int recordType = readU16();
if (recordType == 0x00ff)
break;
@@ -263,7 +263,7 @@ bool Pict2Parser::parse()
if (m_recordSize <= 0) // we were not able to compute variable record size
return false;
else
- m_input->seek(initialPosition + m_recordSize, WPX_SEEK_SET);
+ m_input->seek(initialPosition + m_recordSize, librevenge::RVNG_SEEK_SET);
}
return true;
}
@@ -404,28 +404,28 @@ void Pict2Parser::handleShortLineFrom()
void Pict2Parser::handleLongText()
{
- m_input->seek(6, WPX_SEEK_CUR);
+ m_input->seek(6, librevenge::RVNG_SEEK_CUR);
m_recordSize = (int)readU16() + 6;
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
void Pict2Parser::handleDHText()
{
- m_input->seek(2, WPX_SEEK_CUR);
+ m_input->seek(2, librevenge::RVNG_SEEK_CUR);
m_recordSize = (int)readU16() + 3;
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
void Pict2Parser::handleDVText()
{
- m_input->seek(2, WPX_SEEK_CUR);
+ m_input->seek(2, librevenge::RVNG_SEEK_CUR);
m_recordSize = (int)readU16() + 3;
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
void Pict2Parser::handleDHDVText()
{
- m_input->seek(3, WPX_SEEK_CUR);
+ m_input->seek(3, librevenge::RVNG_SEEK_CUR);
m_recordSize = (int)readU16() + 4;
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
@@ -702,7 +702,7 @@ void Pict2Parser::handleBitsRect()
unsigned short bounds_bottom = readU16();
PICT_DEBUG_MSG(("Bounds.bottom: %i\n", bounds_bottom));
readU16();
- m_input->seek(18, WPX_SEEK_CUR);
+ m_input->seek(18, librevenge::RVNG_SEEK_CUR);
m_recordSize = 29 + (0x7fff & rowBytes)*((bounds_bottom > bounds_top) ? bounds_bottom - bounds_top : bounds_top - bounds_bottom);
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
}
@@ -717,7 +717,7 @@ void Pict2Parser::handleBitsRgn()
unsigned short bounds_bottom = readU16();
PICT_DEBUG_MSG(("Bounds.bottom: %i\n", bounds_bottom));
readU16();
- m_input->seek(18, WPX_SEEK_CUR);
+ m_input->seek(18, librevenge::RVNG_SEEK_CUR);
m_recordSize = 29 + (0x7fff & rowBytes)*((bounds_bottom > bounds_top) ? (int)(bounds_bottom - bounds_top) : (int)(bounds_top - bounds_bottom));
m_recordSize += readU16();
PICT_DEBUG_MSG(("Size of the data: %i\n", m_recordSize));
@@ -740,7 +740,7 @@ void Pict2Parser::handlePackBitsRect()
readU16();
#endif
readU16();
- m_input->seek(18, WPX_SEEK_CUR);
+ m_input->seek(18, librevenge::RVNG_SEEK_CUR);
#if 0
m_recordSize = 29 + (0x7fff & rowBytes)*((bounds_bottom > bounds_top) ? bounds_bottom - bounds_top : bounds_top - bounds_bottom);
#endif
@@ -764,7 +764,7 @@ void Pict2Parser::handlePackBitsRgn()
readU16();
#endif
readU16();
- m_input->seek(18, WPX_SEEK_CUR);
+ m_input->seek(18, librevenge::RVNG_SEEK_CUR);
#if 0
m_recordSize = 29 + (0x7fff & rowBytes)*((bounds_bottom > bounds_top) ? bounds_bottom - bounds_top : bounds_top - bounds_bottom);
m_recordSize += readU16();
diff --git a/src/lib/Pict2Parser.h b/src/lib/Pict2Parser.h
index 5091cf0..2e372a3 100644
--- a/src/lib/Pict2Parser.h
+++ b/src/lib/Pict2Parser.h
@@ -22,7 +22,7 @@
#include "PictXParser.h"
#include "PictBitmap.h"
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
#include <map>
#include <stack>
@@ -31,7 +31,7 @@
class Pict2Parser : public PictXParser
{
public:
- Pict2Parser(WPXInputStream *input, libwpg::WPGPaintInterface *painter);
+ Pict2Parser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
bool parse();
private:
diff --git a/src/lib/PictBitmap.cpp b/src/lib/PictBitmap.cpp
index 78bcd12..3a3ad48 100644
--- a/src/lib/PictBitmap.cpp
+++ b/src/lib/PictBitmap.cpp
@@ -75,7 +75,7 @@ public:
bool vFlip;
bool hFlip;
PictColor *pixels;
- ::WPXBinaryData dib;
+ librevenge::RVNGBinaryData dib;
Private(int w, int h): width(w), height(h), vRes(72), hRes(72), vFlip(false), hFlip(false), pixels(0), dib() {}
};
@@ -149,7 +149,7 @@ void libpict::PictBitmap::setPixel(int x, int y, const libpict::PictColor &color
d->pixels[y*d->width + x] = color;
}
-const ::WPXBinaryData &libpict::PictBitmap::getDIB() const
+const librevenge::RVNGBinaryData &libpict::PictBitmap::getDIB() const
{
if (d->dib.size() || d->height <= 0 || d->width <= 0)
return d->dib;
diff --git a/src/lib/PictBitmap.h b/src/lib/PictBitmap.h
index 4791cb7..43e6759 100644
--- a/src/lib/PictBitmap.h
+++ b/src/lib/PictBitmap.h
@@ -28,7 +28,7 @@
#define __PICTBITMAP_H__
#include "PictColor.h"
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
namespace libpict
{
@@ -60,7 +60,7 @@ public:
void setPixel(int x, int y, const PictColor &color);
- const ::WPXBinaryData &getDIB() const;
+ const librevenge::RVNGBinaryData &getDIB() const;
private:
class Private;
diff --git a/src/lib/PictColor.cpp b/src/lib/PictColor.cpp
index 4338dec..9c99f5f 100644
--- a/src/lib/PictColor.cpp
+++ b/src/lib/PictColor.cpp
@@ -62,9 +62,9 @@ libpict::PictColor &libpict::PictColor::operator=(const libpict::PictColor &colo
return *this;
}
-const ::WPXString libpict::PictColor::getColorString() const
+const librevenge::RVNGString libpict::PictColor::getColorString() const
{
- ::WPXString sColor;
+ librevenge::RVNGString sColor;
sColor.sprintf("#%.2x%.2x%.2x", red, green, blue);
return sColor;
}
diff --git a/src/lib/PictColor.h b/src/lib/PictColor.h
index d6bbdbe..a049e2e 100644
--- a/src/lib/PictColor.h
+++ b/src/lib/PictColor.h
@@ -26,7 +26,7 @@
#ifndef __PICTCOLOR_H__
#define __PICTCOLOR_H__
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
namespace libpict
{
@@ -46,7 +46,7 @@ public:
PictColor &operator=(const PictColor &color);
- const ::WPXString getColorString() const;
+ const librevenge::RVNGString getColorString() const;
double getOpacity() const;
};
diff --git a/src/lib/PictHeader.cpp b/src/lib/PictHeader.cpp
index 81ec17d..e66e219 100644
--- a/src/lib/PictHeader.cpp
+++ b/src/lib/PictHeader.cpp
@@ -22,7 +22,7 @@
namespace
{
-unsigned char readU8(WPXInputStream *input)
+unsigned char readU8(librevenge::RVNGInputStream *input)
{
unsigned long numBytesRead;
unsigned char const *p = input->read(sizeof(unsigned char), numBytesRead);
@@ -32,7 +32,7 @@ unsigned char readU8(WPXInputStream *input)
return *(unsigned char const *)(p);
}
-unsigned short readU16(WPXInputStream *input)
+unsigned short readU16(librevenge::RVNGInputStream *input)
{
unsigned long numBytesRead;
unsigned short const *p = (unsigned short const *)input->read(sizeof(unsigned short), numBytesRead);
@@ -42,7 +42,7 @@ unsigned short readU16(WPXInputStream *input)
return (unsigned short)((((unsigned char const *)(p))[1] << 0) | (((unsigned char const *)(p))[0] << 8));
}
-unsigned readU32(WPXInputStream *input)
+unsigned readU32(librevenge::RVNGInputStream *input)
{
unsigned long numBytesRead;
unsigned const *p = (unsigned const *)input->read(sizeof(unsigned), numBytesRead);
@@ -67,7 +67,7 @@ PictHeader::PictHeader() :
{
}
-bool PictHeader::load(WPXInputStream *input)
+bool PictHeader::load(librevenge::RVNGInputStream *input)
{
if (loadPict1Header(input))
return true;
@@ -76,22 +76,22 @@ bool PictHeader::load(WPXInputStream *input)
return false;
}
-bool PictHeader::loadPict1Header(WPXInputStream *input)
+bool PictHeader::loadPict1Header(librevenge::RVNGInputStream *input)
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
/* Try first to see whether the 512 bytes header is missing */
- input->seek(10, WPX_SEEK_CUR);
+ input->seek(10, librevenge::RVNG_SEEK_CUR);
if ((0x11 == readU8(input)) && (0x01 == readU8(input)))
- input->seek(0, WPX_SEEK_CUR);
+ input->seek(0, librevenge::RVNG_SEEK_CUR);
/* Ok, let us now skip the first 512 bytes and restart */
else
{
- input->seek(512 + 10, WPX_SEEK_SET);
+ input->seek(512 + 10, librevenge::RVNG_SEEK_SET);
if ((0x11 == readU8(input)) && (0x01 == readU8(input)))
- input->seek(512, WPX_SEEK_SET);
+ input->seek(512, librevenge::RVNG_SEEK_SET);
else
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
PICT_DEBUG_MSG(("No Pict1 header present\n"));
return false;
}
@@ -105,37 +105,37 @@ bool PictHeader::loadPict1Header(WPXInputStream *input)
m_right = readU16(input);
if (0x11 != readU8(input))
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
return false;
}
if (0x01 != readU8(input))
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
return false;
}
PICT_DEBUG_MSG(("Pict1Header: fileSize = 0x%.4x, top = 0x%.4x, left = 0x%.4x, bottom = 0x%.4x, right = 0x%.4x\n", m_fileSize, m_top, m_left, m_bottom, m_right));
m_dataStart = input->tell();
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
m_pictVersion = 1;
return true;
}
-bool PictHeader::loadPict2Header(WPXInputStream *input)
+bool PictHeader::loadPict2Header(librevenge::RVNGInputStream *input)
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
/* Try first to see whether the 512 bytes header is missing */
- input->seek(10, WPX_SEEK_CUR);
+ input->seek(10, librevenge::RVNG_SEEK_CUR);
if ((0x0011 == readU16(input)) && (0x02FF == readU16(input)))
- input->seek(0, WPX_SEEK_CUR);
+ input->seek(0, librevenge::RVNG_SEEK_CUR);
/* Ok, let us now skip the first 512 bytes and restart */
else
{
- input->seek(512 + 10, WPX_SEEK_SET);
+ input->seek(512 + 10, librevenge::RVNG_SEEK_SET);
if ((0x0011 == readU16(input)) && (0x02FF == readU16(input)))
- input->seek(512, WPX_SEEK_SET);
+ input->seek(512, librevenge::RVNG_SEEK_SET);
else
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
PICT_DEBUG_MSG(("No Pict2 header present\n"));
return false;
}
@@ -149,24 +149,24 @@ bool PictHeader::loadPict2Header(WPXInputStream *input)
m_right = readU16(input);
if (0x0011 != readU16(input))
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
return false;
}
if (0x02FF != readU16(input))
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
return false;
}
if (0x0C00 != readU16(input))
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
return false;
}
else
- input->seek(24, WPX_SEEK_CUR);
+ input->seek(24, librevenge::RVNG_SEEK_CUR);
PICT_DEBUG_MSG(("Pict2Header: fileSize = 0x%.4x, top = 0x%.4x, left = 0x%.4x, bottom = 0x%.4x, right = 0x%.4x\n", m_fileSize, m_top, m_left, m_bottom, m_right));
m_dataStart = input->tell();
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
m_pictVersion = 2;
return true;
}
diff --git a/src/lib/PictHeader.h b/src/lib/PictHeader.h
index d910634..c60dea6 100644
--- a/src/lib/PictHeader.h
+++ b/src/lib/PictHeader.h
@@ -20,14 +20,14 @@
#ifndef __PICTHEADER_H__
#define __PICTHEADER_H__
-#include <libwpd-stream/WPXStream.h>
+#include <librevenge-stream/librevenge-stream.h>
class PictHeader
{
public:
PictHeader();
- bool load(WPXInputStream *input);
+ bool load(librevenge::RVNGInputStream *input);
unsigned long startOfDocument() const
{
@@ -77,8 +77,8 @@ private:
unsigned long m_pictureSize;
unsigned long m_dataStart;
- bool loadPict1Header(WPXInputStream *input);
- bool loadPict2Header(WPXInputStream *input);
+ bool loadPict1Header(librevenge::RVNGInputStream *input);
+ bool loadPict2Header(librevenge::RVNGInputStream *input);
};
#endif // PictHEADER
diff --git a/src/lib/PictImage.cpp b/src/lib/PictImage.cpp
index 7b3e026..32811ff 100644
--- a/src/lib/PictImage.cpp
+++ b/src/lib/PictImage.cpp
@@ -18,14 +18,13 @@
*/
#include <sstream>
-#include <libwpg/libwpg.h>
+#include <librevenge/librevenge.h>
#include <libpict/libpict.h>
#include "PictHeader.h"
#include "PictXParser.h"
#include "Pict1Parser.h"
#include "Pict2Parser.h"
#include "libpict_utils.h"
-#include "PictSVGGenerator.h"
/**
Analyzes the content of an input stream to see if it can be parsed
@@ -33,9 +32,9 @@ 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 Macintosh Pict Image that libpict is able to parse
*/
-bool libpict::PictImage::isSupported(WPXInputStream *input)
+bool libpict::PictImage::isSupported(librevenge::RVNGInputStream *input)
{
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
PictHeader header;
if(!header.load(input))
@@ -46,17 +45,17 @@ bool libpict::PictImage::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
+librevenge::RVNGDrawingInterface class implementation when needed. This is often commonly called the
'main parsing routine'.
\param input The input stream
-\param painter A WPGPainterInterface implementation
+\param painter A librevenge::RVNGDrawingInterface implementation
\return A value that indicates whether the parsing was successful
*/
-bool libpict::PictImage::parse(::WPXInputStream *input, libwpg::WPGPaintInterface *painter)
+bool libpict::PictImage::parse(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter)
{
PictXParser *parser = 0;
- input->seek(0, WPX_SEEK_SET);
+ input->seek(0, librevenge::RVNG_SEEK_SET);
PICT_DEBUG_MSG(("Loading header...\n"));
PictHeader header;
@@ -64,7 +63,7 @@ bool libpict::PictImage::parse(::WPXInputStream *input, libwpg::WPGPaintInterfac
return false;
// seek to the start of document
- input->seek(header.startOfDocument(), WPX_SEEK_SET);
+ input->seek(header.startOfDocument(), librevenge::RVNG_SEEK_SET);
unsigned char tmpVersion = header.getVersion();
bool retval;
@@ -90,22 +89,3 @@ bool libpict::PictImage::parse(::WPXInputStream *input, libwpg::WPGPaintInterfac
return retval;
}
-
-/**
-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 libpict::PictImage::generateSVG(::WPXInputStream *input, WPXString &output)
-{
- std::ostringstream tmpOutputStream;
- libpict::PictSVGGenerator generator(tmpOutputStream);
- bool result = libpict::PictImage::parse(input, &generator);
- if (result)
- output = WPXString(tmpOutputStream.str().c_str());
- else
- output = WPXString("");
- return result;
-}
diff --git a/src/lib/PictSVGGenerator.cpp b/src/lib/PictSVGGenerator.cpp
deleted file mode 100644
index 16a4012..0000000
--- a/src/lib/PictSVGGenerator.cpp
+++ /dev/null
@@ -1,342 +0,0 @@
-/* libpict
- * Copyright (C) 2011 Fridrich Strba (fridrich.strba@bluewin.ch)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1301 USA
- */
-
-#include "PictSVGGenerator.h"
-#include <locale.h>
-#include <sstream>
-#include <string>
-
-static std::string doubleToString(const double value)
-{
- std::ostringstream tempStream;
- tempStream << value;
- std::string decimalPoint(localeconv()->decimal_point);
- if ((decimalPoint.size() == 0) || (decimalPoint == "."))
- return tempStream.str();
- std::string stringValue(tempStream.str());
- if (!stringValue.empty())
- {
- std::string::size_type pos;
- while ((pos = stringValue.find(decimalPoint)) != std::string::npos)
- stringValue.replace(pos,decimalPoint.size(),".");
- }
- return stringValue;
-}
-
-
-libpict::PictSVGGenerator::PictSVGGenerator(std::ostream &output_sink): m_gradient(), m_style(), m_gradientIndex(1), m_outputSink(output_sink)
-{
-}
-
-libpict::PictSVGGenerator::~PictSVGGenerator()
-{
-}
-
-void libpict::PictSVGGenerator::startGraphics(const WPXPropertyList &propList)
-{
- m_outputSink << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n";
- m_outputSink << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"";
- m_outputSink << " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
-
- m_outputSink << "<!-- Created with pict2svg/libpict -->\n";
-
- m_outputSink << "<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" ";
- m_outputSink << "xmlns:xlink=\"http://www.w3.org/1999/xlink\" ";
- if (propList["svg:width"])
- m_outputSink << "width=\"" << doubleToString(72*(propList["svg:width"]->getDouble())) << "\" ";
- if (propList["svg:height"])
- m_outputSink << "height=\"" << doubleToString(72*(propList["svg:height"]->getDouble())) << "\"";
- m_outputSink << " >\n";
-
- m_gradientIndex = 1;
-}
-
-void libpict::PictSVGGenerator::endGraphics()
-{
- m_outputSink << "</svg>\n";
-}
-
-void libpict::PictSVGGenerator::setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient)
-{
- m_style = propList;
-
- m_gradient = gradient;
-
- if(propList["draw:fill"] && propList["draw:fill"]->getStr() == "gradient" && m_gradient.count())
- {
- double angle = (m_style["draw:angle"] ? m_style["draw:angle"]->getDouble() : 0.0);
-
- m_outputSink << "<defs>\n";
- m_outputSink << " <linearGradient id=\"grad" << m_gradientIndex++ << "\" >\n";
- for(unsigned c = 0; c < m_gradient.count(); c++)
- {
- m_outputSink << " <stop offset=\"" << m_gradient[c]["svg:offset"]->getStr().cstr() << "\"";
-
- m_outputSink << " stop-color=\"" << m_gradient[c]["svg:stop-color"]->getStr().cstr() << "\"";
- m_outputSink << " stop-opacity=\"" << m_gradient[c]["svg:stop-opacity"]->getStr().cstr() << "\" />" << std::endl;
-
- }
- m_outputSink << " </linearGradient>\n";
-
- // not a simple horizontal gradient
- if(angle != -90)
- {
- m_outputSink << " <linearGradient xlink:href=\"#grad" << m_gradientIndex-1 << "\"";
- m_outputSink << " id=\"grad" << m_gradientIndex++ << "\" ";
- m_outputSink << "x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\" ";
- m_outputSink << "gradientTransform=\"rotate(" << angle << ")\" ";
- m_outputSink << "gradientUnits=\"objectBoundingBox\" >\n";
- m_outputSink << " </linearGradient>\n";
- }
-
- m_outputSink << "</defs>\n";
- }
-
-}
-
-void libpict::PictSVGGenerator::startLayer(const ::WPXPropertyList &propList)
-{
- m_outputSink << "<g id=\"Layer" << propList["svg:id"]->getInt() << "\" >\n";
-}
-
-void libpict::PictSVGGenerator::endLayer()
-{
- m_outputSink << "</g>\n";
-}
-
-void libpict::PictSVGGenerator::drawRectangle(const ::WPXPropertyList &propList)
-{
- m_outputSink << "<rect ";
- m_outputSink << "x=\"" << doubleToString(72*propList["svg:x"]->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 libpict::PictSVGGenerator::drawEllipse(const WPXPropertyList &propList)
-{
- m_outputSink << "<ellipse ";
- m_outputSink << "cx=\"" << doubleToString(72*propList["svg:cx"]->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["libpict:rotate"] && propList["libpict:rotate"]->getDouble() != 0.0)
- m_outputSink << " transform=\" translate(" << doubleToString(72*propList["svg:cx"]->getDouble()) << ", " << doubleToString(72*propList["svg:cy"]->getDouble())
- << ") rotate(" << doubleToString(-propList["libpict:rotate"]->getDouble())
- << ") translate(" << doubleToString(-72*propList["svg:cx"]->getDouble())
- << ", " << doubleToString(-72*propList["svg:cy"]->getDouble())
- << ")\" ";
- m_outputSink << "/>\n";
-}
-
-void libpict::PictSVGGenerator::drawPolyline(const ::WPXPropertyListVector &vertices)
-{
- drawPolySomething(vertices, false);
-}
-
-void libpict::PictSVGGenerator::drawPolygon(const ::WPXPropertyListVector &vertices)
-{
- drawPolySomething(vertices, true);
-}
-
-void libpict::PictSVGGenerator::drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed)
-{
- if(vertices.count() < 2)
- return;
-
- if(vertices.count() == 2)
- {
- m_outputSink << "<line ";
- m_outputSink << "x1=\"" << doubleToString(72*(vertices[0]["svg:x"]->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 << "<polygon ";
- else
- m_outputSink << "<polyline ";
-
- m_outputSink << "points=\"";
- for(unsigned i = 0; i < vertices.count(); i++)
- {
- m_outputSink << doubleToString(72*(vertices[i]["svg:x"]->getDouble())) << " " << doubleToString(72*(vertices[i]["svg:y"]->getDouble()));
- if (i < vertices.count()-1)
- m_outputSink << ", ";
- }
- m_outputSink << "\"\n";
- writeStyle(isClosed);
- m_outputSink << "/>\n";
- }
-}
-
-void libpict::PictSVGGenerator::drawPath(const ::WPXPropertyListVector &path)
-{
- m_outputSink << "<path d=\" ";
- bool isClosed = false;
- unsigned i=0;
- for(i=0; i < path.count(); i++)
- {
- WPXPropertyList propList = path[i];
- if (propList["libpict:path-action"] && propList["libpict:path-action"]->getStr() == "M")
- {
- m_outputSink << "\nM";
- m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble()));
- }
- else if (propList["libpict:path-action"] && propList["libpict:path-action"]->getStr() == "L")
- {
- m_outputSink << "\nL";
- m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble()));
- }
- else if (propList["libpict:path-action"] && propList["libpict: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["libpict:path-action"] && propList["libpict:path-action"]->getStr() == "A")
- {
- m_outputSink << "\nA";
- m_outputSink << doubleToString(72*(propList["svg:rx"]->getDouble())) << "," << doubleToString(72*(propList["svg:ry"]->getDouble())) << " ";
- m_outputSink << (propList["libpict:rotate"] ? propList["libpict:rotate"]->getStr().cstr() : "0") << " ";
- m_outputSink << "0,0 ";
- m_outputSink << doubleToString(72*(propList["svg:x"]->getDouble())) << "," << doubleToString(72*(propList["svg:y"]->getDouble()));
- }
- else if ((i >= path.count()-1 && i > 2) && propList["libpict:path-action"] && propList["libpict:path-action"]->getStr() == "Z" )
- {
- isClosed = true;
- m_outputSink << "\nZ";
- }
- }
-
- m_outputSink << "\" \n";
- writeStyle(isClosed);
- m_outputSink << "/>\n";
-}
-
-void libpict::PictSVGGenerator::drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData)
-{
- if (!propList["libpict:mime-type"] || propList["libpict:mime-type"]->getStr().len() <= 0)
- return;
- WPXString base64 = binaryData.getBase64Data();
- m_outputSink << "<image ";
- if (propList["svg:x"] && propList["svg:y"] && propList["svg:width"] && propList["svg:height"])
- m_outputSink << "x=\"" << doubleToString(72*(propList["svg:x"]->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["libpict:mime-type"]->getStr().cstr() << ";base64,";
- m_outputSink << base64.cstr();
- m_outputSink << "\" />\n";
-}
-
-void libpict::PictSVGGenerator::startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector & /* path */)
-{
- m_outputSink << "<text ";
- if (propList["svg:x"] && propList["svg:y"])
- m_outputSink << "x=\"" << doubleToString(72*(propList["svg:x"]->getDouble())) << "\" y=\"" << doubleToString(72*(propList["svg:y"]->getDouble())) << "\">\n";
-}
-
-void libpict::PictSVGGenerator::endTextObject()
-{
- m_outputSink << "</text>\n";
-}
-
-void libpict::PictSVGGenerator::startTextSpan(const ::WPXPropertyList &propList)
-{
- m_outputSink << "<tspan ";
- if (propList["style:font-name"])
- m_outputSink << "font-family=\"" << propList["style:font-name"]->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-weight"]->getStr().cstr() << "\" ";
- if (propList["fo:font-size"])
- m_outputSink << "font-size=\"" << propList["fo:font-size"]->getStr().cstr() << "\" ";
- if (propList["fo:color"])
- m_outputSink << "fill=\"" << propList["fo:color"]->getStr().cstr() << "\" ";
- m_outputSink << ">\n";
-}
-
-void libpict::PictSVGGenerator::endTextSpan()
-{
- m_outputSink << "</tspan>\n";
-}
-
-void libpict::PictSVGGenerator::insertText(const ::WPXString &str)
-{
- WPXString tempUTF8(str, true);
- m_outputSink << tempUTF8.cstr() << "\n";
-}
-
-// create "style" attribute based on current pen and brush
-void libpict::PictSVGGenerator::writeStyle(bool /* isClosed */)
-{
- m_outputSink << "style=\"";
-
- if (m_style["svg:stroke-width"])
- m_outputSink << "stroke-width: " << doubleToString(72*m_style["svg:stroke-width"]->getDouble()) << "; ";
-
- if((m_style["svg:stroke-width"] && m_style["svg:stroke-width"]->getDouble() > 0.0) || (m_style["draw:stroke"] && m_style["draw:stroke"]->getStr() == "solid"))
- {
- 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"))
- {
-#if 0
- if (m_dashArray.count())
- {
- m_outputSink << "stroke-dasharray: ";
- for(unsigned i = 0; i < m_dashArray.count(); i++)
- {
- m_outputSink << doubleToString(72*m_dashArray.at(i)*m_style["svg:stroke_width"]->getDouble());
- if(i < m_dashArray.count()-1)
- m_outputSink << ", ";
- }
- m_outputSink << "; ";
- }
-#endif
- }
-
- if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "none")
- m_outputSink << "fill: none; ";
-
- if(m_style["draw:fill"] && m_style["draw:fill"]->getStr() == "bitmap")
- 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() == "gradient")
- m_outputSink << "fill: url(#grad" << m_gradientIndex-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() << "; ";
-
- m_outputSink << "\""; // style
-}
diff --git a/src/lib/PictSVGGenerator.h b/src/lib/PictSVGGenerator.h
deleted file mode 100644
index 9300133..0000000
--- a/src/lib/PictSVGGenerator.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* libpict
- * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
- * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1301 USA
- *
- * For further information visit http://libpict.sourceforge.net
- */
-
-/* "This product is not manufactured, approved, or supported by
- * Corel Corporation or Corel Corporation Limited."
- */
-
-#ifndef __PICTSVGGENERATOR_H__
-#define __PICTSVGGENERATOR_H__
-
-#include <stdio.h>
-#include <iostream>
-#include <libwpd/libwpd.h>
-#include <libwpg/libwpg.h>
-#include <libpict/libpict.h>
-
-namespace libpict
-{
-
-class PictSVGGenerator : public libwpg::WPGPaintInterface
-{
-public:
- PictSVGGenerator(std::ostream &output_sink);
- ~PictSVGGenerator();
-
- 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;
- void writeStyle(bool isClosed=true);
- void drawPolySomething(const ::WPXPropertyListVector &vertices, bool isClosed);
-
- std::ostream &m_outputSink;
-};
-
-} // namespace libpict
-
-#endif // __PICTSVGGENERATOR_H__
diff --git a/src/lib/PictXParser.cpp b/src/lib/PictXParser.cpp
index 698dc90..1daa5f0 100644
--- a/src/lib/PictXParser.cpp
+++ b/src/lib/PictXParser.cpp
@@ -20,7 +20,7 @@
#include "PictXParser.h"
#include "libpict_utils.h"
-PictXParser::PictXParser(WPXInputStream *input, libwpg::WPGPaintInterface *painter):
+PictXParser::PictXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter):
m_input(input), m_painter(painter), m_colorPalette(std::map<int,libpict::PictColor>())
{
}
@@ -33,7 +33,7 @@ PictXParser::PictXParser(const PictXParser &parser):
unsigned char PictXParser::readU8()
{
- if (!m_input || m_input->atEOS())
+ if (!m_input || m_input->isEnd())
return (unsigned char)0;
unsigned long numBytesRead;
unsigned char const *p = m_input->read(sizeof(unsigned char), numBytesRead);
diff --git a/src/lib/PictXParser.h b/src/lib/PictXParser.h
index 3159284..c3ac8b8 100644
--- a/src/lib/PictXParser.h
+++ b/src/lib/PictXParser.h
@@ -28,9 +28,8 @@
#ifndef __PICTXPARSER_H__
#define __PICTXPARSER_H__
-#include <libwpg/libwpg.h>
-#include <libwpd-stream/WPXStream.h>
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
+#include <librevenge-stream/librevenge-stream.h>
#include "PictColor.h"
#include <map>
@@ -38,7 +37,7 @@
class PictXParser
{
public:
- PictXParser(WPXInputStream *input, libwpg::WPGPaintInterface *painter);
+ PictXParser(librevenge::RVNGInputStream *input, librevenge::RVNGDrawingInterface *painter);
PictXParser(const PictXParser &parser);
virtual ~PictXParser() {};
virtual bool parse() = 0;
@@ -52,8 +51,8 @@ public:
PictXParser &operator=(const PictXParser &parser);
protected:
- WPXInputStream *m_input;
- libwpg::WPGPaintInterface *m_painter;
+ librevenge::RVNGInputStream *m_input;
+ librevenge::RVNGDrawingInterface *m_painter;
std::map<int,libpict::PictColor> m_colorPalette;
};
diff --git a/src/lib/makefile.mk b/src/lib/makefile.mk
deleted file mode 100644
index 1641dd9..0000000
--- a/src/lib/makefile.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-
-PRJ=..$/..$/..$/..$/..$/..
-
-PRJNAME=libpict
-TARGET=pictlib
-ENABLE_EXCEPTIONS=TRUE
-LIBTARGET=NO
-
-.INCLUDE : settings.mk
-
-.IF "$(GUI)"=="WNT"
-CFLAGS+=-GR
-.ENDIF
-.IF "$(COM)"=="GCC"
-CFLAGSCXX+=-frtti
-.ENDIF
-
-.IF "$(SYSTEM_LIBWPD)" == "YES"
-INCPRE+=$(LIBWPD_CFLAGS) -I..
-.ELSE
-INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
-.ENDIF
-
-SLOFILES= \
- $(SLO)$/Pict1Parser.obj \
- $(SLO)$/Pict2Parser.obj \
- $(SLO)$/PictBitmap.obj \
- $(SLO)$/PictColor.obj \
- $(SLO)$/PictDashArray.obj \
- $(SLO)$/PictHeader.obj \
- $(SLO)$/PictInternalStream.obj \
- $(SLO)$/PictImage.obj \
- $(SLO)$/PictSVGGenerator.obj \
- $(SLO)$/PictXParser.obj
-
-LIB1ARCHIV=$(LB)$/libpictlib.a
-LIB1TARGET=$(SLB)$/$(TARGET).lib
-LIB1OBJFILES= $(SLOFILES)
-
-.INCLUDE : target.mk