diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index db5aea6ca8d3..9f7b3e738ab7 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -59,7 +59,6 @@ #include #include #include -#include #include #include #include @@ -1799,7 +1798,6 @@ SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory( IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler ) IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler ) #endif - IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService ) if ( ::comp_SfxDocumentMetaData::_getImplementationName().equals( OUString::createFromAscii( pImplementationName ) ) ) { diff --git a/sfx2/source/doc/ownsubfilterservice.cxx b/sfx2/source/doc/ownsubfilterservice.cxx index d3b85a660009..bb817db1e67a 100644 --- a/sfx2/source/doc/ownsubfilterservice.cxx +++ b/sfx2/source/doc/ownsubfilterservice.cxx @@ -19,89 +19,46 @@ #include #include -#include +#include +#include +#include +#include -#include +#include +#include +#include #include -using namespace ::com::sun::star; +using namespace css; -namespace sfx2 { +namespace { -//------------------------------------------------------------------------- -OwnSubFilterService::OwnSubFilterService( const uno::Reference < lang::XMultiServiceFactory >& xFactory ) -: m_xFactory( xFactory ) -, m_pObjectShell( NULL ) +class OwnSubFilterService : public cppu::WeakImplHelper2 < document::XFilter + ,lang::XServiceInfo > { -} + uno::Reference< frame::XModel > m_xModel; + uno::Reference< io::XStream > m_xStream; + SfxObjectShell* m_pObjectShell; -//------------------------------------------------------------------------- -OwnSubFilterService::~OwnSubFilterService() -{ -} +public: + OwnSubFilterService( const uno::Sequence< uno::Any >& aArguments ) + throw (uno::Exception, uno::RuntimeException); + virtual ~OwnSubFilterService(); -//------------------------------------------------------------------------- -uno::Sequence< OUString > SAL_CALL OwnSubFilterService::impl_getStaticSupportedServiceNames() -{ - uno::Sequence< OUString > aRet(2); - aRet[0] = "com.sun.star.document.OwnSubFilter"; - aRet[1] = "com.sun.star.comp.document.OwnSubFilter"; - return aRet; -} + // XFilter + virtual ::sal_Bool SAL_CALL filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) throw (uno::RuntimeException); + virtual void SAL_CALL cancel() throw (uno::RuntimeException); -//------------------------------------------------------------------------- -OUString SAL_CALL OwnSubFilterService::impl_getStaticImplementationName() -{ - return OUString("com.sun.star.comp.document.OwnSubFilter"); -} + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) throw (uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (uno::RuntimeException); + virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (uno::RuntimeException); +}; -//------------------------------------------------------------------------- -uno::Reference< uno::XInterface > SAL_CALL OwnSubFilterService::impl_staticCreateSelfInstance( - const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) -{ - return uno::Reference< uno::XInterface >( *new OwnSubFilterService( xServiceManager ) ); -} - -//------------------------------------------------------------------------- -uno::Reference< lang::XSingleServiceFactory > SAL_CALL OwnSubFilterService::impl_createFactory( - const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) -{ - return ::cppu::createSingleFactory( xServiceManager, - OwnSubFilterService::impl_getStaticImplementationName(), - OwnSubFilterService::impl_staticCreateSelfInstance, - OwnSubFilterService::impl_getStaticSupportedServiceNames() ); -} - - -// XFilter - -//------------------------------------------------------------------------- -sal_Bool SAL_CALL OwnSubFilterService::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) - throw (uno::RuntimeException) -{ - if ( !m_pObjectShell ) - throw uno::RuntimeException(); - - return m_pObjectShell->ImportFromGeneratedStream_Impl( m_xStream, aDescriptor ); -} - -//------------------------------------------------------------------------- -void SAL_CALL OwnSubFilterService::cancel() - throw (uno::RuntimeException) -{ - // not implemented -} - - -// XInitialization - -//------------------------------------------------------------------------- -void SAL_CALL OwnSubFilterService::initialize( const uno::Sequence< uno::Any >& aArguments ) +OwnSubFilterService::OwnSubFilterService( const uno::Sequence< uno::Any >& aArguments ) throw (uno::Exception, uno::RuntimeException) + : m_pObjectShell( NULL ) { - if ( !m_xFactory.is() ) - throw uno::RuntimeException(); - if ( aArguments.getLength() != 2 ) throw lang::IllegalArgumentException(); @@ -122,11 +79,29 @@ void SAL_CALL OwnSubFilterService::initialize( const uno::Sequence< uno::Any >& throw lang::IllegalArgumentException(); } -// XServiceInfo +OwnSubFilterService::~OwnSubFilterService() +{ +} + +sal_Bool SAL_CALL OwnSubFilterService::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) + throw (uno::RuntimeException) +{ + if ( !m_pObjectShell ) + throw uno::RuntimeException(); + + return m_pObjectShell->ImportFromGeneratedStream_Impl( m_xStream, aDescriptor ); +} + +void SAL_CALL OwnSubFilterService::cancel() + throw (uno::RuntimeException) +{ + // not implemented +} + OUString SAL_CALL OwnSubFilterService::getImplementationName() throw ( uno::RuntimeException ) { - return impl_getStaticImplementationName(); + return OUString("com.sun.star.comp.document.OwnSubFilter"); } sal_Bool SAL_CALL OwnSubFilterService::supportsService( const OUString& ServiceName ) @@ -138,9 +113,22 @@ sal_Bool SAL_CALL OwnSubFilterService::supportsService( const OUString& ServiceN uno::Sequence< OUString > SAL_CALL OwnSubFilterService::getSupportedServiceNames() throw ( uno::RuntimeException ) { - return impl_getStaticSupportedServiceNames(); + uno::Sequence< OUString > aRet(2); + aRet[0] = "com.sun.star.document.OwnSubFilter"; + aRet[1] = "com.sun.star.comp.document.OwnSubFilter"; + return aRet; } -} // namespace sfx2 +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_document_OwnSubFilter_get_implementation( + css::uno::XComponentContext *, + css::uno::Sequence const &arguments) +{ + rtl::Reference x(new OwnSubFilterService(arguments)); + x->acquire(); + return static_cast(x.get()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/ownsubfilterservice.hxx b/sfx2/source/inc/ownsubfilterservice.hxx deleted file mode 100644 index 3a2be4f1685f..000000000000 --- a/sfx2/source/inc/ownsubfilterservice.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- 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 . - */ - -#ifndef INCLUDED_SFX2_SOURCE_INC_OWNSUBFILTERSERVICE_HXX -#define INCLUDED_SFX2_SOURCE_INC_OWNSUBFILTERSERVICE_HXX - -#include -#include -#include -#include -#include -#include -#include - -class SfxObjectShell; - -namespace sfx2 { - -class OwnSubFilterService : public cppu::WeakImplHelper3 < ::com::sun::star::document::XFilter - ,::com::sun::star::lang::XInitialization - ,::com::sun::star::lang::XServiceInfo > -{ - ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; - ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; - SfxObjectShell* m_pObjectShell; - -public: - - OwnSubFilterService(const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > &xNewFactory); - virtual ~OwnSubFilterService(); - - static ::com::sun::star::uno::Sequence< OUString > SAL_CALL - impl_getStaticSupportedServiceNames(); - - static OUString SAL_CALL impl_getStaticImplementationName(); - - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL - impl_staticCreateSelfInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - - static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL - impl_createFactory( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - - - // 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); - - // 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 OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - -}; - -} // namespace sfx2 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/util/sfx.component b/sfx2/util/sfx.component index d1fee9b523ec..286c202897b0 100644 --- a/sfx2/util/sfx.component +++ b/sfx2/util/sfx.component @@ -32,7 +32,8 @@ - +