integrate libqxp
Change-Id: Ic7479b82d09c1e36d28267434a77bf4bc158adfa Reviewed-on: https://gerrit.libreoffice.org/41612 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: David Tardon <dtardon@redhat.com>
This commit is contained in:
committed by
David Tardon
parent
c8777a1879
commit
e59b5b1fc7
@@ -197,6 +197,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk $(SRCDIR)/download.lst $(S
|
||||
$(call fetch_Optional,POPPLER,POPPLER_TARBALL) \
|
||||
$(call fetch_Optional,POSTGRESQL,POSTGRESQL_TARBALL) \
|
||||
$(call fetch_Optional,PYTHON,PYTHON_TARBALL) \
|
||||
$(call fetch_Optional,QXP,QXP_TARBALL) \
|
||||
$(call fetch_Optional,REDLAND,RAPTOR_TARBALL) \
|
||||
$(call fetch_Optional,REDLAND,RASQAL_TARBALL) \
|
||||
$(call fetch_Optional,REDLAND,REDLAND_TARBALL) \
|
||||
|
@@ -1991,6 +1991,39 @@ endef
|
||||
endif # SYSTEM_PAGEMAKER
|
||||
|
||||
|
||||
ifneq ($(SYSTEM_QXP),)
|
||||
|
||||
define gb_LinkTarget__use_qxp
|
||||
$(call gb_LinkTarget_set_include,$(1),\
|
||||
$$(INCLUDE) \
|
||||
$(QXP_CFLAGS) \
|
||||
)
|
||||
$(call gb_LinkTarget_add_libs,$(1),$(QXP_LIBS))
|
||||
|
||||
endef
|
||||
gb_ExternalProject__use_qxp :=
|
||||
|
||||
else # !SYSTEM_QXP
|
||||
|
||||
define gb_LinkTarget__use_qxp
|
||||
$(call gb_LinkTarget_set_include,$(1),\
|
||||
-I$(call gb_UnpackedTarball_get_dir,libqxp)/inc \
|
||||
$$(INCLUDE) \
|
||||
)
|
||||
$(call gb_LinkTarget_add_libs,$(1),\
|
||||
$(call gb_UnpackedTarball_get_dir,libqxp)/src/lib/.libs/libqxp-0.0$(gb_StaticLibrary_PLAINEXT) \
|
||||
)
|
||||
$(call gb_LinkTarget_use_external_project,$(1),libqxp)
|
||||
|
||||
endef
|
||||
define gb_ExternalProject__use_qxp
|
||||
$(call gb_ExternalProject_use_external_project,$(1),libqxp)
|
||||
|
||||
endef
|
||||
|
||||
endif # SYSTEM_QXP
|
||||
|
||||
|
||||
ifneq ($(SYSTEM_ZMF),)
|
||||
|
||||
define gb_LinkTarget__use_zmf
|
||||
|
@@ -457,6 +457,8 @@ export PYTHON_LIBS=$(gb_SPACE)@PYTHON_LIBS@
|
||||
export PYTHON_VERSION=@PYTHON_VERSION@
|
||||
export PYTHON_VERSION_MAJOR=@PYTHON_VERSION_MAJOR@
|
||||
export PYTHON_VERSION_MINOR=@PYTHON_VERSION_MINOR@
|
||||
export QXP_CFLAGS=$(gb_SPACE)@QXP_CFLAGS@
|
||||
export QXP_LIBS=$(gb_SPACE)@QXP_LIBS@
|
||||
export RANLIB=@RANLIB@
|
||||
export RAPTOR_MAJOR=@RAPTOR_MAJOR@
|
||||
export RASQAL_MAJOR=@RASQAL_MAJOR@
|
||||
@@ -556,6 +558,7 @@ export SYSTEM_PAGEMAKER=@SYSTEM_PAGEMAKER@
|
||||
export SYSTEM_POPPLER=@SYSTEM_POPPLER@
|
||||
export SYSTEM_POSTGRESQL=@SYSTEM_POSTGRESQL@
|
||||
export SYSTEM_PYTHON=@SYSTEM_PYTHON@
|
||||
export SYSTEM_QXP=@SYSTEM_QXP@
|
||||
export SYSTEM_REDLAND=@SYSTEM_REDLAND@
|
||||
export SYSTEM_REVENGE=@SYSTEM_REVENGE@
|
||||
export SYSTEM_RHINO=@SYSTEM_RHINO@
|
||||
|
@@ -7776,6 +7776,8 @@ libo_CHECK_SYSTEM_MODULE([libabw],[ABW],[libabw-0.1])
|
||||
|
||||
libo_CHECK_SYSTEM_MODULE([libpagemaker],[PAGEMAKER],[libpagemaker-0.0])
|
||||
|
||||
libo_CHECK_SYSTEM_MODULE([libqxp],[QXP],[libqxp-0.0])
|
||||
|
||||
libo_CHECK_SYSTEM_MODULE([libzmf],[ZMF],[libzmf-0.0])
|
||||
|
||||
libo_CHECK_SYSTEM_MODULE([libstaroffice],[STAROFFICE],[libstaroffice-0.0])
|
||||
|
@@ -199,6 +199,8 @@ export POSTGRESQL_SHA256SUM := db61d498105a7d5fe46185e67ac830c878cdd7dc1f82a87f0
|
||||
export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
|
||||
export PYTHON_SHA256SUM := 6ed87a8b6c758cc3299a8b433e8a9a9122054ad5bc8aad43299cff3a53d8ca44
|
||||
export PYTHON_TARBALL := Python-3.5.4.tgz
|
||||
export QXP_SHA256SUM := 0dd32afbf1c889debc28848b260c1bdc0eba5f57504476b787e164f7c59776d5
|
||||
export QXP_TARBALL := libqxp-0.0.0.tar.xz
|
||||
export RAPTOR_SHA256SUM := ada7f0ba54787b33485d090d3d2680533520cd4426d2f7fb4782dd4a6a1480ed
|
||||
export RAPTOR_TARBALL := a39f6c07ddb20d7dd2ff1f95fa21e2cd-raptor2-2.0.15.tar.gz
|
||||
export RASQAL_SHA256SUM := 6924c9ac6570bd241a9669f83b467c728a322470bf34f4b2da4f69492ccfd97c
|
||||
|
1
external/Module_external.mk
vendored
1
external/Module_external.mk
vendored
@@ -88,6 +88,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
|
||||
$(call gb_Helper_optional,POPPLER,poppler) \
|
||||
$(call gb_Helper_optional,POSTGRESQL,postgresql) \
|
||||
$(call gb_Helper_optional,PYTHON,python3) \
|
||||
$(call gb_Helper_optional,QXP,libqxp) \
|
||||
$(call gb_Helper_optional,REDLAND,redland) \
|
||||
$(call gb_Helper_optional,REVENGE,librevenge) \
|
||||
$(call gb_Helper_optional,RHINO,rhino) \
|
||||
|
37
external/libqxp/0001-add-missing-includes.patch.1
vendored
Normal file
37
external/libqxp/0001-add-missing-includes.patch.1
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
From 5658a197de7dd7827e6cb2ba9acd8ed7934e9e83 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksas Pantechovskis <alex.pantec@gmail.com>
|
||||
Date: Sun, 27 Aug 2017 22:55:00 +0300
|
||||
Subject: [PATCH] add missing includes
|
||||
|
||||
---
|
||||
src/lib/QXPBlockParser.cpp | 1 +
|
||||
src/lib/QXPContentCollector.cpp | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/lib/QXPBlockParser.cpp b/src/lib/QXPBlockParser.cpp
|
||||
index a9a8c9b..d0a58e7 100644
|
||||
--- a/src/lib/QXPBlockParser.cpp
|
||||
+++ b/src/lib/QXPBlockParser.cpp
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
+#include <iterator>
|
||||
|
||||
#include "QXPHeader.h"
|
||||
#include "QXPMemoryStream.h"
|
||||
diff --git a/src/lib/QXPContentCollector.cpp b/src/lib/QXPContentCollector.cpp
|
||||
index 0a5a2c9..6a227a6 100644
|
||||
--- a/src/lib/QXPContentCollector.cpp
|
||||
+++ b/src/lib/QXPContentCollector.cpp
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
+#include <iterator>
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
--
|
||||
2.7.4
|
||||
|
89
external/libqxp/0001-don-t-use-RVNGStringStream-in-the-main-lib.patch.1
vendored
Normal file
89
external/libqxp/0001-don-t-use-RVNGStringStream-in-the-main-lib.patch.1
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
From 4118cfa23d2e251278a55f7fd44c246c84c41ab5 Mon Sep 17 00:00:00 2001
|
||||
From: Aleksas Pantechovskis <alex.pantec@gmail.com>
|
||||
Date: Sun, 27 Aug 2017 19:39:37 +0300
|
||||
Subject: [PATCH] don't use RVNGStringStream in the main lib
|
||||
|
||||
librevenge-stream is not used in libreoffice
|
||||
---
|
||||
src/lib/QXP4Parser.cpp | 4 ++--
|
||||
src/lib/QXPBlockParser.cpp | 6 +++---
|
||||
src/lib/QXPParser.cpp | 1 -
|
||||
3 files changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/lib/QXP4Parser.cpp b/src/lib/QXP4Parser.cpp
|
||||
index c748e3e..3e31951 100644
|
||||
--- a/src/lib/QXP4Parser.cpp
|
||||
+++ b/src/lib/QXP4Parser.cpp
|
||||
@@ -15,11 +15,11 @@
|
||||
#include "QXP4Deobfuscator.h"
|
||||
#include "QXP4Header.h"
|
||||
#include "QXPCollector.h"
|
||||
+#include "QXPMemoryStream.h"
|
||||
|
||||
namespace libqxp
|
||||
{
|
||||
|
||||
-using librevenge::RVNGStringStream;
|
||||
using std::make_shared;
|
||||
using std::shared_ptr;
|
||||
|
||||
@@ -123,7 +123,7 @@ bool QXP4Parser::parsePages(const std::shared_ptr<librevenge::RVNGInputStream> &
|
||||
void QXP4Parser::parseColors(const std::shared_ptr<librevenge::RVNGInputStream> &docStream)
|
||||
{
|
||||
unsigned length = readU32(docStream, be);
|
||||
- auto stream = make_shared<RVNGStringStream>(readNBytes(docStream, length), length);
|
||||
+ auto stream = make_shared<QXPMemoryStream>(readNBytes(docStream, length), length);
|
||||
|
||||
try
|
||||
{
|
||||
diff --git a/src/lib/QXPBlockParser.cpp b/src/lib/QXPBlockParser.cpp
|
||||
index 58cecb9..a9a8c9b 100644
|
||||
--- a/src/lib/QXPBlockParser.cpp
|
||||
+++ b/src/lib/QXPBlockParser.cpp
|
||||
@@ -15,12 +15,12 @@
|
||||
#include <vector>
|
||||
|
||||
#include "QXPHeader.h"
|
||||
+#include "QXPMemoryStream.h"
|
||||
|
||||
namespace libqxp
|
||||
{
|
||||
|
||||
using librevenge::RVNGInputStream;
|
||||
-using librevenge::RVNGStringStream;
|
||||
using std::make_shared;
|
||||
using std::vector;
|
||||
|
||||
@@ -36,7 +36,7 @@ std::shared_ptr<RVNGInputStream> QXPBlockParser::getBlock(const uint32_t index)
|
||||
{
|
||||
seek(m_input, (index - 1) * m_blockLength);
|
||||
auto block = readNBytes(m_input, m_blockLength);
|
||||
- return make_shared<RVNGStringStream>(block, m_blockLength);
|
||||
+ return make_shared<QXPMemoryStream>(block, m_blockLength);
|
||||
}
|
||||
|
||||
std::shared_ptr<RVNGInputStream> QXPBlockParser::getChain(const uint32_t index)
|
||||
@@ -59,7 +59,7 @@ std::shared_ptr<RVNGInputStream> QXPBlockParser::getChain(const uint32_t index)
|
||||
isBig = nextVal < 0;
|
||||
next = abs(nextVal);
|
||||
}
|
||||
- return make_shared<RVNGStringStream>(chain.data(), chain.size());
|
||||
+ return make_shared<QXPMemoryStream>(chain.data(), chain.size());
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/lib/QXPParser.cpp b/src/lib/QXPParser.cpp
|
||||
index 54abd7e..9dd90a8 100644
|
||||
--- a/src/lib/QXPParser.cpp
|
||||
+++ b/src/lib/QXPParser.cpp
|
||||
@@ -18,7 +18,6 @@
|
||||
namespace libqxp
|
||||
{
|
||||
|
||||
-using librevenge::RVNGStringStream;
|
||||
using std::make_shared;
|
||||
|
||||
QXPParser::QXPParser(const std::shared_ptr<librevenge::RVNGInputStream> &input, librevenge::RVNGDrawingInterface *painter, const std::shared_ptr<QXPHeader> &header)
|
||||
--
|
||||
2.7.4
|
||||
|
45
external/libqxp/ExternalProject_libqxp.mk
vendored
Normal file
45
external/libqxp/ExternalProject_libqxp.mk
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_ExternalProject_ExternalProject,libqxp))
|
||||
|
||||
$(eval $(call gb_ExternalProject_use_autoconf,libqxp,build))
|
||||
|
||||
$(eval $(call gb_ExternalProject_register_targets,libqxp,\
|
||||
build \
|
||||
))
|
||||
|
||||
$(eval $(call gb_ExternalProject_use_externals,libqxp,\
|
||||
boost_headers \
|
||||
icu \
|
||||
revenge \
|
||||
zlib \
|
||||
))
|
||||
|
||||
$(call gb_ExternalProject_get_state_target,libqxp,build) :
|
||||
$(call gb_ExternalProject_run,build,\
|
||||
export PKG_CONFIG="" \
|
||||
&& MAKE=$(MAKE) ./configure \
|
||||
--with-pic \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--without-docs \
|
||||
--disable-tools \
|
||||
--disable-debug \
|
||||
--disable-werror \
|
||||
--disable-weffc \
|
||||
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
|
||||
CXXFLAGS="$(CXXFLAGS) $(CXXFLAGS_CXX11) $(if $(SYSTEM_BOOST),$(BOOST_CPPFLAGS),-I$(call gb_UnpackedTarball_get_dir,boost))" \
|
||||
REVENGE_GENERATORS_CFLAGS=' ' REVENGE_GENERATORS_LIBS=' ' REVENGE_STREAM_CFLAGS=' ' REVENGE_STREAM_LIBS=' ' \
|
||||
ax_cv_cxx_compile_cxx11=yes \
|
||||
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
|
||||
&& $(MAKE) -C src/lib \
|
||||
)
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
7
external/libqxp/Makefile
vendored
Normal file
7
external/libqxp/Makefile
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
|
||||
module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
|
||||
include $(module_directory)/../../solenv/gbuild/partial_build.mk
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
17
external/libqxp/Module_libqxp.mk
vendored
Normal file
17
external/libqxp/Module_libqxp.mk
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_Module_Module,libqxp))
|
||||
|
||||
$(eval $(call gb_Module_add_targets,libqxp,\
|
||||
ExternalProject_libqxp \
|
||||
UnpackedTarball_libqxp \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
4
external/libqxp/README
vendored
Normal file
4
external/libqxp/README
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
libqxp is a library and a set of tools for reading and converting
|
||||
QuarkXPress file format. It supports versions 3.1-4.1 currently.
|
||||
|
||||
[https://wiki.documentfoundation.org/DLP/Libraries/libqxp]
|
29
external/libqxp/UnpackedTarball_libqxp.mk
vendored
Normal file
29
external/libqxp/UnpackedTarball_libqxp.mk
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
$(eval $(call gb_UnpackedTarball_UnpackedTarball,libqxp))
|
||||
|
||||
$(eval $(call gb_UnpackedTarball_set_tarball,libqxp,$(QXP_TARBALL)))
|
||||
|
||||
$(eval $(call gb_UnpackedTarball_set_patchlevel,libqxp,0))
|
||||
|
||||
ifeq ($(COM_IS_CLANG),TRUE)
|
||||
ifneq ($(filter -fsanitize=%,$(CC)),)
|
||||
$(eval $(call gb_UnpackedTarball_add_patches,libqxp, \
|
||||
external/libqxp/ubsan-visibility.patch \
|
||||
))
|
||||
endif
|
||||
endif
|
||||
|
||||
$(eval $(call gb_UnpackedTarball_add_patches,libqxp, \
|
||||
external/libqxp/0001-don-t-use-RVNGStringStream-in-the-main-lib.patch.1 \
|
||||
external/libqxp/0001-add-missing-includes.patch.1 \
|
||||
))
|
||||
|
||||
# vim: set noet sw=4 ts=4:
|
11
external/libqxp/ubsan-visibility.patch
vendored
Normal file
11
external/libqxp/ubsan-visibility.patch
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
--- configure
|
||||
+++ configure
|
||||
@@ -16787,7 +16787,7 @@
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fvisibility=hidden compiler flag" >&5
|
||||
$as_echo_n "checking for -fvisibility=hidden compiler flag... " >&6; }
|
||||
saved_CXXFLAGS="$CXXFLAGS"
|
||||
- CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
|
||||
+ CXXFLAGS="$CXXFLAGS -fvisibility-ms-compat"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
@@ -555,6 +555,7 @@ $(eval $(call filter_Configuration_add_types,fcfg_langpack,fcfg_draw_types.xcu,f
|
||||
draw_Visio_Document \
|
||||
draw_ClarisWorks \
|
||||
draw_PageMaker_Document \
|
||||
draw_QXP_Document \
|
||||
draw_ZMF_Document \
|
||||
MWAW_Bitmap \
|
||||
MWAW_Drawing \
|
||||
@@ -576,6 +577,7 @@ $(eval $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_filters.x
|
||||
FreehandDocument \
|
||||
ClarisWorks_Draw \
|
||||
PageMakerDocument \
|
||||
QXPDocument \
|
||||
ZMFDocument \
|
||||
MWAW_Bitmap \
|
||||
MWAW_Drawing \
|
||||
|
13
filter/source/config/fragments/filters/QXPDocument.xcu
Normal file
13
filter/source/config/fragments/filters/QXPDocument.xcu
Normal file
@@ -0,0 +1,13 @@
|
||||
<node oor:name="QXP Document" oor:op="replace">
|
||||
<prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
|
||||
<prop oor:name="UIComponent"/>
|
||||
<prop oor:name="FilterService"><value>org.libreoffice.comp.Draw.QXPImportFilter</value></prop>
|
||||
<prop oor:name="UserData"/>
|
||||
<prop oor:name="UIName">
|
||||
<value xml:lang="en-US">QuarkXPress</value>
|
||||
</prop>
|
||||
<prop oor:name="FileFormatVersion"><value>0</value></prop>
|
||||
<prop oor:name="Type"><value>draw_QXP_Document</value></prop>
|
||||
<prop oor:name="TemplateName"/>
|
||||
<prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
|
||||
</node>
|
12
filter/source/config/fragments/types/draw_QXP_Document.xcu
Normal file
12
filter/source/config/fragments/types/draw_QXP_Document.xcu
Normal file
@@ -0,0 +1,12 @@
|
||||
<node oor:name="draw_QXP_Document" oor:op="replace" >
|
||||
<prop oor:name="DetectService"><value>org.libreoffice.comp.Draw.QXPImportFilter</value></prop>
|
||||
<prop oor:name="URLPattern"/>
|
||||
<prop oor:name="Extensions"><value>qxd qxt</value></prop>
|
||||
<prop oor:name="MediaType"/>
|
||||
<prop oor:name="Preferred"><value>true</value></prop>
|
||||
<prop oor:name="PreferredFilter"><value>QXP Document</value></prop>
|
||||
<prop oor:name="UIName">
|
||||
<value>QuarkXPress</value>
|
||||
</prop>
|
||||
<prop oor:name="ClipboardFormat"/>
|
||||
</node>
|
@@ -52,6 +52,7 @@ $(eval $(call gb_Library_use_externals,wpftdraw,\
|
||||
zmf \
|
||||
png \
|
||||
pagemaker \
|
||||
qxp \
|
||||
revenge \
|
||||
staroffice \
|
||||
visio \
|
||||
@@ -72,6 +73,7 @@ $(eval $(call gb_Library_add_exception_objects,wpftdraw,\
|
||||
writerperfect/source/draw/MSPUBImportFilter \
|
||||
writerperfect/source/draw/MWAWDrawImportFilter \
|
||||
writerperfect/source/draw/PageMakerImportFilter \
|
||||
writerperfect/source/draw/QXPImportFilter \
|
||||
writerperfect/source/draw/StarOfficeDrawImportFilter \
|
||||
writerperfect/source/draw/VisioImportFilter \
|
||||
writerperfect/source/draw/WPGImportFilter \
|
||||
|
66
writerperfect/source/draw/QXPImportFilter.cxx
Normal file
66
writerperfect/source/draw/QXPImportFilter.cxx
Normal file
@@ -0,0 +1,66 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* QXPImportFilter: Sets up the filter, and calls OdgExporter
|
||||
* to do the actual filtering
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <libodfgen/libodfgen.hxx>
|
||||
|
||||
#include <libqxp/libqxp.h>
|
||||
|
||||
#include <com/sun/star/uno/XComponentContext.hpp>
|
||||
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
|
||||
#include "QXPImportFilter.hxx"
|
||||
|
||||
using com::sun::star::uno::RuntimeException;
|
||||
using com::sun::star::uno::Sequence;
|
||||
using com::sun::star::uno::XComponentContext;
|
||||
using com::sun::star::uno::XInterface;
|
||||
|
||||
bool QXPImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &)
|
||||
{
|
||||
return libqxp::QXPDocument::parse(&rInput, &rGenerator) == libqxp::QXPDocument::RESULT_OK;
|
||||
}
|
||||
|
||||
bool QXPImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
|
||||
{
|
||||
if (libqxp::QXPDocument::isSupported(&rInput))
|
||||
{
|
||||
rTypeName = "draw_QXP_Document";
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
OUString SAL_CALL QXPImportFilter::getImplementationName()
|
||||
{
|
||||
return OUString("org.libreoffice.comp.Draw.QXPImportFilter");
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL QXPImportFilter::supportsService(const OUString &rServiceName)
|
||||
{
|
||||
return cppu::supportsService(this, rServiceName);
|
||||
}
|
||||
|
||||
Sequence< OUString > SAL_CALL QXPImportFilter::getSupportedServiceNames()
|
||||
{
|
||||
return Sequence< OUString > {"com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection"};
|
||||
}
|
||||
|
||||
extern "C"
|
||||
SAL_DLLPUBLIC_EXPORT css::uno::XInterface *SAL_CALL
|
||||
org_libreoffice_comp_Draw_QXPImportFilter_get_implementation(
|
||||
css::uno::XComponentContext *const context,
|
||||
const css::uno::Sequence<css::uno::Any> &)
|
||||
{
|
||||
return cppu::acquire(new QXPImportFilter(context));
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
38
writerperfect/source/draw/QXPImportFilter.hxx
Normal file
38
writerperfect/source/draw/QXPImportFilter.hxx
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_QXPIMPORTFILTER_HXX
|
||||
#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_QXPIMPORTFILTER_HXX
|
||||
|
||||
#include "ImportFilter.hxx"
|
||||
|
||||
#include "DocumentHandlerForOdg.hxx"
|
||||
|
||||
/* This component will be instantiated for both import or export. Whether it calls
|
||||
* setSourceDocument or setTargetDocument determines which Impl function the filter
|
||||
* member calls */
|
||||
class QXPImportFilter : public writerperfect::ImportFilter<OdgGenerator>
|
||||
{
|
||||
public:
|
||||
explicit QXPImportFilter(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
|
||||
: writerperfect::ImportFilter<OdgGenerator>(rxContext)
|
||||
{
|
||||
}
|
||||
|
||||
// XServiceInfo
|
||||
virtual OUString SAL_CALL getImplementationName() override;
|
||||
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override;
|
||||
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
|
||||
|
||||
private:
|
||||
virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) override;
|
||||
virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, OdgGenerator &rGenerator, utl::MediaDescriptor &) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -54,6 +54,11 @@
|
||||
<service name="com.sun.star.document.ImportFilter"/>
|
||||
<service name="com.sun.star.document.ExtendedTypeDetection"/>
|
||||
</implementation>
|
||||
<implementation name="org.libreoffice.comp.Draw.QXPImportFilter"
|
||||
constructor="org_libreoffice_comp_Draw_QXPImportFilter_get_implementation">
|
||||
<service name="com.sun.star.document.ImportFilter"/>
|
||||
<service name="com.sun.star.document.ExtendedTypeDetection"/>
|
||||
</implementation>
|
||||
<implementation name="org.libreoffice.comp.Draw.ZMFImportFilter"
|
||||
constructor="org_libreoffice_comp_Draw_ZMFImportFilter_get_implementation">
|
||||
<service name="com.sun.star.document.ImportFilter"/>
|
||||
|
Reference in New Issue
Block a user