sc/source/ui/Accessibility/AccessibleCell.cxx | 23 +++++++++-------------- sw/source/core/access/acccell.cxx | 17 ++++++++++------- sw/source/core/access/acctable.cxx | 24 ++++++++++++++---------- sw/source/core/access/acctable.hxx | 2 ++ 4 files changed, 35 insertions(+), 31 deletions(-)
New commits: commit 324a9bbbfa6f2b0252ba34f090c9d16d7615dc41 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Jan 19 17:01:46 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Jan 20 10:39:44 2026 +0100 tdf#170338 sc a11y: Don't report empty "Formula" attribute This is the Calc equivalent of previous Writer commit Change-Id: I60abdd66a1f456d0298d7c1b6e0879faa4f3ce81 Author: Michael Weghorn <[email protected]> Date: Mon Jan 19 16:34:17 2026 +0100 tdf#170338 sw a11y: Don't report empty "Formula" attribute Change-Id: I91364ff1759b0937626022b0cd5fdb35bd1fa5c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197602 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 24e85cf35c8e..5e401d3fc082 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -480,28 +480,23 @@ OUString SAL_CALL ScAccessibleCell::getExtendedAttributes() if (mpViewShell) { - OUString strFor = mpViewShell->GetFormula(maCellAddress) ; - if (!strFor.isEmpty()) - { - strFor = strFor.copy(1); - strFor = ReplaceFourChar(strFor); - } - strFor = "Formula:" + strFor + - ";Note:" + - ReplaceFourChar(GetAllDisplayNote()) + ";" + + const OUString sFormula = mpViewShell->GetFormula(maCellAddress) ; + if (!sFormula.isEmpty()) + sAttributes += u"Formula:" + ReplaceFourChar(sFormula.copy(1)) + u";"; + + sAttributes += "Note:" + ReplaceFourChar(GetAllDisplayNote()) + ";" + getShadowAttrs() + //the string returned contains the spliter ";" getBorderAttrs();//the string returned contains the spliter ";" //end of cell attributes if( mpDoc ) { - strFor += "isdropdown:"; + sAttributes += "isdropdown:"; if( IsDropdown() ) - strFor += "true"; + sAttributes += "true"; else - strFor += "false"; - strFor += ";"; + sAttributes += "false"; + sAttributes += ";"; } - sAttributes += strFor ; } return sAttributes; commit 1579423b8756a299ea1a9a523d53d2078c689836 Author: Michael Weghorn <[email protected]> AuthorDate: Mon Jan 19 16:34:17 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Jan 20 10:39:37 2026 +0100 tdf#170338 sw a11y: Don't report empty "Formula" attribute Only report a "Formula" extended/object attribute for a Writer table cell on the a11y level if it's value is non-empty. This prevents the attribute from being reported for table cells that don't actually have any formula set. Change-Id: I60abdd66a1f456d0298d7c1b6e0879faa4f3ce81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197601 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 956aa625d086..c8111426bec2 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -309,13 +309,16 @@ OUString SAL_CALL SwAccessibleCell::getExtendedAttributes() const SwTableBoxFormula& tbl_formula = pFrameFormat->GetTableBoxFormula(); - OUString strFormula = tbl_formula.GetFormula() - .replaceAll(u"\", u"\\") - .replaceAll(u";", u"\;") - .replaceAll(u"=", u"\=") - .replaceAll(u",", u"\,") - .replaceAll(u":", u"\:"); - return "Formula:" + strFormula + ";"; + OUString sFormula = tbl_formula.GetFormula(); + if (sFormula.isEmpty()) + return OUString(); + + sFormula = sFormula.replaceAll(u"\", u"\\") + .replaceAll(u";", u"\;") + .replaceAll(u"=", u"\=") + .replaceAll(u",", u"\,") + .replaceAll(u":", u"\:"); + return "Formula:" + sFormula + ";"; } sal_Int32 SAL_CALL SwAccessibleCell::getBackground() commit cc5e445092347bfcef8fb70bc0e6008c107fd0bc Author: Michael Weghorn <[email protected]> AuthorDate: Mon Jan 19 15:36:06 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Jan 20 10:39:30 2026 +0100 tdf#170338 sw a11y: Add helper to get table's SwTabFrame Introduce new helper method SwAccessibleTable::GetTabFrame to cast the frame to SwTabFrame in one place, instead of doing this in multiple places. This will also be reused in SwAccessibleCell in an upcoming commit. Change-Id: I91053ee9691da277a5d9c7aa36ada811da0741a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197600 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 0f033829d0a0..7ba2960377e0 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -577,7 +577,7 @@ SwAccessibleTable::SwAccessibleTable( StartListening(const_cast<SwFrameFormat*>(pFrameFormat)->GetNotifier()); SetName( pFrameFormat->GetName().toString() + "-" + OUString::number( pTabFrame->GetPhyPageNum() ) ); - const OUString sArg1( static_cast< const SwTabFrame * >( GetFrame() )->GetFormat()->GetName().toString() ); + const OUString sArg1 = GetTabFrame()->GetFormat()->GetName().toString(); const OUString sArg2( GetFormattedPageNumber() ); m_sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 ); @@ -593,7 +593,7 @@ SwAccessibleTable::~SwAccessibleTable() void SwAccessibleTable::Notify(const SfxHint& rHint) { - const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(GetFrame()); + const SwTabFrame* pTabFrame = GetTabFrame(); if(rHint.GetId() == SfxHintId::Dying) { EndListeningAll(); @@ -627,8 +627,8 @@ void SwAccessibleTable::Notify(const SfxHint& rHint) // #i77106# std::unique_ptr<SwAccessibleTableData_Impl> SwAccessibleTable::CreateNewTableData() { - const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>( GetFrame() ); - return std::unique_ptr<SwAccessibleTableData_Impl>(new SwAccessibleTableData_Impl( *GetMap(), pTabFrame, IsInPagePreview() )); + return std::unique_ptr<SwAccessibleTableData_Impl>( + new SwAccessibleTableData_Impl(*GetMap(), GetTabFrame(), IsInPagePreview())); } void SwAccessibleTable::UpdateTableData() @@ -809,9 +809,8 @@ uno::Reference< XAccessibleTable > SAL_CALL // #i87532# - assure that return accessible object is empty, // if no column header exists. - rtl::Reference<SwAccessibleTableColHeaders> pTableColHeaders = - new SwAccessibleTableColHeaders(GetMap()->shared_from_this(), - static_cast<const SwTabFrame *>(GetFrame())); + rtl::Reference<SwAccessibleTableColHeaders> pTableColHeaders + = new SwAccessibleTableColHeaders(GetMap()->shared_from_this(), GetTabFrame()); if ( pTableColHeaders->getAccessibleChildCount() <= 0 ) { return uno::Reference< XAccessibleTable >(); @@ -1387,6 +1386,11 @@ sal_Int32 SAL_CALL SwAccessibleTable::getBackground() return sal_Int32(crBack); } +const SwTabFrame* SwAccessibleTable::GetTabFrame() const +{ + return static_cast<const SwTabFrame*>(GetFrame()); +} + void SwAccessibleTable::FireSelectionEvent( ) { for (const unotools::WeakReference<SwAccessibleContext>& rxCell : m_vecCellRemove) @@ -1528,8 +1532,8 @@ SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( std::unique_ptr<SwAccessibleTableData_Impl> SwAccessibleTableColHeaders::CreateNewTableData() { - const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>( GetFrame() ); - return std::unique_ptr<SwAccessibleTableData_Impl>(new SwAccessibleTableData_Impl( *(GetMap()), pTabFrame, IsInPagePreview(), true )); + return std::unique_ptr<SwAccessibleTableData_Impl>( + new SwAccessibleTableData_Impl(*(GetMap()), GetTabFrame(), IsInPagePreview(), true)); } void SwAccessibleTableColHeaders::Notify(const SfxHint& ) @@ -1545,7 +1549,7 @@ sal_Int64 SAL_CALL SwAccessibleTableColHeaders::getAccessibleChildCount() sal_Int32 nCount = 0; - const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>( GetFrame() ); + const SwTabFrame* pTabFrame = GetTabFrame(); const SwAccessibleChildSList aVisList( GetVisArea(), *pTabFrame, *(GetMap()) ); SwAccessibleChildSList::const_iterator aIter( aVisList.begin() ); while( aIter != aVisList.end() ) diff --git a/sw/source/core/access/acctable.hxx b/sw/source/core/access/acctable.hxx index 7a7cda419b3e..55c1aef0c17a 100644 --- a/sw/source/core/access/acctable.hxx +++ b/sw/source/core/access/acctable.hxx @@ -180,6 +180,8 @@ public: // XAccessibleComponent sal_Int32 SAL_CALL getBackground() override; + const SwTabFrame* GetTabFrame() const; + void FireSelectionEvent( ); void AddSelectionCell(SwAccessibleContext*, bool bAddOrRemove); };
