sw/inc/OnlineAccessibilityCheck.hxx | 4 ++-- sw/inc/node.hxx | 2 +- sw/source/core/docnode/node.cxx | 4 ++-- sw/source/core/layout/atrfrm.cxx | 10 ++++++++++ sw/source/core/txtnode/OnlineAccessibilityCheck.cxx | 9 ++++++--- sw/source/uibase/shells/drwbassh.cxx | 8 ++++++++ 6 files changed, 29 insertions(+), 8 deletions(-)
New commits: commit f53f7228fc77ac5d2579c9039220d53b4d8443a2 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Mon Aug 21 19:42:38 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Aug 24 11:04:47 2023 +0200 tdf#156116 - A11Y - fix object name does not update in accessibility sidebar when we modify the name on the Navigator sidebar. Update the related accessibility issue after we modify the name on the sidebar. Change-Id: I8f4b8780ff1ffe7cfb86ff837c9579d6b785b832 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155904 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> (cherry picked from commit 069569e4a095f2fe42e94c2dad15356e2038727a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155925 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/inc/OnlineAccessibilityCheck.hxx b/sw/inc/OnlineAccessibilityCheck.hxx index 1055c7e67d53..1e320554f8fc 100644 --- a/sw/inc/OnlineAccessibilityCheck.hxx +++ b/sw/inc/OnlineAccessibilityCheck.hxx @@ -57,7 +57,7 @@ private: void runAccessibilityCheck(SwNode* pNode); void updateStatusbar(); - void updateNodeStatus(SwNode* pContentNode); + void updateNodeStatus(SwNode* pContentNode, bool bIssueObjectNameChanged = false); void initialCheck(); void lookForPreviousNodeAndUpdate(SwPosition const& rNewPos); void clearAccessibilityIssuesFromAllNodes(); @@ -66,7 +66,7 @@ private: public: OnlineAccessibilityCheck(SwDoc& rDocument); void update(SwPosition const& rNewPos); - void resetAndQueue(SwNode* pNode); + void resetAndQueue(SwNode* pNode, bool bIssueObjectNameChanged = false); void resetAndQueueDocumentLevel(); void updateCheckerActivity(); sal_Int32 getNumberOfAccessibilityIssues() { return m_nAccessibilityIssues; } diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index a6a7dc603a27..240bdb05b4fd 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -336,7 +336,7 @@ public: return m_aAccessibilityCheckStatus; } - void resetAndQueueAccessibilityCheck(); + void resetAndQueueAccessibilityCheck(bool bIssueObjectNameChanged = false); private: SwNode( const SwNode & rNodes ) = delete; diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 64a9e86137c5..4304b875c4d7 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -2179,9 +2179,9 @@ void SwNode::RemoveAnchoredFly(SwFrameFormat *const pFlyFormat) m_aAnchoredFlys.erase(it); } -void SwNode::resetAndQueueAccessibilityCheck() +void SwNode::resetAndQueueAccessibilityCheck(bool bIssueObjectNameChanged) { - GetDoc().getOnlineAccessibilityCheck()->resetAndQueue(this); + GetDoc().getOnlineAccessibilityCheck()->resetAndQueue(this, bIssueObjectNameChanged); } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index f988cfa95912..07f767e30785 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2614,6 +2614,16 @@ void SwFrameFormat::SetFormatName( const OUString& rNewName, bool bBroadcast ) if (bBroadcast) { GetNotifier().Broadcast(aHint); } + + // update accessibility sidebar object name if we modify the object name on the navigator bar + if (!aHint.m_sOld.isEmpty() && aHint.m_sOld != aHint.m_sNew) + { + if (SwFlyFrame* pSFly = SwIterator<SwFlyFrame, SwFormat>(*this).First()) + { + if (SwNode* pSwNode = static_cast<SwNoTextFrame*>(pSFly->Lower())->GetNode()) + pSwNode->resetAndQueueAccessibilityCheck(true); + } + } } else SwFormat::SetFormatName( rNewName, bBroadcast ); diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx index c7da361e284f..983681051a2b 100644 --- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx +++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx @@ -79,13 +79,16 @@ OnlineAccessibilityCheck::OnlineAccessibilityCheck(SwDoc& rDocument) { } -void OnlineAccessibilityCheck::updateNodeStatus(SwNode* pNode) +void OnlineAccessibilityCheck::updateNodeStatus(SwNode* pNode, bool bIssueObjectNameChanged) { if (!pNode->IsContentNode() && !pNode->IsTableNode()) return; m_nAccessibilityIssues = 0; + if (bIssueObjectNameChanged) + return; + auto it = m_aNodes.find(pNode); if (it == m_aNodes.end()) { @@ -292,7 +295,7 @@ void OnlineAccessibilityCheck::clearAccessibilityIssuesFromAllNodes() updateStatusbar(); } -void OnlineAccessibilityCheck::resetAndQueue(SwNode* pNode) +void OnlineAccessibilityCheck::resetAndQueue(SwNode* pNode, bool bIssueObjectNameChanged) { if (utl::ConfigManager::IsFuzzing()) return; @@ -305,7 +308,7 @@ void OnlineAccessibilityCheck::resetAndQueue(SwNode* pNode) pNode->getAccessibilityCheckStatus().reset(); m_aNodes.erase(pNode); runAccessibilityCheck(pNode); - updateNodeStatus(pNode); + updateNodeStatus(pNode, bIssueObjectNameChanged); updateStatusbar(); } diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index cbb8a9c7835f..a5a63a66343d 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -595,9 +595,17 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) if(RET_OK == pDlg->Execute()) { + const OUString aOrigName = aName; pDlg->GetName(aName); pSelected->SetName(aName); pSh->SetModified(); + + // update accessibility sidebar object name if we modify the object name on the navigator bar + if (!aName.isEmpty() && aOrigName != aName) + { + if (SwNode* pSwNode = FindFrameFormat(pSelected)->GetAnchor().GetAnchorNode()) + pSwNode->resetAndQueueAccessibilityCheck(true); + } } }