sw/source/core/access/acccell.cxx     |    8 ++----
 sw/source/core/access/acccell.hxx     |    4 +--
 sw/source/core/access/accdoc.cxx      |   44 ++++++++++++++--------------------
 sw/source/core/access/accdoc.hxx      |    4 +--
 sw/source/core/access/accembedded.cxx |   24 ++++++++----------
 5 files changed, 37 insertions(+), 47 deletions(-)

New commits:
commit 73ac4d936eeb211fd62b1d42382b07d39ac00ebf
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Mar 5 14:25:26 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Mar 6 07:17:05 2026 +0100

    sw a11y: Flatten SwAccessibleEmbeddedObject::getExtendedAttributes
    
    Return early if pFFrame is null.
    
    Change-Id: Id2eac7eaaad655a28713a0f599fb280b895ceab2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201043
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/sw/source/core/access/accembedded.cxx 
b/sw/source/core/access/accembedded.cxx
index 18b1ed152365..9859f343a555 100644
--- a/sw/source/core/access/accembedded.cxx
+++ b/sw/source/core/access/accembedded.cxx
@@ -43,25 +43,23 @@ OUString SAL_CALL 
SwAccessibleEmbeddedObject::getExtendedAttributes()
 {
     SolarMutexGuard g;
 
-    OUString style;
     SwFlyFrame* pFFrame = getFlyFrame();
+    if (!pFFrame)
+        return {};
 
-    if (pFFrame)
+    OUString style = "style:";
+    SwContentFrame* pCFrame;
+    pCFrame = pFFrame->ContainsContent();
+    if (pCFrame)
     {
-        style = "style:";
-        SwContentFrame* pCFrame;
-        pCFrame = pFFrame->ContainsContent();
-        if (pCFrame)
+        assert(pCFrame->IsNoTextFrame());
+        SwContentNode* const pCNode = 
static_cast<SwNoTextFrame*>(pCFrame)->GetNode();
+        if (pCNode)
         {
-            assert(pCFrame->IsNoTextFrame());
-            SwContentNode* const pCNode = 
static_cast<SwNoTextFrame*>(pCFrame)->GetNode();
-            if (pCNode)
-            {
-                style += 
static_cast<SwOLENode*>(pCNode)->GetOLEObj().GetStyleString();
-            }
+            style += 
static_cast<SwOLENode*>(pCNode)->GetOLEObj().GetStyleString();
         }
-        style += ";";
     }
+    style += ";";
     return style;
 }
 
commit dbfa0d9814d696b4d6d258e1d198373e51efac79
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Mar 5 14:21:53 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Mar 6 07:16:58 2026 +0100

    sw a11y: Switch to override new extended attr helper for document
    
    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: I88972174f15327d748915df05472807528fb038d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201042
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index b56664c87de4..b217b52564bf 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -399,36 +399,35 @@ void SwAccessibleDocument::deselectAccessibleChild(
     maSelectionHelper.deselectAccessibleChild( nChildIndex );
 }
 
