diff -up calligra-2.8.6/CMakeLists.txt.librevenge calligra-2.8.6/CMakeLists.txt
--- calligra-2.8.6/CMakeLists.txt.librevenge 2014-09-22 15:39:32.290174245 -0500
+++ calligra-2.8.6/CMakeLists.txt 2014-09-22 15:39:32.293174214 -0500
@@ -661,6 +661,16 @@ macro_optional_find_package(Okular)
macro_log_feature(OKULAR_FOUND "Okular" "Okular ODP Plugin" "http://okular.kde.org/" FALSE "" "Required to build the Okular OpenDocument Presenter plugin")
##
+## Test for librevenge
+##
+macro_optional_find_package(LibRevenge)
+macro_log_feature(LIBREVENGE_FOUND "LibRevenge"
+ "A base library for writing document import filters"
+ "http://sf.net/p/libwpd/librevenge/" FALSE ""
+ "Required by various import filters"
+)
+
+##
## Test for libodfgen
##
macro_optional_find_package(LibOdfGen)
diff -up calligra-2.8.6/cmake/modules/FindLibEtonyek.cmake.librevenge calligra-2.8.6/cmake/modules/FindLibEtonyek.cmake
--- calligra-2.8.6/cmake/modules/FindLibEtonyek.cmake.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/cmake/modules/FindLibEtonyek.cmake 2014-09-22 15:39:32.293174214 -0500
@@ -10,16 +10,16 @@
include(LibFindMacros)
libfind_package(LIBETONYEK LibWpd)
-libfind_pkg_check_modules(LIBETONYEK_PKGCONF libetonyek-0.0)
+libfind_pkg_check_modules(LIBETONYEK_PKGCONF libetonyek-0.1)
find_path(LIBETONYEK_INCLUDE_DIR
NAMES libetonyek/libetonyek.h
HINTS ${LIBETONYEK_PKGCONF_INCLUDE_DIRS} ${LIBETONYEK_PKGCONF_INCLUDEDIR}
- PATH_SUFFIXES libetonyek-0.0
+ PATH_SUFFIXES libetonyek-0.1
)
find_library(LIBETONYEK_LIBRARY
- NAMES etonyek etonyek-0.0
+ NAMES etonyek etonyek-0.1
HINTS ${LIBETONYEK_PKGCONF_LIBRARY_DIRS} ${LIBETONYEK_PKGCONF_LIBDIR}
)
diff -up calligra-2.8.6/cmake/modules/FindLibOdfGen.cmake.librevenge calligra-2.8.6/cmake/modules/FindLibOdfGen.cmake
--- calligra-2.8.6/cmake/modules/FindLibOdfGen.cmake.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/cmake/modules/FindLibOdfGen.cmake 2014-09-22 15:39:32.293174214 -0500
@@ -9,16 +9,16 @@
# Redistribution and use is allowed according to the terms of the BSD license.
include(LibFindMacros)
-libfind_pkg_check_modules(LIBODFGEN_PKGCONF libodfgen-0.0)
+libfind_pkg_check_modules(LIBODFGEN_PKGCONF libodfgen-0.1)
find_path(LIBODFGEN_INCLUDE_DIR
NAMES libodfgen/libodfgen.hxx
HINTS ${LIBODFGEN_PKGCONF_INCLUDE_DIRS} ${LIBODFGEN_PKGCONF_INCLUDEDIR}
- PATH_SUFFIXES libodfgen-0.0
+ PATH_SUFFIXES libodfgen-0.1
)
find_library(LIBODFGEN_LIBRARY
- NAMES odfgen-0.0
+ NAMES odfgen-0.1
HINTS ${LIBODFGEN_PKGCONF_LIBRARY_DIRS} ${LIBODFGEN_PKGCONF_LIBDIR}
)
diff -up calligra-2.8.6/cmake/modules/FindLibRevenge.cmake.librevenge calligra-2.8.6/cmake/modules/FindLibRevenge.cmake
--- calligra-2.8.6/cmake/modules/FindLibRevenge.cmake.librevenge 2014-09-22 15:39:32.294174204 -0500
+++ calligra-2.8.6/cmake/modules/FindLibRevenge.cmake 2014-09-22 15:39:32.294174204 -0500
@@ -0,0 +1,37 @@
+# - Try to find the librevenge
+# Once done this will define
+#
+# LIBREVENGE_FOUND - system has LIBREVENGE
+# LIBREVENGE_INCLUDE_DIRS - the LIBREVENGE include directory
+# LIBREVENGE_LIBRARIES - Link these to use LIBREVENGE
+# LIBREVENGE_DEFINITIONS - Compiler switches required for using LIBREVENGE
+#
+
+include(LibFindMacros)
+libfind_pkg_check_modules(REVENGE_PKGCONF librevenge-0.0)
+
+find_path(REVENGE_INCLUDE_DIR
+ NAMES librevenge/librevenge.h
+ HINTS ${REVENGE_PKGCONF_INCLUDE_DIRS} ${REVENGE_PKGCONF_INCLUDEDIR}
+ PATH_SUFFIXES librevenge-0.0
+)
+
+find_path(REVENGE_STREAM_INCLUDE_DIR
+ NAMES librevenge-stream/librevenge-stream.h
+ HINTS ${REVENGE_STREAM_PKGCONF_INCLUDE_DIRS} ${REVENGE_STREAM_PKGCONF_INCLUDEDIR}
+ PATH_SUFFIXES librevenge-0.0
+)
+
+find_library(REVENGE_LIBRARY
+ NAMES revenge librevenge revenge-0.0 librevenge-0.0
+ HINTS ${REVENGE_STREAM_PKGCONF_LIBRARY_DIRS} ${REVENGE_STREAM_PKGCONF_LIBDIR}
+)
+
+find_library(REVENGE_STREAM_LIBRARY
+ NAMES revenge-stream librevenge-stream revenge-stream-0.0 librevenge-stream-0.0
+ HINTS ${REVENGE_PKGCONF_LIBRARY_DIRS} ${REVENGE_PKGCONF_LIBDIR}
+)
+
+set(LIBREVENGE_PROCESS_LIBS REVENGE_LIBRARY REVENGE_STREAM_LIBRARY)
+set(LIBREVENGE_PROCESS_INCLUDES REVENGE_INCLUDE_DIR REVENGE_STREAM_INCLUDE_DIR)
+libfind_process(LIBREVENGE)
diff -up calligra-2.8.6/cmake/modules/FindLibVisio.cmake.librevenge calligra-2.8.6/cmake/modules/FindLibVisio.cmake
--- calligra-2.8.6/cmake/modules/FindLibVisio.cmake.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/cmake/modules/FindLibVisio.cmake 2014-09-22 15:39:32.294174204 -0500
@@ -12,16 +12,16 @@
include(LibFindMacros)
libfind_package(LIBWPD LibWpd)
libfind_package(LIBWPG LibWpg)
-libfind_pkg_check_modules(LIBVISIO_PKGCONF libvisio-0.0)
+libfind_pkg_check_modules(LIBVISIO_PKGCONF libvisio-0.1)
find_path(LIBVISIO_INCLUDE_DIR
NAMES libvisio/libvisio.h
HINTS ${LIBVISIO_PKGCONF_INCLUDE_DIRS} ${LIBVISIO_PKGCONF_INCLUDEDIR}
- PATH_SUFFIXES libvisio-0.0
+ PATH_SUFFIXES libvisio-0.1
)
find_library(LIBVISIO_LIBRARY
- NAMES visio visio-0.0
+ NAMES visio visio-0.1
HINTS ${LIBVISIO_PKGCONF_LIBRARY_DIRS} ${LIBVISIO_PKGCONF_LIBDIR}
)
diff -up calligra-2.8.6/cmake/modules/FindLibWpd.cmake.librevenge calligra-2.8.6/cmake/modules/FindLibWpd.cmake
--- calligra-2.8.6/cmake/modules/FindLibWpd.cmake.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/cmake/modules/FindLibWpd.cmake 2014-09-22 15:39:32.294174204 -0500
@@ -8,31 +8,19 @@
#
include(LibFindMacros)
-libfind_pkg_check_modules(WPD_PKGCONF libwpd-0.9)
-libfind_pkg_check_modules(WPD_STREAM_PKGCONF libwpd-stream-0.9)
+libfind_pkg_check_modules(WPD_PKGCONF libwpd-0.10)
find_path(WPD_INCLUDE_DIR
NAMES libwpd/libwpd.h
HINTS ${WPD_PKGCONF_INCLUDE_DIRS} ${WPD_PKGCONF_INCLUDEDIR}
- PATH_SUFFIXES libwpd-0.9
-)
-
-find_path(WPD_STREAM_INCLUDE_DIR
- NAMES libwpd-stream/libwpd-stream.h
- HINTS ${WPD_STREAM_PKGCONF_INCLUDE_DIRS} ${WPD_STREAM_PKGCONF_INCLUDEDIR}
- PATH_SUFFIXES libwpd-0.9
+ PATH_SUFFIXES libwpd-0.10
)
find_library(WPD_LIBRARY
- NAMES wpd libwpd wpd-0.9 libwpd-0.9
+ NAMES wpd libwpd wpd-0.10 libwpd-0.10
HINTS ${WPD_PKGCONF_LIBRARY_DIRS} ${WPD_PKGCONF_LIBDIR}
)
-find_library(WPD_STREAM_LIBRARY
- NAMES wpd-stream libwpd-stream wpd-stream-0.9 libwpd-stream-0.9
- HINTS ${WPD_STREAM_PKGCONF_LIBRARY_DIRS} ${WPD_STREAM_PKGCONF_LIBDIR}
-)
-
-set(LIBWPD_PROCESS_LIBS WPD_LIBRARY WPD_STREAM_LIBRARY)
-set(LIBWPD_PROCESS_INCLUDES WPD_INCLUDE_DIR WPD_STREAM_INCLUDE_DIR)
+set(LIBWPD_PROCESS_LIBS WPD_LIBRARY)
+set(LIBWPD_PROCESS_INCLUDES WPD_INCLUDE_DIR)
libfind_process(LIBWPD)
diff -up calligra-2.8.6/cmake/modules/FindLibWpg.cmake.librevenge calligra-2.8.6/cmake/modules/FindLibWpg.cmake
--- calligra-2.8.6/cmake/modules/FindLibWpg.cmake.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/cmake/modules/FindLibWpg.cmake 2014-09-22 15:39:32.294174204 -0500
@@ -11,16 +11,16 @@
include(LibFindMacros)
libfind_package(LIBWPG LibWpd)
-libfind_pkg_check_modules(LIBWPG_PKGCONF libwpg-0.2)
+libfind_pkg_check_modules(LIBWPG_PKGCONF libwpg-0.3)
find_path(LIBWPG_INCLUDE_DIR
NAMES libwpg/libwpg.h
HINTS ${LIBWPG_PKGCONF_INCLUDE_DIRS} ${LIBWPG_PKGCONF_INCLUDEDIR}
- PATH_SUFFIXES libwpg-0.2
+ PATH_SUFFIXES libwpg-0.3
)
find_library(LIBWPG_LIBRARY
- NAMES wpg wpg-0.2
+ NAMES wpg wpg-0.3
HINTS ${LIBWPG_PKGCONF_LIBRARY_DIRS} ${LIBWPG_PKGCONF_LIBDIR}
)
diff -up calligra-2.8.6/cmake/modules/FindLibWps.cmake.librevenge calligra-2.8.6/cmake/modules/FindLibWps.cmake
--- calligra-2.8.6/cmake/modules/FindLibWps.cmake.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/cmake/modules/FindLibWps.cmake 2014-09-22 15:39:32.294174204 -0500
@@ -10,16 +10,16 @@
include(LibFindMacros)
libfind_package(LIBWPS LibWpd)
-libfind_pkg_check_modules(LIBWPS_PKGCONF libwps-0.2)
+libfind_pkg_check_modules(LIBWPS_PKGCONF libwps-0.3)
find_path(LIBWPS_INCLUDE_DIR
NAMES libwps/libwps.h
HINTS ${LIBWPS_PKGCONF_INCLUDE_DIRS} ${LIBWPS_PKGCONF_INCLUDEDIR}
- PATH_SUFFIXES libwps-0.2
+ PATH_SUFFIXES libwps-0.3
)
find_library(LIBWPS_LIBRARY
- NAMES wps wps-0.2
+ NAMES wps wps-0.3
HINTS ${LIBWPS_PKGCONF_LIBRARY_DIRS} ${LIBWPS_PKGCONF_LIBDIR}
)
diff -up calligra-2.8.6/filters/flow/visio/import/CMakeLists.txt.librevenge calligra-2.8.6/filters/flow/visio/import/CMakeLists.txt
--- calligra-2.8.6/filters/flow/visio/import/CMakeLists.txt.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/flow/visio/import/CMakeLists.txt 2014-09-22 15:39:32.295174193 -0500
@@ -1,6 +1,7 @@
include_directories(
../../../libodfhandler/
${LIBODFGEN_INCLUDE_DIRS}
+ ${LIBREVENGE_INCLUDE_DIRS}
${LIBVISIO_INCLUDE_DIRS}
${KOMAIN_INCLUDES}
)
@@ -15,7 +16,7 @@ set(vsdx2odg_PART_SRCS
kde4_add_plugin(calligra_filter_vsdx2odg ${vsdx2odg_PART_SRCS})
-target_link_libraries(calligra_filter_vsdx2odg komain ${LIBODFGEN_LIBRARIES} ${LIBVISIO_LIBRARIES})
+target_link_libraries(calligra_filter_vsdx2odg komain ${LIBODFGEN_LIBRARIES} ${LIBREVENGE_LIBRARIES} ${LIBVISIO_LIBRARIES})
install(TARGETS calligra_filter_vsdx2odg DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES calligra_filter_vsdx2odg.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff -up calligra-2.8.6/filters/flow/visio/import/VSDXImport.cpp.librevenge calligra-2.8.6/filters/flow/visio/import/VSDXImport.cpp
--- calligra-2.8.6/filters/flow/visio/import/VSDXImport.cpp.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/flow/visio/import/VSDXImport.cpp 2014-09-22 15:39:32.295174193 -0500
@@ -17,7 +17,7 @@
#include "VSDXImport.h"
#include <libvisio/libvisio.h>
-#include <libodfgen/OdgGenerator.hxx>
+#include <libodfgen/libodfgen.hxx>
#include "OutputFileHelper.hxx"
#include <KoFilterChain.h>
@@ -39,7 +39,7 @@ public:
~OdgOutputFileHelper() {}
private:
- bool _isSupportedFormat(WPXInputStream *input, const char * /* password */)
+ bool _isSupportedFormat(librevenge::RVNGInputStream *input, const char * /* password */)
{
if (!libvisio::VisioDocument::isSupported(input))
{
@@ -49,9 +49,10 @@ private:
return true;
}
- bool _convertDocument(WPXInputStream *input, const char * /* password */, OdfDocumentHandler *handler, OdfStreamType streamType)
+ bool _convertDocument(librevenge::RVNGInputStream *input, const char * /* password */, OdfDocumentHandler *handler, OdfStreamType streamType)
{
- OdgGenerator exporter(handler, streamType);
+ OdgGenerator exporter;
+ exporter.addDocumentHandler(handler, streamType);
return libvisio::VisioDocument::parse(input, &exporter);
}
};
diff -up calligra-2.8.6/filters/flow/wpg/import/CMakeLists.txt.librevenge calligra-2.8.6/filters/flow/wpg/import/CMakeLists.txt
--- calligra-2.8.6/filters/flow/wpg/import/CMakeLists.txt.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/flow/wpg/import/CMakeLists.txt 2014-09-22 15:40:26.095613204 -0500
@@ -1,6 +1,7 @@
include_directories(
../../../libodfhandler/
${LIBODFGEN_INCLUDE_DIRS}
+ ${LIBREVENGE_INCLUDE_DIRS}
${LIBVISIO_INCLUDE_DIRS}
${LIBWPG_INCLUDE_DIRS}
${KOMAIN_INCLUDES}
@@ -16,7 +17,7 @@ set(wpg2odg_PART_SRCS
kde4_add_plugin(calligra_filter_wpg2odg ${wpg2odg_PART_SRCS})
-target_link_libraries(calligra_filter_wpg2odg komain ${LIBODFGEN_LIBRARIES} ${LIBWPG_LIBRARIES})
+target_link_libraries(calligra_filter_wpg2odg komain ${LIBODFGEN_LIBRARIES} ${LIBREVENGE_LIBRARIES} ${LIBWPG_LIBRARIES})
install(TARGETS calligra_filter_wpg2odg DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES calligra_filter_wpg2odg.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff -up calligra-2.8.6/filters/flow/wpg/import/WPGImport.cpp.librevenge calligra-2.8.6/filters/flow/wpg/import/WPGImport.cpp
--- calligra-2.8.6/filters/flow/wpg/import/WPGImport.cpp.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/flow/wpg/import/WPGImport.cpp 2014-09-22 15:39:32.295174193 -0500
@@ -17,7 +17,7 @@
#include "WPGImport.h"
#include <libwpg/libwpg.h>
-#include <libodfgen/OdgGenerator.hxx>
+#include <libodfgen/libodfgen.hxx>
#include "OutputFileHelper.hxx"
#include <KoFilterChain.h>
@@ -39,7 +39,7 @@ public:
~OdgOutputFileHelper() {}
private:
- bool _isSupportedFormat(WPXInputStream *input, const char * /* password */)
+ bool _isSupportedFormat(librevenge::RVNGInputStream *input, const char * /* password */)
{
if (!libwpg::WPGraphics::isSupported(input))
{
@@ -49,9 +49,10 @@ private:
return true;
}
- bool _convertDocument(WPXInputStream *input, const char * /* password */, OdfDocumentHandler *handler, OdfStreamType streamType)
+ bool _convertDocument(librevenge::RVNGInputStream *input, const char * /* password */, OdfDocumentHandler *handler, OdfStreamType streamType)
{
- OdgGenerator exporter(handler, streamType);
+ OdgGenerator exporter;
+ exporter.addDocumentHandler(handler, streamType);
return libwpg::WPGraphics::parse(input, &exporter);
}
};
diff -up calligra-2.8.6/filters/karbon/wpg/CMakeLists.txt.librevenge calligra-2.8.6/filters/karbon/wpg/CMakeLists.txt
--- calligra-2.8.6/filters/karbon/wpg/CMakeLists.txt.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/karbon/wpg/CMakeLists.txt 2014-09-22 15:39:32.296174183 -0500
@@ -1,11 +1,11 @@
-include_directories(${CMAKE_BINARY_DIR}/filters/ ${LIBWPD_INCLUDE_DIRS} ${LIBWPG_INCLUDE_DIR}/)
+include_directories(${CMAKE_BINARY_DIR}/filters/ ${LIBREVENGE_INCLUDE_DIRS} ${LIBWPG_INCLUDE_DIR}/)
set(wpg2svg_PART_SRCS WPGImport.cpp)
kde4_add_plugin(calligra_filter_wpg2svg ${wpg2svg_PART_SRCS})
-target_link_libraries(calligra_filter_wpg2svg komain ${LIBWPG_LIBRARIES} ${LIBWPG_STREAM_LIBRARIES} ${LIBWPD_LIBRARIES})
+target_link_libraries(calligra_filter_wpg2svg komain ${LIBWPG_LIBRARIES} ${LIBREVENGE_LIBRARIES})
install(TARGETS calligra_filter_wpg2svg DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES calligra_filter_wpg2svg.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff -up calligra-2.8.6/filters/karbon/wpg/WPGImport.cpp.librevenge calligra-2.8.6/filters/karbon/wpg/WPGImport.cpp
--- calligra-2.8.6/filters/karbon/wpg/WPGImport.cpp.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/karbon/wpg/WPGImport.cpp 2014-09-22 15:39:32.296174183 -0500
@@ -32,14 +32,12 @@
#include <QString>
#include <QFile>
+#include <librevenge/librevenge.h>
+#include <librevenge-stream/librevenge-stream.h>
+
#include <libwpg/libwpg.h>
-#if LIBWPG_VERSION_MINOR<2
-#include <libwpg/WPGStreamImplementation.h>
-#else
-#include <libwpd-stream/libwpd-stream.h>
-#include <libwpd/libwpd.h>
-#endif
+#include <cassert>
#include <iostream>
K_PLUGIN_FACTORY(WPGImportFactory, registerPlugin<WPGImport>();)
@@ -63,39 +61,29 @@ KoFilter::ConversionStatus WPGImport::co
if (to != "image/svg+xml")
return KoFilter::NotImplemented;
-#if LIBWPG_VERSION_MINOR<2
- WPXInputStream* input = new libwpg::WPGFileStream(m_chain->inputFile().toLocal8Bit());
- if (input->isOLEStream()) {
- WPXInputStream* olestream = input->getDocumentOLEStream();
- if (olestream) {
- delete input;
- input = olestream;
- }
- }
- libwpg::WPGString output;
-#else
- WPXInputStream* input = new WPXFileStream(m_chain->inputFile().toLocal8Bit());
- if (input->isOLEStream()) {
- WPXInputStream* olestream = input->getDocumentOLEStream("Anything");
+ librevenge::RVNGInputStream* input = new librevenge::RVNGFileStream(m_chain->inputFile().toLocal8Bit());
+ if (input->isStructured()) {
+ librevenge::RVNGInputStream* olestream = input->getSubStreamByName("Anything");
if (olestream) {
delete input;
input = olestream;
}
}
- ::WPXString output;
-#endif
-
if (!libwpg::WPGraphics::isSupported(input)) {
kWarning() << "ERROR: Unsupported file format (unsupported version) or file is encrypted!";
delete input;
return KoFilter::NotImplemented;
}
- if (!libwpg::WPGraphics::generateSVG(input, output)) {
+ ::librevenge::RVNGStringVector output;
+ librevenge::RVNGSVGDrawingGenerator generator(output, "");
+
+ if (!libwpg::WPGraphics::parse(input, &generator)) {
kWarning() << "ERROR: SVG Generation failed!";
delete input;
return KoFilter::ParsingError;
}
+ assert(1 == output.size());
delete input;
@@ -104,7 +92,8 @@ KoFilter::ConversionStatus WPGImport::co
kWarning() << "ERROR: Could not open output file" << m_chain->outputFile();
return KoFilter::InternalError;
}
- outputFile.write(output.cstr());
+ outputFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
+ outputFile.write(output[0].cstr());
outputFile.close();
return KoFilter::OK;
diff -up calligra-2.8.6/filters/libodfhandler/DiskDocumentHandler.cxx.librevenge calligra-2.8.6/filters/libodfhandler/DiskDocumentHandler.cxx
--- calligra-2.8.6/filters/libodfhandler/DiskDocumentHandler.cxx.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/libodfhandler/DiskDocumentHandler.cxx 2014-09-22 15:39:32.296174183 -0500
@@ -37,7 +37,7 @@ DiskOdfDocumentHandler::DiskOdfDocumentH
{
}
-void DiskOdfDocumentHandler::startElement(const char *psName, const WPXPropertyList &xPropList)
+void DiskOdfDocumentHandler::startElement(const char *psName, const librevenge::RVNGPropertyList &xPropList)
{
if (mbIsTagOpened)
{
@@ -46,11 +46,11 @@ void DiskOdfDocumentHandler::startElemen
}
PUTSTRING("<");
PUTSTRING(psName);
- WPXPropertyList::Iter i(xPropList);
+ librevenge::RVNGPropertyList::Iter i(xPropList);
for (i.rewind(); i.next(); )
{
- // filter out libwpd elements
- if (strncmp(i.key(), "libwpd", 6) != 0)
+ // filter out librevenge properties
+ if (strncmp(i.key(), "librevenge", 10) != 0)
{
PUTSTRING(" ");
PUTSTRING(i.key());
@@ -91,14 +91,15 @@ void DiskOdfDocumentHandler::endElement(
}
}
-void DiskOdfDocumentHandler::characters(const WPXString &sCharacters)
+void DiskOdfDocumentHandler::characters(const librevenge::RVNGString &sCharacters)
{
if (mbIsTagOpened)
{
PUTSTRING(">");
mbIsTagOpened = false;
}
- WPXString sEscapedCharacters(sCharacters, true);
+ librevenge::RVNGString sEscapedCharacters;
+ sEscapedCharacters.appendEscapedXML(sCharacters);
if (sEscapedCharacters.len() > 0)
PUTSTRING(sEscapedCharacters.cstr());
}
diff -up calligra-2.8.6/filters/libodfhandler/DiskDocumentHandler.hxx.librevenge calligra-2.8.6/filters/libodfhandler/DiskDocumentHandler.hxx
--- calligra-2.8.6/filters/libodfhandler/DiskDocumentHandler.hxx.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/libodfhandler/DiskDocumentHandler.hxx 2014-09-22 15:39:32.296174183 -0500
@@ -23,7 +23,7 @@
#ifndef _DISKDOCUMENTHANDLER_H
#define _DISKDOCUMENTHANDLER_H
-#include <libodfgen/OdfDocumentHandler.hxx>
+#include <libodfgen/libodfgen.hxx>
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -45,9 +45,9 @@ public:
#endif
virtual void startDocument() {}
virtual void endDocument();
- virtual void startElement(const char *psName, const WPXPropertyList &xPropList);
+ virtual void startElement(const char *psName, const librevenge::RVNGPropertyList &xPropList);
virtual void endElement(const char *psName);
- virtual void characters(const WPXString &sCharacters);
+ virtual void characters(const librevenge::RVNGString &sCharacters);
private:
DiskOdfDocumentHandler(DiskOdfDocumentHandler const &);
@@ -58,7 +58,7 @@ private:
FemtoZip *mpOutput;
#endif
bool mbIsTagOpened;
- WPXString msOpenedTagName;
+ librevenge::RVNGString msOpenedTagName;
};
#endif
diff -up calligra-2.8.6/filters/libodfhandler/OutputFileHelper.cxx.librevenge calligra-2.8.6/filters/libodfhandler/OutputFileHelper.cxx
--- calligra-2.8.6/filters/libodfhandler/OutputFileHelper.cxx.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/libodfhandler/OutputFileHelper.cxx 2014-09-22 15:39:32.296174183 -0500
@@ -37,7 +37,7 @@
#include "DiskDocumentHandler.hxx"
#include "StdOutHandler.hxx"
-#include <libwpd-stream/WPXStreamImplementation.h>
+#include <librevenge-stream/librevenge-stream.h>
struct OutputFileHelperImpl
{
@@ -197,12 +197,12 @@ bool OutputFileHelper::writeChildFile(co
bool OutputFileHelper::writeConvertedContent(const char *childFileName, const char *inFileName, const OdfStreamType streamType)
{
- WPXFileStream input(inFileName);
+ librevenge::RVNGFileStream input(inFileName);
if (!_isSupportedFormat(&input, m_impl->mpPassword))
return false;
- input.seek(0, WPX_SEEK_SET);
+ input.seek(0, librevenge::RVNG_SEEK_SET);
OdfDocumentHandler *pHandler;
#ifdef USE_GSF_OUTPUT
diff -up calligra-2.8.6/filters/libodfhandler/OutputFileHelper.hxx.librevenge calligra-2.8.6/filters/libodfhandler/OutputFileHelper.hxx
--- calligra-2.8.6/filters/libodfhandler/OutputFileHelper.hxx.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/libodfhandler/OutputFileHelper.hxx 2014-09-22 15:39:32.297174172 -0500
@@ -22,9 +22,10 @@
#ifndef _OUTPUTFILEHELPER_HXX
#define _OUTPUTFILEHELPER_HXX
-#include <libodfgen/OdfDocumentHandler.hxx>
+#include <libodfgen/libodfgen.hxx>
+
+#include <librevenge-stream/librevenge-stream.h>
-class WPXInputStream;
struct OutputFileHelperImpl;
class OutputFileHelper
@@ -38,8 +39,8 @@ public:
bool writeConvertedContent(const char *childFileName, const char *inFileName, const OdfStreamType streamType);
private:
- virtual bool _isSupportedFormat(WPXInputStream *input, const char *password) = 0;
- virtual bool _convertDocument(WPXInputStream *input, const char *password, OdfDocumentHandler *handler, const OdfStreamType streamType) = 0;
+ virtual bool _isSupportedFormat(librevenge::RVNGInputStream *input, const char *password) = 0;
+ virtual bool _convertDocument(librevenge::RVNGInputStream *input, const char *password, OdfDocumentHandler *handler, const OdfStreamType streamType) = 0;
OutputFileHelperImpl *m_impl;
private:
diff -up calligra-2.8.6/filters/libodfhandler/StdOutHandler.cxx.librevenge calligra-2.8.6/filters/libodfhandler/StdOutHandler.cxx
--- calligra-2.8.6/filters/libodfhandler/StdOutHandler.cxx.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/libodfhandler/StdOutHandler.cxx 2014-09-22 15:39:32.297174172 -0500
@@ -31,7 +31,7 @@ StdOutHandler::StdOutHandler() :
printf("<?xml version=\"1.0\"?>\n");
}
-void StdOutHandler::startElement(const char *psName, const WPXPropertyList &xPropList)
+void StdOutHandler::startElement(const char *psName, const librevenge::RVNGPropertyList &xPropList)
{
if (mbIsTagOpened)
{
@@ -39,11 +39,11 @@ void StdOutHandler::startElement(const c
mbIsTagOpened = false;
}
printf("<%s", psName);
- WPXPropertyList::Iter i(xPropList);
+ librevenge::RVNGPropertyList::Iter i(xPropList);
for (i.rewind(); i.next(); )
{
- // filter out libwpd elements
- if (strncmp(i.key(), "libwpd", 6) != 0)
+ // filter out librevenge properties
+ if (strncmp(i.key(), "librevenge", 10) != 0)
printf(" %s=\"%s\"", i.key(), i()->getStr().cstr());
}
mbIsTagOpened = true;
@@ -73,15 +73,14 @@ void StdOutHandler::endElement(const cha
}
}
-void StdOutHandler::characters(const WPXString &sCharacters)
+void StdOutHandler::characters(const librevenge::RVNGString &sCharacters)
{
if (mbIsTagOpened)
{
printf(">");
mbIsTagOpened = false;
}
- WPXString sEscapedCharacters(sCharacters, true);
- printf("%s", sEscapedCharacters.cstr());
+ printf("%s", librevenge::RVNGString::escapeXML(sCharacters).cstr());
}
void StdOutHandler::endDocument()
diff -up calligra-2.8.6/filters/libodfhandler/StdOutHandler.hxx.librevenge calligra-2.8.6/filters/libodfhandler/StdOutHandler.hxx
--- calligra-2.8.6/filters/libodfhandler/StdOutHandler.hxx.librevenge 2014-09-20 11:42:13.000000000 -0500
+++ calligra-2.8.6/filters/libodfhandler/StdOutHandler.hxx 2014-09-22 15:39:32.297174172 -0500
@@ -23,7 +23,7 @@
#ifndef _STDOUTHANDLER_H
#define _STDOUTHANDLER_H
-#include <libodfgen/OdfDocumentHandler.hxx>
+#include <libodfgen/libodfgen.hxx>
class StdOutHandler : public OdfDocumentHandler
{
@@ -31,12 +31,12 @@ public:
StdOutHandler();
virtual void startDocument() {}
virtual void endDocument();
- virtual void startElement(const char *psName, const WPXPropertyList &xPropList);
+ virtual void startElement(const char *psName, const librevenge::RVNGPropertyList &xPropList);
virtual void endElement(const char *psName);
- virtual void characters(const WPXString &sCharacters);
+ virtual void characters(const librevenge::RVNGString &sCharacters);
private:
bool mbIsTagOpened;
- WPXString msOpenedTagName;
+ librevenge::RVNGString msOpenedTagName;
};
#endif
diff -up calligra-2.8.6/filters/words/wordperfect/import/CMakeLists.txt.librevenge calligra-2.8.6/filters/words/wordperfect/import/CMakeLists.txt
--- calligra-2.8.6/filters/words/wordperfect/import/CMakeLists.txt.librevenge 2014-09-20 11:42:14.000000000 -0500
+++ calligra-2.8.6/filters/words/wordperfect/import/CMakeLists.txt 2014-09-22 15:39:32.297174172 -0500
@@ -1,6 +1,7 @@
include_directories(
../../../libodfhandler/
${LIBODFGEN_INCLUDE_DIRS}
+ ${LIBREVENGE_INCLUDE_DIRS}
${LIBWPD_INCLUDE_DIRS}
${LIBWPG_INCLUDE_DIRS}
${KOMAIN_INCLUDES}
@@ -17,7 +18,7 @@ set(wpd2odt_PART_SRCS
kde4_add_plugin(calligra_filter_wpd2odt ${wpd2odt_PART_SRCS})
target_link_libraries(calligra_filter_wpd2odt
- komain ${LIBODFGEN_LIBRARIES} ${LIBWPD_LIBRARIES} ${LIBWPG_LIBRARIES})
+ komain ${LIBODFGEN_LIBRARIES} ${LIBREVENGE_LIBRARIES} ${LIBWPD_LIBRARIES} ${LIBWPG_LIBRARIES})
install(TARGETS calligra_filter_wpd2odt DESTINATION ${PLUGIN_INSTALL_DIR})
diff -up calligra-2.8.6/filters/words/wordperfect/import/WPDImport.cpp.librevenge calligra-2.8.6/filters/words/wordperfect/import/WPDImport.cpp
--- calligra-2.8.6/filters/words/wordperfect/import/WPDImport.cpp.librevenge 2014-09-20 11:42:14.000000000 -0500
+++ calligra-2.8.6/filters/words/wordperfect/import/WPDImport.cpp 2014-09-22 15:39:32.297174172 -0500
@@ -18,8 +18,7 @@
#include <libwpd/libwpd.h>
#include <libwpg/libwpg.h>
-#include <libodfgen/OdtGenerator.hxx>
-#include <libodfgen/OdgGenerator.hxx>
+#include <libodfgen/libodfgen.hxx>
#include <OutputFileHelper.hxx>
#include <KoFilterChain.h>
@@ -31,6 +30,7 @@
#include <QString>
#include <QByteArray>
+#include <cassert>
#include <stdio.h>
class OdtOutputFileHelper : public OutputFileHelper
@@ -41,20 +41,20 @@ public:
~OdtOutputFileHelper() {};
private:
- bool _isSupportedFormat(WPXInputStream *input, const char *password)
+ bool _isSupportedFormat(librevenge::RVNGInputStream *input, const char *password)
{
- WPDConfidence confidence = WPDocument::isFileFormatSupported(input);
- if (WPD_CONFIDENCE_EXCELLENT != confidence && WPD_CONFIDENCE_SUPPORTED_ENCRYPTION != confidence)
+ libwpd::WPDConfidence confidence = libwpd::WPDocument::isFileFormatSupported(input);
+ if (libwpd::WPD_CONFIDENCE_EXCELLENT != confidence && libwpd::WPD_CONFIDENCE_SUPPORTED_ENCRYPTION != confidence)
{
fprintf(stderr, "ERROR: We have no confidence that you are giving us a valid WordPerfect document.\n");
return false;
}
- if (WPD_CONFIDENCE_SUPPORTED_ENCRYPTION == confidence && !password)
+ if (libwpd::WPD_CONFIDENCE_SUPPORTED_ENCRYPTION == confidence && !password)
{
fprintf(stderr, "ERROR: The WordPerfect document is encrypted and you did not give us a password.\n");
return false;
}
- if (confidence == WPD_CONFIDENCE_SUPPORTED_ENCRYPTION && password && (WPD_PASSWORD_MATCH_OK != WPDocument::verifyPassword(input, password)))
+ if (confidence == libwpd::WPD_CONFIDENCE_SUPPORTED_ENCRYPTION && password && (libwpd::WPD_PASSWORD_MATCH_OK != libwpd::WPDocument::verifyPassword(input, password)))
{
fprintf(stderr, "ERROR: The WordPerfect document is encrypted and we either\n");
fprintf(stderr, "ERROR: don't know how to decrypt it or the given password is wrong.\n");
@@ -64,41 +64,47 @@ private:
return true;
}
- static bool handleEmbeddedWPGObject(const WPXBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType)
+ static bool handleEmbeddedWPGObject(const librevenge::RVNGBinaryData &data, OdfDocumentHandler *pHandler, const OdfStreamType streamType)
{
- OdgGenerator exporter(pHandler, streamType);
+ OdgGenerator exporter;
+ exporter.addDocumentHandler(pHandler, streamType);
libwpg::WPGFileFormat fileFormat = libwpg::WPG_AUTODETECT;
- if (!libwpg::WPGraphics::isSupported(const_cast<WPXInputStream *>(data.getDataStream())))
+ if (!libwpg::WPGraphics::isSupported(const_cast<librevenge::RVNGInputStream *>(data.getDataStream())))
fileFormat = libwpg::WPG_WPG1;
- return libwpg::WPGraphics::parse(const_cast<WPXInputStream *>(data.getDataStream()), &exporter, fileFormat);
+ return libwpg::WPGraphics::parse(const_cast<librevenge::RVNGInputStream *>(data.getDataStream()), &exporter, fileFormat);
}
- static bool handleEmbeddedWPGImage(const WPXBinaryData &input, WPXBinaryData &output)
+ static bool handleEmbeddedWPGImage(const librevenge::RVNGBinaryData &input, librevenge::RVNGBinaryData &output)
{
- WPXString svgOutput;
libwpg::WPGFileFormat fileFormat = libwpg::WPG_AUTODETECT;
- if (!libwpg::WPGraphics::isSupported(const_cast<WPXInputStream *>(input.getDataStream())))
+ if (!libwpg::WPGraphics::isSupported(const_cast<librevenge::RVNGInputStream *>(input.getDataStream())))
fileFormat = libwpg::WPG_WPG1;
- if (!libwpg::WPGraphics::generateSVG(const_cast<WPXInputStream *>(input.getDataStream()), svgOutput, fileFormat))
+ librevenge::RVNGStringVector svgOutput;
+ librevenge::RVNGSVGDrawingGenerator generator(svgOutput, "");
+ if (!libwpg::WPGraphics::parse(const_cast<librevenge::RVNGInputStream *>(input.getDataStream()), &generator, fileFormat))
return false;
+ assert(1 == svgOutput.size());
output.clear();
- output.append((unsigned char *)svgOutput.cstr(), strlen(svgOutput.cstr()));
+ const librevenge::RVNGString svgPrefix("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
+ output.append((unsigned char *)svgPrefix.cstr(), svgPrefix.size());
+ output.append((unsigned char *)svgOutput[0].cstr(), svgOutput[0].size());
return true;
}
- bool _convertDocument(WPXInputStream *input, const char *password, OdfDocumentHandler *handler, const OdfStreamType streamType)
+ bool _convertDocument(librevenge::RVNGInputStream *input, const char *password, OdfDocumentHandler *handler, const OdfStreamType streamType)
{
- OdtGenerator collector(handler, streamType);
+ OdtGenerator collector;
+ collector.addDocumentHandler(handler, streamType);
collector.registerEmbeddedObjectHandler("image/x-wpg", &handleEmbeddedWPGObject);
collector.registerEmbeddedImageHandler("image/x-wpg", &handleEmbeddedWPGImage);
- if (WPD_OK == WPDocument::parse(input, &collector, password))
+ if (libwpd::WPD_OK == libwpd::WPDocument::parse(input, &collector, password))
return true;
return false;
}
diff -up calligra-2.8.6/filters/words/works/import/CMakeLists.txt.librevenge calligra-2.8.6/filters/words/works/import/CMakeLists.txt
--- calligra-2.8.6/filters/words/works/import/CMakeLists.txt.librevenge 2014-09-20 11:42:14.000000000 -0500
+++ calligra-2.8.6/filters/words/works/import/CMakeLists.txt 2014-09-22 15:39:32.298174162 -0500
@@ -1,6 +1,7 @@
include_directories(
../../../libodfhandler/
${LIBODFGEN_INCLUDE_DIRS}
+ ${LIBREVENGE_INCLUDE_DIRS}
${LIBWPS_INCLUDE_DIRS}
${KOMAIN_INCLUDES}
)
@@ -15,7 +16,7 @@ set(wps2odt_PART_SRCS
kde4_add_plugin(calligra_filter_wps2odt ${wps2odt_PART_SRCS})
-target_link_libraries(calligra_filter_wps2odt komain ${LIBODFGEN_LIBRARIES} ${LIBWPS_LIBRARIES})
+target_link_libraries(calligra_filter_wps2odt komain ${LIBODFGEN_LIBRARIES} ${LIBREVENGE_LIBRARIES} ${LIBWPS_LIBRARIES})
install(TARGETS calligra_filter_wps2odt DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES calligra_filter_wps2odt.desktop DESTINATION ${SERVICES_INSTALL_DIR})
diff -up calligra-2.8.6/filters/words/works/import/WPSImport.cpp.librevenge calligra-2.8.6/filters/words/works/import/WPSImport.cpp
--- calligra-2.8.6/filters/words/works/import/WPSImport.cpp.librevenge 2014-09-20 11:42:14.000000000 -0500
+++ calligra-2.8.6/filters/words/works/import/WPSImport.cpp 2014-09-22 15:39:32.298174162 -0500
@@ -16,9 +16,9 @@
#include "WPSImport.h"
-#include <libwpd/libwpd.h>
+#include <librevenge/librevenge.h>
#include <libwps/libwps.h>
-#include <libodfgen/OdtGenerator.hxx>
+#include <libodfgen/libodfgen.hxx>
#include "OutputFileHelper.hxx"
#include <KoFilterChain.h>
@@ -40,10 +40,11 @@ public:
~OdtOutputFileHelper() {};
private:
- bool _isSupportedFormat(WPXInputStream *input, const char * /* password */)
+ bool _isSupportedFormat(librevenge::RVNGInputStream *input, const char * /* password */)
{
- WPSConfidence confidence = WPSDocument::isFileFormatSupported(input);
- if (confidence == WPS_CONFIDENCE_NONE || confidence == WPS_CONFIDENCE_POOR)
+ libwps::WPSKind kind = libwps::WPS_TEXT;
+ libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(input, kind);
+ if ((libwps::WPS_TEXT != kind) || (confidence != libwps::WPS_CONFIDENCE_EXCELLENT))
{
fprintf(stderr, "ERROR: We have no confidence that you are giving us a valid Microsoft Works document.\n");
return false;
@@ -52,10 +53,11 @@ private:
return true;
}
- bool _convertDocument(WPXInputStream *input, const char * /* password */, OdfDocumentHandler *handler, const OdfStreamType streamType)
+ bool _convertDocument(librevenge::RVNGInputStream *input, const char * /* password */, OdfDocumentHandler *handler, const OdfStreamType streamType)
{
- OdtGenerator collector(handler, streamType);
- if (WPS_OK == WPSDocument::parse(input, &collector))
+ OdtGenerator collector;
+ collector.addDocumentHandler(handler, streamType);
+ if (libwps::WPS_OK == libwps::WPSDocument::parse(input, &collector))
return true;
return false;
}