diff options
Diffstat (limited to 'writerperfect/source/wpdimp')
-rw-r--r-- | writerperfect/source/wpdimp/WordPerfectCollector.cxx | 53 | ||||
-rw-r--r-- | writerperfect/source/wpdimp/WordPerfectCollector.hxx | 41 | ||||
-rw-r--r-- | writerperfect/source/wpdimp/WordPerfectImportFilter.cxx | 293 | ||||
-rw-r--r-- | writerperfect/source/wpdimp/WordPerfectImportFilter.hxx | 115 | ||||
-rw-r--r-- | writerperfect/source/wpdimp/makefile.mk | 21 | ||||
-rw-r--r-- | writerperfect/source/wpdimp/wpft_genericfilter.cxx | 71 |
6 files changed, 594 insertions, 0 deletions
diff --git a/writerperfect/source/wpdimp/WordPerfectCollector.cxx b/writerperfect/source/wpdimp/WordPerfectCollector.cxx new file mode 100644 index 000000000000..0bc10cc0ba5b --- /dev/null +++ b/writerperfect/source/wpdimp/WordPerfectCollector.cxx @@ -0,0 +1,53 @@ +/* WordPerfectCollector: Collects sections and runs of text from a + * wordperfect file (and styles to go along with them) and writes them + * to a Writer target document + * + * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For further information visit http://libwpd.sourceforge.net + * + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#if defined _MSC_VER +#pragma warning( push, 1 ) +#endif +#include "WordPerfectCollector.hxx" +#if defined _MSC_VER +#pragma warning( pop ) +#endif + +WordPerfectCollector::WordPerfectCollector(WPXInputStream *pInput, DocumentHandler *pHandler) : + DocumentCollector(pInput, pHandler) +{ +} + +WordPerfectCollector::~WordPerfectCollector() +{ +} + +bool WordPerfectCollector::parseSourceDocument(WPXInputStream &input) +{ + WPDResult result = WPDocument::parse(&input, static_cast<WPXHLListenerImpl *>(this)); + if (result != WPD_OK) + return false; + + return true; +} diff --git a/writerperfect/source/wpdimp/WordPerfectCollector.hxx b/writerperfect/source/wpdimp/WordPerfectCollector.hxx new file mode 100644 index 000000000000..400a5ca8c856 --- /dev/null +++ b/writerperfect/source/wpdimp/WordPerfectCollector.hxx @@ -0,0 +1,41 @@ +/* WordPerfectCollector: Collects sections and runs of text from a + * wordperfect file (and styles to go along with them) and writes them + * to a Writer target document + * + * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For further information visit http://libwpd.sourceforge.net + * + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#ifndef _WORDPERFECTCOLLECTOR_HXX +#define _WORDPERFECTCOLLECTOR_HXX + +#include "filter/DocumentCollector.hxx" + +class WordPerfectCollector : public DocumentCollector +{ +public: + WordPerfectCollector(WPXInputStream *pInput, DocumentHandler *pHandler); + virtual ~WordPerfectCollector(); + bool parseSourceDocument(WPXInputStream &pInput); +}; +#endif diff --git a/writerperfect/source/wpdimp/WordPerfectImportFilter.cxx b/writerperfect/source/wpdimp/WordPerfectImportFilter.cxx new file mode 100644 index 000000000000..d4ee07e87c6d --- /dev/null +++ b/writerperfect/source/wpdimp/WordPerfectImportFilter.cxx @@ -0,0 +1,293 @@ +/* WordPerfectImportFilter: Sets up the filter, and calls DocumentCollector + * to do the actual filtering + * + * Copyright (C) 2000 by Sun Microsystems, Inc. + * Copyright (C) 2002-2004 William Lachance (wlach@interlog.com) + * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com) + * Copyright (C) 2004 Fridrich Strba <fridrich.strba@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@sun.com) + * + */ +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ + +#include <osl/diagnose.h> +#ifndef _RTL_TENCINFO_H_ +#include <rtl/tencinfo.h> +#endif +#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> + +#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#endif + +#ifndef _ATTRLIST_HPP_ +#include <xmloff/attrlist.hxx> +#endif +#include <ucbhelper/content.hxx> + +#include "filter/FilterInternal.hxx" +#include "filter/DocumentHandler.hxx" +#include "filter/DocumentCollector.hxx" +#include "stream/WPXSvStream.h" + +#if defined _MSC_VER +#pragma warning( push, 1 ) +#endif +#include <libwpd/WPDocument.h> +#if defined _MSC_VER +#pragma warning( pop ) +#endif + +#include "WordPerfectCollector.hxx" +#include "WordPerfectImportFilter.hxx" + +using namespace ::rtl; +using namespace ::com::sun::star; + +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::ucb::XCommandEnvironment; + +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; + +void callHandler(uno::Reference < XDocumentHandler > xDocHandler); + +sal_Bool SAL_CALL WordPerfectImportFilter::importImpl( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) + throw (RuntimeException) +{ + WRITER_DEBUG_MSG(("WordPerfectImportFilter::importImpl: Got here!\n")); + + sal_Int32 nLength = aDescriptor.getLength(); + const PropertyValue * pValue = aDescriptor.getConstArray(); + OUString sURL; + uno::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.Writer.XMLImporter" ) ); + uno::Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY ); + + // The XImporter sets up an empty target document for XDocumentHandler to write to.. + uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY); + xImporter->setTargetDocument(mxDoc); + + // OO Document Handler: abstract class to handle document SAX messages, concrete implementation here + // writes to in-memory target doc + DocumentHandler xHandler(xInternalHandler); + + WPXSvInputStream input( xInputStream ); + + WordPerfectCollector collector(&input, &xHandler); + collector.filter(); + + return true; +} + +sal_Bool SAL_CALL WordPerfectImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) + throw (RuntimeException) +{ + WRITER_DEBUG_MSG(("WordPerfectImportFilter::filter: Got here!\n")); + return importImpl ( aDescriptor ); +} +void SAL_CALL WordPerfectImportFilter::cancel( ) + throw (RuntimeException) +{ + WRITER_DEBUG_MSG(("WordPerfectImportFilter::cancel: Got here!\n")); +} + +// XImporter +void SAL_CALL WordPerfectImportFilter::setTargetDocument( const uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) + throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException) +{ + WRITER_DEBUG_MSG(("WordPerfectImportFilter::getTargetDocument: Got here!\n")); + meType = FILTER_IMPORT; + mxDoc = xDoc; +} + +// XExtendedFilterDetection +OUString SAL_CALL WordPerfectImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor ) + throw( com::sun::star::uno::RuntimeException ) +{ + WRITER_DEBUG_MSG(("WordPerfectImportFilter::detect: Got here!\n")); + + WPDConfidence confidence = WPD_CONFIDENCE_NONE; + OUString sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "" ) ); + sal_Int32 nLength = Descriptor.getLength(); + sal_Int32 location = nLength; + OUString sURL; + const PropertyValue * pValue = Descriptor.getConstArray(); + uno::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; + else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) ) + pValue[i].Value >>= sURL; + } + + uno::Reference< com::sun::star::ucb::XCommandEnvironment > xEnv; + if (!xInputStream.is()) + { + try + { + ::ucbhelper::Content aContent(sURL, xEnv); + xInputStream = aContent.openStream(); + } + catch ( ... ) + { + return ::rtl::OUString(); + } + + if (!xInputStream.is()) + return ::rtl::OUString(); + } + + WPXSvInputStream input( xInputStream ); + + if (input.atEOS()) + return ::rtl::OUString(); + + confidence = WPDocument::isFileFormatSupported(&input, false); + + if (confidence == WPD_CONFIDENCE_EXCELLENT) + sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_WordPerfect_Document" ) ); + + if (sTypeName.getLength()) + { + if ( location == Descriptor.getLength() ) + { + Descriptor.realloc(nLength+1); + Descriptor[location].Name = ::rtl::OUString::createFromAscii( "TypeName" ); + } + + Descriptor[location].Value <<=sTypeName; + } + + return sTypeName; +} + + +// XInitialization +void SAL_CALL WordPerfectImportFilter::initialize( const Sequence< Any >& aArguments ) + throw (Exception, RuntimeException) +{ + WRITER_DEBUG_MSG(("WordPerfectImportFilter::initialize: Got here!\n")); + 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 WordPerfectImportFilter_getImplementationName () + throw (RuntimeException) +{ + return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.WordPerfectImportFilter" ) ); +} + +#define SERVICE_NAME1 "com.sun.star.document.ImportFilter" +#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection" +sal_Bool SAL_CALL WordPerfectImportFilter_supportsService( const OUString& ServiceName ) + throw (RuntimeException) +{ + return (ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) || + ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) ) ); +} +Sequence< OUString > SAL_CALL WordPerfectImportFilter_getSupportedServiceNames( ) + throw (RuntimeException) +{ + Sequence < OUString > aRet(2); +// Sequence < OUString > aRet(1); + 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 + +uno::Reference< XInterface > SAL_CALL WordPerfectImportFilter_createInstance( const uno::Reference< XMultiServiceFactory > & rSMgr) + throw( Exception ) +{ + return (cppu::OWeakObject*) new WordPerfectImportFilter( rSMgr ); +} + +// XServiceInfo +OUString SAL_CALL WordPerfectImportFilter::getImplementationName( ) + throw (RuntimeException) +{ + return WordPerfectImportFilter_getImplementationName(); +} +sal_Bool SAL_CALL WordPerfectImportFilter::supportsService( const OUString& rServiceName ) + throw (RuntimeException) +{ + return WordPerfectImportFilter_supportsService( rServiceName ); +} +Sequence< OUString > SAL_CALL WordPerfectImportFilter::getSupportedServiceNames( ) + throw (RuntimeException) +{ + return WordPerfectImportFilter_getSupportedServiceNames(); +} diff --git a/writerperfect/source/wpdimp/WordPerfectImportFilter.hxx b/writerperfect/source/wpdimp/WordPerfectImportFilter.hxx new file mode 100644 index 000000000000..4276329b960a --- /dev/null +++ b/writerperfect/source/wpdimp/WordPerfectImportFilter.hxx @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2000 by Sun Microsystems, Inc. + * Copyright (C) 2002-2004 William Lachance (wlach@interlog.com) + * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com) + * Copyright (C) 2004 Fridrich Strba <fridrich.strba@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@sun.com) + * + */ + +/* "This product is not manufactured, approved, or supported by + * Corel Corporation or Corel Corporation Limited." + */ +#ifndef _WORDPERFECTIMPORTFILTER_HXX +#define _WORDPERFECTIMPORTFILTER_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> + +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 WordPerfectImportFilter : 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; + + 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 ) {} + virtual ~WordPerfectImportFilter() {} + + // 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 WordPerfectImportFilter_getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + +sal_Bool SAL_CALL WordPerfectImportFilter_supportsService( const ::rtl::OUString& ServiceName ) + throw ( ::com::sun::star::uno::RuntimeException ); + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL WordPerfectImportFilter_getSupportedServiceNames( ) + throw ( ::com::sun::star::uno::RuntimeException ); + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > +SAL_CALL WordPerfectImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) + throw ( ::com::sun::star::uno::Exception ); + +#endif diff --git a/writerperfect/source/wpdimp/makefile.mk b/writerperfect/source/wpdimp/makefile.mk new file mode 100644 index 000000000000..bc2a3cda544b --- /dev/null +++ b/writerperfect/source/wpdimp/makefile.mk @@ -0,0 +1,21 @@ +PRJ=..$/.. + +PRJNAME=writerperfect +TARGET=wpdimp +ENABLE_EXCEPTIONS=true + +.INCLUDE : settings.mk + +.IF "$(SYSTEM_LIBWPD)" == "YES" +INCPRE+=$(LIBWPD_CFLAGS) -I.. +.ELSE +# broken but ... necessary, internal include shafted ... +INCPRE+=-I.. +.ENDIF + +SLOFILES= \ + $(SLO)$/WordPerfectCollector.obj \ + $(SLO)$/WordPerfectImportFilter.obj \ + $(SLO)$/wpft_genericfilter.obj + +.INCLUDE : target.mk diff --git a/writerperfect/source/wpdimp/wpft_genericfilter.cxx b/writerperfect/source/wpdimp/wpft_genericfilter.cxx new file mode 100644 index 000000000000..b107d5ff4a71 --- /dev/null +++ b/writerperfect/source/wpdimp/wpft_genericfilter.cxx @@ -0,0 +1,71 @@ +/* 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@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 "WordPerfectImportFilter.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" +{ +//================================================================================================== +void SAL_CALL component_getImplementationEnvironment( + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} +//================================================================================================== +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(WordPerfectImportFilter_getImplementationName()) ) + { + Reference< XSingleServiceFactory > xFactory( createSingleFactory( + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), + OUString::createFromAscii( pImplName ), + WordPerfectImportFilter_createInstance, WordPerfectImportFilter_getSupportedServiceNames() ) ); + + if (xFactory.is()) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + } + + return pRet; +} +} |