diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-05 15:37:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-06 12:25:13 +0200 |
commit | 29c5e1ccbe28751297699eb184a861ee6b2f2f7e (patch) | |
tree | 6a6e86f3fc6eeef6a5f4f467dd9fba1b29b9135a /cui | |
parent | 088b7f419f48f3390aac22587bbd92e9e027d5b1 (diff) |
cui,cppcanvas: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: Id603bc26f95d3da86b8c7360a7bde8eee97049ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98141
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/Library_cui.mk | 1 | ||||
-rw-r--r-- | cui/source/dialogs/colorpicker.cxx | 20 | ||||
-rw-r--r-- | cui/source/inc/colorpicker.hxx | 47 | ||||
-rw-r--r-- | cui/source/uno/services.cxx | 41 | ||||
-rw-r--r-- | cui/util/cui.component | 5 |
5 files changed, 9 insertions, 105 deletions
diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 09f355776341..583cc5c74346 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -226,7 +226,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/tabpages/tpshadow \ cui/source/tabpages/tptrans \ cui/source/tabpages/transfrm \ - cui/source/uno/services \ )) # vim: set noet sw=4 ts=4: diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index ca5172f800ec..2dc7e779740c 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -33,7 +33,6 @@ #include <vcl/weld.hxx> #include <svx/hexcolorcontrol.hxx> #include <basegfx/color/bcolortools.hxx> -#include <colorpicker.hxx> #include <cmath> #include <o3tl/typed_flags_set.hxx> @@ -1240,20 +1239,13 @@ private: } -OUString ColorPicker_getImplementationName() +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_cui_ColorPicker_get_implementation( + css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&) { - return "com.sun.star.cui.ColorPicker"; + return cppu::acquire( new ColorPicker ); } -Reference< XInterface > ColorPicker_createInstance( Reference< XComponentContext > const & ) -{ - return static_cast<XWeak*>( new ColorPicker ); -} - -Sequence< OUString > ColorPicker_getSupportedServiceNames() -{ - return { "com.sun.star.ui.dialogs.ColorPicker" }; -} const OUStringLiteral gsColorKey( "Color" ); const OUStringLiteral gsModeKey( "Mode" ); @@ -1277,7 +1269,7 @@ void SAL_CALL ColorPicker::initialize( const Sequence< Any >& aArguments ) // XInitialization OUString SAL_CALL ColorPicker::getImplementationName( ) { - return ColorPicker_getImplementationName(); + return "com.sun.star.cui.ColorPicker"; } sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName ) @@ -1287,7 +1279,7 @@ sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName ) Sequence< OUString > SAL_CALL ColorPicker::getSupportedServiceNames( ) { - return ColorPicker_getSupportedServiceNames(); + return { "com.sun.star.ui.dialogs.ColorPicker" }; } // XPropertyAccess diff --git a/cui/source/inc/colorpicker.hxx b/cui/source/inc/colorpicker.hxx deleted file mode 100644 index 7c05ebabcc46..000000000000 --- a/cui/source/inc/colorpicker.hxx +++ /dev/null @@ -1,47 +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_CUI_SOURCE_INC_COLORPICKER_HXX -#define INCLUDED_CUI_SOURCE_INC_COLORPICKER_HXX - -#include <sal/config.h> - -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <rtl/ustring.hxx> - -namespace com::sun::star::uno { - class XComponentContext; - class XInterface; -} - -namespace cui { - -OUString ColorPicker_getImplementationName(); - -css::uno::Reference<css::uno::XInterface> ColorPicker_createInstance( - css::uno::Reference<css::uno::XComponentContext> const &); - -/// @throws css::uno::RuntimeException -css::uno::Sequence<OUString> ColorPicker_getSupportedServiceNames(); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/uno/services.cxx b/cui/source/uno/services.cxx deleted file mode 100644 index 62c6bbaf47a1..000000000000 --- a/cui/source/uno/services.cxx +++ /dev/null @@ -1,41 +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 <cppuhelper/factory.hxx> -#include <cppuhelper/implementationentry.hxx> - -#include <colorpicker.hxx> - -using namespace com::sun::star; - -namespace -{ - cppu::ImplementationEntry const entries[] = { - { &::cui::ColorPicker_createInstance, &::cui::ColorPicker_getImplementationName, &::cui::ColorPicker_getSupportedServiceNames, &cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } - }; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * cui_component_getFactory( char const * implName, void * serviceManager, void * registryKey) -{ - return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/util/cui.component b/cui/util/cui.component index e4a5c124ff49..37023b4e1fa1 100644 --- a/cui/util/cui.component +++ b/cui/util/cui.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="cui" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.cui.ColorPicker"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.cui.ColorPicker" + constructor="com_sun_star_cui_ColorPicker_get_implementation"> <service name="com.sun.star.ui.dialogs.ColorPicker"/> </implementation> </component> |