-OUString SAL_CALL SwAccessibleDocument::getExtendedAttributes()
+std::unordered_map<OUString, OUString> 
SwAccessibleDocument::implGetExtendedAttributes()
 {
-    SolarMutexGuard g;
-
     SwDoc* pDoc = GetMap() ? GetShell().GetDoc() : nullptr;
 
     if (!pDoc)
-        return OUString();
+        return {};
     SwCursorShell* pCursorShell = GetCursorShell();
     if( !pCursorShell )
-        return OUString();
+        return {};
 
     SwFEShell* pFEShell = dynamic_cast<SwFEShell*>(pCursorShell);
     if (!pFEShell)
-        return OUString();
+        return {};
 
     OUString sDisplay;
     sal_uInt16 nPage, nLogPage;
     pFEShell->GetPageNumber(-1,true,nPage,nLogPage,sDisplay);
 
-    OUString sValue = "page-name:" + sDisplay +
-        ";page-number:" +
-        OUString::number( nPage ) +
-        ";total-pages:" +
-        OUString::number( pCursorShell->GetPageCnt() ) + ";";
+    std::unordered_map<OUString, OUString> aAttributes
+        = { { u"page-name"_ustr, sDisplay },
+            { u"page-number"_ustr, OUString::number(nPage) },
+            { u"total-pages"_ustr, 
OUString::number(pCursorShell->GetPageCnt()) } };
 
     // cursor position relative to the page
     Point aCursorPagePos = pFEShell->GetCursorPagePos();
-    sValue += "cursor-position-in-page-horizontal:" + 
OUString::number(aCursorPagePos.getX())
-            + ";cursor-position-in-page-vertical:" + 
OUString::number(aCursorPagePos.getY()) + ";";
+    aAttributes.emplace(u"cursor-position-in-page-horizontal"_ustr,
+                        OUString::number(aCursorPagePos.getX()));
+    aAttributes.emplace(u"cursor-position-in-page-vertical"_ustr,
+                        OUString::number(aCursorPagePos.getY()));
 
     SwContentFrame* pCurrFrame = pCursorShell->GetCurrFrame();
     SwPageFrame* pCurrPage = pCurrFrame->FindPageFrame();
@@ -520,12 +519,9 @@ OUString SAL_CALL 
SwAccessibleDocument::getExtendedAttributes()
         }
     }
 
-    sValue += "line-number:" + OUString::number( nLineNum ) + ";";
+    aAttributes.emplace(u"line-number"_ustr, OUString::number(nLineNum));
 
     SwFrame* pCurrCol=static_cast<SwFrame*>(pCurrFrame)->FindColFrame();
-
-    sValue += "column-number:";
-
     int nCurrCol = 1;
     if(pCurrCol!=nullptr)
     {
@@ -548,12 +544,12 @@ OUString SAL_CALL 
SwAccessibleDocument::getExtendedAttributes()
             }
         }
     }
-    sValue += OUString::number( nCurrCol ) + ";";
+    aAttributes.emplace(u"column-number"_ustr, OUString::number(nCurrCol));
 
     const SwFormatCol &rFormatCol=pCurrPage->GetAttrSet()->GetCol();
     sal_uInt16 nColCount=rFormatCol.GetNumCols();
     nColCount = nColCount>0?nColCount:1;
-    sValue += "total-columns:" + OUString::number( nColCount ) + ";";
+    aAttributes.emplace(u"total-columns"_ustr, OUString::number(nColCount));
 
     SwSectionFrame* 
pCurrSctFrame=static_cast<SwFrame*>(pCurrFrame)->FindSctFrame();
     if(pCurrSctFrame!=nullptr && pCurrSctFrame->GetSection()!=nullptr )
@@ -566,7 +562,7 @@ OUString SAL_CALL 
SwAccessibleDocument::getExtendedAttributes()
         sectionName = sectionName.replaceFirst( "," , "\," );
         sectionName = sectionName.replaceFirst( ":" , "\:" );
 
-        sValue += "section-name:" + sectionName + ";";
+        aAttributes.emplace(u"section-name"_ustr, sectionName);
 
         //section-columns-number
 
@@ -585,18 +581,16 @@ OUString SAL_CALL 
SwAccessibleDocument::getExtendedAttributes()
                 }
             }
         }
-        sValue += "section-columns-number:" +
-            OUString::number( nCurrCol ) + ";";
+        aAttributes.emplace(u"section-columns-number"_ustr, 
OUString::number(nCurrCol));
 
         //section-total-columns
         const SwFormatCol &rFormatSctCol=pCurrSctFrame->GetAttrSet()->GetCol();
         sal_uInt16 nSctColCount=rFormatSctCol.GetNumCols();
         nSctColCount = nSctColCount>0?nSctColCount:1;
-        sValue += "section-total-columns:" +
-            OUString::number( nSctColCount ) + ";";
+        aAttributes.emplace(u"section-total-columns"_ustr, 
OUString::number(nSctColCount));
     }
 
