summaryrefslogtreecommitdiffstats
path: root/writerperfect/source/impress
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /writerperfect/source/impress
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'writerperfect/source/impress')
-rw-r--r--writerperfect/source/impress/KeynoteImportFilter.cxx247
-rw-r--r--writerperfect/source/impress/KeynoteImportFilter.hxx44
-rw-r--r--writerperfect/source/impress/MWAWPresentationImportFilter.cxx104
-rw-r--r--writerperfect/source/impress/MWAWPresentationImportFilter.hxx45
-rw-r--r--writerperfect/source/impress/StarOfficePresentationImportFilter.cxx102
-rw-r--r--writerperfect/source/impress/StarOfficePresentationImportFilter.hxx45
-rw-r--r--writerperfect/source/impress/wpftimpress.component27
7 files changed, 614 insertions, 0 deletions
diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx
new file mode 100644
index 000000000..c212c5ab8
--- /dev/null
+++ b/writerperfect/source/impress/KeynoteImportFilter.cxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* KeynoteImportFilter: Sets up the filter, and calls OdpExporter
+ * 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 <memory>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/supportsservice.hxx>
+
+#include <libetonyek/libetonyek.h>
+#include <ucbhelper/content.hxx>
+#include <unotools/ucbhelper.hxx>
+
+#include <DirectoryStream.hxx>
+#include <DocumentHandler.hxx>
+#include <WPXSvInputStream.hxx>
+
+#include "KeynoteImportFilter.hxx"
+
+using writerperfect::WPXSvInputStream;
+
+namespace beans = com::sun::star::beans;
+namespace ucb = com::sun::star::ucb;
+
+bool KeynoteImportFilter::doImportDocument(weld::Window*, librevenge::RVNGInputStream& rInput,
+ OdpGenerator& rGenerator, utl::MediaDescriptor&)
+{
+ return libetonyek::EtonyekDocument::parse(&rInput, &rGenerator);
+}
+
+bool KeynoteImportFilter::doDetectFormat(librevenge::RVNGInputStream& rInput, OUString& rTypeName)
+{
+ if (libetonyek::EtonyekDocument::isSupported(&rInput))
+ {
+ rTypeName = "impress_Keynote_Document";
+ return true;
+ }
+
+ return false;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL
+KeynoteImportFilter::detect(css::uno::Sequence<css::beans::PropertyValue>& Descriptor)
+{
+ sal_Int32 nLength = Descriptor.getLength();
+ sal_Int32 nNewLength = nLength + 2;
+ sal_Int32 nComponentDataLocation = -1;
+ sal_Int32 nTypeNameLocation = -1;
+ sal_Int32 nUCBContentLocation = -1;
+ bool bIsPackage = false;
+ bool bUCBContentChanged = false;
+ const beans::PropertyValue* pValue = Descriptor.getConstArray();
+ css::uno::Reference<com::sun::star::io::XInputStream> xInputStream;
+ css::uno::Reference<ucb::XContent> xContent;
+ css::uno::Sequence<beans::NamedValue> lComponentDataNV;
+ css::uno::Sequence<beans::PropertyValue> lComponentDataPV;
+ bool bComponentDataNV = true;
+
+ for (sal_Int32 i = 0; i < nLength; i++)
+ {
+ if (pValue[i].Name == "TypeName")
+ {
+ nTypeNameLocation = i;
+ --nNewLength;
+ }
+ if (pValue[i].Name == "ComponentData")
+ {
+ bComponentDataNV = pValue[i].Value >>= lComponentDataNV;
+ if (!bComponentDataNV)
+ pValue[i].Value >>= lComponentDataPV;
+ nComponentDataLocation = i;
+ --nNewLength;
+ }
+ else if (pValue[i].Name == "InputStream")
+ {
+ pValue[i].Value >>= xInputStream;
+ }
+ else if (pValue[i].Name == "UCBContent")
+ {
+ pValue[i].Value >>= xContent;
+ nUCBContentLocation = i;
+ }
+ }
+
+ assert(nNewLength >= nLength);
+
+ if (!xInputStream.is())
+ return OUString();
+
+ std::unique_ptr<librevenge::RVNGInputStream> input
+ = std::make_unique<WPXSvInputStream>(xInputStream);
+
+ /* Apple Keynote documents come in two variants:
+ * * actual files (zip), only produced by Keynote 5 (at least with
+ * default settings)
+ * * packages (IOW, directories), produced by Keynote 1-4 and again
+ * starting with 6.
+ * But since the libetonyek import only works with a stream, we need
+ * to pass it one for the whole package. Here we determine if that
+ * is needed.
+ *
+ * Note: for convenience, we also recognize that the main XML file
+ * from a package was passed and pass the whole package to the
+ * filter instead.
+ */
+ if (xContent.is())
+ {
+ ucbhelper::Content aContent(xContent, utl::UCBContentHelper::getDefaultCommandEnvironment(),
+ comphelper::getProcessComponentContext());
+ try
+ {
+ if (aContent.isFolder())
+ {
+ input = std::make_unique<writerperfect::DirectoryStream>(xContent);
+ bIsPackage = true;
+ }
+ }
+ catch (...)
+ {
+ return OUString();
+ }
+ }
+
+ libetonyek::EtonyekDocument::Type type = libetonyek::EtonyekDocument::TYPE_UNKNOWN;
+ const libetonyek::EtonyekDocument::Confidence confidence
+ = libetonyek::EtonyekDocument::isSupported(input.get(), &type);
+ if ((libetonyek::EtonyekDocument::CONFIDENCE_NONE == confidence)
+ || (libetonyek::EtonyekDocument::TYPE_KEYNOTE != type))
+ return OUString();
+
+ if (confidence == libetonyek::EtonyekDocument::CONFIDENCE_SUPPORTED_PART)
+ {
+ if (bIsPackage) // we passed a directory stream, but the filter claims it's APXL file?
+ return OUString();
+
+ std::unique_ptr<writerperfect::DirectoryStream> xDir
+ = writerperfect::DirectoryStream::createForParent(xContent);
+ auto pDir = xDir.get();
+ input = std::move(xDir);
+ if (bool(input))
+ {
+ if (libetonyek::EtonyekDocument::CONFIDENCE_EXCELLENT
+ == libetonyek::EtonyekDocument::isSupported(input.get()))
+ {
+ xContent = pDir->getContent();
+ bUCBContentChanged = true;
+ bIsPackage = true;
+ }
+ else
+ {
+ // The passed stream has been detected as APXL file, but its parent dir is not a valid Keynote
+ // package? Something is wrong here...
+ return OUString();
+ }
+ }
+ }
+
+ // we do not need to insert ComponentData if this is not a package
+ if (!bIsPackage && (nComponentDataLocation == -1))
+ --nNewLength;
+
+ if (nNewLength > nLength)
+ Descriptor.realloc(nNewLength);
+
+ if (nTypeNameLocation == -1)
+ {
+ assert(nLength < nNewLength);
+ nTypeNameLocation = nLength++;
+ Descriptor[nTypeNameLocation].Name = "TypeName";
+ }
+
+ if (bIsPackage && (nComponentDataLocation == -1))
+ {
+ assert(nLength < nNewLength);
+ nComponentDataLocation = nLength++;
+ Descriptor[nComponentDataLocation].Name = "ComponentData";
+ }
+
+ if (bIsPackage)
+ {
+ if (bComponentDataNV)
+ {
+ const sal_Int32 nCDSize = lComponentDataNV.getLength();
+ lComponentDataNV.realloc(nCDSize + 1);
+ beans::NamedValue aValue;
+ aValue.Name = "IsPackage";
+ aValue.Value <<= true;
+ lComponentDataNV[nCDSize] = aValue;
+ Descriptor[nComponentDataLocation].Value <<= lComponentDataNV;
+ }
+ else
+ {
+ const sal_Int32 nCDSize = lComponentDataPV.getLength();
+ lComponentDataPV.realloc(nCDSize + 1);
+ beans::PropertyValue aProp;
+ aProp.Name = "IsPackage";
+ aProp.Value <<= true;
+ aProp.Handle = -1;
+ aProp.State = beans::PropertyState_DIRECT_VALUE;
+ lComponentDataPV[nCDSize] = aProp;
+ Descriptor[nComponentDataLocation].Value <<= lComponentDataPV;
+ }
+ }
+
+ if (bUCBContentChanged)
+ Descriptor[nUCBContentLocation].Value <<= xContent;
+
+ const OUString sTypeName("impress_AppleKeynote");
+ Descriptor[nTypeNameLocation].Value <<= sTypeName;
+
+ return sTypeName;
+}
+
+// XServiceInfo
+OUString SAL_CALL KeynoteImportFilter::getImplementationName()
+{
+ return "org.libreoffice.comp.Impress.KeynoteImportFilter";
+}
+
+sal_Bool SAL_CALL KeynoteImportFilter::supportsService(const OUString& rServiceName)
+{
+ return cppu::supportsService(this, rServiceName);
+}
+
+css::uno::Sequence<OUString> SAL_CALL KeynoteImportFilter::getSupportedServiceNames()
+{
+ return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+org_libreoffice_comp_Impress_KeynoteImportFilter_get_implementation(
+ css::uno::XComponentContext* const context, const css::uno::Sequence<css::uno::Any>&)
+{
+ return cppu::acquire(new KeynoteImportFilter(context));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/KeynoteImportFilter.hxx b/writerperfect/source/impress/KeynoteImportFilter.hxx
new file mode 100644
index 000000000..1ae6002a5
--- /dev/null
+++ b/writerperfect/source/impress/KeynoteImportFilter.hxx
@@ -0,0 +1,44 @@
+/* -*- 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_IMPRESS_KEYNOTEIMPORTFILTER_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_KEYNOTEIMPORTFILTER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <ImportFilter.hxx>
+#include <DocumentHandlerForOdp.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 KeynoteImportFilter : public writerperfect::ImportFilter<OdpGenerator>
+{
+public:
+ explicit KeynoteImportFilter(const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+ : writerperfect::ImportFilter<OdpGenerator>(rxContext)
+ {
+ }
+
+ //XExtendedFilterDetection
+ virtual OUString SAL_CALL
+ detect(css::uno::Sequence<css::beans::PropertyValue>& Descriptor) override;
+
+ // 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,
+ OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/MWAWPresentationImportFilter.cxx b/writerperfect/source/impress/MWAWPresentationImportFilter.cxx
new file mode 100644
index 000000000..c5de6984a
--- /dev/null
+++ b/writerperfect/source/impress/MWAWPresentationImportFilter.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* MWAWPresentationImportFilter: 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 "MWAWPresentationImportFilter.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 MWAWPresentationImportFilter::doImportDocument(weld::Window*,
+ librevenge::RVNGInputStream& rInput,
+ OdpGenerator& rGenerator, utl::MediaDescriptor&)
+{
+ return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
+}
+
+bool MWAWPresentationImportFilter::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)
+ {
+ if (docKind == MWAWDocument::MWAW_K_PRESENTATION)
+ {
+ switch (docType)
+ {
+ case MWAWDocument::MWAW_T_CLARISWORKS:
+ rTypeName = "impress_ClarisWorks";
+ break;
+ case MWAWDocument::MWAW_T_RESERVED8:
+ rTypeName = "impress_PowerPoint3";
+ break;
+ default:
+ rTypeName = "MWAW_Presentation";
+ break;
+ }
+ }
+ }
+
+ return !rTypeName.isEmpty();
+}
+
+void MWAWPresentationImportFilter::doRegisterHandlers(OdpGenerator& rGenerator)
+{
+ rGenerator.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWGraphicObject);
+ rGenerator.registerEmbeddedObjectHandler("image/mwaw-ods",
+ &handleEmbeddedMWAWSpreadsheetObject);
+}
+
+// XServiceInfo
+OUString SAL_CALL MWAWPresentationImportFilter::getImplementationName()
+{
+ return "com.sun.star.comp.Impress.MWAWPresentationImportFilter";
+}
+sal_Bool SAL_CALL MWAWPresentationImportFilter::supportsService(const OUString& rServiceName)
+{
+ return cppu::supportsService(this, rServiceName);
+}
+css::uno::Sequence<OUString> SAL_CALL MWAWPresentationImportFilter::getSupportedServiceNames()
+{
+ return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+com_sun_star_comp_Impress_MWAWPresentationImportFilter_get_implementation(
+ css::uno::XComponentContext* const context, const css::uno::Sequence<css::uno::Any>&)
+{
+ return cppu::acquire(new MWAWPresentationImportFilter(context));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/MWAWPresentationImportFilter.hxx b/writerperfect/source/impress/MWAWPresentationImportFilter.hxx
new file mode 100644
index 000000000..4bb1afb55
--- /dev/null
+++ b/writerperfect/source/impress/MWAWPresentationImportFilter.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_IMPRESS_MWAWPRESENTATIONIMPORTFILTER_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_MWAWPRESENTATIONIMPORTFILTER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <ImportFilter.hxx>
+
+#include <DocumentHandlerForOdp.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 MWAWPresentationImportFilter : public writerperfect::ImportFilter<OdpGenerator>
+{
+public:
+ explicit MWAWPresentationImportFilter(
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+ : writerperfect::ImportFilter<OdpGenerator>(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,
+ OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
+ virtual void doRegisterHandlers(OdpGenerator& rGenerator) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/StarOfficePresentationImportFilter.cxx b/writerperfect/source/impress/StarOfficePresentationImportFilter.cxx
new file mode 100644
index 000000000..4f60f57e3
--- /dev/null
+++ b/writerperfect/source/impress/StarOfficePresentationImportFilter.cxx
@@ -0,0 +1,102 @@
+/* -*- 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 "StarOfficePresentationImportFilter.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 StarOfficePresentationImportFilter::doImportDocument(weld::Window*,
+ librevenge::RVNGInputStream& rInput,
+ OdpGenerator& rGenerator,
+ utl::MediaDescriptor&)
+{
+ return STOFFDocument::STOFF_R_OK == STOFFDocument::parse(&rInput, &rGenerator);
+}
+
+bool StarOfficePresentationImportFilter::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_PRESENTATION:
+ rTypeName = "StarOffice_Presentation";
+ break;
+ default:
+ break;
+ }
+ }
+
+ return !rTypeName.isEmpty();
+}
+
+void StarOfficePresentationImportFilter::doRegisterHandlers(OdpGenerator& rGenerator)
+{
+ rGenerator.registerEmbeddedObjectHandler("image/stoff-odg", &handleEmbeddedSTOFFGraphicObject);
+ rGenerator.registerEmbeddedObjectHandler("image/stoff-ods",
+ &handleEmbeddedSTOFFSpreadsheetObject);
+}
+
+// XServiceInfo
+OUString SAL_CALL StarOfficePresentationImportFilter::getImplementationName()
+{
+ return "org.libreoffice.comp.Impress.StarOfficePresentationImportFilter";
+}
+
+sal_Bool SAL_CALL StarOfficePresentationImportFilter::supportsService(const OUString& rServiceName)
+{
+ return cppu::supportsService(this, rServiceName);
+}
+
+Sequence<OUString> SAL_CALL StarOfficePresentationImportFilter::getSupportedServiceNames()
+{
+ return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExtendedTypeDetection" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+org_libreoffice_comp_Presentation_StarOfficePresentationImportFilter_get_implementation(
+ css::uno::XComponentContext* const context, const css::uno::Sequence<css::uno::Any>&)
+{
+ return cppu::acquire(new StarOfficePresentationImportFilter(context));
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/StarOfficePresentationImportFilter.hxx b/writerperfect/source/impress/StarOfficePresentationImportFilter.hxx
new file mode 100644
index 000000000..7a5e6103a
--- /dev/null
+++ b/writerperfect/source/impress/StarOfficePresentationImportFilter.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_PRESENTATION_STAROFFICEPRESENTATIONIMPORTFILTER_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_PRESENTATION_STAROFFICEPRESENTATIONIMPORTFILTER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <ImportFilter.hxx>
+
+#include <DocumentHandlerForOdp.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 StarOfficePresentationImportFilter : public writerperfect::ImportFilter<OdpGenerator>
+{
+public:
+ explicit StarOfficePresentationImportFilter(
+ const css::uno::Reference<css::uno::XComponentContext>& rxContext)
+ : writerperfect::ImportFilter<OdpGenerator>(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,
+ OdpGenerator& rGenerator, utl::MediaDescriptor&) override;
+ virtual void doRegisterHandlers(OdpGenerator& rGenerator) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/wpftimpress.component b/writerperfect/source/impress/wpftimpress.component
new file mode 100644
index 000000000..0f7df39fa
--- /dev/null
+++ b/writerperfect/source/impress/wpftimpress.component
@@ -0,0 +1,27 @@
+<?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="org.libreoffice.comp.Impress.KeynoteImportFilter"
+ constructor="org_libreoffice_comp_Impress_KeynoteImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.Impress.MWAWPresentationImportFilter"
+ constructor="com_sun_star_comp_Impress_MWAWPresentationImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+ <implementation name="org.libreoffice.comp.Impress.StarOfficePresentationImportFilter"
+ constructor="org_libreoffice_comp_Presentation_StarOfficePresentationImportFilter_get_implementation">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+</component>