chart2/source/controller/main/DrawCommandDispatch.cxx | 28 +++++------ chart2/source/controller/main/FeatureCommandDispatchBase.cxx | 9 --- chart2/source/controller/main/FeatureCommandDispatchBase.hxx | 10 +++ chart2/source/controller/main/ShapeController.cxx | 24 ++++----- 4 files changed, 36 insertions(+), 35 deletions(-)
New commits: commit ee4e270276c541357a9795b339521b19422b10ce Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sat Jul 5 20:00:41 2025 +0500 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jul 9 09:03:59 2025 +0200 Simplify FeatureCommandDispatchBase::implDescribeSupportedFeature Use OUString, instead of converting to it from ASCII. Change-Id: Ia7a30a4e6b2599d59740d26d0268070050070166 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187439 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187517 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx index 39e5956ec0e1..39c75e884320 100644 --- a/chart2/source/controller/main/DrawCommandDispatch.cxx +++ b/chart2/source/controller/main/DrawCommandDispatch.cxx @@ -371,20 +371,20 @@ void DrawCommandDispatch::execute( const OUString& rCommand, const Sequence< bea void DrawCommandDispatch::describeSupportedFeatures() { - implDescribeSupportedFeature( ".uno:SelectObject", ChartCommandID::DrawObjectSelect, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:Line", ChartCommandID::DrawLine, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:LineArrowEnd", ChartCommandID::DrawLineArrowEnd, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:Rect", ChartCommandID::DrawRect, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:Ellipse", ChartCommandID::DrawEllipse, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:Freeline_Unfilled", ChartCommandID::DrawFreelineNoFill, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:DrawText", ChartCommandID::DrawText, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:DrawCaption", ChartCommandID::DrawCaption, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:BasicShapes", ChartCommandID::DrawToolboxCsBasic, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:SymbolShapes", ChartCommandID::DrawToolboxCsSymbol, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:ArrowShapes", ChartCommandID::DrawToolboxCsArrow, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:FlowChartShapes", ChartCommandID::DrawToolboxCsFlowchart, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:CalloutShapes", ChartCommandID::DrawToolboxCsCallout, CommandGroup::INSERT ); - implDescribeSupportedFeature( ".uno:StarShapes", ChartCommandID::DrawToolboxCsStar, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:SelectObject"_ustr, ChartCommandID::DrawObjectSelect, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:Line"_ustr, ChartCommandID::DrawLine, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:LineArrowEnd"_ustr, ChartCommandID::DrawLineArrowEnd, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:Rect"_ustr, ChartCommandID::DrawRect, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:Ellipse"_ustr, ChartCommandID::DrawEllipse, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:Freeline_Unfilled"_ustr, ChartCommandID::DrawFreelineNoFill, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:DrawText"_ustr, ChartCommandID::DrawText, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:DrawCaption"_ustr, ChartCommandID::DrawCaption, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:BasicShapes"_ustr, ChartCommandID::DrawToolboxCsBasic, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:SymbolShapes"_ustr, ChartCommandID::DrawToolboxCsSymbol, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:ArrowShapes"_ustr, ChartCommandID::DrawToolboxCsArrow, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:FlowChartShapes"_ustr, ChartCommandID::DrawToolboxCsFlowchart, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:CalloutShapes"_ustr, ChartCommandID::DrawToolboxCsCallout, CommandGroup::INSERT ); + implDescribeSupportedFeature( u".uno:StarShapes"_ustr, ChartCommandID::DrawToolboxCsStar, CommandGroup::INSERT ); } void DrawCommandDispatch::setInsertObj(SdrObjKind eObj) diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx index 489538600591..a07fb0735fa3 100644 --- a/chart2/source/controller/main/FeatureCommandDispatchBase.cxx +++ b/chart2/source/controller/main/FeatureCommandDispatchBase.cxx @@ -77,15 +77,10 @@ void FeatureCommandDispatchBase::dispatch( const util::URL& URL, } } -void FeatureCommandDispatchBase::implDescribeSupportedFeature( const char* pAsciiCommandURL, +void FeatureCommandDispatchBase::implDescribeSupportedFeature( const OUString& sCommandURL, ChartCommandID nId, sal_Int16 nGroup ) { - ControllerFeature aFeature; - aFeature.Command = OUString::createFromAscii( pAsciiCommandURL ); - aFeature.nFeatureId = nId; - aFeature.GroupId = nGroup; - - m_aSupportedFeatures[ aFeature.Command ] = aFeature; + m_aSupportedFeatures[sCommandURL] = { sCommandURL, nGroup, nId }; } } // namespace chart diff --git a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx index 3ceb35ad1268..271a3c6cd282 100644 --- a/chart2/source/controller/main/FeatureCommandDispatchBase.hxx +++ b/chart2/source/controller/main/FeatureCommandDispatchBase.hxx @@ -66,6 +66,12 @@ namespace chart struct ControllerFeature: public css::frame::DispatchInformation { ChartCommandID nFeatureId; + ControllerFeature() = default; + ControllerFeature(const OUString& command, sal_Int16 groupId, ChartCommandID featureId) + : css::frame::DispatchInformation(command, groupId) + , nFeatureId(featureId) + { + } }; typedef std::map< OUString, @@ -113,7 +119,7 @@ protected: Must not be called outside <member>describeSupportedFeatures</member>. - @param pAsciiCommandURL + @param sCommandURL the URL of the feature command @param nId the id of the feature. Later references to this feature usually happen by id, not by @@ -122,7 +128,7 @@ protected: the command group of the feature. This is important for configuring the controller UI by the user, see also <type scope="css::frame">CommandGroup</type>. */ - void implDescribeSupportedFeature( const char* pAsciiCommandURL, ChartCommandID nId, + void implDescribeSupportedFeature( const OUString& sCommandURL, ChartCommandID nId, sal_Int16 nGroup ); mutable SupportedFeatures m_aSupportedFeatures; diff --git a/chart2/source/controller/main/ShapeController.cxx b/chart2/source/controller/main/ShapeController.cxx index f9d262c6e3f3..548982720cd5 100644 --- a/chart2/source/controller/main/ShapeController.cxx +++ b/chart2/source/controller/main/ShapeController.cxx @@ -196,18 +196,18 @@ void ShapeController::execute( const OUString& rCommand, const Sequence< beans:: void ShapeController::describeSupportedFeatures() { - implDescribeSupportedFeature( ".uno:FormatLine", ChartCommandID::ShapeFormatLine, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:FormatArea", ChartCommandID::ShapeFormatArea, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:TextAttributes", ChartCommandID::ShapeTextAttributes, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:TransformDialog", ChartCommandID::ShapeTransformDialog, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:ObjectTitleDescription", ChartCommandID::ShapeObjectTitleDescription, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:RenameObject", ChartCommandID::ShapeRenameObject, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:BringToFront", ChartCommandID::ShapeBringToFront, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:Forward", ChartCommandID::ShapeForward, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:Backward", ChartCommandID::ShapeBackward, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:SendToBack", ChartCommandID::ShapeSendToBack, CommandGroup::FORMAT ); - implDescribeSupportedFeature( ".uno:FontDialog", ChartCommandID::ShapeFontDialog, CommandGroup::EDIT ); - implDescribeSupportedFeature( ".uno:ParagraphDialog", ChartCommandID::ShapeParagraphDialog, CommandGroup::EDIT ); + implDescribeSupportedFeature( u".uno:FormatLine"_ustr, ChartCommandID::ShapeFormatLine, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:FormatArea"_ustr, ChartCommandID::ShapeFormatArea, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:TextAttributes"_ustr, ChartCommandID::ShapeTextAttributes, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:TransformDialog"_ustr, ChartCommandID::ShapeTransformDialog, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:ObjectTitleDescription"_ustr, ChartCommandID::ShapeObjectTitleDescription, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:RenameObject"_ustr, ChartCommandID::ShapeRenameObject, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:BringToFront"_ustr, ChartCommandID::ShapeBringToFront, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:Forward"_ustr, ChartCommandID::ShapeForward, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:Backward"_ustr, ChartCommandID::ShapeBackward, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:SendToBack"_ustr, ChartCommandID::ShapeSendToBack, CommandGroup::FORMAT ); + implDescribeSupportedFeature( u".uno:FontDialog"_ustr, ChartCommandID::ShapeFontDialog, CommandGroup::EDIT ); + implDescribeSupportedFeature( u".uno:ParagraphDialog"_ustr, ChartCommandID::ShapeParagraphDialog, CommandGroup::EDIT ); } IMPL_LINK( ShapeController, CheckNameHdl, AbstractSvxObjectNameDialog&, rDialog, bool )