include/vcl/accessibility/AccessibleAttribute.hxx |   27 ++++++++++++++++++++++
 sc/source/ui/Accessibility/AccessibleCell.cxx     |   12 +++------
 2 files changed, 31 insertions(+), 8 deletions(-)

New commits:
commit b908f7dd96fae78977abf67278a6fee48a8b9c2d
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Mar 5 18:06:22 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Mar 6 07:18:39 2026 +0100

    tdf#171086 a11y: Move "{row,col}indextext" strings to vcl header
    
    Move the "rowindextext" and "colindextext" strings used for
    reporting accessible attributes matching those specified in
    ARIA (see the links in the comments for more details) from
    a Calc-specific source file to a new global vcl header, for reuse
    in Writer in an upcoming commit.
    
    Have them in an AccessibleAttribute namespace, which could also
    simplify later converting from a string-based key in the
    map returned by OAccessible::implGetExtendedAttributes to
    one using an enum class. (AccessibleAttribute could then
    be turned into such an enum class.)
    
    Change-Id: I78e783df2b47bc8af54fbad570cb0aeb0b6a8629
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201063
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/include/vcl/accessibility/AccessibleAttribute.hxx 
b/include/vcl/accessibility/AccessibleAttribute.hxx
new file mode 100644
index 000000000000..6fb06a37fbb7
--- /dev/null
+++ b/include/vcl/accessibility/AccessibleAttribute.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <rtl/ustring.hxx>
+
+namespace AccessibleAttribute
+{
+// row index text as specified in ARIA,
+// maps to attribute of the same name for AT-SPI2, IAccessible2, UIA
+// https://www.w3.org/TR/core-aam-1.2/#ariaRowIndexText
+constexpr OUString RowIndexText = u"rowindextext"_ustr;
+
+// column index text as specified in ARIA,
+// maps to attribute of the same name for AT-SPI2, IAccessible2, UIA
+// https://www.w3.org/TR/core-aam-1.2/#ariaColIndexText
+constexpr OUString ColIndexText = u"colindextext"_ustr;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx 
b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 340fe5a0ba43..eb4d6caccaa0 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -42,6 +42,7 @@
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
 #include <editeng/brushitem.hxx>
+#include <vcl/accessibility/AccessibleAttribute.hxx>
 #include <vcl/svapp.hxx>
 
 #include <AccessibleSpreadsheet.hxx>
@@ -465,16 +466,11 @@ static OUString ReplaceFourChar(const OUString& 
oldOUString)
 
 std::unordered_map<OUString, OUString> 
ScAccessibleCell::implGetExtendedAttributes()
 {
-    std::unordered_map<OUString, OUString> aAttributes;
-
-    // report row and column index text via attributes as specified in ARIA 
which map
-    // to attributes of the same name for AT-SPI2, IAccessible2, UIA
-    // https://www.w3.org/TR/core-aam-1.2/#ariaRowIndexText
-    // https://www.w3.org/TR/core-aam-1.2/#ariaColIndexText
     const OUString sRowIndexText = maCellAddress.Format(ScRefFlags::ROW_VALID);
     const OUString sColIndexText = maCellAddress.Format(ScRefFlags::COL_VALID);
-    aAttributes.emplace(u"rowindextext"_ustr, sRowIndexText);
-    aAttributes.emplace(u"colindextext"_ustr, sColIndexText);
+    std::unordered_map<OUString, OUString> aAttributes
+        = { { AccessibleAttribute::RowIndexText, sRowIndexText },
+            { AccessibleAttribute::ColIndexText, sColIndexText } };
 
     if (mpViewShell)
     {

Reply via email to