From e59b5b1fc7266d56a17e387b8df0f6d6956e8ea5 Mon Sep 17 00:00:00 2001 From: Aleksas Pantechovskis Date: Sun, 27 Aug 2017 22:10:14 +0300 Subject: integrate libqxp Change-Id: Ic7479b82d09c1e36d28267434a77bf4bc158adfa Reviewed-on: https://gerrit.libreoffice.org/41612 Tested-by: Jenkins Reviewed-by: David Tardon --- writerperfect/Library_wpftdraw.mk | 2 + writerperfect/source/draw/QXPImportFilter.cxx | 66 +++++++++++++++++++++++++++ writerperfect/source/draw/QXPImportFilter.hxx | 38 +++++++++++++++ writerperfect/source/draw/wpftdraw.component | 5 ++ 4 files changed, 111 insertions(+) create mode 100644 writerperfect/source/draw/QXPImportFilter.cxx create mode 100644 writerperfect/source/draw/QXPImportFilter.hxx (limited to 'writerperfect') 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 + +#include + +#include + +#include + +#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 &) +{ + 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 +{ +public: + explicit QXPImportFilter(const css::uno::Reference< css::uno::XComponentContext > &rxContext) + : writerperfect::ImportFilter(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 @@ + + + + -- cgit