sw/source/core/access/AccessibilityCheck.cxx | 19 +++++++++---------- sw/source/core/txtnode/OnlineAccessibilityCheck.cxx | 10 ++++++++-- 2 files changed, 17 insertions(+), 12 deletions(-)
New commits: commit 1dc60ddafbbc1b1e8612cf1263f6987a1f3417b6 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Thu Jun 22 18:48:10 2023 +0200 Commit: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> CommitDate: Fri Jun 23 10:31:08 2023 +0200 tdf#152576 - A11Y sidebar: improving update of issues on sidebar Put the empty paragraph nodes to the correct WeakNodeContainer. Change-Id: I2db5608b0f7a625b6221d9290ea3d2502f4cadea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153469 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de> diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index ec2a101795e5..b9eeaafc6171 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -683,21 +683,20 @@ public: class NewlineSpacingCheck : public NodeCheck { private: - static SwTextNode* getNextTextNode(SwNode* pCurrent) + static SwTextNode* getPrevTextNode(SwNode* pCurrent) { SwTextNode* pTextNode = nullptr; auto nIndex = pCurrent->GetIndex(); - auto nCount = pCurrent->GetNodes().Count(); - nIndex++; // go to next node + nIndex--; // go to previous node - while (pTextNode == nullptr && nIndex < nCount) + while (pTextNode == nullptr && nIndex >= SwNodeOffset(0)) { auto pNode = pCurrent->GetNodes()[nIndex]; if (pNode->IsTextNode()) pTextNode = pNode->GetTextNode(); - nIndex++; + nIndex--; } return pTextNode; @@ -721,16 +720,16 @@ public: auto nParagraphLength = pTextNode->GetText().getLength(); if (nParagraphLength == 0) { - SwTextNode* pNextTextNode = getNextTextNode(pCurrent); - if (!pNextTextNode) + SwTextNode* pPrevTextNode = getPrevTextNode(pCurrent); + if (!pPrevTextNode) return; - if (pNextTextNode->GetText().getLength() == 0) + if (pPrevTextNode->GetText().getLength() == 0) { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_NEWLINES_SPACE), sfx::AccessibilityIssueID::TEXT_FORMATTING); pIssue->setIssueObject(IssueObject::TEXT); - pIssue->setNode(pNextTextNode); - SwDoc& rDocument = pNextTextNode->GetDoc(); + pIssue->setNode(pTextNode); + SwDoc& rDocument = pTextNode->GetDoc(); pIssue->setDoc(rDocument); } } diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx index d39443313c6f..4b2dfe9237e9 100644 --- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx +++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx @@ -248,15 +248,16 @@ void OnlineAccessibilityCheck::lookForPreviousNodeAndUpdate(const SwPosition& rN return; } + // Run the docement level Accessibility Check + runDocumentLevelAccessibilityCheck(); + // Get the real previous node from index SwNode* pNode = pCurrentNode->GetNodes()[m_nPreviousNodeIndex]; if (pNode && (pNode->IsContentNode() || pNode->IsTableNode())) { - runDocumentLevelAccessibilityCheck(); runAccessibilityCheck(pNode); updateNodeStatus(pNode); - updateStatusbar(); // Assign previous node and index m_pPreviousNode = std::move(pCurrentWeak); @@ -264,9 +265,14 @@ void OnlineAccessibilityCheck::lookForPreviousNodeAndUpdate(const SwPosition& rN } else { + runAccessibilityCheck(pCurrentNode); + updateNodeStatus(pCurrentNode); + m_pPreviousNode.reset(); m_nPreviousNodeIndex = SwNodeOffset(-1); } + + updateStatusbar(); } void OnlineAccessibilityCheck::clearAccessibilityIssuesFromAllNodes()