From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- writerperfect/source/draw/CDRImportFilter.cxx | 60 +++++++++++ writerperfect/source/draw/CDRImportFilter.hxx | 42 ++++++++ writerperfect/source/draw/CMXImportFilter.cxx | 60 +++++++++++ writerperfect/source/draw/CMXImportFilter.hxx | 42 ++++++++ writerperfect/source/draw/FreehandImportFilter.cxx | 56 ++++++++++ writerperfect/source/draw/FreehandImportFilter.hxx | 39 +++++++ writerperfect/source/draw/MSPUBImportFilter.cxx | 56 ++++++++++ writerperfect/source/draw/MSPUBImportFilter.hxx | 39 +++++++ writerperfect/source/draw/MWAWDrawImportFilter.cxx | 116 +++++++++++++++++++++ writerperfect/source/draw/MWAWDrawImportFilter.hxx | 44 ++++++++ .../source/draw/PageMakerImportFilter.cxx | 56 ++++++++++ .../source/draw/PageMakerImportFilter.hxx | 40 +++++++ writerperfect/source/draw/QXPImportFilter.cxx | 60 +++++++++++ writerperfect/source/draw/QXPImportFilter.hxx | 39 +++++++ .../source/draw/StarOfficeDrawImportFilter.cxx | 101 ++++++++++++++++++ .../source/draw/StarOfficeDrawImportFilter.hxx | 45 ++++++++ writerperfect/source/draw/VisioImportFilter.cxx | 56 ++++++++++ writerperfect/source/draw/VisioImportFilter.hxx | 39 +++++++ writerperfect/source/draw/WPGImportFilter.cxx | 62 +++++++++++ writerperfect/source/draw/WPGImportFilter.hxx | 44 ++++++++ writerperfect/source/draw/ZMFImportFilter.cxx | 60 +++++++++++ writerperfect/source/draw/ZMFImportFilter.hxx | 39 +++++++ writerperfect/source/draw/wpftdraw.component | 67 ++++++++++++ 23 files changed, 1262 insertions(+) create mode 100644 writerperfect/source/draw/CDRImportFilter.cxx create mode 100644 writerperfect/source/draw/CDRImportFilter.hxx create mode 100644 writerperfect/source/draw/CMXImportFilter.cxx create mode 100644 writerperfect/source/draw/CMXImportFilter.hxx create mode 100644 writerperfect/source/draw/FreehandImportFilter.cxx create mode 100644 writerperfect/source/draw/FreehandImportFilter.hxx create mode 100644 writerperfect/source/draw/MSPUBImportFilter.cxx create mode 100644 writerperfect/source/draw/MSPUBImportFilter.hxx create mode 100644 writerperfect/source/draw/MWAWDrawImportFilter.cxx create mode 100644 writerperfect/source/draw/MWAWDrawImportFilter.hxx create mode 100644 writerperfect/source/draw/PageMakerImportFilter.cxx create mode 100644 writerperfect/source/draw/PageMakerImportFilter.hxx create mode 100644 writerperfect/source/draw/QXPImportFilter.cxx create mode 100644 writerperfect/source/draw/QXPImportFilter.hxx create mode 100644 writerperfect/source/draw/StarOfficeDrawImportFilter.cxx create mode 100644 writerperfect/source/draw/StarOfficeDrawImportFilter.hxx create mode 100644 writerperfect/source/draw/VisioImportFilter.cxx create mode 100644 writerperfect/source/draw/VisioImportFilter.hxx create mode 100644 writerperfect/source/draw/WPGImportFilter.cxx create mode 100644 writerperfect/source/draw/WPGImportFilter.hxx create mode 100644 writerperfect/source/draw/ZMFImportFilter.cxx create mode 100644 writerperfect/source/draw/ZMFImportFilter.hxx create mode 100644 writerperfect/source/draw/wpftdraw.component (limited to 'writerperfect/source/draw') diff --git a/writerperfect/source/draw/CDRImportFilter.cxx b/writerperfect/source/draw/CDRImportFilter.cxx new file mode 100644 index 000000000..34b490326 --- /dev/null +++ b/writerperfect/source/draw/CDRImportFilter.cxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* CDRImportFilter: 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/. + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#include + +#include + +#include "CDRImportFilter.hxx" + +bool CDRImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return libcdr::CDRDocument::parse(&rInput, &rGenerator); +} + +bool CDRImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + if (libcdr::CDRDocument::isSupported(&rInput)) + { + rTypeName = "draw_CorelDraw_Document"; + return true; + } + + return false; +} + +// XServiceInfo +OUString SAL_CALL CDRImportFilter::getImplementationName() +{ + return "com.sun.star.comp.Draw.CDRImportFilter"; +} + +sal_Bool SAL_CALL CDRImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence SAL_CALL CDRImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_Draw_CDRImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new CDRImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/CDRImportFilter.hxx b/writerperfect/source/draw/CDRImportFilter.hxx new file mode 100644 index 000000000..5d7c5334b --- /dev/null +++ b/writerperfect/source/draw/CDRImportFilter.hxx @@ -0,0 +1,42 @@ +/* -*- 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/. + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ +#ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_CDRIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_CDRIMPORTFILTER_HXX + +#include + +#include + +/* 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 CDRImportFilter : public writerperfect::ImportFilter +{ +public: + explicit CDRImportFilter(const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/CMXImportFilter.cxx b/writerperfect/source/draw/CMXImportFilter.cxx new file mode 100644 index 000000000..23aab816a --- /dev/null +++ b/writerperfect/source/draw/CMXImportFilter.cxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* CMXImportFilter: 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/. + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#include + +#include + +#include "CMXImportFilter.hxx" + +bool CMXImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return libcdr::CMXDocument::parse(&rInput, &rGenerator); +} + +bool CMXImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + if (libcdr::CMXDocument::isSupported(&rInput)) + { + rTypeName = "draw_Corel_Presentation_Exchange"; + return true; + } + + return false; +} + +// XServiceInfo +OUString SAL_CALL CMXImportFilter::getImplementationName() +{ + return "com.sun.star.comp.Draw.CMXImportFilter"; +} + +sal_Bool SAL_CALL CMXImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence SAL_CALL CMXImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_Draw_CMXImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new CMXImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/CMXImportFilter.hxx b/writerperfect/source/draw/CMXImportFilter.hxx new file mode 100644 index 000000000..0e6d9b46d --- /dev/null +++ b/writerperfect/source/draw/CMXImportFilter.hxx @@ -0,0 +1,42 @@ +/* -*- 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/. + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ +#ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_CMXIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_CMXIMPORTFILTER_HXX + +#include + +#include + +/* 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 CMXImportFilter : public writerperfect::ImportFilter +{ +public: + explicit CMXImportFilter(const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/FreehandImportFilter.cxx b/writerperfect/source/draw/FreehandImportFilter.cxx new file mode 100644 index 000000000..68dd7b56b --- /dev/null +++ b/writerperfect/source/draw/FreehandImportFilter.cxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* FreehandImportFilter: 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 "FreehandImportFilter.hxx" + +bool FreehandImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return libfreehand::FreeHandDocument::parse(&rInput, &rGenerator); +} + +bool FreehandImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + if (libfreehand::FreeHandDocument::isSupported(&rInput)) + { + rTypeName = "draw_Freehand_Document"; + return true; + } + + return false; +} + +// XServiceInfo +OUString SAL_CALL FreehandImportFilter::getImplementationName() +{ + return "com.sun.star.comp.Draw.FreehandImportFilter"; +} + +sal_Bool SAL_CALL FreehandImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence SAL_CALL FreehandImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_Draw_FreehandImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new FreehandImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/FreehandImportFilter.hxx b/writerperfect/source/draw/FreehandImportFilter.hxx new file mode 100644 index 000000000..99921bdf6 --- /dev/null +++ b/writerperfect/source/draw/FreehandImportFilter.hxx @@ -0,0 +1,39 @@ +/* -*- 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_FREEHANDIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_FREEHANDIMPORTFILTER_HXX + +#include + +#include + +/* 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 FreehandImportFilter : public writerperfect::ImportFilter +{ +public: + explicit FreehandImportFilter(const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/MSPUBImportFilter.cxx b/writerperfect/source/draw/MSPUBImportFilter.cxx new file mode 100644 index 000000000..ba34cd2f1 --- /dev/null +++ b/writerperfect/source/draw/MSPUBImportFilter.cxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* MSPUBImportFilter: 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 "MSPUBImportFilter.hxx" + +bool MSPUBImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return libmspub::MSPUBDocument::parse(&rInput, &rGenerator); +} + +bool MSPUBImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + if (libmspub::MSPUBDocument::isSupported(&rInput)) + { + rTypeName = "draw_Publisher_Document"; + return true; + } + + return false; +} + +// XServiceInfo +OUString SAL_CALL MSPUBImportFilter::getImplementationName() +{ + return "com.sun.star.comp.Draw.MSPUBImportFilter"; +} + +sal_Bool SAL_CALL MSPUBImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence SAL_CALL MSPUBImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_Draw_MSPUBImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new MSPUBImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/MSPUBImportFilter.hxx b/writerperfect/source/draw/MSPUBImportFilter.hxx new file mode 100644 index 000000000..3e2125198 --- /dev/null +++ b/writerperfect/source/draw/MSPUBImportFilter.hxx @@ -0,0 +1,39 @@ +/* -*- 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_MSPUBIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_MSPUBIMPORTFILTER_HXX + +#include + +#include + +/* 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 MSPUBImportFilter : public writerperfect::ImportFilter +{ +public: + explicit MSPUBImportFilter(const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/MWAWDrawImportFilter.cxx b/writerperfect/source/draw/MWAWDrawImportFilter.cxx new file mode 100644 index 000000000..000debdcb --- /dev/null +++ b/writerperfect/source/draw/MWAWDrawImportFilter.cxx @@ -0,0 +1,116 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* MWAWDrawImportFilter: Sets up the filter, and calls DocumentCollector + * to do the actual filtering + * + * 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/. + */ + +#include + +#include + +#include "MWAWDrawImportFilter.hxx" + +static bool handleEmbeddedMWAWGraphicObject(const librevenge::RVNGBinaryData& data, + OdfDocumentHandler* pHandler, + const OdfStreamType streamType) +{ + OdgGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); + return MWAWDocument::decodeGraphic(data, &exporter); +} + +static bool handleEmbeddedMWAWSpreadsheetObject(const librevenge::RVNGBinaryData& data, + OdfDocumentHandler* pHandler, + const OdfStreamType streamType) +{ + OdsGenerator exporter; + exporter.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWGraphicObject); + exporter.addDocumentHandler(pHandler, streamType); + return MWAWDocument::decodeSpreadsheet(data, &exporter); +} + +bool MWAWDrawImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator); +} + +bool MWAWDrawImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + rTypeName.clear(); + + MWAWDocument::Type docType = MWAWDocument::MWAW_T_UNKNOWN; + MWAWDocument::Kind docKind = MWAWDocument::MWAW_K_UNKNOWN; + const MWAWDocument::Confidence confidence + = MWAWDocument::isFileFormatSupported(&rInput, docType, docKind); + + if (confidence == MWAWDocument::MWAW_C_EXCELLENT) + { + switch (docKind) + { + case MWAWDocument::MWAW_K_DRAW: + switch (docType) + { + case MWAWDocument::MWAW_T_CLARISWORKS: + rTypeName = "draw_ClarisWorks"; + break; + default: + rTypeName = "MWAW_Drawing"; + break; + } + break; + case MWAWDocument::MWAW_K_PAINT: + switch (docType) + { + case MWAWDocument::MWAW_T_CLARISWORKS: + rTypeName = "draw_ClarisWorks"; + break; + default: + rTypeName = "MWAW_Bitmap"; + break; + } + break; + default: + break; + } + } + + return !rTypeName.isEmpty(); +} + +void MWAWDrawImportFilter::doRegisterHandlers(OdgGenerator& rGenerator) +{ + rGenerator.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWGraphicObject); + rGenerator.registerEmbeddedObjectHandler("image/mwaw-ods", + &handleEmbeddedMWAWSpreadsheetObject); +} + +// XServiceInfo +OUString SAL_CALL MWAWDrawImportFilter::getImplementationName() +{ + return "com.sun.star.comp.Draw.MWAWDrawImportFilter"; +} + +sal_Bool SAL_CALL MWAWDrawImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence SAL_CALL MWAWDrawImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_Draw_MWAWDrawImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new MWAWDrawImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/MWAWDrawImportFilter.hxx b/writerperfect/source/draw/MWAWDrawImportFilter.hxx new file mode 100644 index 000000000..ddc305830 --- /dev/null +++ b/writerperfect/source/draw/MWAWDrawImportFilter.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_MWAWDRAWIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_MWAWDRAWIMPORTFILTER_HXX + +#include + +#include + +#include + +/* 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 MWAWDrawImportFilter : public writerperfect::ImportFilter +{ +public: + explicit MWAWDrawImportFilter(const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; + virtual void doRegisterHandlers(OdgGenerator& rGenerator) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/PageMakerImportFilter.cxx b/writerperfect/source/draw/PageMakerImportFilter.cxx new file mode 100644 index 000000000..5f5379de9 --- /dev/null +++ b/writerperfect/source/draw/PageMakerImportFilter.cxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* PageMakerImportFilter: 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 "PageMakerImportFilter.hxx" + +bool PageMakerImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return libpagemaker::PMDocument::parse(&rInput, &rGenerator); +} + +bool PageMakerImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + if (libpagemaker::PMDocument::isSupported(&rInput)) + { + rTypeName = "draw_PageMaker_Document"; + return true; + } + + return false; +} + +// XServiceInfo +OUString SAL_CALL PageMakerImportFilter::getImplementationName() +{ + return "org.libreoffice.comp.Draw.PageMakerImportFilter"; +} + +sal_Bool SAL_CALL PageMakerImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence SAL_CALL PageMakerImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +org_libreoffice_comp_Draw_PageMakerImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new PageMakerImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/PageMakerImportFilter.hxx b/writerperfect/source/draw/PageMakerImportFilter.hxx new file mode 100644 index 000000000..a333924bf --- /dev/null +++ b/writerperfect/source/draw/PageMakerImportFilter.hxx @@ -0,0 +1,40 @@ +/* -*- 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_PAGEMAKERIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_PAGEMAKERIMPORTFILTER_HXX + +#include + +#include + +/* 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 PageMakerImportFilter : public writerperfect::ImportFilter +{ +public: + explicit PageMakerImportFilter( + const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/QXPImportFilter.cxx b/writerperfect/source/draw/QXPImportFilter.cxx new file mode 100644 index 000000000..c644ad470 --- /dev/null +++ b/writerperfect/source/draw/QXPImportFilter.cxx @@ -0,0 +1,60 @@ +/* -*- 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 "QXPImportFilter.hxx" + +using com::sun::star::uno::Sequence; +using com::sun::star::uno::XComponentContext; +using com::sun::star::uno::XInterface; + +bool QXPImportFilter::doImportDocument(weld::Window*, 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 "org.libreoffice.comp.Draw.QXPImportFilter"; +} + +sal_Bool SAL_CALL QXPImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence SAL_CALL QXPImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +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 000000000..8a2538b8b --- /dev/null +++ b/writerperfect/source/draw/QXPImportFilter.hxx @@ -0,0 +1,39 @@ +/* -*- 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 + +#include + +/* 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& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx b/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx new file mode 100644 index 000000000..1c335bfc4 --- /dev/null +++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.cxx @@ -0,0 +1,101 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#include + +#include + +#include "StarOfficeDrawImportFilter.hxx" + +using com::sun::star::uno::Sequence; +using com::sun::star::uno::XComponentContext; +using com::sun::star::uno::XInterface; + +static bool handleEmbeddedSTOFFGraphicObject(const librevenge::RVNGBinaryData& data, + OdfDocumentHandler* pHandler, + const OdfStreamType streamType) +{ + OdgGenerator exporter; + exporter.addDocumentHandler(pHandler, streamType); + return STOFFDocument::decodeGraphic(data, &exporter); +} + +static bool handleEmbeddedSTOFFSpreadsheetObject(const librevenge::RVNGBinaryData& data, + OdfDocumentHandler* pHandler, + const OdfStreamType streamType) +{ + OdsGenerator exporter; + exporter.registerEmbeddedObjectHandler("image/stoff-odg", &handleEmbeddedSTOFFGraphicObject); + exporter.addDocumentHandler(pHandler, streamType); + return STOFFDocument::decodeSpreadsheet(data, &exporter); +} + +bool StarOfficeDrawImportFilter::doImportDocument(weld::Window*, + librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator); +} + +bool StarOfficeDrawImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, + OUString& rTypeName) +{ + rTypeName.clear(); + + STOFFDocument::Kind docKind = STOFFDocument::STOFF_K_UNKNOWN; + const STOFFDocument::Confidence confidence + = STOFFDocument::isFileFormatSupported(&rInput, docKind); + + if (confidence == STOFFDocument::STOFF_C_EXCELLENT + || confidence == STOFFDocument::STOFF_C_SUPPORTED_ENCRYPTION) + { + switch (docKind) + { + case STOFFDocument::STOFF_K_DRAW: + rTypeName = "StarOffice_Drawing"; + break; + default: + break; + } + } + + return !rTypeName.isEmpty(); +} + +void StarOfficeDrawImportFilter::doRegisterHandlers(OdgGenerator& rGenerator) +{ + rGenerator.registerEmbeddedObjectHandler("image/stoff-odg", &handleEmbeddedSTOFFGraphicObject); + rGenerator.registerEmbeddedObjectHandler("image/stoff-ods", + &handleEmbeddedSTOFFSpreadsheetObject); +} + +// XServiceInfo +OUString SAL_CALL StarOfficeDrawImportFilter::getImplementationName() +{ + return "org.libreoffice.comp.Draw.StarOfficeDrawImportFilter"; +} + +sal_Bool SAL_CALL StarOfficeDrawImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence SAL_CALL StarOfficeDrawImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +org_libreoffice_comp_Draw_StarOfficeDrawImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new StarOfficeDrawImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx new file mode 100644 index 000000000..2526a96a9 --- /dev/null +++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +#ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_STAROFFICEDRAWIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_STAROFFICEDRAWIMPORTFILTER_HXX + +#include + +#include + +#include + +/* 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 StarOfficeDrawImportFilter : public writerperfect::ImportFilter +{ +public: + explicit StarOfficeDrawImportFilter( + const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; + virtual void doRegisterHandlers(OdgGenerator& rGenerator) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/VisioImportFilter.cxx b/writerperfect/source/draw/VisioImportFilter.cxx new file mode 100644 index 000000000..33b23aae4 --- /dev/null +++ b/writerperfect/source/draw/VisioImportFilter.cxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* VisioImportFilter: 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 "VisioImportFilter.hxx" + +bool VisioImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return libvisio::VisioDocument::parse(&rInput, &rGenerator); +} + +bool VisioImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + if (libvisio::VisioDocument::isSupported(&rInput)) + { + rTypeName = "draw_Visio_Document"; + return true; + } + + return false; +} + +// XServiceInfo +OUString SAL_CALL VisioImportFilter::getImplementationName() +{ + return "com.sun.star.comp.Draw.VisioImportFilter"; +} + +sal_Bool SAL_CALL VisioImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence SAL_CALL VisioImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_Draw_VisioImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new VisioImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/VisioImportFilter.hxx b/writerperfect/source/draw/VisioImportFilter.hxx new file mode 100644 index 000000000..387827a4a --- /dev/null +++ b/writerperfect/source/draw/VisioImportFilter.hxx @@ -0,0 +1,39 @@ +/* -*- 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_VISIOIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_VISIOIMPORTFILTER_HXX + +#include + +#include + +/* 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 VisioImportFilter : public writerperfect::ImportFilter +{ +public: + explicit VisioImportFilter(const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/WPGImportFilter.cxx b/writerperfect/source/draw/WPGImportFilter.cxx new file mode 100644 index 000000000..10411ea3b --- /dev/null +++ b/writerperfect/source/draw/WPGImportFilter.cxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* WPGImportFilter: Sets up the filter, and calls OdgExporter + * to do the actual filtering + * + * 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/. + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#include + +#include + +#include "WPGImportFilter.hxx" + +bool WPGImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return libwpg::WPGraphics::parse(&rInput, &rGenerator); +} + +bool WPGImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + if (libwpg::WPGraphics::isSupported(&rInput)) + { + rTypeName = "draw_WordPerfect_Graphics"; + return true; + } + + return false; +} + +// XServiceInfo +OUString SAL_CALL WPGImportFilter::getImplementationName() +{ + return "com.sun.star.comp.Draw.WPGImportFilter"; +} + +sal_Bool SAL_CALL WPGImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +css::uno::Sequence SAL_CALL WPGImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_Draw_WPGImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new WPGImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/WPGImportFilter.hxx b/writerperfect/source/draw/WPGImportFilter.hxx new file mode 100644 index 000000000..3e75f08ee --- /dev/null +++ b/writerperfect/source/draw/WPGImportFilter.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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/. + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ +#ifndef INCLUDED_WRITERPERFECT_SOURCE_DRAW_WPGIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_WPGIMPORTFILTER_HXX + +#include + +#include + +/* 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 WPGImportFilter : public writerperfect::ImportFilter +{ +public: + explicit WPGImportFilter(const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) override; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/ZMFImportFilter.cxx b/writerperfect/source/draw/ZMFImportFilter.cxx new file mode 100644 index 000000000..0d1f16c97 --- /dev/null +++ b/writerperfect/source/draw/ZMFImportFilter.cxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ZMFImportFilter: 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 "ZMFImportFilter.hxx" + +using com::sun::star::uno::Sequence; +using com::sun::star::uno::XComponentContext; +using com::sun::star::uno::XInterface; + +bool ZMFImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput, + OdgGenerator& rGenerator, utl::MediaDescriptor&) +{ + return libzmf::ZMFDocument::parse(&rInput, &rGenerator); +} + +bool ZMFImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) +{ + if (libzmf::ZMFDocument::isSupported(&rInput)) + { + rTypeName = "draw_ZMF_Document"; + return true; + } + + return false; +} + +// XServiceInfo +OUString SAL_CALL ZMFImportFilter::getImplementationName() +{ + return "org.libreoffice.comp.Draw.ZMFImportFilter"; +} + +sal_Bool SAL_CALL ZMFImportFilter::supportsService(const OUString& rServiceName) +{ + return cppu::supportsService(this, rServiceName); +} + +Sequence SAL_CALL ZMFImportFilter::getSupportedServiceNames() +{ + return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" }; +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +org_libreoffice_comp_Draw_ZMFImportFilter_get_implementation( + css::uno::XComponentContext* const context, const css::uno::Sequence&) +{ + return cppu::acquire(new ZMFImportFilter(context)); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerperfect/source/draw/ZMFImportFilter.hxx b/writerperfect/source/draw/ZMFImportFilter.hxx new file mode 100644 index 000000000..6fef0180d --- /dev/null +++ b/writerperfect/source/draw/ZMFImportFilter.hxx @@ -0,0 +1,39 @@ +/* -*- 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_ZMFIMPORTFILTER_HXX +#define INCLUDED_WRITERPERFECT_SOURCE_DRAW_ZMFIMPORTFILTER_HXX + +#include + +#include + +/* 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 ZMFImportFilter : public writerperfect::ImportFilter +{ +public: + explicit ZMFImportFilter(const css::uno::Reference& 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 SAL_CALL getSupportedServiceNames() override; + +private: + virtual bool doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName) override; + virtual bool doImportDocument(weld::Window* pParent, 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 new file mode 100644 index 000000000..1f9ced75a --- /dev/null +++ b/writerperfect/source/draw/wpftdraw.component @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3