diff options
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 3 | ||||
-rw-r--r-- | filter/source/xmlfilterdetect/fdcomp.cxx | 50 | ||||
-rw-r--r-- | filter/source/xmlfilterdetect/filterdetect.cxx | 42 | ||||
-rw-r--r-- | filter/source/xmlfilterdetect/filterdetect.hxx | 42 |
4 files changed, 44 insertions, 93 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 501d04bcb936..4a50aa9d8b98 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -125,9 +125,6 @@ #include <svx/svx3ditems.hxx> #include <svx/svdoashp.hxx> #include <svx/sdasaitm.hxx> -#include <ucbhelper/content.hxx> -#include <ucbhelper/contentbroker.hxx> - #include "svx/EnhancedCustomShapeTypeNames.hxx" #include "svx/EnhancedCustomShapeGeometry.hxx" #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> diff --git a/filter/source/xmlfilterdetect/fdcomp.cxx b/filter/source/xmlfilterdetect/fdcomp.cxx index a031a33488a5..f20ff3a617ba 100644 --- a/filter/source/xmlfilterdetect/fdcomp.cxx +++ b/filter/source/xmlfilterdetect/fdcomp.cxx @@ -26,42 +26,30 @@ * ************************************************************************/ -#include <stdio.h> -#include <osl/mutex.hxx> -#include <osl/thread.h> -#include <cppuhelper/factory.hxx> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include "filterdetect.hxx" +#include "sal/config.h" -using namespace ::rtl; -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "sal/types.h" -extern "C" -{ -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(FilterDetect_getImplementationName()) ) - { - Reference< XSingleServiceFactory > xFactory( createSingleFactory( - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), - OUString::createFromAscii( pImplName ), - FilterDetect_createInstance, FilterDetect_getSupportedServiceNames() ) ); +#include "filterdetect.hxx" - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } +namespace { - return pRet; +static cppu::ImplementationEntry const services[] = { + { &FilterDetect_createInstance, &FilterDetect_getImplementationName, + &FilterDetect_getSupportedServiceNames, + &cppu::createSingleComponentFactory, 0, 0 }, + { 0, 0, 0, 0, 0, 0 } +}; } + +extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( + char const * pImplName, void * pServiceManager, void * pRegistryKey) +{ + return cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, services); } + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/xmlfilterdetect/filterdetect.cxx b/filter/source/xmlfilterdetect/filterdetect.cxx index 0e79ca4aaec0..9e7959ddf7aa 100644 --- a/filter/source/xmlfilterdetect/filterdetect.cxx +++ b/filter/source/xmlfilterdetect/filterdetect.cxx @@ -33,7 +33,6 @@ #include <cstring> #include "filterdetect.hxx" #include <osl/diagnose.h> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XInputStream.hpp> @@ -47,27 +46,21 @@ #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/XStyleLoader.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/document/XExtendedFilterDetection.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/beans/PropertyState.hpp> - #include <ucbhelper/content.hxx> -#include <ucbhelper/contentbroker.hxx> -#include <ucbhelper/commandenvironment.hxx> -#include <unotools/ucbhelper.hxx> -#include <com/sun/star/ucb/XCommandEnvironment.hpp> - - 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::XComponentContext; 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::io::XActiveDataSource; using com::sun::star::io::XOutputStream; using com::sun::star::beans::PropertyValue; @@ -80,7 +73,6 @@ using com::sun::star::document::XImporter; using com::sun::star::xml::sax::InputSource; using com::sun::star::xml::sax::XDocumentHandler; using com::sun::star::xml::sax::XParser; -using com::sun::star::task::XInteractionHandler; using namespace ::com::sun::star::frame; using namespace ::com::sun::star; @@ -167,10 +159,11 @@ bool isXMLStream(const ::rtl::OString& aHeaderStrm) } try { - Reference< com::sun::star::ucb::XCommandEnvironment > xEnv; if (!xInStream.is()) { - ::ucbhelper::Content aContent(sUrl,xEnv); + ::ucbhelper::Content aContent( + sUrl, Reference< com::sun::star::ucb::XCommandEnvironment >(), + mxCtx); xInStream = aContent.openStream(); if (!xInStream.is()) { @@ -189,7 +182,7 @@ bool isXMLStream(const ::rtl::OString& aHeaderStrm) return ::rtl::OUString(); // test typedetect code - Reference <XNameAccess> xTypeCont(mxMSF->createInstance(OUString( "com.sun.star.document.TypeDetection" )),UNO_QUERY); + Reference <XNameAccess> xTypeCont(mxCtx->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", mxCtx), UNO_QUERY); Sequence < ::rtl::OUString > myTypes= xTypeCont->getElementNames(); nLength = myTypes.getLength(); @@ -270,32 +263,21 @@ void SAL_CALL FilterDetect::initialize( const Sequence< Any >& aArguments ) OUString FilterDetect_getImplementationName () - throw (RuntimeException) { return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.filters.XMLFilterDetect" ) ); } #define SERVICE_NAME1 "com.sun.star.document.ExtendedTypeDetection" -sal_Bool SAL_CALL FilterDetect_supportsService( const OUString& ServiceName ) - throw (RuntimeException) -{ - return ServiceName == SERVICE_NAME1; -} -Sequence< OUString > SAL_CALL FilterDetect_getSupportedServiceNames( ) - throw (RuntimeException) +Sequence< OUString > FilterDetect_getSupportedServiceNames() { - Sequence < OUString > aRet(2); - OUString* pArray = aRet.getArray(); - pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) ); + Sequence < OUString > aRet(1); + aRet[0] = SERVICE_NAME1; return aRet; } -#undef SERVICE_NAME1 -#undef SERVICE_NAME2 -Reference< XInterface > SAL_CALL FilterDetect_createInstance( const Reference< XMultiServiceFactory > & rSMgr) - throw( Exception ) +Reference< XInterface > FilterDetect_createInstance( const Reference< XComponentContext > & context) { - return (cppu::OWeakObject*) new FilterDetect( rSMgr ); + return static_cast< cppu::OWeakObject * >( new FilterDetect( context ) ); } // XServiceInfo @@ -307,7 +289,7 @@ OUString SAL_CALL FilterDetect::getImplementationName( ) sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName ) throw (RuntimeException) { - return FilterDetect_supportsService( rServiceName ); + return rServiceName == SERVICE_NAME1; } Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames( ) throw (RuntimeException) diff --git a/filter/source/xmlfilterdetect/filterdetect.hxx b/filter/source/xmlfilterdetect/filterdetect.hxx index 7dc327932be2..8c2dba8b82dc 100644 --- a/filter/source/xmlfilterdetect/filterdetect.hxx +++ b/filter/source/xmlfilterdetect/filterdetect.hxx @@ -31,7 +31,9 @@ #include <cppuhelper/implbase3.hxx> - +namespace com { namespace sun { namespace star { namespace uno { + class XComponentContext; +} } } } enum FilterType { @@ -60,7 +62,7 @@ class FilterDetect : public cppu::WeakImplHelper3 protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCtx; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc; @@ -86,9 +88,9 @@ protected: public: - FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF) + FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxCtx) - : mxMSF( rxMSF ) {} + : mxCtx( rxCtx ) {} virtual ~FilterDetect() {} @@ -126,33 +128,15 @@ public: }; +OUString SAL_CALL FilterDetect_getImplementationName(); +com::sun::star::uno::Sequence< OUString > SAL_CALL +FilterDetect_getSupportedServiceNames(); -::rtl::OUString FilterDetect_getImplementationName() - - throw ( ::com::sun::star::uno::RuntimeException ); - - - -sal_Bool SAL_CALL FilterDetect_supportsService( const ::rtl::OUString& ServiceName ) - - throw ( ::com::sun::star::uno::RuntimeException ); - - - -::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL FilterDetect_getSupportedServiceNames( ) - - throw ( ::com::sun::star::uno::RuntimeException ); - - - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - -SAL_CALL FilterDetect_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) - - throw ( ::com::sun::star::uno::Exception ); - - +com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL +FilterDetect_createInstance( + com::sun::star::uno::Reference< + com::sun::star::uno::XComponentContext > const & context); #endif |