-    return sValue;
+    return aAttributes;
 }
 
 sal_Int32 SAL_CALL SwAccessibleDocument::getBackground()
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx
index 81187b0501b0..ea8d2609b5b6 100644
--- a/sw/source/core/access/accdoc.hxx
+++ b/sw/source/core/access/accdoc.hxx
@@ -86,6 +86,8 @@ class SwAccessibleDocument
     SwAccessibleSelectionHelper maSelectionHelper;
 
 protected:
+    virtual std::unordered_map<OUString, OUString> implGetExtendedAttributes() 
override;
+
     // Set states for getAccessibleStateSet.
     // This derived class additionally sets MULTISELECTABLE(1)
     virtual void GetStates( sal_Int64& rStateSet ) override;
@@ -114,8 +116,6 @@ public:
     virtual void SAL_CALL deselectAccessibleChild(
         sal_Int64 nChildIndex ) override;
 
-    virtual OUString SAL_CALL getExtendedAttributes() override;
-
     // thread safe C++ interface
 
     // The object is not visible any longer and should be destroyed
commit 023439708dde021637d9855ae4fe7ffbb4227f2c
Author:     Michael Weghorn <[email protected]>
AuthorDate: Thu Mar 5 14:10:26 2026 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Fri Mar 6 07:16:51 2026 +0100

    tdf#171086 sw a11y: Switch to override new extended attr helper for cell
    
    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: Id7967ed51dd7f035dd891da222e5583d47bf4d19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201041
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/sw/source/core/access/acccell.cxx 
b/sw/source/core/access/acccell.cxx
index 5c4ea561f12f..940190a71898 100644
--- a/sw/source/core/access/acccell.cxx
+++ b/sw/source/core/access/acccell.cxx
@@ -299,10 +299,8 @@ uno::Any SwAccessibleCell::getMinimumIncrement(  )
     return uno::Any();
 }
 
-OUString SAL_CALL SwAccessibleCell::getExtendedAttributes()
+std::unordered_map<OUString, OUString> 
SwAccessibleCell::implGetExtendedAttributes()
 {
-    SolarMutexGuard g;
-
     SwFrameFormat *pFrameFormat = GetTableBoxFormat();
     assert(pFrameFormat);
 
@@ -310,7 +308,7 @@ OUString SAL_CALL SwAccessibleCell::getExtendedAttributes()
 
     OUString sFormula = tbl_formula.GetFormula();
     if (sFormula.isEmpty())
-        return OUString();
+        return {};
 
     // ensure the use of readable cell references (like "<A1>") instead of 
internal pointers
     if (const SwTabFrame* pTabFrame = m_pAccTable ? m_pAccTable->GetTabFrame() 
: nullptr)
@@ -328,7 +326,7 @@ OUString SAL_CALL SwAccessibleCell::getExtendedAttributes()
                    .replaceAll(u"=", u"\=")
                    .replaceAll(u",", u"\,")
                    .replaceAll(u":", u"\:");
-    return "Formula:" + sFormula + ";";
+    return { { u"Formula"_ustr, sFormula } };
 }
 
 sal_Int32 SAL_CALL SwAccessibleCell::getBackground()
diff --git a/sw/source/core/access/acccell.hxx 
b/sw/source/core/access/acccell.hxx
index 08875d2e67a2..fb7e714851cd 100644
--- a/sw/source/core/access/acccell.hxx
+++ b/sw/source/core/access/acccell.hxx
@@ -44,6 +44,8 @@ class SwAccessibleCell : public SwAccessibleCell_BASE
     rtl::Reference<SwAccessibleTable> m_pAccTable;
 
 protected:
+    virtual std::unordered_map<OUString, OUString> implGetExtendedAttributes() 
override;
+
     // Set states for getAccessibleStateSet.
     // This derived class additionally sets SELECTABLE(1) and SELECTED(+)
     virtual void GetStates( sal_Int64& rStateSet ) override;
@@ -68,8 +70,6 @@ public:
 
     virtual void InvalidatePosOrSize( const SwRect& rFrame ) override;
 
-    // XAccessibleExtendedAttributes
-    OUString SAL_CALL getExtendedAttributes() override;
 private:
     const SwCellFrame& GetCellFrame() const;
     SwFrameFormat* GetTableBoxFormat() const;

Reply via email to