From 1eb53a05e4a0148bcb0116a1c07cb7bba6f922df Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 5 Mar 2026 14:41:29 +0100 Subject: [PATCH] svx a11y: Switch to override new extended attr helper for OLE shape Override the OAccessible::implGetExtendedAttributes base class method newly introduced in Change-Id: Ie66f135fbf6cdc98c7cdca27fa3f5fe7db7f9a74 Author: Michael Weghorn Date: Thu Mar 5 12:12:45 2026 +0100 a11y: Introduce helper to implement XAccessibleExtendedAttributes logic instead of manually implementing XAccessibleExtendedAttributes::getExtendedAttributes, to unify/deduplicate the string concatenation and locking logic by having it implemented (only) in the base class implementation. Change-Id: I12ce4776dc489dd87ee509b10c14da25a5139de6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201047 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/svx/AccessibleOLEShape.hxx | 4 ++-- svx/source/accessibility/AccessibleOLEShape.cxx | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/svx/AccessibleOLEShape.hxx b/include/svx/AccessibleOLEShape.hxx index c173a34f5b80..b594666d3354 100644 --- a/include/svx/AccessibleOLEShape.hxx +++ b/include/svx/AccessibleOLEShape.hxx @@ -59,9 +59,9 @@ public: css::accessibility::XAccessibleKeyBinding> SAL_CALL getAccessibleActionKeyBinding ( sal_Int32 nIndex) override; -// ====== XAccessibleExtendedAttributes ===================================== - virtual OUString SAL_CALL getExtendedAttributes() override; protected: + virtual std::unordered_map implGetExtendedAttributes() override; + /// Create a name string that contains the accessible name. virtual OUString CreateAccessibleBaseName () override; diff --git a/svx/source/accessibility/AccessibleOLEShape.cxx b/svx/source/accessibility/AccessibleOLEShape.cxx index 5c3930ea07ee..647c5e153fa1 100644 --- a/svx/source/accessibility/AccessibleOLEShape.cxx +++ b/svx/source/accessibility/AccessibleOLEShape.cxx @@ -71,13 +71,12 @@ Reference SAL_CALL AccessibleOLEShape::getAccessibleActio throw lang::IndexOutOfBoundsException(); } -// XAccessibleExtendedAttributes -OUString SAL_CALL AccessibleOLEShape::getExtendedAttributes() +std::unordered_map AccessibleOLEShape::implGetExtendedAttributes() { - if (m_pShape) - return "style:" + static_cast(m_pShape)->GetStyleString() + ";"; + if (!m_pShape) + return {}; - return OUString(); + return { { u"style"_ustr, static_cast(m_pShape)->GetStyleString() } }; } /// Set this object's name if is different to the current name.