[Libreoffice-commits] .: configure.in filter/Configuration_filter.mk filter/source writerperfect/Library_cdrimport.mk writerperfect/source

Fridrich Strba fridrich at kemper.freedesktop.org
Thu Apr 19 02:03:23 PDT 2012


 configure.in                                                              |    2 
 filter/Configuration_filter.mk                                            |    2 
 filter/source/config/fragments/filters/CorelPresentationExchange.xcu      |   13 
 filter/source/config/fragments/types/draw_Corel_Presentation_Exchange.xcu |   12 
 writerperfect/Library_cdrimport.mk                                        |    1 
 writerperfect/source/cdrimp/CDRImportFilter.cxx                           |    1 
 writerperfect/source/cdrimp/CDRImportFilter.hxx                           |   13 
 writerperfect/source/cdrimp/CMXImportFilter.cxx                           |  276 ++++++++++
 writerperfect/source/cdrimp/CMXImportFilter.hxx                           |  110 +++
 writerperfect/source/cdrimp/cdrimport_genericfilter.cxx                   |   14 
 writerperfect/source/vsdimp/VisioImportFilter.cxx                         |    1 
 writerperfect/source/vsdimp/VisioImportFilter.hxx                         |    4 
 writerperfect/source/wpdimp/WordPerfectImportFilter.cxx                   |    1 
 writerperfect/source/wpdimp/WordPerfectImportFilter.hxx                   |    4 
 writerperfect/source/wpgimp/WPGImportFilter.cxx                           |    1 
 writerperfect/source/wpgimp/WPGImportFilter.hxx                           |    4 
 writerperfect/source/wpsimp/MSWorksImportFilter.cxx                       |    1 
 writerperfect/source/wpsimp/MSWorksImportFilter.hxx                       |    8 
 18 files changed, 435 insertions(+), 33 deletions(-)

New commits:
commit 858c8620d910055dcf37f1d82599e768da641e56
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Thu Apr 19 11:02:31 2012 +0200

    Stub CMX importer

diff --git a/configure.in b/configure.in
index 4f981fc..801199c 100644
--- a/configure.in
+++ b/configure.in
@@ -5931,7 +5931,7 @@ AC_MSG_CHECKING([which libcdr to use])
 if test "$with_system_libcdr" = "yes"; then
     AC_MSG_RESULT([external])
     SYSTEM_LIBCDR=YES
-    PKG_CHECK_MODULES( CDR, libcdr-0.0 )
+    PKG_CHECK_MODULES( CDR, libcdr-0.0 >= 0.0.5 )
 elif test $_os = iOS; then
     # libcdr depends on libwpd and libwpg and those are LGPL
     AC_MSG_RESULT([none])
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index 8a4eba9..ef2204a 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -546,6 +546,7 @@ $(call filter_Configuration_add_types,fcfg_langpack,fcfg_draw_types.xcu,filter/s
 	draw_WordPerfect_Graphics \
 	draw_Visio_Document \
 	draw_CorelDraw_Document \
+	draw_Corel_Presentation_Exchange \
 )
 
 $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_filters.xcu,filter/source/config/fragments/filters,\
@@ -557,6 +558,7 @@ $(call filter_Configuration_add_filters,fcfg_langpack,fcfg_draw_filters.xcu,filt
 	WordPerfectGraphics \
 	VisioDocument \
 	CorelDrawDocument \
+	CorelPresentationExchange \
 )
 
 $(call filter_Configuration_add_ui_filters,fcfg_langpack,filter/source/config/fragments/filters,\
diff --git a/filter/source/config/fragments/filters/CorelPresentationExchange.xcu b/filter/source/config/fragments/filters/CorelPresentationExchange.xcu
new file mode 100644
index 0000000..09c3e15
--- /dev/null
+++ b/filter/source/config/fragments/filters/CorelPresentationExchange.xcu
@@ -0,0 +1,13 @@
+    <node oor:name="Corel Presentation Exchange" 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.Draw.CMXImportFilter</value></prop>
+        <prop oor:name="UserData"><value></value></prop>
+        <prop oor:name="UIName">
+            <value xml:lang="x-default">Corel Presentation Exchange</value>
+        </prop>
+        <prop oor:name="FileFormatVersion"><value>0</value></prop>
+        <prop oor:name="Type"><value>draw_Corel_Presentation_Exchange</value></prop>
+        <prop oor:name="TemplateName"/>
+        <prop oor:name="DocumentService"><value>com.sun.star.drawing.DrawingDocument</value></prop>
+    </node>
diff --git a/filter/source/config/fragments/types/draw_Corel_Presentation_Exchange.xcu b/filter/source/config/fragments/types/draw_Corel_Presentation_Exchange.xcu
new file mode 100644
index 0000000..7f002b0
--- /dev/null
+++ b/filter/source/config/fragments/types/draw_Corel_Presentation_Exchange.xcu
@@ -0,0 +1,12 @@
+        <node oor:name="draw_Corel_Presentation_Exchange" oor:op="replace" >
+            <prop oor:name="DetectService"><value>com.sun.star.comp.Draw.CMXImportFilter</value></prop>
+            <prop oor:name="URLPattern"/>
+            <prop oor:name="Extensions"><value>cmx</value></prop>
+            <prop oor:name="MediaType"><value>image/x-cmx</value></prop>
+            <prop oor:name="Preferred"><value>true</value></prop>
+            <prop oor:name="PreferredFilter"><value>Corel Presentation Exchange</value></prop>
+            <prop oor:name="UIName">
+                <value>Corel Presentation Exchange</value>
+            </prop>
+            <prop oor:name="ClipboardFormat"/>
+        </node>
diff --git a/writerperfect/Library_cdrimport.mk b/writerperfect/Library_cdrimport.mk
index a6b05b0..257757c 100644
--- a/writerperfect/Library_cdrimport.mk
+++ b/writerperfect/Library_cdrimport.mk
@@ -65,6 +65,7 @@ $(eval $(call gb_Library_use_externals,cdrimport,\
 
 $(eval $(call gb_Library_add_exception_objects,cdrimport,\
 	writerperfect/source/cdrimp/CDRImportFilter \
+	writerperfect/source/cdrimp/CMXImportFilter \
 	writerperfect/source/cdrimp/cdrimport_genericfilter \
 ))
 
diff --git a/writerperfect/source/cdrimp/CDRImportFilter.cxx b/writerperfect/source/cdrimp/CDRImportFilter.cxx
index 9187689..2476a55 100644
--- a/writerperfect/source/cdrimp/CDRImportFilter.cxx
+++ b/writerperfect/source/cdrimp/CDRImportFilter.cxx
@@ -139,7 +139,6 @@ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
 #ifdef DEBUG
     std::cerr << "CDRImportFilter::setTargetDocument" << std::endl;
 #endif
-    meType = FILTER_IMPORT;
     mxDoc = xDoc;
 }
 
diff --git a/writerperfect/source/cdrimp/CDRImportFilter.hxx b/writerperfect/source/cdrimp/CDRImportFilter.hxx
index 8f52805..56f124e 100644
--- a/writerperfect/source/cdrimp/CDRImportFilter.hxx
+++ b/writerperfect/source/cdrimp/CDRImportFilter.hxx
@@ -27,8 +27,8 @@
 /* "This product is not manufactured, approved, or supported by
  * Corel Corporation or Corel Corporation Limited."
  */
-#ifndef _VISIOIMPORTFILTER_HXX
-#define _VISIOIMPORTFILTER_HXX
+#ifndef _CDRIMPORTFILTER_HXX
+#define _CDRIMPORTFILTER_HXX
 
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/document/XImporter.hpp>
@@ -40,11 +40,6 @@
 
 #include <stdio.h>
 
-enum FilterType
-{
-    FILTER_IMPORT,
-    FILTER_EXPORT
-};
 /* This component will be instantiated for both import or export. Whether it calls
  * setSourceDocument or setTargetDocument determines which Impl function the filter
  * member calls */
@@ -64,11 +59,9 @@ protected:
     ::rtl::OUString msFilterName;
     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
 
-    FilterType meType;
-
 public:
     CDRImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
-        : mxMSF( rxMSF ), meType((FilterType)0) {}
+        : mxMSF( rxMSF ) {}
     virtual ~CDRImportFilter() {}
 
     // XFilter
diff --git a/writerperfect/source/cdrimp/CMXImportFilter.cxx b/writerperfect/source/cdrimp/CMXImportFilter.cxx
new file mode 100644
index 0000000..76a9d06
--- /dev/null
+++ b/writerperfect/source/cdrimp/CMXImportFilter.cxx
@@ -0,0 +1,276 @@
+/* -*- 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
+ *
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004-2006 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ *  Contributor(s): Martin Gallwey (gallwey at sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+
+#include <osl/diagnose.h>
+#include <rtl/tencinfo.h>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XInputStream.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 <xmloff/attrlist.hxx>
+
+#include <libcdr/libcdr.h>
+#include "filter/DocumentHandler.hxx"
+#include "filter/OdgGenerator.hxx"
+#include "CMXImportFilter.hxx"
+#include "stream/WPXSvStream.h"
+
+#include <iostream>
+
+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 namespace ::rtl;
+using rtl::OString;
+using rtl::OUString;
+using com::sun::star::uno::Sequence;
+using com::sun::star::uno::Reference;
+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::lang::XMultiServiceFactory;
+using com::sun::star::beans::PropertyValue;
+using com::sun::star::document::XFilter;
+using com::sun::star::document::XExtendedFilterDetection;
+
+using com::sun::star::io::XInputStream;
+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;
+
+
+sal_Bool SAL_CALL CMXImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter::filter" << std::endl;
+#endif
+    sal_Int32 nLength = aDescriptor.getLength();
+    const PropertyValue *pValue = aDescriptor.getConstArray();
+    OUString sURL;
+    Reference < XInputStream > xInputStream;
+    for ( sal_Int32 i = 0 ; i < nLength; i++)
+    {
+        if ( pValue[i].Name == "InputStream" )
+            pValue[i].Value >>= xInputStream;
+        else if ( pValue[i].Name == "URL" )
+            pValue[i].Value >>= sURL;
+    }
+    if ( !xInputStream.is() )
+    {
+        OSL_ASSERT( 0 );
+        return sal_False;
+    }
+    OString sFileName;
+    sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
+
+    // An XML import service: what we push sax messages to..
+    OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
+    Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
+
+    // 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);
+
+    WPXSvInputStream input( xInputStream );
+
+    OdgGenerator exporter(&xHandler, ODF_FLAT_XML);
+    bool tmpParseResult = libcdr::CMXDocument::parse(&input, &exporter);
+    return tmpParseResult;
+}
+
+void SAL_CALL CMXImportFilter::cancel(  )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter::cancel" << std::endl;
+#endif
+}
+
+// XImporter
+void SAL_CALL CMXImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter::setTargetDocument" << std::endl;
+#endif
+    mxDoc = xDoc;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL CMXImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
+throw( com::sun::star::uno::RuntimeException )
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter::detect" << std::endl;
+#endif
+    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;
+    }
+
+    WPXSvInputStream input( xInputStream );
+
+    if (libcdr::CMXDocument::isSupported(&input))
+        sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw_CorelDraw_Document" ) );
+
+    if (sTypeName.getLength())
+    {
+        if ( location == Descriptor.getLength() )
+        {
+            Descriptor.realloc(nLength+1);
+            Descriptor[location].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TypeName"));
+        }
+
+        Descriptor[location].Value <<=sTypeName;
+    }
+    return sTypeName;
+}
+
+
+// XInitialization
+void SAL_CALL CMXImportFilter::initialize( const Sequence< Any >& aArguments )
+throw (Exception, RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter::initialize" << std::endl;
+#endif
+    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 CMXImportFilter_getImplementationName ()
+throw (RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter_getImplementationName" << std::endl;
+#endif
+    return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.CMXImportFilter" ) );
+}
+
+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
+#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
+sal_Bool SAL_CALL CMXImportFilter_supportsService( const OUString &ServiceName )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter_supportsService" << std::endl;
+#endif
+    return ( ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2 );
+}
+Sequence< OUString > SAL_CALL CMXImportFilter_getSupportedServiceNames(  )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter_getSupportedServiceNames" << std::endl;
+#endif
+    Sequence < OUString > aRet(2);
+    OUString *pArray = aRet.getArray();
+    pArray[0] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
+    pArray[1] =  OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
+    return aRet;
+}
+#undef SERVICE_NAME2
+#undef SERVICE_NAME1
+
+Reference< XInterface > SAL_CALL CMXImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+throw( Exception )
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter_createInstance" << std::endl;
+#endif
+    return (cppu::OWeakObject *) new CMXImportFilter( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL CMXImportFilter::getImplementationName(  )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter::getImplementationName" << std::endl;
+#endif
+    return CMXImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL CMXImportFilter::supportsService( const OUString &rServiceName )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter::supportsService" << std::endl;
+#endif
+    return CMXImportFilter_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL CMXImportFilter::getSupportedServiceNames(  )
+throw (RuntimeException)
+{
+#ifdef DEBUG
+    std::cerr << "CMXImportFilter::getSupportedServiceNames" << std::endl;
+#endif
+    return CMXImportFilter_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/cdrimp/CMXImportFilter.hxx b/writerperfect/source/cdrimp/CMXImportFilter.hxx
new file mode 100644
index 0000000..a9ec8f4
--- /dev/null
+++ b/writerperfect/source/cdrimp/CMXImportFilter.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2000 by Sun Microsystems, Inc.
+ * Copyright (C) 2002-2004 William Lachance (wlach at interlog.com)
+ * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
+ * Copyright (C) 2004 Fridrich Strba <fridrich.strba at bluewin.ch>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ *  Contributor(s): Martin Gallwey (gallwey at sun.com)
+ *
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#ifndef _CMXIMPORTFILTER_HXX
+#define _CMXIMPORTFILTER_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/xml/sax/XDocumentHandler.hpp>
+#include <cppuhelper/implbase5.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 CMXImportFilter : 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
+    >
+{
+protected:
+    // oo.org declares
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
+    ::rtl::OUString msFilterName;
+    ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
+
+public:
+    CMXImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+        : mxMSF( rxMSF ) {}
+    virtual ~CMXImportFilter() {}
+
+    // 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);
+    virtual void SAL_CALL cancel(  )
+    throw (::com::sun::star::uno::RuntimeException);
+
+    // 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);
+
+    //XExtendedFilterDetection
+    virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
+    throw( com::sun::star::uno::RuntimeException );
+
+    // 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);
+
+    // XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName(  )
+    throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString &ServiceName )
+    throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
+    throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+::rtl::OUString CMXImportFilter_getImplementationName()
+throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL CMXImportFilter_supportsService( const ::rtl::OUString &ServiceName )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL CMXImportFilter_getSupportedServiceNames(  )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL CMXImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+throw ( ::com::sun::star::uno::Exception );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/cdrimp/cdrimport_genericfilter.cxx b/writerperfect/source/cdrimp/cdrimport_genericfilter.cxx
index dd13f38..ced5137 100644
--- a/writerperfect/source/cdrimp/cdrimport_genericfilter.cxx
+++ b/writerperfect/source/cdrimp/cdrimport_genericfilter.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 
 #include "CDRImportFilter.hxx"
+#include "CMXImportFilter.hxx"
 
 using namespace ::rtl;
 using namespace ::cppu;
@@ -60,6 +61,19 @@ extern "C"
                 pRet = xFactory.get();
             }
         }
+        if ( pServiceManager && implName.equals(CMXImportFilter_getImplementationName()) )
+        {
+            Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+                        reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+                        OUString::createFromAscii( pImplName ),
+                        CMXImportFilter_createInstance, CMXImportFilter_getSupportedServiceNames() ) );
+
+            if (xFactory.is())
+            {
+                xFactory->acquire();
+                pRet = xFactory.get();
+            }
+        }
 
         return pRet;
     }
diff --git a/writerperfect/source/vsdimp/VisioImportFilter.cxx b/writerperfect/source/vsdimp/VisioImportFilter.cxx
index c06076c..13bf089 100644
--- a/writerperfect/source/vsdimp/VisioImportFilter.cxx
+++ b/writerperfect/source/vsdimp/VisioImportFilter.cxx
@@ -139,7 +139,6 @@ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
 #ifdef DEBUG
     std::cerr << "VisioImportFilter::setTargetDocument" << std::endl;
 #endif
-    meType = FILTER_IMPORT;
     mxDoc = xDoc;
 }
 
diff --git a/writerperfect/source/vsdimp/VisioImportFilter.hxx b/writerperfect/source/vsdimp/VisioImportFilter.hxx
index aaeac49..a4e7d7f 100644
--- a/writerperfect/source/vsdimp/VisioImportFilter.hxx
+++ b/writerperfect/source/vsdimp/VisioImportFilter.hxx
@@ -64,11 +64,9 @@ protected:
     ::rtl::OUString msFilterName;
     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
 
-    FilterType meType;
-
 public:
     VisioImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
-        : mxMSF( rxMSF ), meType((FilterType)0) {}
+        : mxMSF( rxMSF ) {}
     virtual ~VisioImportFilter() {}
 
     // XFilter
diff --git a/writerperfect/source/wpdimp/WordPerfectImportFilter.cxx b/writerperfect/source/wpdimp/WordPerfectImportFilter.cxx
index 2dab43a..f98d65e 100644
--- a/writerperfect/source/wpdimp/WordPerfectImportFilter.cxx
+++ b/writerperfect/source/wpdimp/WordPerfectImportFilter.cxx
@@ -199,7 +199,6 @@ void SAL_CALL WordPerfectImportFilter::setTargetDocument( const uno::Reference<
 throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
 {
     WRITER_DEBUG_MSG(("WordPerfectImportFilter::getTargetDocument: Got here!\n"));
-    meType = FILTER_IMPORT;
     mxDoc = xDoc;
 }
 
diff --git a/writerperfect/source/wpdimp/WordPerfectImportFilter.hxx b/writerperfect/source/wpdimp/WordPerfectImportFilter.hxx
index 7ad5693..777be1d 100644
--- a/writerperfect/source/wpdimp/WordPerfectImportFilter.hxx
+++ b/writerperfect/source/wpdimp/WordPerfectImportFilter.hxx
@@ -66,14 +66,12 @@ protected:
     ::rtl::OUString msFilterName;
     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
 
-    FilterType meType;
-
     sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
     throw (::com::sun::star::uno::RuntimeException);
 
 public:
     WordPerfectImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
-        : mxMSF( rxMSF ), meType((FilterType)0) {}
+        : mxMSF( rxMSF ) {}
     virtual ~WordPerfectImportFilter() {}
 
     // XFilter
diff --git a/writerperfect/source/wpgimp/WPGImportFilter.cxx b/writerperfect/source/wpgimp/WPGImportFilter.cxx
index 5ce5599..ff7612b 100644
--- a/writerperfect/source/wpgimp/WPGImportFilter.cxx
+++ b/writerperfect/source/wpgimp/WPGImportFilter.cxx
@@ -138,7 +138,6 @@ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
 #ifdef DEBUG
     std::cerr << "WPGImportFilter::setTargetDocument" << std::endl;
 #endif
-    meType = FILTER_IMPORT;
     mxDoc = xDoc;
 }
 
diff --git a/writerperfect/source/wpgimp/WPGImportFilter.hxx b/writerperfect/source/wpgimp/WPGImportFilter.hxx
index 4373132..03fb123 100644
--- a/writerperfect/source/wpgimp/WPGImportFilter.hxx
+++ b/writerperfect/source/wpgimp/WPGImportFilter.hxx
@@ -64,11 +64,9 @@ protected:
     ::rtl::OUString msFilterName;
     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
 
-    FilterType meType;
-
 public:
     WPGImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
-        : mxMSF( rxMSF ), meType((FilterType)0) {}
+        : mxMSF( rxMSF ) {}
     virtual ~WPGImportFilter() {}
 
     // XFilter
diff --git a/writerperfect/source/wpsimp/MSWorksImportFilter.cxx b/writerperfect/source/wpsimp/MSWorksImportFilter.cxx
index cb9b056..2cca078 100644
--- a/writerperfect/source/wpsimp/MSWorksImportFilter.cxx
+++ b/writerperfect/source/wpsimp/MSWorksImportFilter.cxx
@@ -137,7 +137,6 @@ void SAL_CALL MSWorksImportFilter::setTargetDocument( const Reference< ::com::su
 throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
 {
     WRITER_DEBUG_MSG(("MSWorksImportFilter::getTargetDocument: Got here!\n"));
-    meType = FILTER_IMPORT;
     mxDoc = xDoc;
 }
 
diff --git a/writerperfect/source/wpsimp/MSWorksImportFilter.hxx b/writerperfect/source/wpsimp/MSWorksImportFilter.hxx
index b75f669..6ef5485 100644
--- a/writerperfect/source/wpsimp/MSWorksImportFilter.hxx
+++ b/writerperfect/source/wpsimp/MSWorksImportFilter.hxx
@@ -38,11 +38,6 @@
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <cppuhelper/implbase5.hxx>
 
-enum FilterType
-{
-    FILTER_IMPORT,
-    FILTER_EXPORT
-};
 /* This component will be instantiated for both import or export. Whether it calls
  * setSourceDocument or setTargetDocument determines which Impl function the filter
  * member calls */
@@ -62,15 +57,12 @@ protected:
     ::rtl::OUString msFilterName;
     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
 
-    FilterType meType;
-
     sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
     throw (::com::sun::star::uno::RuntimeException);
 
 public:
     MSWorksImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
         : mxMSF( rxMSF )
-        , meType( FILTER_IMPORT )
     {}
     virtual ~MSWorksImportFilter() {}
 


More information about the Libreoffice-commits mailing list