diff options
-rwxr-xr-x | solenv/bin/native-code.py | 4 | ||||
-rw-r--r-- | ucb/Library_ucptdoc1.mk | 1 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx | 52 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx | 15 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_provider.cxx | 28 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_provider.hxx | 7 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/tdoc_services.cxx | 71 | ||||
-rw-r--r-- | ucb/source/ucp/tdoc/ucptdoc1.component | 8 |
8 files changed, 39 insertions, 147 deletions
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index b28e05c408d7..63cd7413942a 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -37,7 +37,6 @@ core_factory_list = [ ("libucpexpand1lo.a", "ucpexpand1_component_getFactory", "#ifdef ANDROID"), ("libucpfile1.a", "ucpfile_component_getFactory"), ("libucphier1.a", "ucphier1_component_getFactory"), - ("libucptdoc1lo.a", "ucptdoc1_component_getFactory"), ("libxstor.a", "xstor_component_getFactory"), ("libodfflatxmllo.a", "odfflatxml_component_getFactory"), ("libvcllo.a", "vcl_component_getFactory"), @@ -317,6 +316,9 @@ core_constructor_list = [ "stardiv_Toolkit_VCLXPointer_get_implementation", "stardiv_Toolkit_VCLXPopupMenu_get_implementation", "stardiv_Toolkit_VCLXToolkit_get_implementation", +# ucb/source/tdoc/ucptdoc1.component + "ucb_tdoc_ContentProvider_get_implementation", + "ucb_tdoc_DocumentContentFactory_get_implementation", # unotools/util/utl.component "unotools_ServiceDocument_get_implementation", "unotools_OTempFileService_get_implementation", diff --git a/ucb/Library_ucptdoc1.mk b/ucb/Library_ucptdoc1.mk index 54ff1fee2fcb..5dc25f3d0229 100644 --- a/ucb/Library_ucptdoc1.mk +++ b/ucb/Library_ucptdoc1.mk @@ -32,7 +32,6 @@ $(eval $(call gb_Library_add_exception_objects,ucptdoc1,\ ucb/source/ucp/tdoc/tdoc_passwordrequest \ ucb/source/ucp/tdoc/tdoc_provider \ ucb/source/ucp/tdoc/tdoc_resultset \ - ucb/source/ucp/tdoc/tdoc_services \ ucb/source/ucp/tdoc/tdoc_stgelems \ ucb/source/ucp/tdoc/tdoc_storage \ ucb/source/ucp/tdoc/tdoc_uri \ diff --git a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx index eadd8fcd681f..c069fed082e0 100644 --- a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx +++ b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx @@ -24,8 +24,10 @@ *************************************************************************/ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <cppuhelper/factory.hxx> #include <cppuhelper/supportsservice.hxx> +#include <rtl/ref.hxx> #include "tdoc_documentcontentfactory.hxx" @@ -37,8 +39,8 @@ using namespace tdoc_ucp; DocumentContentFactory::DocumentContentFactory( - const uno::Reference< lang::XMultiServiceFactory >& xSMgr ) -: m_xSMgr( xSMgr ) + const uno::Reference< uno::XComponentContext >& rxContext ) +: m_xContext( rxContext ) { } @@ -55,7 +57,7 @@ DocumentContentFactory::~DocumentContentFactory() // virtual OUString SAL_CALL DocumentContentFactory::getImplementationName() { - return getImplementationName_Static(); + return "com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory"; } // virtual @@ -69,24 +71,7 @@ DocumentContentFactory::supportsService( const OUString& ServiceName ) uno::Sequence< OUString > SAL_CALL DocumentContentFactory::getSupportedServiceNames() { - return getSupportedServiceNames_Static(); -} - - -// static -OUString DocumentContentFactory::getImplementationName_Static() -{ - return - "com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory"; -} - - -// static -uno::Sequence< OUString > -DocumentContentFactory::getSupportedServiceNames_Static() -{ - uno::Sequence< OUString > aSNS { "com.sun.star.frame.TransientDocumentsDocumentContentFactory" }; - return aSNS; + return { "com.sun.star.frame.TransientDocumentsDocumentContentFactory" }; } @@ -101,7 +86,7 @@ DocumentContentFactory::createDocumentContent( uno::Reference< frame::XTransientDocumentsDocumentContentFactory > xDocFac; try { - xDocFac.set( m_xSMgr->createInstance("com.sun.star.ucb.TransientDocumentsContentProvider"), + xDocFac.set( m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.ucb.TransientDocumentsContentProvider", m_xContext), uno::UNO_QUERY ); } catch ( uno::Exception const & ) @@ -120,25 +105,14 @@ DocumentContentFactory::createDocumentContent( // Service factory implementation. -/// @throws uno::Exception -static uno::Reference< uno::XInterface > -DocumentContentFactory_CreateInstance( - const uno::Reference< lang::XMultiServiceFactory> & rSMgr ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +ucb_tdoc_DocumentContentFactory_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - return static_cast<lang::XServiceInfo*>(new DocumentContentFactory(rSMgr)); + static rtl::Reference<DocumentContentFactory> g_Instance(new DocumentContentFactory(context)); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); } -// static -uno::Reference< lang::XSingleServiceFactory > -DocumentContentFactory::createServiceFactory( - const uno::Reference< lang::XMultiServiceFactory >& rxServiceMgr ) -{ - return cppu::createOneInstanceFactory( - rxServiceMgr, - DocumentContentFactory::getImplementationName_Static(), - DocumentContentFactory_CreateInstance, - DocumentContentFactory::getSupportedServiceNames_Static() ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx index 0956541c46e6..6a5218ac4889 100644 --- a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx +++ b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.hxx @@ -20,9 +20,8 @@ #ifndef INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_DOCUMENTCONTENTFACTORY_HXX #define INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_DOCUMENTCONTENTFACTORY_HXX -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/frame/XTransientDocumentsDocumentContentFactory.hpp> #include <cppuhelper/implbase.hxx> @@ -35,7 +34,7 @@ class DocumentContentFactory : css::lang::XServiceInfo > { public: - explicit DocumentContentFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& rXSMgr ); + explicit DocumentContentFactory( const css::uno::Reference< css::uno::XComponentContext >& ); virtual ~DocumentContentFactory() override; // XServiceInfo @@ -51,16 +50,8 @@ public: virtual css::uno::Reference< css::ucb::XContent > SAL_CALL createDocumentContent( const css::uno::Reference< css::frame::XModel >& Model ) override; - // Non-UNO interfaces - static OUString - getImplementationName_Static(); - static css::uno::Sequence< OUString > - getSupportedServiceNames_Static(); - - static css::uno::Reference< css::lang::XSingleServiceFactory > - createServiceFactory( const css::uno::Reference< css::lang::XMultiServiceFactory > & rxServiceMgr ); private: - css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMgr; + css::uno::Reference< css::uno::XComponentContext > m_xContext; }; } // namespace tdoc_ucp diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx index d2d8c6ae2035..e1d0f30e1ca9 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.cxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx @@ -102,29 +102,31 @@ XTYPEPROVIDER_IMPL_5( ContentProvider, // XServiceInfo methods. +OUString SAL_CALL ContentProvider::getImplementationName() +{ + return "com.sun.star.comp.ucb.TransientDocumentsContentProvider"; +} -XSERVICEINFO_COMMOM_IMPL( ContentProvider, - "com.sun.star.comp.ucb.TransientDocumentsContentProvider" ) -/// @throws css::uno::Exception -static css::uno::Reference< css::uno::XInterface > -ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr ) +sal_Bool SAL_CALL ContentProvider::supportsService( const OUString& ServiceName ) { - css::lang::XServiceInfo* pX = new ContentProvider( ucbhelper::getComponentContext(rSMgr) ); - return css::uno::Reference< css::uno::XInterface >::query( pX ); + return cppu::supportsService( this, ServiceName ); } -css::uno::Sequence< OUString > -ContentProvider::getSupportedServiceNames_Static() +css::uno::Sequence< OUString > SAL_CALL ContentProvider::getSupportedServiceNames() { - css::uno::Sequence< OUString > aSNS { "com.sun.star.ucb.TransientDocumentsContentProvider" }; - return aSNS; + return { "com.sun.star.ucb.TransientDocumentsContentProvider" }; } -// Service factory implementation. +// Service factory implementation. -ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider ); +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +ucb_tdoc_ContentProvider_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new ContentProvider(context)); +} // XContentProvider methods. diff --git a/ucb/source/ucp/tdoc/tdoc_provider.hxx b/ucb/source/ucp/tdoc/tdoc_provider.hxx index c1498cd488f3..b105ac9367a3 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.hxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.hxx @@ -78,13 +78,6 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - static OUString getImplementationName_Static(); - static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); - - static css::uno::Reference< css::lang::XSingleServiceFactory > - createServiceFactory( const css::uno::Reference< - css::lang::XMultiServiceFactory >& rxServiceMgr ); - // XContentProvider virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override; diff --git a/ucb/source/ucp/tdoc/tdoc_services.cxx b/ucb/source/ucp/tdoc/tdoc_services.cxx deleted file mode 100644 index c46751bf6d1a..000000000000 --- a/ucb/source/ucp/tdoc/tdoc_services.cxx +++ /dev/null @@ -1,71 +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 . - */ - - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> - -#include "tdoc_provider.hxx" -#include "tdoc_documentcontentfactory.hxx" - -using namespace com::sun::star; -using namespace tdoc_ucp; - - -extern "C" SAL_DLLPUBLIC_EXPORT void * ucptdoc1_component_getFactory( - const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - void * pRet = nullptr; - - uno::Reference< lang::XMultiServiceFactory > xSMgr( - static_cast< lang::XMultiServiceFactory * >( - pServiceManager ) ); - uno::Reference< lang::XSingleServiceFactory > xFactory; - - - // Transient Documents Content Provider. - - - if ( ContentProvider::getImplementationName_Static(). - equalsAscii( pImplName ) ) - { - xFactory = ContentProvider::createServiceFactory( xSMgr ); - } - - - // Transient Documents Document Content Factory. - - - else if ( DocumentContentFactory::getImplementationName_Static(). - equalsAscii( pImplName ) ) - { - xFactory = DocumentContentFactory::createServiceFactory( xSMgr ); - } - - - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - - return pRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucb/source/ucp/tdoc/ucptdoc1.component b/ucb/source/ucp/tdoc/ucptdoc1.component index ebc03a445fbe..331538c432f3 100644 --- a/ucb/source/ucp/tdoc/ucptdoc1.component +++ b/ucb/source/ucp/tdoc/ucptdoc1.component @@ -18,11 +18,13 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="ucptdoc1" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.ucb.TransientDocumentsContentProvider"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.ucb.TransientDocumentsContentProvider" + constructor="ucb_tdoc_ContentProvider_get_implementation"> <service name="com.sun.star.ucb.TransientDocumentsContentProvider"/> </implementation> - <implementation name="com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory"> + <implementation name="com.sun.star.comp.ucb.TransientDocumentsDocumentContentFactory" + constructor="ucb_tdoc_DocumentContentFactory_get_implementation"> <service name="com.sun.star.frame.TransientDocumentsDocumentContentFactory"/> </implementation> </component> |