include/svx/AccessibleOLEShape.hxx | 4 ++-- svx/source/accessibility/AccessibleOLEShape.cxx | 9 ++++----- sw/source/core/access/accpara.cxx | 10 ++++------ sw/source/core/access/accpara.hxx | 3 +-- 4 files changed, 11 insertions(+), 15 deletions(-)
New commits: commit 1eb53a05e4a0148bcb0116a1c07cb7bba6f922df Author: Michael Weghorn <[email protected]> AuthorDate: Thu Mar 5 14:41:29 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Mar 6 07:17:43 2026 +0100 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 <[email protected]> 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 <[email protected]> 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<OUString, OUString> 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<XAccessibleKeyBinding> SAL_CALL AccessibleOLEShape::getAccessibleActio throw lang::IndexOutOfBoundsException(); } -// XAccessibleExtendedAttributes -OUString SAL_CALL AccessibleOLEShape::getExtendedAttributes() +std::unordered_map<OUString, OUString> AccessibleOLEShape::implGetExtendedAttributes() { - if (m_pShape) - return "style:" + static_cast<SdrOle2Obj*>(m_pShape)->GetStyleString() + ";"; + if (!m_pShape) + return {}; - return OUString(); + return { { u"style"_ustr, static_cast<SdrOle2Obj*>(m_pShape)->GetStyleString() } }; } /// Set this object's name if is different to the current name. commit 709fb5f115eee1cbf7b550feb8d05d08717903a5 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Mar 5 14:34:04 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Mar 6 07:17:32 2026 +0100 sw a11y: Switch to override new extended attr helper for para Override the OAccessible::implGetExtendedAttributes base class method newly introduced in Change-Id: Ie66f135fbf6cdc98c7cdca27fa3f5fe7db7f9a74 Author: Michael Weghorn <[email protected]> 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: I28d5525a76ab60b3f7969321f40b548dbf9a5c70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201046 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 447cf75cfe3b..a7dff330cccb 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -3305,20 +3305,18 @@ bool SwAccessibleParagraph::IsBlockQuote() return false; } -OUString SAL_CALL SwAccessibleParagraph::getExtendedAttributes() +std::unordered_map<OUString, OUString> SwAccessibleParagraph::implGetExtendedAttributes() { - SolarMutexGuard g; - - OUString strHeading; + std::unordered_map<OUString, OUString> aAttributes; if (m_nHeadingLevel >= 0) { // report heading level using the "level" object attribute as specified in ARIA, // maps to attributes of the same name for AT-SPI, IAccessible2, UIA // https://www.w3.org/TR/core-aam-1.2/#ariaLevelHeading - strHeading = "level:" + OUString::number(m_nHeadingLevel) + ";"; + aAttributes.emplace(u"level"_ustr, OUString::number(m_nHeadingLevel)); } - return strHeading; + return aAttributes; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx index cf1d199e3bbf..fbac111bed41 100644 --- a/sw/source/core/access/accpara.hxx +++ b/sw/source/core/access/accpara.hxx @@ -158,6 +158,7 @@ public: bool IsHeading() const; protected: + virtual std::unordered_map<OUString, OUString> implGetExtendedAttributes() override; // Set states for getAccessibleStateSet. // This derived class additionally sets MULTILINE(1), MULTISELECTABLE(+), @@ -327,8 +328,6 @@ public: virtual sal_Int32 SAL_CALL getSeletedPositionEnd( sal_Int32 nSelectedPortionIndex ) override; virtual sal_Bool SAL_CALL removeSelection( sal_Int32 selectionIndex ) override; virtual sal_Int32 SAL_CALL addSelection(sal_Int32 startOffset, sal_Int32 endOffset) override; - // XAccessibleExtendedAttributes - virtual OUString SAL_CALL getExtendedAttributes() override; sal_Int32 GetRealHeadingLevel(); bool IsBlockQuote();
