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 22365598a3ebd4eef1c367fbff5b3cdf37980a2f Author: Mike Kaganski <[email protected]> AuthorDate: Mon Jul 7 09:51:48 2025 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Jul 7 13:04:05 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]> diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index 4273d8437297..b4d39566ec2e 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -542,10 +542,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 47152d320972..59667d64a9f4 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -1110,29 +1110,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 702c5fa1ad19..204479359423 100644 --- a/chart2/source/controller/main/ChartController_Tools.cxx +++ b/chart2/source/controller/main/ChartController_Tools.cxx @@ -1211,7 +1211,7 @@ void ChartController::executeDispatch_ToggleGridVertical() aUndoGuard.commit(); } -void ChartController::executeDispatch_FillColor(sal_uInt32 nColor) +void ChartController::executeDispatch_FillColor(const css::uno::Any& rColor) { try { @@ -1221,7 +1221,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) { @@ -1271,12 +1271,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& ) { @@ -1284,12 +1284,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& ) {
