[Libreoffice-commits] core.git: 3 commits - config_host.mk.in configure.ac external/Module_external.mk filter/Configuration_filter.mk filter/source Makefile.fetch RepositoryExternal.mk writerperfect/Library_wpftimpress.mk writerperfect/qa writerperfect/source

David Tardon dtardon at redhat.com
Mon Oct 20 05:49:28 PDT 2014


 Makefile.fetch                                                      |    2 
 RepositoryExternal.mk                                               |   16 
 config_host.mk.in                                                   |    4 
 configure.ac                                                        |   35 +
 external/Module_external.mk                                         |    2 
 filter/Configuration_filter.mk                                      |    2 
 filter/source/config/fragments/filters/ClarisWorks_Impress.xcu      |   30 +
 filter/source/config/fragments/types/impress_ClarisWorks.xcu        |   29 +
 writerperfect/Library_wpftimpress.mk                                |    3 
 writerperfect/qa/unit/WpftImpressFilterTest.cxx                     |    1 
 writerperfect/qa/unit/data/impress/libmwaw/pass/ClarisWorks_6.0.cwk |binary
 writerperfect/source/impress/ImportFilterBase.cxx                   |  248 ++++++++++
 writerperfect/source/impress/ImportFilterBase.hxx                   |  113 ++++
 writerperfect/source/impress/KeynoteImportFilter.cxx                |  156 ------
 writerperfect/source/impress/KeynoteImportFilter.hxx                |   41 -
 writerperfect/source/impress/MWAWPresentationImportFilter.cxx       |  181 +++++++
 writerperfect/source/impress/MWAWPresentationImportFilter.hxx       |   53 ++
 writerperfect/source/impress/wpftimpress.component                  |    4 
 writerperfect/source/impress/wpftimpress_genericfilter.cxx          |    7 
 19 files changed, 744 insertions(+), 183 deletions(-)

New commits:
commit f24c60870531689d95c056037e48cd29ad1d17bb
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Oct 20 14:21:22 2014 +0200

    allow to build with system opencollada
    
    Change-Id: I6101099c57d429987e06bca0652c843f4a94f8cc

diff --git a/Makefile.fetch b/Makefile.fetch
index e8ccf5b..18b12be 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -184,7 +184,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,NSS,NSS_TARBALL) \
 		$(call fetch_Optional_pack,NUMBERTEXT_EXTENSION_PACK) \
 		$(call fetch_Optional,ODFGEN,ODFGEN_TARBALL) \
