include/svx/ShapeTypeHandler.hxx | 11 -------- svx/source/accessibility/ShapeTypeHandler.cxx | 35 ++++++++------------------ 2 files changed, 12 insertions(+), 34 deletions(-)
New commits: commit a804e8efd2ed8edc7a7bbf47121d7da74dc6b994 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed May 21 14:37:55 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu May 22 05:50:51 2025 +0200 svx a11y: Merge both ShapeTypeHandler::GetTypeId Change-Id: I31eaad6616a127f056c89c68c0208182d8563b4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185614 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/svx/ShapeTypeHandler.hxx b/include/svx/ShapeTypeHandler.hxx index 5e9fa5e76b6a..7ba5c8b5fcd2 100644 --- a/include/svx/ShapeTypeHandler.hxx +++ b/include/svx/ShapeTypeHandler.hxx @@ -87,15 +87,6 @@ public: */ static ShapeTypeHandler& Instance(); - /** Determines the type id of a shape with the given service name. - @param aServiceName - Service name of the shape for which to return the type id. - @return - Returns the type id of the shape with the given service name or - -1 when the service name is not known. - */ - ShapeTypeId GetTypeId (const OUString& aServiceName) const; - /** Determines the type id of the specified shape. @param xShape Reference to the shape for which to return the type id. diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx index e394de227107..d1f41da29338 100644 --- a/svx/source/accessibility/ShapeTypeHandler.cxx +++ b/svx/source/accessibility/ShapeTypeHandler.cxx @@ -69,32 +69,19 @@ ShapeTypeHandler& ShapeTypeHandler::Instance() return *instance; } - -/** The given service name is first transformed into a slot id that - identifies the place of the type descriptor. From that descriptor the - shape type id is returned. -*/ -ShapeTypeId ShapeTypeHandler::GetTypeId (const OUString& aServiceName) const +ShapeTypeId ShapeTypeHandler::GetTypeId(const uno::Reference<drawing::XShape>& rxShape) const { - tServiceNameToSlotId::const_iterator I (maServiceNameToSlotId.find (aServiceName)); - if (I != maServiceNameToSlotId.end()) - { - return maShapeTypeDescriptorList[I->second].mnShapeTypeId; - } - else + if (!rxShape.is()) return -1; -} + // The service name is first transformed into a slot id that + // identifies the place of the type descriptor. From that descriptor the + // shape type id is returned. + tServiceNameToSlotId::const_iterator I(maServiceNameToSlotId.find(rxShape->getShapeType())); + if (I != maServiceNameToSlotId.end()) + return maShapeTypeDescriptorList[I->second].mnShapeTypeId; -/** Extract the specified shape's service name and forward the request to - the appropriate method. -*/ -ShapeTypeId ShapeTypeHandler::GetTypeId (const uno::Reference<drawing::XShape>& rxShape) const -{ - if (rxShape.is()) - return GetTypeId (rxShape->getShapeType()); - else - return -1; + return -1; } @@ -107,7 +94,7 @@ rtl::Reference<AccessibleShape> const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo) const { - ShapeTypeId nSlotId (GetSlotId (rShapeInfo.mxShape)); + ShapeTypeId nSlotId = GetSlotId(rShapeInfo.mxShape); rtl::Reference<AccessibleShape> pShape( maShapeTypeDescriptorList[nSlotId].maCreateFunction ( rShapeInfo, commit 6503bb08224731f3756c59569fd4575ea2b7a4d4 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed May 21 14:30:56 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Thu May 22 05:50:43 2025 +0200 svx a11y: Return ShapeTypeId instead of tools::Long That's what's stored in ShapeTypeHandler::maServiceNameToSlotId and what the callers wants, so there's no reason to use any other integer type. Change-Id: Ibb5cdf0dc36767771ae02a255e878dcddcb3a45d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185613 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/svx/ShapeTypeHandler.hxx b/include/svx/ShapeTypeHandler.hxx index ee6335e0f470..5e9fa5e76b6a 100644 --- a/include/svx/ShapeTypeHandler.hxx +++ b/include/svx/ShapeTypeHandler.hxx @@ -178,7 +178,7 @@ private: Returns the slot id of the shape with the given service name or 0 when the service name is not known. */ - SVX_DLLPRIVATE tools::Long GetSlotId (const css::uno::Reference< + SVX_DLLPRIVATE ShapeTypeId GetSlotId(const css::uno::Reference< css::drawing::XShape>& rxShape) const; }; diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx index 06b8332f524b..e394de227107 100644 --- a/svx/source/accessibility/ShapeTypeHandler.cxx +++ b/svx/source/accessibility/ShapeTypeHandler.cxx @@ -166,7 +166,7 @@ void ShapeTypeHandler::AddShapeTypeList (int nDescriptorCount, } } -tools::Long ShapeTypeHandler::GetSlotId(const uno::Reference<drawing::XShape>& rxShape) const +ShapeTypeId ShapeTypeHandler::GetSlotId(const uno::Reference<drawing::XShape>& rxShape) const { if (!rxShape.is()) return 0;