dtrans/Library_mcnttype.mk | 1 dtrans/source/cnttype/mcnttfactory.cxx | 27 +++++------ dtrans/source/cnttype/mcnttfactory.hxx | 3 - dtrans/source/cnttype/mctfentry.cxx | 78 --------------------------------- dtrans/util/mcnttype.component | 5 +- solenv/bin/native-code.py | 3 - 6 files changed, 18 insertions(+), 99 deletions(-)
New commits: commit 92cccb9a7ead4a7f106db8c79e142013dd214441 Author: Noel Grandin <[email protected]> AuthorDate: Sat Jul 11 15:06:06 2020 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Sat Jul 11 18:33:18 2020 +0200 dtrans/mcnttype: create instances with uno constructors See tdf#74608 for motivation. Also drop mutex, no need to lock when we're just constructing something. Change-Id: I5e845ae2fbb03fc4f38d0ee85b2061891fa0993f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98560 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/dtrans/Library_mcnttype.mk b/dtrans/Library_mcnttype.mk index 2442a01cb721..fd023a7eb4eb 100644 --- a/dtrans/Library_mcnttype.mk +++ b/dtrans/Library_mcnttype.mk @@ -33,7 +33,6 @@ $(eval $(call gb_Library_use_libraries,mcnttype,\ $(eval $(call gb_Library_add_exception_objects,mcnttype,\ dtrans/source/cnttype/mcnttfactory \ dtrans/source/cnttype/mcnttype \ - dtrans/source/cnttype/mctfentry \ )) # vim: set noet sw=4 ts=4: diff --git a/dtrans/source/cnttype/mcnttfactory.cxx b/dtrans/source/cnttype/mcnttfactory.cxx index 49db6274619b..4a3e6fbb4d95 100644 --- a/dtrans/source/cnttype/mcnttfactory.cxx +++ b/dtrans/source/cnttype/mcnttfactory.cxx @@ -18,33 +18,22 @@ */ #include <cppuhelper/supportsservice.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> #include "mcnttfactory.hxx" #include "mcnttype.hxx" -#define MIMECONTENTTYPEFACTORY_IMPL_NAME "com.sun.star.datatransfer.MimeCntTypeFactory" - using namespace ::osl; using namespace ::cppu; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::datatransfer; -namespace -{ - Sequence< OUString > MimeContentTypeFactory_getSupportedServiceNames( ) - { - Sequence< OUString > aRet { "com.sun.star.datatransfer.MimeContentTypeFactory" }; - return aRet; - } -} - CMimeContentTypeFactory::CMimeContentTypeFactory() { } Reference< XMimeContentType > CMimeContentTypeFactory::createMimeContentType( const OUString& aContentType ) { - MutexGuard aGuard( m_aMutex ); return Reference< XMimeContentType >( new CMimeContentType( aContentType ) ); } @@ -52,7 +41,7 @@ Reference< XMimeContentType > CMimeContentTypeFactory::createMimeContentType( co OUString SAL_CALL CMimeContentTypeFactory::getImplementationName( ) { - return MIMECONTENTTYPEFACTORY_IMPL_NAME; + return "com.sun.star.datatransfer.MimeCntTypeFactory"; } sal_Bool SAL_CALL CMimeContentTypeFactory::supportsService( const OUString& ServiceName ) @@ -62,7 +51,17 @@ sal_Bool SAL_CALL CMimeContentTypeFactory::supportsService( const OUString& Serv Sequence< OUString > SAL_CALL CMimeContentTypeFactory::getSupportedServiceNames( ) { - return MimeContentTypeFactory_getSupportedServiceNames( ); + return { "com.sun.star.datatransfer.MimeContentTypeFactory" }; +} + + +// returns a factory to create XFilePicker-Services + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +dtrans_CMimeContentTypeFactory_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire( new CMimeContentTypeFactory() ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/source/cnttype/mcnttfactory.hxx b/dtrans/source/cnttype/mcnttfactory.hxx index d79cd6063ff4..06d671c6bb1a 100644 --- a/dtrans/source/cnttype/mcnttfactory.hxx +++ b/dtrans/source/cnttype/mcnttfactory.hxx @@ -45,9 +45,6 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - -private: - ::osl::Mutex m_aMutex; }; #endif diff --git a/dtrans/source/cnttype/mctfentry.cxx b/dtrans/source/cnttype/mctfentry.cxx deleted file mode 100644 index 43d165876230..000000000000 --- a/dtrans/source/cnttype/mctfentry.cxx +++ /dev/null @@ -1,78 +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 <cppuhelper/factory.hxx> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/container/XSet.hpp> -#include <com/sun/star/datatransfer/XMimeContentTypeFactory.hpp> -#include "mcnttfactory.hxx" - -#define MIMECONTENTTYPEFACTORY_IMPL_NAME "com.sun.star.datatransfer.MimeCntTypeFactory" - -using namespace ::cppu; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::datatransfer; - -namespace -{ - - // functions to create a new Clipboard instance; is needed by factory helper implementation - // @param rServiceManager - service manager, useful if the component needs other uno services - // so we should give it to every UNO-Implementation component - - Reference< XInterface > createInstance( const Reference< XMultiServiceFactory >& ) - { - return Reference< XInterface >( static_cast< XMimeContentTypeFactory* >( new CMimeContentTypeFactory() ) ); - } -} - -extern "C" -{ - -// component_getFactory -// returns a factory to create XFilePicker-Services - -SAL_DLLPUBLIC_EXPORT void* mcnttype_component_getFactory( const char* pImplName, void* pSrvManager, void* /*pRegistryKey*/ ) -{ - void* pRet = nullptr; - - if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, MIMECONTENTTYPEFACTORY_IMPL_NAME ) ) ) - { - Sequence<OUString> aSNS { "com.sun.star.datatransfer.MimeContentTypeFactory" }; - - Reference< XSingleServiceFactory > xFactory ( createSingleFactory( - static_cast< XMultiServiceFactory* > ( pSrvManager ), - OUString::createFromAscii( pImplName ), - createInstance, - aSNS ) ); - if ( xFactory.is() ) - { - xFactory->acquire(); - pRet = xFactory.get(); - } - } - - return pRet; -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dtrans/util/mcnttype.component b/dtrans/util/mcnttype.component index faca00cefcda..077181d422b0 100644 --- a/dtrans/util/mcnttype.component +++ b/dtrans/util/mcnttype.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="mcnttype" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.datatransfer.MimeCntTypeFactory"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.datatransfer.MimeCntTypeFactory" + constructor="dtrans_CMimeContentTypeFactory_get_implementation"> <service name="com.sun.star.datatransfer.MimeContentTypeFactory"/> </implementation> </component> diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index e62c4b90b12e..cbd3f9eb1779 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -43,7 +43,6 @@ core_factory_list = [ ("libxmlfdlo.a", "xmlfd_component_getFactory"), ("libxmlfalo.a", "xmlfa_component_getFactory"), ("libodfflatxmllo.a", "odfflatxml_component_getFactory"), - ("libmcnttype.a", "mcnttype_component_getFactory"), ("libvcllo.a", "vcl_component_getFactory"), ("libspelllo.a", "spell_component_getFactory", "#ifndef IOS"), ("libpdffilterlo.a", "pdffilter_component_getFactory"), @@ -148,6 +147,8 @@ core_constructor_list = [ "com_sun_star_comp_dba_ORowSet_get_implementation", # drawinglayer/drawinglayer.component "drawinglayer_XPrimitive2DRenderer", +# dtrans/util/mcnttype.component + "dtrans_CMimeContentTypeFactory_get_implementation", # emfio/emfio.component "emfio_emfreader_XEmfParser_get_implementation", # eventattacher/source/evtatt.component _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