-		$(call fetch_Optional,COLLADA2GLTF,OPENCOLLADA_TARBALL) \
+		$(call fetch_Optional,OPENCOLLADA,OPENCOLLADA_TARBALL) \
 		$(call fetch_Optional,OPENLDAP,OPENLDAP_TARBALL) \
 		$(call fetch_Optional,OPENSSL,OPENSSL_TARBALL) \
 		$(call fetch_Optional,ORCUS,ORCUS_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 5277aea..911dab1 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -3371,6 +3371,20 @@ endif # SYSTEN_LIBGLTF
 
 ifeq ($(ENABLE_COLLADA),TRUE)
 
+ifeq ($(SYSTEM_OPENCOLLADA),TRUE)
+
+define gb_LinkTarget__use_opencollada_parser
+$(call gb_LinkTarget_set_include,$(1),\
+	$$(INCLUDE) \
+	$(OPENCOLLADA_CFLAGS) \
+)
+
+$(call gb_LinkTarget_add_libs,$(1),$(OPENCOLLADA_LIBS))
+
+endef
+
+else # !SYSTEM_OPENCOLLADA
+
 define gb_LinkTarget__use_opencollada_parser
 $(call gb_LinkTarget_set_include,$(1),\
 	-I$(call gb_UnpackedTarball_get_dir,opencollada)/COLLADABaseUtils/include \
@@ -3385,6 +3399,8 @@ $(call gb_LinkTarget_use_static_libraries,$(1),\
 )
 endef
 
+endif # SYSTEM_OPENCOLLADA
+
 define gb_LinkTarget__use_collada2gltf
 $(call gb_LinkTarget_set_include,$(1),\
 	-I$(call gb_UnpackedTarball_get_dir,collada2gltf) \
diff --git a/config_host.mk.in b/config_host.mk.in
index 0fefbb0..738c80c 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -431,7 +431,8 @@ export OOOP_SAMPLES_PACK=@OOOP_SAMPLES_PACK@
 export OOOP_TEMPLATES_PACK=@OOOP_TEMPLATES_PACK@
 export OOO_JUNIT_JAR=@OOO_JUNIT_JAR@
 export OOO_VENDOR=@OOO_VENDOR@
-export OPENSSL_CFLAGS=$(gb_SPACE)@OPENSSL_CFLAGS@
+export OPENCOLLADA_CFLAGS=$(gb_SPACE)@OPENCOLLADA_CFLAGS@
+export OPENCOLLADA_LIBS=$(gb_SPACE)@OPENCOLLADA_LIBS@
 export OPENSSL_LIBS=$(gb_SPACE)@OPENSSL_LIBS@
 export ORCUS_CFLAGS=$(gb_SPACE)@ORCUS_CFLAGS@
 export ORCUS_LIBS=$(gb_SPACE)@ORCUS_LIBS@
@@ -558,6 +559,7 @@ export SYSTEM_NPAPI_HEADERS=@SYSTEM_NPAPI_HEADERS@
 export SYSTEM_NSS=@SYSTEM_NSS@
 export SYSTEM_ODBC_HEADERS=@SYSTEM_ODBC_HEADERS@
 export SYSTEM_ODFGEN=@SYSTEM_ODFGEN@
+export SYSTEM_OPENCOLLADA=@SYSTEM_OPENCOLLADA@
 export SYSTEM_OPENLDAP=@SYSTEM_OPENLDAP@
 export SYSTEM_OPENSSL=@SYSTEM_OPENSSL@
 export SYSTEM_PAGEMAKER=@SYSTEM_PAGEMAKER@
diff --git a/configure.ac b/configure.ac
index 17feb1a..5d2198b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1641,6 +1641,11 @@ AC_ARG_WITH(system-ucpp,
         [Use ucpp already on system.]),,
     [])
 
+AC_ARG_WITH(system-opencollada,
+    AS_HELP_STRING([--with-system-opencollada],
+        [Use openCOLLADA already on system.]),,
+    [with_system_opencollada=no])
+
 AC_ARG_WITH(system-openldap,
     AS_HELP_STRING([--with-system-openldap],
         [Use the OpenLDAP LDAP SDK already on system.]),,
@@ -10342,11 +10347,41 @@ if test "$enable_collada" != "no" -a "$ENABLE_GLTF" = "TRUE"; then
     AC_MSG_RESULT([yes])
     ENABLE_COLLADA=TRUE
     AC_DEFINE(HAVE_FEATURE_COLLADA,1)
+    AC_MSG_CHECKING([which OPENCOLLADA to use])
+    if test "$with_system_opencollada" = "yes"; then
+        AC_MSG_RESULT([external])
+        SYSTEM_OPENCOLLADA=TRUE
+        AS_IF([test -n "$OPENCOLLADA_CFLAGS"],[],[AC_MSG_ERROR([export OPENCOLLADA_CFLAGS])])
+        AS_IF([test -n "$OPENCOLLADA_LIBS"],[],[AC_MSG_ERROR([export OPENCOLLADA_LIBS])])
+        AC_LANG_PUSH([C++])
+        save_CXXFLAGS=$CXXFLAGS
+        save_CPPFLAGS=$CPPFLAGS
+        CXXFLAGS="$CXXFLAGS $OPENCOLLADA_CFLAGS"
+        CPPFLAGS="$CPPFLAGS $OPENCOLLADA_CFLAGS"
+        AC_CHECK_HEADERS(
+                COLLADABU.h \
+                COLLADAFW.h \
+                COLLADASaxFWLLoader.h \
+                GeneratedSaxParser.h,
+            [],
+            [AC_MSG_ERROR([openCOLLADA headers not found. Install openCOLLADA])],
+            [])
+        CXXFLAGS=$save_CXXFLAGS
+        CPPFLAGS=$save_CPPFLAGS
+        AC_LANG_POP([C++])
+        OPENCOLLADA_CFLAGS=$(printf '%s' "$OPENCOLLADA_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
+    else
+        AC_MSG_RESULT([internal])
+        BUILD_TYPE="$BUILD_TYPE OPENCOLLADA"
+    fi
     BUILD_TYPE="$BUILD_TYPE COLLADA2GLTF"
 else
     AC_MSG_RESULT([no])
 fi
 AC_SUBST(ENABLE_COLLADA)
+AC_SUBST([OPENCOLLADA_CFLAGS])
+AC_SUBST([OPENCOLLADA_LIBS])
+AC_SUBST([SYSTEM_OPENCOLLADA])
 
 # pdf import?
 AC_MSG_CHECKING([whether to build the PDF import feature])
diff --git a/external/Module_external.mk b/external/Module_external.mk
index c95ea20..688e335 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -75,7 +75,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
 	$(call gb_Helper_optional,NEON,neon) \
 	$(call gb_Helper_optional,NSS,nss) \
 	$(call gb_Helper_optional,ODFGEN,libodfgen) \
-	$(call gb_Helper_optional,COLLADA2GLTF,opencollada) \
+	$(call gb_Helper_optional,OPENCOLLADA,opencollada) \
 	$(call gb_Helper_optional,OPENLDAP,openldap) \
 	$(call gb_Helper_optional,OPENSSL,openssl) \
 	$(call gb_Helper_optional,ORCUS,liborcus) \
commit 689851d9bb22ff924325693cee8fde3e10142f37
Author: David Tardon <dtardon at redhat.com>
Date:   Mon Oct 20 13:23:26 2014 +0200

    add test file for MWAW presentation import
    
    Change-Id: I676de4ca59524e858bf24133d7c54f424922ef26

diff --git a/writerperfect/qa/unit/WpftImpressFilterTest.cxx b/writerperfect/qa/unit/WpftImpressFilterTest.cxx
index 531da4f..1b5590a 100644
--- a/writerperfect/qa/unit/WpftImpressFilterTest.cxx
+++ b/writerperfect/qa/unit/WpftImpressFilterTest.cxx
@@ -32,6 +32,7 @@ WpftImpressFilterTest::WpftImpressFilterTest()
 void WpftImpressFilterTest::test()
 {
     doTest("org.libreoffice.comp.Impress.KeynoteImportFilter", "/writerperfect/qa/unit/data/impress/libetonyek/");
+    doTest("com.sun.star.comp.Impress.MWAWPresentationImportFilter", "/writerperfect/qa/unit/data/impress/libmwaw/");
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(WpftImpressFilterTest);
diff --git a/writerperfect/qa/unit/data/impress/libmwaw/fail/.gitignore b/writerperfect/qa/unit/data/impress/libmwaw/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/writerperfect/qa/unit/data/impress/libmwaw/indeterminate/.gitignore b/writerperfect/qa/unit/data/impress/libmwaw/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/writerperfect/qa/unit/data/impress/libmwaw/pass/ClarisWorks_6.0.cwk b/writerperfect/qa/unit/data/impress/libmwaw/pass/ClarisWorks_6.0.cwk
new file mode 100644
index 0000000..2e60a81
Binary files /dev/null and b/writerperfect/qa/unit/data/impress/libmwaw/pass/ClarisWorks_6.0.cwk differ
commit 3a6e9fb87355f72b7bedc07b2da9bda9433af38e
Author: osnola <alonso at loria.fr>
Date:   Fri Oct 17 09:29:45 2014 +0200

    Add a filter for AppleWork's presentation file...
    
    Change-Id: I9f03ecc6d67ad77ccb0d5240fe0b5968c8063bd3

diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index a536311..6cd9664 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -687,6 +687,7 @@ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_impress_types.xcu,filte
 	impress_OOXML_Presentation \
 	impress_OOXML_Presentation_Template \
 	impress_OOXML_Presentation_AutoPlay \
+	impress_ClarisWorks \
 )
 
 $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impress_filters.xcu,filter/source/config/fragments/filters,\
@@ -709,6 +710,7 @@ $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_impress_filters.xcu,f
 	impress_OOXML \
 	impress_OOXML_Template \
 	impress_OOXML_AutoPlay \
+	ClarisWorks_Impress \
 )
 
 $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
diff --git a/filter/source/config/fragments/filters/ClarisWorks_Impress.xcu b/filter/source/config/fragments/filters/ClarisWorks_Impress.xcu
new file mode 100644
index 0000000..67e5750
--- /dev/null
+++ b/filter/source/config/fragments/filters/ClarisWorks_Impress.xcu
@@ -0,0 +1,30 @@
+<!--
+ * 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 file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+    <node oor:name="ClarisWorks_Impress" oor:op="replace">
+        <prop oor:name="Flags"><value>IMPORT ALIEN USESOPTIONS 3RDPARTYFILTER PREFERRED</value></prop>
+        <prop oor:name="UIComponent"/>
+        <prop oor:name="FilterService"><value>com.sun.star.comp.Impress.MWAWPresentationImportFilter</value></prop>
+        <prop oor:name="UserData"><value></value></prop>
+        <prop oor:name="UIName">
+            <value xml:lang="en-US">ClarisWorks/AppleWorks Presentation</value>
+        </prop>
+        <prop oor:name="FileFormatVersion"><value>0</value></prop>
+        <prop oor:name="Type"><value>impress_ClarisWorks</value></prop>
+        <prop oor:name="TemplateName"/>
+        <prop oor:name="DocumentService"><value>com.sun.star.presentation.PresentationDocument</value></prop>
+    </node>
diff --git a/filter/source/config/fragments/types/impress_ClarisWorks.xcu b/filter/source/config/fragments/types/impress_ClarisWorks.xcu
new file mode 100644
index 0000000..396a6d6
--- /dev/null
+++ b/filter/source/config/fragments/types/impress_ClarisWorks.xcu
@@ -0,0 +1,29 @@
+<!--
+ * 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 file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+-->
+    <node oor:name="impress_ClarisWorks" oor:op="replace" >
+        <prop oor:name="DetectService"><value>com.sun.star.comp.Impress.MWAWPresentationImportFilter</value></prop>
+        <prop oor:name="URLPattern"/>
+        <prop oor:name="Extensions"><value>cwk</value></prop>
+        <prop oor:name="MediaType"><value>application/clarisworks</value></prop>
+        <prop oor:name="Preferred"><value>true</value></prop>
+        <prop oor:name="PreferredFilter"><value>ClarisWorks_Impress</value></prop>
+        <prop oor:name="UIName">
+            <value>ClarisWorks/AppleWorks Presentation</value>
+        </prop>
+        <prop oor:name="ClipboardFormat"/>
+    </node>
diff --git a/writerperfect/Library_wpftimpress.mk b/writerperfect/Library_wpftimpress.mk
index 39ef718..2d82d70 100644
--- a/writerperfect/Library_wpftimpress.mk
+++ b/writerperfect/Library_wpftimpress.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_Library_use_libraries,wpftimpress,\
 $(eval $(call gb_Library_use_externals,wpftimpress,\
 	boost_headers \
 	etonyek \
+	mwaw \
 	odfgen \
 	revenge \
 	zlib \
@@ -47,7 +48,9 @@ $(eval $(call gb_Library_use_externals,wpftimpress,\
 ))
 
 $(eval $(call gb_Library_add_exception_objects,wpftimpress,\
+	writerperfect/source/impress/ImportFilterBase \
 	writerperfect/source/impress/KeynoteImportFilter \
+	writerperfect/source/impress/MWAWPresentationImportFilter \
 	writerperfect/source/impress/wpftimpress_genericfilter \
 ))
 
diff --git a/writerperfect/source/impress/ImportFilterBase.cxx b/writerperfect/source/impress/ImportFilterBase.cxx
new file mode 100644
index 0000000..f16c201
--- /dev/null
+++ b/writerperfect/source/impress/ImportFilterBase.cxx
@@ -0,0 +1,248 @@
+/* -*- 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/.
+ */
+
+#include <boost/shared_ptr.hpp>
+
+#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/io/XSeekable.hpp>
+#include <com/sun/star/ucb/XCommandEnvironment.hpp>
+#include <com/sun/star/ucb/XContent.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/sax/InputSource.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+
+#include <writerperfect/DirectoryStream.hxx>
+#include <writerperfect/DocumentHandler.hxx>
+#include <writerperfect/WPXSvInputStream.hxx>
+
+#include <xmloff/attrlist.hxx>
+
+#include <libodfgen/libodfgen.hxx>
+
+#include "ImportFilterBase.hxx"
+
+using boost::shared_ptr;
+
+namespace writerperfect
+{
+namespace presentation
+{
+
+using com::sun::star::uno::Reference;
+using com::sun::star::io::XInputStream;
+using com::sun::star::io::XSeekable;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::document::XFilter;
+using com::sun::star::document::XExtendedFilterDetection;
+using com::sun::star::document::XImporter;
+using com::sun::star::xml::sax::InputSource;
+using com::sun::star::xml::sax::XAttributeList;
+using com::sun::star::xml::sax::XDocumentHandler;
+using com::sun::star::xml::sax::XParser;
+
+using writerperfect::DocumentHandler;
+using writerperfect::WPXSvInputStream;
+
+namespace
+{
+
+template<class T>
+bool lcl_queryIsPackage(const Sequence<T> &lComponentData)
+{
+    bool bIsPackage = false;
+
+    const sal_Int32 nLength = lComponentData.getLength();
+    const T *pValue = lComponentData.getConstArray();
+    for (sal_Int32 i = 0; i < nLength; ++i)
+    {
+        if (pValue[i].Name == "IsPackage")
+        {
+            pValue[i].Value >>= bIsPackage;
+            break;
+        }
+    }
+
+    return bIsPackage;
+}
+
+bool lcl_isPackage(const Any &rComponentData)
+{
+    Sequence < ::com::sun::star::beans::NamedValue > lComponentDataNV;
+    Sequence < ::com::sun::star::beans::PropertyValue > lComponentDataPV;
+
+    if (rComponentData >>= lComponentDataNV)
+        return lcl_queryIsPackage(lComponentDataNV);
+    else if (rComponentData >>= lComponentDataPV)
+        return lcl_queryIsPackage(lComponentDataPV);
+
+    return false;
+}
+}
+
+ImportFilterImpl::ImportFilterImpl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
+    : mxContext(rxContext)
+{
+}
+
+ImportFilterImpl::~ImportFilterImpl()
+{
+}
+
+sal_Bool SAL_CALL ImportFilterImpl::filter(const Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
+throw (RuntimeException, std::exception)
+{
+    sal_Int32 nLength = aDescriptor.getLength();
+    const PropertyValue *pValue = aDescriptor.getConstArray();
+    Reference < XInputStream > xInputStream;
+    Reference < ::com::sun::star::ucb::XContent > xContent;
+    bool bIsPackage = false;
+    for (sal_Int32 i = 0 ; i < nLength; i++)
+    {
+        if (pValue[i].Name == "ComponentData")
+            bIsPackage = lcl_isPackage(pValue[i].Value);
+        else if (pValue[i].Name == "InputStream")
+            pValue[i].Value >>= xInputStream;
+        else if (pValue[i].Name == "UCBContent")
+            pValue[i].Value >>= xContent;
+    }
+
+    if (!xInputStream.is())
+    {
+        OSL_ASSERT(false);
+        return sal_False;
+    }
+
+    if (bIsPackage && !xContent.is())
+    {
+        SAL_WARN("writerperfect", "presentation::ImportFilterImpl::filter: the input claims to be a package, but does not have UCBContent");
+        bIsPackage = false;
+    }
+
+    // An XML import service: what we push sax messages to..
+    Reference < XDocumentHandler > xInternalHandler(
+        mxContext->getServiceManager()->createInstanceWithContext(
+            "com.sun.star.comp.Impress.XMLOasisImporter", mxContext),
+        css::uno::UNO_QUERY_THROW);
+
+    // The XImporter sets up an empty target document for XDocumentHandler to write to..
+    Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
+    xImporter->setTargetDocument(mxDoc);
+
+    // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
+    // writes to in-memory target doc
+    DocumentHandler xHandler(xInternalHandler);
+
+    shared_ptr< librevenge::RVNGInputStream > input;
+    if (bIsPackage)
+        input.reset(new writerperfect::DirectoryStream(xContent));
+    else
+        input.reset(new WPXSvInputStream(xInputStream));
+
+    OdpGenerator exporter;
+    exporter.addDocumentHandler(&xHandler, ODF_FLAT_XML);
+
+    doRegisterHandlers(exporter);
+
+    bool result=doImportDocument(*input, exporter);
+    return result;
+}
+
+void SAL_CALL ImportFilterImpl::cancel()
+throw (RuntimeException, std::exception)
+{
+}
+
+// XImporter
+void SAL_CALL ImportFilterImpl::setTargetDocument(const Reference< ::com::sun::star::lang::XComponent > &xDoc)
+throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException, std::exception)
+{
+    mxDoc = xDoc;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL ImportFilterImpl::detect(com::sun::star::uno::Sequence< PropertyValue > &Descriptor)
+throw(com::sun::star::uno::RuntimeException, std::exception)
+{
+    OUString sTypeName;
+    sal_Int32 nLength = Descriptor.getLength();
+    sal_Int32 location = nLength;
+    const PropertyValue *pValue = Descriptor.getConstArray();
+    Reference < XInputStream > xInputStream;
+    for (sal_Int32 i = 0 ; i < nLength; i++)
+    {
+        if (pValue[i].Name == "TypeName")
+            location=i;
+        else if (pValue[i].Name == "InputStream")
+            pValue[i].Value >>= xInputStream;
+    }
+
+    if (!xInputStream.is())
+        return OUString();
+
+    WPXSvInputStream input(xInputStream);
+
+    if (doDetectFormat(input, sTypeName))
+    {
+        assert(!sTypeName.isEmpty());
+
+        if (location == nLength)
+        {
+            Descriptor.realloc(nLength+1);
+            Descriptor[location].Name = "TypeName";
+        }
+
+        Descriptor[location].Value <<=sTypeName;
+    }
+    return sTypeName;
+}
+
+
+// XInitialization
+void SAL_CALL ImportFilterImpl::initialize(const Sequence< Any > &aArguments)
+throw (Exception, RuntimeException, std::exception)
+{
+    Sequence < PropertyValue > aAnySeq;
+    sal_Int32 nLength = aArguments.getLength();
+    if (nLength && (aArguments[0] >>= aAnySeq))
+    {
+        const PropertyValue *pValue = aAnySeq.getConstArray();
+        nLength = aAnySeq.getLength();
+        for (sal_Int32 i = 0 ; i < nLength; i++)
+        {
+            if (pValue[i].Name == "Type")
+            {
+                pValue[i].Value >>= msFilterName;
+                break;
+            }
+        }
+    }
+}
+
+bool ImportFilterImpl::doDetectFormat(librevenge::RVNGInputStream &, OUString &)
+{
+    SAL_WARN("writerperfect", "presentation::ImportFilterImpl::doDetectFormat must not be called");
+    return false;
+}
+void ImportFilterImpl::doRegisterHandlers(OdpGenerator &)
+{
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/ImportFilterBase.hxx b/writerperfect/source/impress/ImportFilterBase.hxx
new file mode 100644
index 0000000..e3ca4a8
--- /dev/null
+++ b/writerperfect/source/impress/ImportFilterBase.hxx
@@ -0,0 +1,113 @@
+/* -*- 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_IMPORTFILTERBASE_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_IMPORTFILTERBASE_HXX
+
+#include <librevenge/librevenge.h>
+
+#include <librevenge-stream/librevenge-stream.h>
+
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase4.hxx>
+
+namespace com
+{
+namespace sun
+{
+namespace star
+{
+namespace beans
+{
+struct PropertyValue;
+}
+namespace lang
+{
+class XComponent;
+}
+namespace uno
+{
+class XComponentContext;
+}
+namespace xml
+{
+namespace sax
+{
+class XDocumentHandler;
+}
+}
+}
+}
+}
+
+class OdpGenerator;
+
+namespace writerperfect
+{
+namespace presentation
+{
+
+/* 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 ImportFilterImpl : public cppu::WeakImplHelper4
+    <
+    com::sun::star::document::XFilter,
+    com::sun::star::document::XImporter,
+    com::sun::star::document::XExtendedFilterDetection,
+    com::sun::star::lang::XInitialization
+    >
+{
+public:
+    ImportFilterImpl(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext);
+    virtual ~ImportFilterImpl();
+
+    // XFilter
+    virtual sal_Bool SAL_CALL filter(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
+    throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual void SAL_CALL cancel()
+    throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    // XImporter
+    virtual void SAL_CALL setTargetDocument(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &xDoc)
+    throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    //XExtendedFilterDetection
+    virtual OUString SAL_CALL detect(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &Descriptor)
+    throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+    // XInitialization
+    virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &aArguments)
+    throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+private:
+    virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName);
+    virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator) = 0;
+    virtual void doRegisterHandlers(OdpGenerator &rGenerator);
+
+private:
+    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+    OUString msFilterName;
+    ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
+};
+
+/** A base class for import filters.
+ */
+typedef cppu::ImplInheritanceHelper1<ImportFilterImpl, com::sun::star::lang::XServiceInfo> ImportFilterBase;
+
+}
+}
+
+#endif // INCLUDED_WRITERPERFECT_SOURCE_DRAW_IMPORTFILTERBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/KeynoteImportFilter.cxx b/writerperfect/source/impress/KeynoteImportFilter.cxx
index 15c08d0..efd5ee2 100644
--- a/writerperfect/source/impress/KeynoteImportFilter.cxx
+++ b/writerperfect/source/impress/KeynoteImportFilter.cxx
@@ -9,19 +9,15 @@
 
 #include <boost/shared_ptr.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
 #include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/ucb/XContent.hpp>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/types.hxx>
 #include <cppuhelper/supportsservice.hxx>
+
 #include <iostream>
 #include <libetonyek/libetonyek.h>
 #include <libodfgen/libodfgen.hxx>
@@ -39,24 +35,15 @@
 
 using boost::shared_ptr;
 
-using namespace ::com::sun::star::uno;
-using com::sun::star::uno::Reference;
 using com::sun::star::io::XInputStream;
-using com::sun::star::io::XSeekable;
-using com::sun::star::uno::Sequence;
 using com::sun::star::uno::Any;
-using com::sun::star::uno::UNO_QUERY;
-using com::sun::star::uno::XInterface;
 using com::sun::star::uno::Exception;
+using com::sun::star::uno::Reference;
 using com::sun::star::uno::RuntimeException;
-using com::sun::star::beans::PropertyValue;
-using com::sun::star::document::XFilter;
-using com::sun::star::document::XExtendedFilterDetection;
-using com::sun::star::document::XImporter;
-using com::sun::star::xml::sax::InputSource;
-using com::sun::star::xml::sax::XAttributeList;
-using com::sun::star::xml::sax::XDocumentHandler;
-using com::sun::star::xml::sax::XParser;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::UNO_QUERY;
+using com::sun::star::uno::XComponentContext;
+using com::sun::star::uno::XInterface;
 
 using writerperfect::DocumentHandler;
 using writerperfect::WPXSvInputStream;
@@ -65,111 +52,13 @@ namespace beans = com::sun::star::beans;
 namespace container = com::sun::star::container;
 namespace ucb = com::sun::star::ucb;
 
-namespace
-{
-
-template<class T>
-bool lcl_queryIsPackage(const Sequence<T> &lComponentData)
-{
-    bool bIsPackage = false;
-
-    const sal_Int32 nLength = lComponentData.getLength();
-    const T *pValue = lComponentData.getConstArray();
-    for (sal_Int32 i = 0; i < nLength; ++i)
-    {
-        if (pValue[i].Name == "IsPackage")
-        {
-            pValue[i].Value >>= bIsPackage;
-            break;
-        }
-    }
-
-    return bIsPackage;
-}
-
-bool lcl_isPackage(const Any &rComponentData)
-{
-    Sequence < beans::NamedValue > lComponentDataNV;
-    Sequence < beans::PropertyValue > lComponentDataPV;
-
-    if (rComponentData >>= lComponentDataNV)
-        return lcl_queryIsPackage(lComponentDataNV);
-    else if (rComponentData >>= lComponentDataPV)
-        return lcl_queryIsPackage(lComponentDataPV);
-
-    return false;
-}
-}
-
-sal_Bool SAL_CALL KeynoteImportFilter::filter(const Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
-throw (RuntimeException, std::exception)
-{
-    sal_Int32 nLength = aDescriptor.getLength();
-    const PropertyValue *pValue = aDescriptor.getConstArray();
-    Reference < XInputStream > xInputStream;
-    Reference < ucb::XContent > xContent;
-    bool bIsPackage = false;
-    for (sal_Int32 i = 0 ; i < nLength; i++)
-    {
-        if (pValue[i].Name == "ComponentData")
-            bIsPackage = lcl_isPackage(pValue[i].Value);
-        else if (pValue[i].Name == "InputStream")
-            pValue[i].Value >>= xInputStream;
-        else if (pValue[i].Name == "UCBContent")
-            pValue[i].Value >>= xContent;
-    }
-    if (!xInputStream.is())
-    {
-        OSL_ASSERT(false);
-        return sal_False;
-    }
-
-    if (bIsPackage && !xContent.is())
-    {
-        SAL_WARN("writerperfect", "the input claims to be a package, but does not have UCBContent");
-        bIsPackage = false;
-    }
-
-    // An XML import service: what we push sax messages to..
-    Reference < XDocumentHandler > xInternalHandler(
-        mxContext->getServiceManager()->createInstanceWithContext(
-            "com.sun.star.comp.Impress.XMLOasisImporter", mxContext),
-        css::uno::UNO_QUERY_THROW);
-
-    // The XImporter sets up an empty target document for XDocumentHandler to write to..
-    Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
-    xImporter->setTargetDocument(mxDoc);
-
-    // OO Graphics Handler: abstract class to handle document SAX messages, concrete implementation here
-    // writes to in-memory target doc
-    DocumentHandler xHandler(xInternalHandler);
-
-    shared_ptr< librevenge::RVNGInputStream > input;
-    if (bIsPackage)
-        input.reset(new writerperfect::DirectoryStream(xContent));
-    else
-        input.reset(new WPXSvInputStream(xInputStream));
-
-    OdpGenerator exporter;
-    exporter.addDocumentHandler(&xHandler, ODF_FLAT_XML);
-    bool tmpParseResult = libetonyek::EtonyekDocument::parse(input.get(), &exporter);
-    return tmpParseResult;
-}
-
-void SAL_CALL KeynoteImportFilter::cancel()
-throw (RuntimeException, std::exception)
+bool KeynoteImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator)
 {
-}
-
-// XImporter
-void SAL_CALL KeynoteImportFilter::setTargetDocument(const Reference< ::com::sun::star::lang::XComponent > &xDoc)
-throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException, std::exception)
-{
-    mxDoc = xDoc;
+    return libetonyek::EtonyekDocument::parse(&rInput, &rGenerator);
 }
 
 // XExtendedFilterDetection
-OUString SAL_CALL KeynoteImportFilter::detect(com::sun::star::uno::Sequence< PropertyValue > &Descriptor)
+OUString SAL_CALL KeynoteImportFilter::detect(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &Descriptor)
 throw(com::sun::star::uno::RuntimeException, std::exception)
 {
     sal_Int32 nLength = Descriptor.getLength();
@@ -179,7 +68,7 @@ throw(com::sun::star::uno::RuntimeException, std::exception)
     sal_Int32 nUCBContentLocation = -1;
     bool bIsPackage = false;
     bool bUCBContentChanged = false;
-    const PropertyValue *pValue = Descriptor.getConstArray();
+    const beans::PropertyValue *pValue = Descriptor.getConstArray();
     Reference < XInputStream > xInputStream;
     Reference < ucb::XContent > xContent;
     Sequence < beans::NamedValue > lComponentDataNV;
@@ -338,27 +227,6 @@ throw(com::sun::star::uno::RuntimeException, std::exception)
     return sTypeName;
 }
 
-// XInitialization
-void SAL_CALL KeynoteImportFilter::initialize(const Sequence< Any > &aArguments)
-throw (Exception, RuntimeException, std::exception)
-{
-    Sequence < PropertyValue > aAnySeq;
-    sal_Int32 nLength = aArguments.getLength();
-    if (nLength && (aArguments[0] >>= aAnySeq))
-    {
-        const PropertyValue *pValue = aAnySeq.getConstArray();
-        nLength = aAnySeq.getLength();
-        for (sal_Int32 i = 0 ; i < nLength; i++)
-        {
-            if (pValue[i].Name == "Type")
-            {
-                pValue[i].Value >>= msFilterName;
-                break;
-            }
-        }
-    }
-}
-
 OUString KeynoteImportFilter_getImplementationName()
 throw (RuntimeException)
 {
diff --git a/writerperfect/source/impress/KeynoteImportFilter.hxx b/writerperfect/source/impress/KeynoteImportFilter.hxx
index 2bfec5e..912b076 100644
--- a/writerperfect/source/impress/KeynoteImportFilter.hxx
+++ b/writerperfect/source/impress/KeynoteImportFilter.hxx
@@ -8,59 +8,26 @@
 #ifndef INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_KEYNOTEIMPORTFILTER_HXX
 #define INCLUDED_WRITERPERFECT_SOURCE_IMPRESS_KEYNOTEIMPORTFILTER_HXX
 
-#include <com/sun/star/document/XFilter.hpp>
-#include <com/sun/star/document/XImporter.hpp>
-#include <com/sun/star/document/XExtendedFilterDetection.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <cppuhelper/implbase5.hxx>
 
+#include "ImportFilterBase.hxx"
 #include <stdio.h>
 
 /* 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 cppu::WeakImplHelper5
-    <
-    com::sun::star::document::XFilter,
-    com::sun::star::document::XImporter,
-    com::sun::star::document::XExtendedFilterDetection,
-    com::sun::star::lang::XInitialization,
-    com::sun::star::lang::XServiceInfo
-    >
+class KeynoteImportFilter : public writerperfect::presentation::ImportFilterBase
 {
-protected:
-    // oo.org declares
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
-    OUString msFilterName;
-    ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
-
 public:
     KeynoteImportFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
-        : mxContext(rxContext) {}
+        : writerperfect::presentation::ImportFilterBase(rxContext) {}
     virtual ~KeynoteImportFilter() {}
 
-    // XFilter
-    virtual sal_Bool SAL_CALL filter(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &aDescriptor)
-    throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual void SAL_CALL cancel()
-    throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
-    // XImporter
-    virtual void SAL_CALL setTargetDocument(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &xDoc)
-    throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
     //XExtendedFilterDetection
     virtual OUString SAL_CALL detect(com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &Descriptor)
     throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
-    // XInitialization
-    virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > &aArguments)
-    throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName()
     throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -69,6 +36,8 @@ public:
     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
     throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
+private:
+    virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator) SAL_OVERRIDE;
 };
 
 OUString KeynoteImportFilter_getImplementationName()
diff --git a/writerperfect/source/impress/MWAWPresentationImportFilter.cxx b/writerperfect/source/impress/MWAWPresentationImportFilter.cxx
new file mode 100644
index 0000000..cdbfaa0
--- /dev/null
+++ b/writerperfect/source/impress/MWAWPresentationImportFilter.cxx
@@ -0,0 +1,181 @@
+/* -*- 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 <com/sun/star/uno/Reference.h>
+#include <cppuhelper/supportsservice.hxx>
+
+#include <libmwaw/libmwaw.hxx>
+#include <libodfgen/libodfgen.hxx>
+
+#include "MWAWPresentationImportFilter.hxx"
+
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Reference;
+using com::sun::star::uno::Any;
+using com::sun::star::uno::XInterface;
+using com::sun::star::uno::Exception;
+using com::sun::star::uno::RuntimeException;
+using com::sun::star::uno::XComponentContext;
+
+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.addDocumentHandler(pHandler, streamType);
+    return MWAWDocument::decodeSpreadsheet(data, &exporter);
+}
+
+bool MWAWPresentationImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator)
+{
+    return MWAWDocument::MWAW_R_OK == MWAWDocument::parse(&rInput, &rGenerator);
+}
+
+bool MWAWPresentationImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
+{
+    rTypeName = "";
+
+    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_ACTA:
+            case MWAWDocument::MWAW_T_BEAGLEWORKS:
+            case MWAWDocument::MWAW_T_ADOBEILLUSTRATOR:
+            case MWAWDocument::MWAW_T_CLARISRESOLVE:
+            case MWAWDocument::MWAW_T_DBASE:
+            case MWAWDocument::MWAW_T_DOCMAKER:
+            case MWAWDocument::MWAW_T_EDOC:
+            case MWAWDocument::MWAW_T_FAMILYTREEMAKER:
+            case MWAWDocument::MWAW_T_FILEMAKER:
+            case MWAWDocument::MWAW_T_FOXBASE:
+            case MWAWDocument::MWAW_T_FRAMEMAKER:
+            case MWAWDocument::MWAW_T_FULLIMPACT:
+            case MWAWDocument::MWAW_T_FULLPAINT:
+            case MWAWDocument::MWAW_T_FULLWRITE:
+            case MWAWDocument::MWAW_T_GREATWORKS:
+            case MWAWDocument::MWAW_T_INFOGENIE:
+            case MWAWDocument::MWAW_T_KALEIDAGRAPH:
+            case MWAWDocument::MWAW_T_HANMACWORDJ:
+            case MWAWDocument::MWAW_T_HANMACWORDK:
+            case MWAWDocument::MWAW_T_LIGHTWAYTEXT:
+            case MWAWDocument::MWAW_T_MACDOC:
+            case MWAWDocument::MWAW_T_MACDRAFT:
+            case MWAWDocument::MWAW_T_MACDRAW:
+            case MWAWDocument::MWAW_T_MACDRAWPRO:
+            case MWAWDocument::MWAW_T_MACPAINT:
+            case MWAWDocument::MWAW_T_MACWRITE:
+            case MWAWDocument::MWAW_T_MACWRITEPRO:
+            case MWAWDocument::MWAW_T_MARINERWRITE:
+            case MWAWDocument::MWAW_T_MINDWRITE:
+            case MWAWDocument::MWAW_T_MICROSOFTFILE:
+            case MWAWDocument::MWAW_T_MICROSOFTMULTIPLAN:
+            case MWAWDocument::MWAW_T_MICROSOFTWORD:
+            case MWAWDocument::MWAW_T_MICROSOFTWORKS:
+            case MWAWDocument::MWAW_T_MORE:
+            case MWAWDocument::MWAW_T_NISUSWRITER:
+            case MWAWDocument::MWAW_T_OVERVUE:
+            case MWAWDocument::MWAW_T_PAGEMAKER:
+            case MWAWDocument::MWAW_T_PIXELPAINT:
+            case MWAWDocument::MWAW_T_RAGTIME:
+            case MWAWDocument::MWAW_T_READYSETGO:
+            case MWAWDocument::MWAW_T_SUPERPAINT:
+            case MWAWDocument::MWAW_T_SYMPOSIUM:
+            case MWAWDocument::MWAW_T_TEACHTEXT:
+            case MWAWDocument::MWAW_T_TEXEDIT:
+            case MWAWDocument::MWAW_T_TRAPEZE:
+            case MWAWDocument::MWAW_T_WINGZ:
+            case MWAWDocument::MWAW_T_WRITENOW:
+            case MWAWDocument::MWAW_T_WRITERPLUS:
+            case MWAWDocument::MWAW_T_XPRESS:
+            case MWAWDocument::MWAW_T_ZWRITE:
+            case MWAWDocument::MWAW_T_4DIMENSION:
+
+            case MWAWDocument::MWAW_T_RESERVED1:
+            case MWAWDocument::MWAW_T_RESERVED2:
+            case MWAWDocument::MWAW_T_RESERVED3:
+            case MWAWDocument::MWAW_T_RESERVED4:
+            case MWAWDocument::MWAW_T_RESERVED5:
+            case MWAWDocument::MWAW_T_RESERVED6:
+            case MWAWDocument::MWAW_T_RESERVED7:
+            case MWAWDocument::MWAW_T_RESERVED8:
+            case MWAWDocument::MWAW_T_RESERVED9:
+            case MWAWDocument::MWAW_T_UNKNOWN:
+            default:
+                break;
+            }
+        }
+    }
+
+    return !rTypeName.isEmpty();
+}
+
+void MWAWPresentationImportFilter::doRegisterHandlers(OdpGenerator &rGenerator)
+{
+    rGenerator.registerEmbeddedObjectHandler("image/mwaw-odg", &handleEmbeddedMWAWGraphicObject);
+    rGenerator.registerEmbeddedObjectHandler("image/mwaw-ods", &handleEmbeddedMWAWSpreadsheetObject);
+}
+
+OUString MWAWPresentationImportFilter_getImplementationName()
+throw (RuntimeException)
+{
+    return OUString("com.sun.star.comp.Impress.MWAWPresentationImportFilter");
+}
+
+Sequence< OUString > SAL_CALL MWAWPresentationImportFilter_getSupportedServiceNames()
+throw (RuntimeException)
+{
+    Sequence < OUString > aRet(2);
+    OUString *pArray = aRet.getArray();
+    pArray[0] =  "com.sun.star.document.ImportFilter";
+    pArray[1] =  "com.sun.star.document.ExtendedTypeDetection";
+    return aRet;
+}
+
+Reference< XInterface > SAL_CALL MWAWPresentationImportFilter_createInstance(const Reference< XComponentContext > &rContext)
+throw(Exception)
+{
+    return (cppu::OWeakObject *) new MWAWPresentationImportFilter(rContext);
+}
+
+// XServiceInfo
+OUString SAL_CALL MWAWPresentationImportFilter::getImplementationName()
+throw (RuntimeException, std::exception)
+{
+    return MWAWPresentationImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL MWAWPresentationImportFilter::supportsService(const OUString &rServiceName)
+throw (RuntimeException, std::exception)
+{
+    return cppu::supportsService(this, rServiceName);
+}
+Sequence< OUString > SAL_CALL MWAWPresentationImportFilter::getSupportedServiceNames()
+throw (RuntimeException, std::exception)
+{
+    return MWAWPresentationImportFilter_getSupportedServiceNames();
+}
+
+/* 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 0000000..576f9d1
--- /dev/null
+++ b/writerperfect/source/impress/MWAWPresentationImportFilter.hxx
@@ -0,0 +1,53 @@
+/* -*- 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 _MWAWPRESENTATIONIMPORTFILTER_HXX
+#define _MWAWPRESENTATIONIMPORTFILTER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include "ImportFilterBase.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::presentation::ImportFilterBase
+{
+public:
+    MWAWPresentationImportFilter(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext)
+        : writerperfect::presentation::ImportFilterBase(rxContext) {}
+
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName()
+    throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName)
+    throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+    throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+private:
+    virtual bool doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName) SAL_OVERRIDE;
+    virtual bool doImportDocument(librevenge::RVNGInputStream &rInput, librevenge::RVNGPresentationInterface &rGenerator) SAL_OVERRIDE;
+    virtual void doRegisterHandlers(OdpGenerator &rGenerator) SAL_OVERRIDE;
+};
+
+OUString MWAWPresentationImportFilter_getImplementationName()
+throw (::com::sun::star::uno::RuntimeException);
+
+::com::sun::star::uno::Sequence< OUString > SAL_CALL MWAWPresentationImportFilter_getSupportedServiceNames()
+throw (::com::sun::star::uno::RuntimeException);
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL MWAWPresentationImportFilter_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rContext)
+throw (::com::sun::star::uno::Exception);
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/impress/wpftimpress.component b/writerperfect/source/impress/wpftimpress.component
index 66424ab..58d00cc 100644
--- a/writerperfect/source/impress/wpftimpress.component
+++ b/writerperfect/source/impress/wpftimpress.component
@@ -13,4 +13,8 @@
     <service name="com.sun.star.document.ImportFilter"/>
     <service name="com.sun.star.document.ExtendedTypeDetection"/>
   </implementation>
+  <implementation name="com.sun.star.comp.Impress.MWAWPresentationImportFilter">
+    <service name="com.sun.star.document.ImportFilter"/>
+    <service name="com.sun.star.document.ExtendedTypeDetection"/>
+  </implementation>
 </component>
diff --git a/writerperfect/source/impress/wpftimpress_genericfilter.cxx b/writerperfect/source/impress/wpftimpress_genericfilter.cxx
index 49b0f74..3a1129d 100644
--- a/writerperfect/source/impress/wpftimpress_genericfilter.cxx
+++ b/writerperfect/source/impress/wpftimpress_genericfilter.cxx
@@ -26,6 +26,7 @@
 #include "sal/types.h"
 
 #include "KeynoteImportFilter.hxx"
+#include "MWAWPresentationImportFilter.hxx"
 
 namespace
 {
@@ -37,6 +38,12 @@ static cppu::ImplementationEntry const services[] =
         &KeynoteImportFilter_getSupportedServiceNames,
         &cppu::createSingleComponentFactory, 0, 0
     },
+    {
+        &MWAWPresentationImportFilter_createInstance,
+        &MWAWPresentationImportFilter_getImplementationName,
+        &MWAWPresentationImportFilter_getSupportedServiceNames,
+        &cppu::createSingleComponentFactory, 0, 0
+    },
     { 0, 0, 0, 0, 0, 0 }
 };
 


More information about the Libreoffice-commits mailing list