chart2/source/controller/inc/ChartController.hxx | 6 ++--- chart2/source/controller/main/ChartController.cxx | 18 ++-------------- chart2/source/controller/main/ChartController_Tools.cxx | 12 +++++----- 3 files changed, 12 insertions(+), 24 deletions(-)
New commits: commit 242fb77bcd2ac23a4ca9e78faed2f8518a27bf63 Author: Mike Kaganski <[email protected]> AuthorDate: Mon Jul 7 09:51:48 2025 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Jul 7 16:19:31 2025 +0200 Avoid Any -> value -> Any back-and-forth These values can be forwarded as is, avoiding the overhead. Change-Id: I82314a92b7fd7e711d410a4e43fe5d93caaa4bac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187464 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 22365598a3ebd4eef1c367fbff5b3cdf37980a2f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187478 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index e86438675e8e..131ed3059d2e 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -538,10 +538,10 @@ private: void executeDispatch_LOKSetTextSelection(int nType, int nX, int nY); void executeDispatch_LOKPieSegmentDragging(int nOffset); - void executeDispatch_FillColor(sal_uInt32 nColor); + void executeDispatch_FillColor(const css::uno::Any& rColor); void executeDispatch_FillGradient(std::u16string_view sJSONGradient); - void executeDispatch_LineColor(sal_uInt32 nColor); - void executeDispatch_LineWidth(sal_uInt32 nWidth); + void executeDispatch_LineColor(const css::uno::Any& rColor); + void executeDispatch_LineWidth(const css::uno::Any& rWidth); void sendPopupRequest(std::u16string_view rCID, tools::Rectangle aRectangle); diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index bdee1f41486b..02321610fe93 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -1093,29 +1093,17 @@ void SAL_CALL ChartController::dispatch( else if(aCommand == "FillColor") { if (rArgs.getLength() > 0) - { - sal_uInt32 nColor; - if (rArgs[0].Value >>= nColor) - this->executeDispatch_FillColor(nColor); - } + executeDispatch_FillColor(rArgs[0].Value); } else if(aCommand == "XLineColor") { if (rArgs.getLength() > 0) - { - sal_Int32 nColor = -1; - rArgs[0].Value >>= nColor; - this->executeDispatch_LineColor(nColor); - } + executeDispatch_LineColor(rArgs[0].Value); } else if(aCommand == "LineWidth") { if (rArgs.getLength() > 0) - { - sal_Int32 nWidth = -1; - rArgs[0].Value >>= nWidth; - this->executeDispatch_LineWidth(nWidth); - } + executeDispatch_LineWidth(rArgs[0].Value); } else if(aCommand.startsWith("FillGradient")) { diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx index abb4c338f461..0539106c18d8 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -1210,7 +1210,7 @@ void ChartController::executeDispatch_ToggleGridVertical() aUndoGuard.commit(); } -void ChartController::executeDispatch_FillColor(sal_uInt32 nColor) +void ChartController::executeDispatch_FillColor(const css::uno::Any& rColor) { try { @@ -1220,7 +1220,7 @@ void ChartController::executeDispatch_FillColor(sal_uInt32 nColor) const auto [xPointProperties, eType] = getSelectedGraphObject(getSelection(), xChartModel); if( xPointProperties.is() ) - xPointProperties->setPropertyValue( u"FillColor"_ustr, uno::Any( nColor ) ); + xPointProperties->setPropertyValue(u"FillColor"_ustr, rColor); if (eType == OBJECTTYPE_DATA_SERIES || eType == OBJECTTYPE_DATA_POINT) { @@ -1270,12 +1270,12 @@ void ChartController::executeDispatch_FillGradient(std::u16string_view sJSONGrad } } -void ChartController::executeDispatch_LineColor(sal_uInt32 nColor) +void ChartController::executeDispatch_LineColor(const css::uno::Any& rColor) { try { if (css::uno::Reference<css::beans::XPropertySet> xPropSet = getSelectedGraphObject(*this)) - xPropSet->setPropertyValue( u"LineColor"_ustr, css::uno::Any( Color(ColorTransparency, nColor) ) ); + xPropSet->setPropertyValue(u"LineColor"_ustr, rColor); } catch( const uno::Exception& ) { @@ -1283,12 +1283,12 @@ void ChartController::executeDispatch_LineColor(sal_uInt32 nColor) } } -void ChartController::executeDispatch_LineWidth(sal_uInt32 nWidth) +void ChartController::executeDispatch_LineWidth(const css::uno::Any& rWidth) { try { if (css::uno::Reference<css::beans::XPropertySet> xPropSet = getSelectedGraphObject(*this)) - xPropSet->setPropertyValue( u"LineWidth"_ustr, css::uno::Any( nWidth ) ); + xPropSet->setPropertyValue(u"LineWidth"_ustr, rWidth); } catch( const uno::Exception& ) {
