summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorAleksas Pantechovskis <alex.pantec@gmail.com>2017-08-27 22:10:14 +0300
committerDavid Tardon <dtardon@redhat.com>2017-08-28 08:20:47 +0200
commite59b5b1fc7266d56a17e387b8df0f6d6956e8ea5 (patch)
treebcf876537965bba8f7c3b9915a31fdde4236b809 /writerperfect
parentc8777a18792a292bcbcb536e72b25b390b49000e (diff)
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>
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/Library_wpftdraw.mk2
-rw-r--r--writerperfect/source/draw/QXPImportFilter.cxx66
-rw-r--r--writerperfect/source/draw/QXPImportFilter.hxx38
-rw-r--r--writerperfect/source/draw/wpftdraw.component5
4 files changed, 111 insertions, 0 deletions
diff --git a/writerperfect/Library_wpftdraw.mk b/writerperfect/Library_wpftdraw.mk
index 18425b4f22ea..3992fe7f2f88 100644
--- a/writerperfect/Library_wpftdraw.mk
+++ b/writerperfect/Library_wpftdraw.mk
@@ -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 \
diff --git a/writerperfect/source/draw/QXPImportFilter.cxx b/writerperfect/source/draw/QXPImportFilter.cxx
new file mode 100644
index 000000000000..9556cbec6a3f
--- /dev/null
+++ b/writerperfect/source/draw/QXPImportFilter.cxx
@@ -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: */
diff --git a/writerperfect/source/draw/QXPImportFilter.hxx b/writerperfect/source/draw/QXPImportFilter.hxx
new file mode 100644
index 000000000000..c95dab83f0d9
--- /dev/null
+++ b/writerperfect/source/draw/QXPImportFilter.hxx
@@ -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: */
diff --git a/writerperfect/source/draw/wpftdraw.component b/writerperfect/source/draw/wpftdraw.component
index 72330b24de70..1f9ced75acfe 100644
--- a/writerperfect/source/draw/wpftdraw.component
+++ b/writerperfect/source/draw/wpftdraw.component
@@ -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"/>