From 5ba0ccb2964da46d32ade0c87baf2d407cb52a8a Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 16 Jun 2025 08:01:55 +0200 Subject: [PATCH] [API CHANGE] Drop ColorPicker, AsynchronousColorPicker The unpublished com::sun::star::cui::ColorPicker and com::sun::star::cui::AsynchronousColorPicker UNO services were previously used to be able to use ColorPickerDialog (implemented in cui) from svtools. That's no longer the case since commit 0905c23676fe34a5346683ee46568e4d1c58806a Author: Michael Weghorn Date: Fri Jun 13 18:27:09 2025 +0200 Stop using UNO abstraction for color picker , so drop the now unused services and the ColorPicker class that implemented them. Change-Id: I9264707df57e46192a393f6736257c413e5d9831 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186538 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Michael Weghorn --- cui/source/dialogs/colorpicker.cxx | 135 ------------------ cui/util/cui.component | 6 - offapi/UnoApi_offapi.mk | 2 - .../sun/star/cui/AsynchronousColorPicker.idl | 34 ----- offapi/com/sun/star/cui/ColorPicker.idl | 35 ----- solenv/bin/native-code.py | 1 - 6 files changed, 213 deletions(-) delete mode 100644 offapi/com/sun/star/cui/AsynchronousColorPicker.idl delete mode 100644 offapi/com/sun/star/cui/ColorPicker.idl diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index e965dbc4dea0..324f1485c85a 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -1009,139 +1009,4 @@ void ColorPickerDialog::setColorComponent( ColorComponent nComp, double dValue ) } } -typedef ::comphelper::WeakComponentImplHelper< XServiceInfo, XExecutableDialog, XAsynchronousExecutableDialog, XInitialization, XPropertyAccess > ColorPickerBase; - -namespace { - -class ColorPicker : public ColorPickerBase -{ -public: - explicit ColorPicker(); - - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override; - - // XInitialization - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - - // XPropertyAccess - virtual Sequence< PropertyValue > SAL_CALL getPropertyValues( ) override; - virtual void SAL_CALL setPropertyValues( const Sequence< PropertyValue >& aProps ) override; - - // XExecutableDialog - virtual void SAL_CALL setTitle( const OUString& aTitle ) override; - virtual sal_Int16 SAL_CALL execute( ) override; - - // XAsynchronousExecutableDialog - virtual void SAL_CALL setDialogTitle( const OUString& aTitle ) override; - virtual void SAL_CALL startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener ) override; - -private: - Color mnColor; - sal_Int16 mnMode; - Reference mxParent; -}; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* -com_sun_star_cui_ColorPicker_get_implementation( - css::uno::XComponentContext*, css::uno::Sequence const&) -{ - return cppu::acquire( new ColorPicker ); -} - - -constexpr OUString gsColorKey( u"Color"_ustr ); -constexpr OUStringLiteral gsModeKey( u"Mode" ); - -ColorPicker::ColorPicker() - : mnColor( 0 ) - , mnMode( 0 ) -{ -} - -// XInitialization -void SAL_CALL ColorPicker::initialize( const Sequence< Any >& aArguments ) -{ - if( aArguments.getLength() == 1 ) - { - aArguments[0] >>= mxParent; - } -} - -// XInitialization -OUString SAL_CALL ColorPicker::getImplementationName( ) -{ - return u"com.sun.star.cui.ColorPicker"_ustr; -} - -sal_Bool SAL_CALL ColorPicker::supportsService( const OUString& sServiceName ) -{ - return cppu::supportsService(this, sServiceName); -} - -Sequence< OUString > SAL_CALL ColorPicker::getSupportedServiceNames( ) -{ - return { u"com.sun.star.ui.dialogs.ColorPicker"_ustr, - u"com.sun.star.ui.dialogs.AsynchronousColorPicker"_ustr }; -} - -// XPropertyAccess -Sequence< PropertyValue > SAL_CALL ColorPicker::getPropertyValues( ) -{ - Sequence< PropertyValue > props{ comphelper::makePropertyValue(gsColorKey, mnColor) }; - return props; -} - -void SAL_CALL ColorPicker::setPropertyValues( const Sequence< PropertyValue >& aProps ) -{ - for ( const PropertyValue& rProp : aProps ) - { - if( rProp.Name == gsColorKey ) - { - rProp.Value >>= mnColor; - } - else if( rProp.Name == gsModeKey ) - { - rProp.Value >>= mnMode; - } - } -} - -// XExecutableDialog -void SAL_CALL ColorPicker::setTitle( const OUString& ) -{ -} - -sal_Int16 SAL_CALL ColorPicker::execute() -{ - std::unique_ptr xDlg(new ColorPickerDialog(Application::GetFrameWeld(mxParent), mnColor, mnMode)); - sal_Int16 ret = xDlg->run(); - if (ret) - mnColor = xDlg->GetColor(); - return ret; -} - -// XAsynchronousExecutableDialog -void SAL_CALL ColorPicker::setDialogTitle( const OUString& ) -{ -} - -void SAL_CALL ColorPicker::startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener ) -{ - std::shared_ptr xDlg = std::make_shared(Application::GetFrameWeld(mxParent), mnColor, mnMode); - rtl::Reference xThis(this); - weld::DialogController::runAsync(xDlg, [xThis=std::move(xThis), xDlg, xListener] (sal_Int32 nResult) { - if (nResult) - xThis->mnColor = xDlg->GetColor(); - - sal_Int16 nRet = static_cast(nResult); - css::ui::dialogs::DialogClosedEvent aEvent( *xThis, nRet ); - xListener->dialogClosed( aEvent ); - }); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/util/cui.component b/cui/util/cui.component index 6c72ec90c872..2e9a7a00430b 100644 --- a/cui/util/cui.component +++ b/cui/util/cui.component @@ -19,12 +19,6 @@ - - - - - diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index b25e2a261ef4..836d02e19442 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -99,8 +99,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/configuration,\ theDefaultProvider \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/cui,\ - AsynchronousColorPicker \ - ColorPicker \ GetCreateDialogFactoryService \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/datatransfer,\ diff --git a/offapi/com/sun/star/cui/AsynchronousColorPicker.idl b/offapi/com/sun/star/cui/AsynchronousColorPicker.idl deleted file mode 100644 index 0740dd30eb2b..000000000000 --- a/offapi/com/sun/star/cui/AsynchronousColorPicker.idl +++ /dev/null @@ -1,34 +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 . - */ - - -module com { module sun { module star { module cui { - -/** - @since LibreOffice 7.3 - */ -service AsynchronousColorPicker : com::sun::star::ui::dialogs::XAsynchronousExecutableDialog -{ - createWithParent([in] com::sun::star::awt::XWindow Parent); -}; - -}; }; }; }; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/cui/ColorPicker.idl b/offapi/com/sun/star/cui/ColorPicker.idl deleted file mode 100644 index 4490b7cd08d3..000000000000 --- a/offapi/com/sun/star/cui/ColorPicker.idl +++ /dev/null @@ -1,35 +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 . - */ - - -module com { module sun { module star { module cui { - -/** - @since LibreOffice 4.1 - */ -service ColorPicker : com::sun::star::ui::dialogs::XExecutableDialog -{ - createWithParent([in] com::sun::star::awt::XWindow Parent); -}; - - -}; }; }; }; - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 156c28d20121..79401d0e3ea6 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -116,7 +116,6 @@ core_constructor_list = [ # cppcanvas/source/uno/mtfrenderer.component "com_sun_star_comp_rendering_MtfRenderer_get_implementation", # cui/util/cui.component - ("com_sun_star_cui_ColorPicker_get_implementation", "#if !ENABLE_FUZZERS"), ("com_sun_star_cui_GetCreateDialogFactoryService", "#if !ENABLE_FUZZERS"), # dbaccess/util/dba.component "com_sun_star_comp_dba_DataAccessDescriptorFactory",