cui/source/dialogs/colorpicker.cxx | 141 -------------------- cui/source/factory/dlgfact.cxx | 4 cui/source/factory/dlgfact.hxx | 2 cui/source/inc/colorpicker.hxx | 3 cui/util/cui.component | 6 include/vcl/ColorDialog.hxx | 7 include/vcl/abstdlg.hxx | 3 offapi/UnoApi_offapi.mk | 2 offapi/com/sun/star/cui/AsynchronousColorPicker.idl | 34 ---- offapi/com/sun/star/cui/ColorPicker.idl | 35 ---- solenv/bin/native-code.py | 1 vcl/source/app/ColorDialog.cxx | 3 12 files changed, 16 insertions(+), 225 deletions(-)
New commits: commit 4ab724bf84b3647539c2fc11062ffbead3cda5ab Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jun 16 09:02:52 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Jun 16 15:37:38 2025 +0200 Use vcl::ColorPickerMode instead of sal_Int16 param Now that the UNO abstraction and corresponding services have been dropped in commit 0905c23676fe34a5346683ee46568e4d1c58806a Author: Michael Weghorn <m.wegh...@posteo.de> Date: Fri Jun 13 18:27:09 2025 +0200 Stop using UNO abstraction for color picker and Change-Id: I9264707df57e46192a393f6736257c413e5d9831 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon Jun 16 08:01:55 2025 +0200 [API CHANGE] Drop ColorPicker, AsynchronousColorPicker , no longer pass a sal_Int16 param to the ColorPickerDialog ctor, but use the vcl::ColorPickerMode enum directly without casting. This also means that there is no more need for the underlying int values of the enum values to have a specific value, so no longer set these explicitly. Change-Id: Ife2a7b0672bacc73b3001ef0e2e57f4626837655 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186539 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 324f1485c85a..1478ff5f250a 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -30,6 +30,7 @@ #include <comphelper/propertyvalue.hxx> #include <comphelper/compbase.hxx> #include <cppuhelper/supportsservice.hxx> +#include <vcl/ColorDialog.hxx> #include <vcl/svapp.hxx> #include <basegfx/color/bcolortools.hxx> #include <cmath> @@ -586,7 +587,7 @@ void ColorSliderControl::SetValue(const Color& rColor, ColorMode eMode, double d } } -ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, const Color& rColor, sal_Int16 nDialogMode) +ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, const Color& rColor, vcl::ColorPickerMode eDialogMode) : SfxDialogController(pParent, u"cui/ui/colorpickerdialog.ui"_ustr, u"ColorPicker"_ustr) , m_xColorField(new weld::CustomWeld(*m_xBuilder, u"colorField"_ustr, m_aColorField)) , m_xColorSlider(new weld::CustomWeld(*m_xBuilder, u"colorSlider"_ustr, m_aColorSlider)) @@ -645,8 +646,7 @@ ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, const Color& rColor, m_xRBSaturation->connect_toggled( aLink2 ); m_xRBBrightness->connect_toggled( aLink2 ); - // modify - if (nDialogMode == 2) + if (eDialogMode == vcl::ColorPickerMode::Modify) m_xColorPrevious->show(); SetColor(rColor); diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 56b09e95d503..9dd24f70179e 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1440,10 +1440,10 @@ public: VclPtr<AbstractColorPickerDialog> AbstractDialogFactory_Impl::CreateColorPickerDialog(weld::Window* pParent, Color nColor, - sal_Int16 nMode) + vcl::ColorPickerMode eMode) { std::unique_ptr<ColorPickerDialog> pColorPickerDialog( - std::make_unique<ColorPickerDialog>(pParent, nColor, nMode)); + std::make_unique<ColorPickerDialog>(pParent, nColor, eMode)); return VclPtr<AbstractColorPickerDialog_Impl>::Create(std::move(pColorPickerDialog)); } diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 0f332eed3dff..4c3a9a4b436c 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -60,7 +60,7 @@ public: virtual VclPtr<SfxAbstractLinksDialog> CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML = false, sfx2::SvBaseLink* p=nullptr) override; virtual VclPtr<AbstractColorPickerDialog> - CreateColorPickerDialog(weld::Window* pParent, Color nColor, sal_Int16 nMode) override; + CreateColorPickerDialog(weld::Window* pParent, Color nColor, vcl::ColorPickerMode eMode) override; virtual VclPtr<AbstractHangulHanjaConversionDialog> CreateHangulHanjaConversionDialog(weld::Widget* pParent) override; virtual VclPtr<AbstractThesaurusDialog> CreateThesaurusDialog(weld::Widget*, diff --git a/cui/source/inc/colorpicker.hxx b/cui/source/inc/colorpicker.hxx index 740280c2b8ef..8dfcdd700ad5 100644 --- a/cui/source/inc/colorpicker.hxx +++ b/cui/source/inc/colorpicker.hxx @@ -19,6 +19,7 @@ #pragma once +#include <vcl/ColorDialog.hxx> #include <vcl/customweld.hxx> #include <vcl/event.hxx> #include <vcl/svapp.hxx> @@ -204,7 +205,7 @@ private: double mdCyan, mdMagenta, mdYellow, mdKey; public: - ColorPickerDialog(weld::Window* pParent, const Color& rColor, sal_Int16 nDialogMode); + ColorPickerDialog(weld::Window* pParent, const Color& rColor, vcl::ColorPickerMode eDialogMode); Color GetColor() const; void SetColor(const Color& rColor); diff --git a/include/vcl/ColorDialog.hxx b/include/vcl/ColorDialog.hxx index 9c3823b8a56a..f27e1be8473b 100644 --- a/include/vcl/ColorDialog.hxx +++ b/include/vcl/ColorDialog.hxx @@ -21,18 +21,19 @@ #include <tools/color.hxx> #include <tools/link.hxx> -#include <vcl/abstdlg.hxx> #include <vcl/dllapi.h> +#include <vcl/vclptr.hxx> #include <functional> +class AbstractColorPickerDialog; + namespace weld { class Window; } namespace vcl { // Select is the default. - // These values must match the constants used in ColorPickerDialog in cui/source/dialogs/colorpicker.cxx - enum class ColorPickerMode { Select = 0, Modify = 2 }; + enum class ColorPickerMode { Select, Modify }; } class VCL_DLLPUBLIC ColorDialog final diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index 03f493d569bf..61d3ea9f5f04 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -22,6 +22,7 @@ #include <sal/types.h> #include <rtl/ustring.hxx> #include <tools/color.hxx> +#include <vcl/ColorDialog.hxx> #include <vcl/dllapi.h> #include <vcl/vclptr.hxx> #include <vcl/vclreferencebase.hxx> @@ -187,7 +188,7 @@ public: virtual VclPtr<VclAbstractDialog> CreateVclDialog(weld::Window* pParent, sal_uInt32 nId) = 0; virtual VclPtr<AbstractColorPickerDialog> - CreateColorPickerDialog(weld::Window* pParent, Color nColor, sal_Int16 nMode) = 0; + CreateColorPickerDialog(weld::Window* pParent, Color nColor, vcl::ColorPickerMode eMode) = 0; // creates instance of PasswordToOpenModifyDialog from cui virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) = 0; diff --git a/vcl/source/app/ColorDialog.cxx b/vcl/source/app/ColorDialog.cxx index 8ad997f5873b..e739ba381692 100644 --- a/vcl/source/app/ColorDialog.cxx +++ b/vcl/source/app/ColorDialog.cxx @@ -18,13 +18,14 @@ */ #include <vcl/ColorDialog.hxx> +#include <vcl/abstdlg.hxx> #include <vcl/weld.hxx> ColorDialog::ColorDialog(weld::Window* pParent, vcl::ColorPickerMode eMode) { VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); assert(pFact); - m_pDialog = pFact->CreateColorPickerDialog(pParent, COL_BLACK, static_cast<sal_Int16>(eMode)); + m_pDialog = pFact->CreateColorPickerDialog(pParent, COL_BLACK, eMode); assert(m_pDialog); } commit 5ba0ccb2964da46d32ade0c87baf2d407cb52a8a Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Jun 16 08:01:55 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Jun 16 15:37:30 2025 +0200 [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 <m.wegh...@posteo.de> 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 <noel.gran...@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> 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<css::awt::XWindow> mxParent; -}; - -} - -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 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<ColorPickerDialog> 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<ColorPickerDialog> xDlg = std::make_shared<ColorPickerDialog>(Application::GetFrameWeld(mxParent), mnColor, mnMode); - rtl::Reference<ColorPicker> 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<sal_Int16>(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 @@ <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" 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.cui.AsynchronousColorPicker"/> - <service name="com.sun.star.ui.dialogs.ColorPicker"/> - <service name="com.sun.star.ui.dialogs.AsynchronousColorPicker"/> - </implementation> <implementation name="com.sun.star.cui.GetCreateDialogFactoryService" constructor="com_sun_star_cui_GetCreateDialogFactoryService"> <service name="com.sun.star.cui.GetCreateDialogFactoryService"/> 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",