summaryrefslogtreecommitdiffstats
path: root/writerperfect/source/draw
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /writerperfect/source/draw
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'writerperfect/source/draw')
-rw-r--r--writerperfect/source/draw/CDRImportFilter.cxx60
-rw-r--r--writerperfect/source/draw/CDRImportFilter.hxx39
-rw-r--r--writerperfect/source/draw/CMXImportFilter.cxx60
-rw-r--r--writerperfect/source/draw/CMXImportFilter.hxx39
-rw-r--r--writerperfect/source/draw/FreehandImportFilter.cxx56
-rw-r--r--writerperfect/source/draw/FreehandImportFilter.hxx36
-rw-r--r--writerperfect/source/draw/MSPUBImportFilter.cxx56
-rw-r--r--writerperfect/source/draw/MSPUBImportFilter.hxx36
-rw-r--r--writerperfect/source/draw/MWAWDrawImportFilter.cxx116
-rw-r--r--writerperfect/source/draw/MWAWDrawImportFilter.hxx41
-rw-r--r--writerperfect/source/draw/PageMakerImportFilter.cxx56
-rw-r--r--writerperfect/source/draw/PageMakerImportFilter.hxx37
-rw-r--r--writerperfect/source/draw/QXPImportFilter.cxx60
-rw-r--r--writerperfect/source/draw/QXPImportFilter.hxx36
-rw-r--r--writerperfect/source/draw/StarOfficeDrawImportFilter.cxx101
-rw-r--r--writerperfect/source/draw/StarOfficeDrawImportFilter.hxx42
-rw-r--r--writerperfect/source/draw/VisioImportFilter.cxx56
-rw-r--r--writerperfect/source/draw/VisioImportFilter.hxx36
-rw-r--r--writerperfect/source/draw/WPGImportFilter.cxx62
-rw-r--r--writerperfect/source/draw/WPGImportFilter.hxx41
-rw-r--r--writerperfect/source/draw/ZMFImportFilter.cxx60
-rw-r--r--writerperfect/source/draw/ZMFImportFilter.hxx36
-rw-r--r--writerperfect/source/draw/wpftdraw.component67
23 files changed, 1229 insertions, 0 deletions
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 <cppuhelper/supportsservice.hxx>
+
+#include <libcdr/libcdr.h>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..0e8247131
--- /dev/null
+++ b/writerperfect/source/draw/CDRImportFilter.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/.
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#pragma once
+
+#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 CDRImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit CDRImportFilter(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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 <cppuhelper/supportsservice.hxx>
+
+#include <libcdr/libcdr.h>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..cc3b19428
--- /dev/null
+++ b/writerperfect/source/draw/CMXImportFilter.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/.
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#pragma once
+
+#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 CMXImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit CMXImportFilter(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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 <cppuhelper/supportsservice.hxx>
+
+#include <libfreehand/libfreehand.h>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..083218117
--- /dev/null
+++ b/writerperfect/source/draw/FreehandImportFilter.hxx
@@ -0,0 +1,36 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#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 FreehandImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit FreehandImportFilter(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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 <cppuhelper/supportsservice.hxx>
+
+#include <libmspub/libmspub.h>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..a84302703
--- /dev/null
+++ b/writerperfect/source/draw/MSPUBImportFilter.hxx
@@ -0,0 +1,36 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#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 MSPUBImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit MSPUBImportFilter(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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 <cppuhelper/supportsservice.hxx>
+
+#include <libmwaw/libmwaw.hxx>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..ed0571dad
--- /dev/null
+++ b/writerperfect/source/draw/MWAWDrawImportFilter.hxx
@@ -0,0 +1,41 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#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 MWAWDrawImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit MWAWDrawImportFilter(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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+ virtual void doRegisterHandlers(OdgGenerator& rGenerator) override;
+};
+
+/* 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 <libpagemaker/libpagemaker.h>
+
+#include <cppuhelper/supportsservice.hxx>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..b98213a27
--- /dev/null
+++ b/writerperfect/source/draw/PageMakerImportFilter.hxx
@@ -0,0 +1,37 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#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 PageMakerImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit PageMakerImportFilter(
+ 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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 <libqxp/libqxp.h>
+
+#include <cppuhelper/supportsservice.hxx>
+
+#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<OUString> 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<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 000000000..5854125d6
--- /dev/null
+++ b/writerperfect/source/draw/QXPImportFilter.hxx
@@ -0,0 +1,36 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 <cppuhelper/supportsservice.hxx>
+
+#include <libstaroffice/libstaroffice.hxx>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..ca44ceb48
--- /dev/null
+++ b/writerperfect/source/draw/StarOfficeDrawImportFilter.hxx
@@ -0,0 +1,42 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#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 StarOfficeDrawImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit StarOfficeDrawImportFilter(
+ 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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+ virtual void doRegisterHandlers(OdgGenerator& rGenerator) override;
+};
+
+/* 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 <cppuhelper/supportsservice.hxx>
+
+#include <libvisio/libvisio.h>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..9d0e8cadb
--- /dev/null
+++ b/writerperfect/source/draw/VisioImportFilter.hxx
@@ -0,0 +1,36 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#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 VisioImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit VisioImportFilter(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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 <cppuhelper/supportsservice.hxx>
+
+#include <libwpg/libwpg.h>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..c4777573d
--- /dev/null
+++ b/writerperfect/source/draw/WPGImportFilter.hxx
@@ -0,0 +1,41 @@
+/* -*- 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."
+ */
+#pragma once
+
+#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 WPGImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit WPGImportFilter(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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 <libzmf/libzmf.h>
+
+#include <cppuhelper/supportsservice.hxx>
+
+#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<OUString> 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<css::uno::Any>&)
+{
+ 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..686a1fb40
--- /dev/null
+++ b/writerperfect/source/draw/ZMFImportFilter.hxx
@@ -0,0 +1,36 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#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 ZMFImportFilter : public writerperfect::ImportFilter<OdgGenerator>
+{
+public:
+ explicit ZMFImportFilter(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(weld::Window* pParent, librevenge::RVNGInputStream& rInput,
+ OdgGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+/* 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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/.
+ *
+-->
+<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.Draw.CDRImportFilter"
+ constructor="com_sun_star_comp_Draw_CDRImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.CMXImportFilter"
+ constructor="com_sun_star_comp_Draw_CMXImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.FreehandImportFilter"
+ constructor="com_sun_star_comp_Draw_FreehandImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.MSPUBImportFilter"
+ constructor="com_sun_star_comp_Draw_MSPUBImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.MWAWDrawImportFilter"
+ constructor="com_sun_star_comp_Draw_MWAWDrawImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="org.libreoffice.comp.Draw.StarOfficeDrawImportFilter"
+ constructor="org_libreoffice_comp_Draw_StarOfficeDrawImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.VisioImportFilter"
+ constructor="com_sun_star_comp_Draw_VisioImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Draw.WPGImportFilter"
+ constructor="com_sun_star_comp_Draw_WPGImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="org.libreoffice.comp.Draw.PageMakerImportFilter"
+ constructor="org_libreoffice_comp_Draw_PageMakerImportFilter_get_implementation">
+ <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"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+</component>