diff options
author | Chris Sherlock <chris.sherlock@collabora.com> | 2015-03-02 16:25:59 +1100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-11 22:38:02 +0100 |
commit | 0214898aa695bc17a40007e82dad3542d855ea70 (patch) | |
tree | cb897b453211c6b94942b485b2938414d1c08b28 /svl | |
parent | 6661f6fee34d3c24bb9a054d5c24566c311e4a09 (diff) |
svl: use constructor syntax in svl.component
Change-Id: I2cb78695ede4017dfc4594175268e3d3c7eb4eca
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/Library_svl.mk | 1 | ||||
-rw-r--r-- | svl/source/inc/registerservices.hxx | 46 | ||||
-rw-r--r-- | svl/source/numbers/numfmuno.cxx | 17 | ||||
-rw-r--r-- | svl/source/numbers/supservs.cxx | 16 | ||||
-rw-r--r-- | svl/source/numbers/supservs.hxx | 12 | ||||
-rw-r--r-- | svl/source/uno/pathservice.cxx | 13 | ||||
-rw-r--r-- | svl/source/uno/registerservices.cxx | 94 | ||||
-rw-r--r-- | svl/util/svl.component | 9 |
8 files changed, 40 insertions, 168 deletions
diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk index 075415776025..db08af5f4b3a 100644 --- a/svl/Library_svl.mk +++ b/svl/Library_svl.mk @@ -139,7 +139,6 @@ $(eval $(call gb_Library_add_exception_objects,svl,\ svl/source/svsql/converter \ svl/source/undo/undo \ svl/source/uno/pathservice \ - svl/source/uno/registerservices \ )) ifeq ($(OS),WNT) diff --git a/svl/source/inc/registerservices.hxx b/svl/source/inc/registerservices.hxx deleted file mode 100644 index a6af0070a06c..000000000000 --- a/svl/source/inc/registerservices.hxx +++ /dev/null @@ -1,46 +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_SVL_SOURCE_INC_REGISTERSERVICES_HXX -#define INCLUDED_SVL_SOURCE_INC_REGISTERSERVICES_HXX - -#include <sal/config.h> - -#include <com/sun/star/uno/Reference.hxx> -#include <sal/types.h> - -namespace com { namespace sun { namespace star { - namespace lang { class XMultiServiceFactory; } - namespace uno { class XInterface; } -} } } - -css::uno::Reference<css::uno::XInterface> SAL_CALL PathService_CreateInstance( - css::uno::Reference<css::lang::XMultiServiceFactory> const &); - -css::uno::Reference<css::uno::XInterface> SAL_CALL -SvNumberFormatsSupplierServiceObject_CreateInstance( - css::uno::Reference<css::lang::XMultiServiceFactory> const &); - -css::uno::Reference<css::uno::XInterface> SAL_CALL -SvNumberFormatterServiceObj_CreateInstance( - css::uno::Reference<css::lang::XMultiServiceFactory> const &); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx index 15e10a764760..f486ed7a0071 100644 --- a/svl/source/numbers/numfmuno.cxx +++ b/svl/source/numbers/numfmuno.cxx @@ -33,8 +33,6 @@ #include <svl/zformat.hxx> #include <svl/itemprop.hxx> -#include <registerservices.hxx> - using namespace com::sun::star; #define PROPERTYNAME_FMTSTR "FormatString" @@ -115,11 +113,6 @@ SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj() { } -com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvNumberFormatterServiceObj_CreateInstance( SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) -{ - return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new SvNumberFormatterServiceObj ); -} - // XNumberFormatter void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier( const uno::Reference<util::XNumberFormatsSupplier>& _xSupplier ) @@ -1099,4 +1092,14 @@ uno::Sequence<OUString> SAL_CALL SvNumberFormatSettingsObj::getSupportedServiceN return aRet; } + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_uno_util_numbers_SvNumberFormatterServiceObject_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new SvNumberFormatterServiceObj()); +} + + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx index a2f609914f3a..416ddef688ae 100644 --- a/svl/source/numbers/supservs.cxx +++ b/svl/source/numbers/supservs.cxx @@ -22,6 +22,7 @@ #include <comphelper/sharedmutex.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/weak.hxx> #include <i18nlangtag/mslangid.hxx> #include <tools/debug.hxx> #include <osl/mutex.hxx> @@ -29,7 +30,6 @@ #include <tools/stream.hxx> #include <svl/instrm.hxx> -#include <registerservices.hxx> #include <strmadpt.hxx> using namespace ::com::sun::star::uno; @@ -39,10 +39,6 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::util; using namespace ::utl; -Reference< XInterface > SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory) -{ - return static_cast< ::cppu::OWeakObject* >(new SvNumberFormatsSupplierServiceObject( comphelper::getComponentContext(_rxFactory) )); -} SvNumberFormatsSupplierServiceObject::SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) :m_pOwnFormatter(NULL) @@ -169,4 +165,14 @@ void SvNumberFormatsSupplierServiceObject::implEnsureFormatter() } } + +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation(::com::sun::star::uno::XComponentContext* context, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) +{ + return cppu::acquire(new SvNumberFormatsSupplierServiceObject(context)); +} + + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/numbers/supservs.hxx b/svl/source/numbers/supservs.hxx index b2bed8e78c74..e49f3996835c 100644 --- a/svl/source/numbers/supservs.hxx +++ b/svl/source/numbers/supservs.hxx @@ -25,7 +25,10 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <registerservices.hxx> +extern "C" ::com::sun::star::uno::XInterface * + SAL_CALL com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation( + ::com::sun::star::uno::XComponentContext* context, + ::com::sun::star::uno::Sequence<css::uno::Any> const &); /** * SvNumberFormatsSupplierServiceObject - a number formats supplier which @@ -40,9 +43,10 @@ class SvNumberFormatsSupplierServiceObject ,public ::com::sun::star::lang::XServiceInfo { // don't want the Set-/GetNumberFormatter to be accessible from outside - friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&); + friend ::com::sun::star::uno::XInterface * + SAL_CALL com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation( + ::com::sun::star::uno::XComponentContext* context, + ::com::sun::star::uno::Sequence<css::uno::Any> const &); protected: SvNumberFormatter* m_pOwnFormatter; diff --git a/svl/source/uno/pathservice.cxx b/svl/source/uno/pathservice.cxx index 91a640d36347..8e02fd804482 100644 --- a/svl/source/uno/pathservice.cxx +++ b/svl/source/uno/pathservice.cxx @@ -26,8 +26,7 @@ #include <com/sun/star/frame/XConfigManager.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> - -#include <registerservices.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> class PathService : public ::cppu::WeakImplHelper2< css::frame::XConfigManager, css::lang::XServiceInfo > { @@ -81,13 +80,11 @@ public: }; - -css::uno::Reference< css::uno::XInterface > PathService_CreateInstance ( - SAL_UNUSED_PARAMETER const css::uno::Reference< - css::lang::XMultiServiceFactory > &) +extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL +com_sun_star_comp_svl_PathService_get_implementation(::com::sun::star::uno::XComponentContext*, + ::com::sun::star::uno::Sequence<css::uno::Any> const &) { - return css::uno::Reference< css::uno::XInterface >( - static_cast< cppu::OWeakObject* >(new PathService())); + return cppu::acquire(new PathService()); } diff --git a/svl/source/uno/registerservices.cxx b/svl/source/uno/registerservices.cxx deleted file mode 100644 index cd28b250dc7e..000000000000 --- a/svl/source/uno/registerservices.cxx +++ /dev/null @@ -1,94 +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 <sal/types.h> -#include <rtl/ustring.hxx> -#include <cppuhelper/factory.hxx> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/registry/XRegistryKey.hpp> -#include <svl/svldllapi.h> - -#include <registerservices.hxx> - -using css::uno::Reference; -using css::uno::Sequence; - -extern "C" -{ - -SVL_DLLPUBLIC void* SAL_CALL svl_component_getFactory ( - const sal_Char * pImplementationName, void * _pServiceManager, - SAL_UNUSED_PARAMETER void * /* _pRegistryKey*/) -{ - void * pResult = 0; - if ( _pServiceManager ) - { - Reference< css::lang::XSingleServiceFactory > xFactory; - if (rtl_str_compare( - pImplementationName, - "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - "com.sun.star.util.NumberFormatsSupplier"; - - xFactory = ::cppu::createSingleFactory( - reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager), - OUString::createFromAscii( pImplementationName ), - SvNumberFormatsSupplierServiceObject_CreateInstance, - aServiceNames); - } - else if (rtl_str_compare( - pImplementationName, - "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = "com.sun.star.util.NumberFormatter"; - - xFactory = ::cppu::createSingleFactory( - reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager), - OUString::createFromAscii( pImplementationName ), - SvNumberFormatterServiceObj_CreateInstance, - aServiceNames); - } - else if (rtl_str_compare ( - pImplementationName, "com.sun.star.comp.svl.PathService") == 0) - { - Sequence< OUString > aServiceNames(1); - aServiceNames.getArray()[0] = - "com.sun.star.config.SpecialConfigManager"; - xFactory = ::cppu::createSingleFactory ( - reinterpret_cast< css::lang::XMultiServiceFactory* >( _pServiceManager ), - OUString::createFromAscii( pImplementationName ), - PathService_CreateInstance, - aServiceNames); - } - if ( xFactory.is() ) - { - xFactory->acquire(); - pResult = xFactory.get(); - } - } - return pResult; -} - -} // "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/util/svl.component b/svl/util/svl.component index 64c0cd41df02..e50f91874abc 100644 --- a/svl/util/svl.component +++ b/svl/util/svl.component @@ -19,13 +19,16 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" prefix="svl" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.svl.PathService"> + <implementation name="com.sun.star.comp.svl.PathService" + constructor="com_sun_star_comp_svl_PathService_get_implementation"> <service name="com.sun.star.config.SpecialConfigManager"/> </implementation> - <implementation name="com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject"> + <implementation name="com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject" + constructor="com_sun_star_uno_util_numbers_SvNumberFormatsSupplierServiceObject_get_implementation"> <service name="com.sun.star.util.NumberFormatsSupplier"/> </implementation> - <implementation name="com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject"> + <implementation name="com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject" + constructor="com_sun_star_uno_util_numbers_SvNumberFormatterServiceObject_get_implementation"> <service name="com.sun.star.util.NumberFormatter"/> </implementation> </component> |