[Libreoffice-commits] .: filter/source writerperfect/source writerperfect/util
Fridrich Strba
fridrich at kemper.freedesktop.org
Tue May 17 01:10:29 PDT 2011
filter/source/config/fragments/filters/VisioDocument.xcu | 13
filter/source/config/fragments/types/draw_Visio_Document.xcu | 12
writerperfect/source/vsdimp/VisioImportFilter.cxx | 279 +++++++++++
writerperfect/source/vsdimp/VisioImportFilter.hxx | 117 ++++
writerperfect/source/vsdimp/makefile.mk | 28 +
writerperfect/source/vsdimp/visioimport_genericfilter.cxx | 73 ++
writerperfect/util/makefile.mk | 36 +
writerperfect/util/visiofilter.component | 8
8 files changed, 565 insertions(+), 1 deletion(-)
New commits:
commit 7b044ed06983dd140f8c27e274e3863210330553
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date: Tue May 17 10:09:52 2011 +0200
Boilerplate code for Visio import filter module
diff --git a/filter/source/config/fragments/filters/VisioDocument.xcu b/filter/source/config/fragments/filters/VisioDocument.xcu
new file mode 100644
index 0000000..7734931
--- /dev/null
+++ b/filter/source/config/fragments/filters/VisioDocument.xcu
@@ -0,0 +1,13 @@
+ <node oor:name="Visio Document" 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.VisioImportFilter</value></prop>
+ <prop oor:name="UserData"><value></value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">Visio Document</value>
+ </prop>
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>draw_Visio_Document</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_Visio_Document.xcu b/filter/source/config/fragments/types/draw_Visio_Document.xcu
new file mode 100644
index 0000000..62511df
--- /dev/null
+++ b/filter/source/config/fragments/types/draw_Visio_Document.xcu
@@ -0,0 +1,12 @@
+ <node oor:name="draw_Visio_Document" oor:op="replace" >
+ <prop oor:name="DetectService"><value>com.sun.star.comp.Draw.VisioImportFilter</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>vsd</value></prop>
+ <prop oor:name="MediaType"><value>image/x-vsd</value></prop>
+ <prop oor:name="Preferred"><value>true</value></prop>
+ <prop oor:name="PreferredFilter"><value>Visio Document</value></prop>
+ <prop oor:name="UIName">
+ <value>Visio Document</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
diff --git a/writerperfect/source/vsdimp/VisioImportFilter.cxx b/writerperfect/source/vsdimp/VisioImportFilter.cxx
new file mode 100644
index 0000000..669b9de
--- /dev/null
+++ b/writerperfect/source/vsdimp/VisioImportFilter.cxx
@@ -0,0 +1,279 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* VisioImportFilter: Sets up the filter, and calls OdgExporter
+ * to do the actual filtering
+ *
+ * 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/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <com/sun/star/uno/Reference.h>
+
+#include <xmloff/attrlist.hxx>
+
+#include "filter/DocumentHandler.hxx"
+#include "filter/OdgGenerator.hxx"
+#include "VisioImportFilter.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 VisioImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
+ throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::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.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+ pValue[i].Value >>= xInputStream;
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "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 = libvisio::VisioDocument::parse(&input, &exporter);
+ return tmpParseResult;
+}
+
+void SAL_CALL VisioImportFilter::cancel( )
+ throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::cancel" << std::endl;
+#endif
+}
+
+// XImporter
+void SAL_CALL VisioImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
+ throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::setTargetDocument" << std::endl;
+#endif
+ meType = FILTER_IMPORT;
+ mxDoc = xDoc;
+}
+
+// XExtendedFilterDetection
+OUString SAL_CALL VisioImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
+ throw( com::sun::star::uno::RuntimeException )
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::detect" << std::endl;
+#endif
+ OUString sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "" ) );
+ 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.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) )
+ location=i;
+ else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
+ pValue[i].Value >>= xInputStream;
+ }
+
+ WPXSvInputStream input( xInputStream );
+
+ if (libvisio::VisioDocument::isSupported(&input))
+ sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "draw_Visio_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 VisioImportFilter::initialize( const Sequence< Any >& aArguments )
+ throw (Exception, RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::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.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) )
+ {
+ pValue[i].Value >>= msFilterName;
+ break;
+ }
+ }
+ }
+}
+OUString VisioImportFilter_getImplementationName ()
+ throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter_getImplementationName" << std::endl;
+#endif
+ return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.VisioImportFilter" ) );
+}
+
+#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
+#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
+sal_Bool SAL_CALL VisioImportFilter_supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter_supportsService" << std::endl;
+#endif
+ return (ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) ||
+ ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) ) );
+}
+Sequence< OUString > SAL_CALL VisioImportFilter_getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter_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 VisioImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
+ throw( Exception )
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter_createInstance" << std::endl;
+#endif
+ return (cppu::OWeakObject*) new VisioImportFilter( rSMgr );
+}
+
+// XServiceInfo
+OUString SAL_CALL VisioImportFilter::getImplementationName( )
+ throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::getImplementationName" << std::endl;
+#endif
+ return VisioImportFilter_getImplementationName();
+}
+sal_Bool SAL_CALL VisioImportFilter::supportsService( const OUString& rServiceName )
+ throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::supportsService" << std::endl;
+#endif
+ return VisioImportFilter_supportsService( rServiceName );
+}
+Sequence< OUString > SAL_CALL VisioImportFilter::getSupportedServiceNames( )
+ throw (RuntimeException)
+{
+#ifdef DEBUG
+ std::cerr << "VisioImportFilter::getSupportedServiceNames" << std::endl;
+#endif
+ return VisioImportFilter_getSupportedServiceNames();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/source/vsdimp/VisioImportFilter.hxx b/writerperfect/source/vsdimp/VisioImportFilter.hxx
new file mode 100644
index 0000000..6cf46b7
--- /dev/null
+++ b/writerperfect/source/vsdimp/VisioImportFilter.hxx
@@ -0,0 +1,117 @@
+/* -*- 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 _VISIOIMPORTFILTER_HXX
+#define _VISIOIMPORTFILTER_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>
+
+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 */
+class VisioImportFilter : 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;
+
+ FilterType meType;
+
+public:
+ VisioImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
+ : mxMSF( rxMSF ) {}
+ virtual ~VisioImportFilter() {}
+
+ // 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 VisioImportFilter_getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+sal_Bool SAL_CALL VisioImportFilter_supportsService( const ::rtl::OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL VisioImportFilter_getSupportedServiceNames( )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+SAL_CALL VisioImportFilter_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/vsdimp/makefile.mk b/writerperfect/source/vsdimp/makefile.mk
new file mode 100644
index 0000000..b296640
--- /dev/null
+++ b/writerperfect/source/vsdimp/makefile.mk
@@ -0,0 +1,28 @@
+PRJ=..$/..
+
+PRJNAME=writerperfect
+TARGET=vsdimp
+ENABLE_EXCEPTIONS=true
+
+.INCLUDE : settings.mk
+
+.IF "$(SYSTEM_LIBWPD)" == "YES"
+INCPRE+=$(LIBWPD_CFLAGS)
+.ENDIF
+
+.IF "$(SYSTEM_LIBWPG)" == "YES"
+INCPRE+=$(LIBWPG_CFLAGS)
+.ENDIF
+
+.IF "$(SYSTEM_LIBVISIO)" == "YES"
+INCPRE+=$(LIBVISIO_CFLAGS)
+.ENDIF
+
+# broken but ... necessary, internal include shafted ...
+INCPRE+= -I..
+
+SLOFILES= \
+ $(SLO)$/VisioImportFilter.obj \
+ $(SLO)$/visioimport_genericfilter.obj
+
+.INCLUDE : target.mk
diff --git a/writerperfect/source/vsdimp/visioimport_genericfilter.cxx b/writerperfect/source/vsdimp/visioimport_genericfilter.cxx
new file mode 100644
index 0000000..be152d1
--- /dev/null
+++ b/writerperfect/source/vsdimp/visioimport_genericfilter.cxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* genericfilter: mostly generic code for registering the filter
+ *
+ * Portions of this code Copyright 2000 by Sun Microsystems, Inc.
+ * Rest is Copyright (C) 2002 William Lachance (wlach at interlog.com)
+ *
+ * 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.
+ */
+
+/* "This product is not manufactured, approved, or supported by
+ * Corel Corporation or Corel Corporation Limited."
+ */
+#include <stdio.h>
+
+#include <osl/mutex.hxx>
+#include <osl/thread.h>
+#include <cppuhelper/factory.hxx>
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+
+#include "VisioImportFilter.hxx"
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::registry;
+
+extern "C"
+{
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
+{
+ void * pRet = 0;
+
+ OUString implName = OUString::createFromAscii( pImplName );
+ if ( pServiceManager && implName.equals(VisioImportFilter_getImplementationName()) )
+ {
+ Reference< XSingleServiceFactory > xFactory( createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
+ OUString::createFromAscii( pImplName ),
+ VisioImportFilter_createInstance, VisioImportFilter_getSupportedServiceNames() ) );
+
+ if (xFactory.is())
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+ }
+
+ return pRet;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerperfect/util/makefile.mk b/writerperfect/util/makefile.mk
index d5d296d..de38569 100644
--- a/writerperfect/util/makefile.mk
+++ b/writerperfect/util/makefile.mk
@@ -81,7 +81,6 @@ SHL2STDLIBS+= \
$(SALLIB) \
$(XMLOFFLIB) \
$(LIBWPS) \
- $(LIBWPG) \
$(LIBWPD)
SHL2TARGET = msworks$(DLLPOSTFIX)
@@ -118,6 +117,35 @@ SHL3LIBS = $(LIB3TARGET)
SHL3VERSIONMAP = $(SOLARENV)/src/component.map
DEF3NAME = $(SHL3TARGET)
+LIB4TARGET= $(SLB)$/wpgimport.lib
+LIB4FILES= \
+ $(SLB)$/stream.lib \
+ $(SLB)$/filter.lib \
+ $(SLB)$/vpsimp.lib
+SHL4LIBS=$(LIB4TARGET)
+SHL4STDLIBS+= \
+ $(SVLLIB) \
+ $(SOTLIB) \
+ $(SO2LIB) \
+ $(SVTOOLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(UCBHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB) \
+ $(XMLOFFLIB) \
+ $(LIBVISIO) \
+ $(LIBWPG) \
+ $(LIBWPD)
+
+SHL4TARGET = visioimport$(DLLPOSTFIX)
+SHL4IMPLIB = i$(SHL4TARGET)
+SHL4LIBS = $(LIB4TARGET)
+SHL4VERSIONMAP = $(SOLARENV)/src/component.map
+DEF3NAME = $(SHL4TARGET)
+
.INCLUDE : target.mk
ALLTAR : $(MISC)/wpft.component $(MISC)/wpgfilter.component $(MISC)/msworksfilter.component
@@ -139,3 +167,9 @@ $(MISC)/msworksfilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xsl
$(XSLTPROC) --nonet --stringparam uri \
'$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL2TARGETN:f)' -o $@ \
$(SOLARENV)/bin/createcomponent.xslt msworksfilter.component
+
+$(MISC)/visiofilter.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ visiofilter.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL4TARGETN:f)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt visiofilter.component
diff --git a/writerperfect/util/visiofilter.component b/writerperfect/util/visiofilter.component
new file mode 100644
index 0000000..6b19b28
--- /dev/null
+++ b/writerperfect/util/visiofilter.component
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.Draw.VisioImportFilter">
+ <service name="com.sun.star.document.ImportFilter"/>
+ <service name="com.sun.star.document.ExtendedTypeDetection"/>
+ </implementation>
+</component>
More information about the Libreoffice-commits
mailing list