summaryrefslogtreecommitdiff
path: root/writerperfect
diff options
context:
space:
mode:
authorosnola <alonso@loria.fr>2014-05-29 10:26:28 +0200
committerDavid Tardon <dtardon@redhat.com>2014-05-29 15:36:13 +0200
commite1fa08fe92d7d3f89f5f75cb67f17bb491c42361 (patch)
tree71404626aa2b4111767696dff6cff3151ac8045b /writerperfect
parent243e6a98d80ed896686b4486b4e675ffb2cc1f59 (diff)
Try to add support for WKS/WDB files...
Change-Id: I0ff1cd35be0e1546a156bc673770a920ad2ca444
Diffstat (limited to 'writerperfect')
-rw-r--r--writerperfect/Library_wpftcalc.mk56
-rw-r--r--writerperfect/Module_writerperfect.mk1
-rw-r--r--writerperfect/source/calc/ImportFilterBase.cxx182
-rw-r--r--writerperfect/source/calc/ImportFilterBase.hxx103
-rw-r--r--writerperfect/source/calc/MSWorksCalcImportFilter.cxx91
-rw-r--r--writerperfect/source/calc/MSWorksCalcImportFilter.hxx53
-rw-r--r--writerperfect/source/calc/wpftcalc.component16
-rw-r--r--writerperfect/source/calc/wpftcalc_genericfilter.cxx51
8 files changed, 553 insertions, 0 deletions
diff --git a/writerperfect/Library_wpftcalc.mk b/writerperfect/Library_wpftcalc.mk
new file mode 100644
index 000000000000..2e69c3b80e60
--- /dev/null
+++ b/writerperfect/Library_wpftcalc.mk
@@ -0,0 +1,56 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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 .
+#
+
+$(eval $(call gb_Library_Library,wpftcalc))
+
+$(eval $(call gb_Library_set_componentfile,wpftcalc,writerperfect/source/calc/wpftcalc))
+
+$(eval $(call gb_Library_use_sdk_api,wpftcalc))
+
+$(eval $(call gb_Library_use_libraries,wpftcalc,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ sot \
+ tl \
+ utl \
+ writerperfect \
+ xo \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_Library_use_externals,wpftcalc,\
+ odfgen \
+ revenge \
+ wps \
+ zlib \
+ lcms2 \
+ libxml2 \
+ icui18n \
+ icuuc \
+))
+
+$(eval $(call gb_Library_add_exception_objects,wpftcalc,\
+ writerperfect/source/calc/ImportFilterBase \
+ writerperfect/source/calc/MSWorksCalcImportFilter \
+ writerperfect/source/calc/wpftcalc_genericfilter \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/writerperfect/Module_writerperfect.mk b/writerperfect/Module_writerperfect.mk
index 24decb49a38a..37da37ca0c6d 100644
--- a/writerperfect/Module_writerperfect.mk
+++ b/writerperfect/Module_writerperfect.mk
@@ -20,6 +20,7 @@
$(eval $(call gb_Module_Module,writerperfect))
$(eval $(call gb_Module_add_targets,writerperfect,\
+ Library_wpftcalc \
Library_wpftdraw \
Library_wpftimpress \
Library_wpftwriter \
diff --git a/writerperfect/source/calc/ImportFilterBase.cxx b/writerperfect/source/calc/ImportFilterBase.cxx
new file mode 100644
index 000000000000..ef3674611b6c
--- /dev/null
+++ b/writerperfect/source/calc/ImportFilterBase.cxx
@@ -0,0 +1,182 @@
+/* -*- 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 <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#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 <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/uno/Reference.h>
+
+#include <writerperfect/DocumentHandler.hxx>
+#include <writerperfect/WPXSvInputStream.hxx>
+
+#include <xmloff/attrlist.hxx>
+
+#include <libodfgen/libodfgen.hxx>
+
+#include "ImportFilterBase.hxx"
+
+namespace writerperfect
+{
+namespace calc
+{
+
+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;
+
+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;
+ for ( sal_Int32 i = 0 ; i < nLength; i++)
+ {
+ if ( pValue[i].Name == "InputStream" )
+ pValue[i].Value >>= xInputStream;
+ }
+ if ( !xInputStream.is() )
+ {
+ OSL_ASSERT( false );
+ return sal_False;
+ }
+
+ // An XML import service: what we push sax messages to..
+ Reference < XDocumentHandler > xInternalHandler(
+ mxContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.comp.Calc.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);
+
+ WPXSvInputStream input( xInputStream );
+
+ OdsGenerator exporter;
+ exporter.addDocumentHandler(&xHandler, ODF_FLAT_XML);
+
+ doRegisterHandlers(exporter);
+
+ return doImportDocument(input, exporter);
+}
+
+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;
+ }
+ }
+ }
+}
+
+void ImportFilterImpl::doRegisterHandlers( OdsGenerator & )
+{
+}
+
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/calc/ImportFilterBase.hxx b/writerperfect/source/calc/ImportFilterBase.hxx
new file mode 100644
index 000000000000..d6ef4543db61
--- /dev/null
+++ b/writerperfect/source/calc/ImportFilterBase.hxx
@@ -0,0 +1,103 @@
+/* -*- 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_CALC_IMPORTFILTERBASE_HXX
+#define INCLUDED_WRITERPERFECT_SOURCE_CALC_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 OdsGenerator;
+
+namespace writerperfect
+{
+namespace calc
+{
+
+/* 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 ) = 0;
+ virtual bool doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGSpreadsheetInterface &rGenerator ) = 0;
+ virtual void doRegisterHandlers( OdsGenerator &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_CALC_IMPORTFILTERBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
new file mode 100644
index 000000000000..1c38f4c89ba6
--- /dev/null
+++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* MSWorksCalcImportFilter: 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 <libwps/libwps.h>
+
+#include "MSWorksCalcImportFilter.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;
+
+bool MSWorksCalcImportFilter::doImportDocument( librevenge::RVNGInputStream &rInput, librevenge::RVNGSpreadsheetInterface &rGenerator )
+{
+ return libwps::WPS_OK == libwps::WPSDocument::parse(&rInput, &rGenerator);
+}
+
+bool MSWorksCalcImportFilter::doDetectFormat( librevenge::RVNGInputStream &rInput, OUString &rTypeName )
+{
+ libwps::WPSKind kind = libwps::WPS_TEXT;
+ const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind);
+
+ if ((kind == libwps::WPS_SPREADSHEET || kind == libwps::WPS_DATABASE) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT))
+ {
+ rTypeName = "calc_MS_Works_Document";
+ return true;
+ }
+
+ return false;
+}
+
+void MSWorksCalcImportFilter::doRegisterHandlers( OdsGenerator & )
+{
+}
+
+OUString MSWorksCalcImportFilter_getImplementationName ()
+throw (RuntimeException)
+{
+ return OUString ( "com.sun.star.comp.Calc.MSWorksCalcImportFilter" );
+}
+
+Sequence< OUString > SAL_CALL MSWorksCalcImportFilter_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;
+}
+#undef SERVICE_NAME2
+#undef SERVICE_NAME1
+
+Reference< XInterface > SAL_CALL MSWorksCalcImportFilter_createInstance( const Reference< XComponentContext > & rContext)
+throw( Exception )
+{
+ return (cppu::OWeakObject *) new MSWorksCalcImportFilter( rContext );
+}
+
+// XServiceInfo
+OUString SAL_CALL MSWorksCalcImportFilter::getImplementationName( )
+throw (RuntimeException, std::exception)
+{
+ return MSWorksCalcImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL MSWorksCalcImportFilter::supportsService( const OUString &rServiceName )
+throw (RuntimeException, std::exception)
+{
+ return cppu::supportsService( this, rServiceName );
+}
+Sequence< OUString > SAL_CALL MSWorksCalcImportFilter::getSupportedServiceNames( )
+throw (RuntimeException, std::exception)
+{
+ return MSWorksCalcImportFilter_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.hxx b/writerperfect/source/calc/MSWorksCalcImportFilter.hxx
new file mode 100644
index 000000000000..2487c50607b5
--- /dev/null
+++ b/writerperfect/source/calc/MSWorksCalcImportFilter.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 _MSWORKSCALCIMPORTFILTER_HXX
+#define _MSWORKSCALCIMPORTFILTER_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 MSWorksCalcImportFilter : public writerperfect::calc::ImportFilterBase
+{
+public:
+ MSWorksCalcImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext )
+ : writerperfect::calc::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::RVNGSpreadsheetInterface &rGenerator ) SAL_OVERRIDE;
+ virtual void doRegisterHandlers( OdsGenerator &rGenerator ) SAL_OVERRIDE;
+};
+
+OUString MSWorksCalcImportFilter_getImplementationName()
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< OUString > SAL_CALL MSWorksCalcImportFilter_getSupportedServiceNames( )
+throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL MSWorksCalcImportFilter_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/calc/wpftcalc.component b/writerperfect/source/calc/wpftcalc.component
new file mode 100644
index 000000000000..c2def1e6c450
--- /dev/null
+++ b/writerperfect/source/calc/wpftcalc.component
@@ -0,0 +1,16 @@
+<?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@"
+ prefix="wpftcalc" xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.Calc.MSWorksCalcImportFilter">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+</component>
diff --git a/writerperfect/source/calc/wpftcalc_genericfilter.cxx b/writerperfect/source/calc/wpftcalc_genericfilter.cxx
new file mode 100644
index 000000000000..eecd0b0f04c3
--- /dev/null
+++ b/writerperfect/source/calc/wpftcalc_genericfilter.cxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This 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 .
+ */
+
+/* genericfilter: mostly generic code for registering the filter */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+
+#include "sal/config.h"
+
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "sal/types.h"
+
+#include "MSWorksCalcImportFilter.hxx"
+
+namespace {
+
+static cppu::ImplementationEntry const services[] = {
+ { &MSWorksCalcImportFilter_createInstance, &MSWorksCalcImportFilter_getImplementationName,
+ &MSWorksCalcImportFilter_getSupportedServiceNames,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 } };
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL wpftcalc_component_getFactory(
+ char const * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, services);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */