sw/source/core/access/AccessibilityCheck.cxx | 49 ++++++++++++++++++++++++--- sw/source/core/access/AccessibilityIssue.cxx | 6 +++ sw/source/core/inc/AccessibilityIssue.hxx | 1 3 files changed, 52 insertions(+), 4 deletions(-)
New commits: commit 12fe9d6e0d645df0ece4d545ff9e9a7dcf99cb90 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Jan 5 19:22:33 2020 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Jan 6 23:14:38 2020 +0100 acc. check: add a UI goto for issues with tables Change-Id: Ifa636ce7ee32495d81571754c29b1114f8b56cdf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86247 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index f33f88b57e61..0e994e0e9e29 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -142,9 +142,13 @@ private: SwTable const& rTable = pTableNode->GetTable(); if (rTable.IsTableComplex()) { - OUString sName = rTable.GetTableStyleName(); + const SwTableFormat* pFormat = rTable.GetFrameFormat(); + OUString sName = pFormat->GetName(); OUString sIssueText = sTableMergeSplit.replaceAll("%OBJECT_NAME%", sName); - lclAddIssue(m_rIssueCollection, sIssueText); + auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText); + pIssue->setDoc(pTableNode->GetDoc()); + pIssue->setIssueObject(IssueObject::TABLE); + pIssue->setObjectID(sName); } else { @@ -172,9 +176,13 @@ private: } if (!bAllColumnsSameSize) { - OUString sName = rTable.GetTableStyleName(); + const SwTableFormat* pFormat = rTable.GetFrameFormat(); + OUString sName = pFormat->GetName(); OUString sIssueText = sTableMergeSplit.replaceAll("%OBJECT_NAME%", sName); - lclAddIssue(m_rIssueCollection, sIssueText); + auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText); + pIssue->setDoc(pTableNode->GetDoc()); + pIssue->setIssueObject(IssueObject::TABLE); + pIssue->setObjectID(sName); } } } diff --git a/sw/source/core/access/AccessibilityIssue.cxx b/sw/source/core/access/AccessibilityIssue.cxx index e4ce9f658f57..1d2e1efc7708 100644 --- a/sw/source/core/access/AccessibilityIssue.cxx +++ b/sw/source/core/access/AccessibilityIssue.cxx @@ -48,6 +48,12 @@ void AccessibilityIssue::gotoIssue() const pWrtShell->GotoFly(m_sObjectID, FLYCNTTYPE_ALL, true); } break; + case IssueObject::TABLE: + { + SwWrtShell* pWrtShell = m_pDoc->GetDocShell()->GetWrtShell(); + pWrtShell->GotoTable(m_sObjectID); + } + break; default: break; } diff --git a/sw/source/core/inc/AccessibilityIssue.hxx b/sw/source/core/inc/AccessibilityIssue.hxx index 2d8776ac5c1f..11b017dea6a5 100644 --- a/sw/source/core/inc/AccessibilityIssue.hxx +++ b/sw/source/core/inc/AccessibilityIssue.hxx @@ -21,6 +21,7 @@ enum class IssueObject UNKNOWN, GRAPHIC, OLE, + TABLE, }; class SW_DLLPUBLIC AccessibilityIssue final : public svx::AccessibilityIssue commit bc62883e07d6795edfb70571f90e1b85fcfdd399 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Jan 5 19:08:19 2020 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Jan 6 23:14:28 2020 +0100 acc. check: check headings are in incremental order This adds an accessibility check for headings. Headings should be in increemntal order. This means for example that the document can't start with "Heading 2" without first having a "Heading 1", or to skip a heading - for example to go from "Heading 1" and next have "Heading 3", skipping "Heading 2". Change-Id: I6fd3189cc659ad0756cc950b7c0b83b3ec8abf84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86246 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 0d07cb4f0357..f33f88b57e61 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -45,6 +45,7 @@ OUString sTextContrast("Text contrast is too low."); OUString sTextBlinking("Blinking text."); OUString sAvoidFootnotes("Avoid footnotes."); OUString sAvoidEndnotes("Avoid endnotes."); +OUString sHeadingsOrder("Headings not in order."); std::shared_ptr<sw::AccessibilityIssue> lclAddIssue(svx::AccessibilityIssueCollection& rIssueCollection, OUString const& rText, @@ -465,6 +466,37 @@ public: } }; +class HeaderCheck : public NodeCheck +{ +private: + int nPreviousLevel; + +public: + HeaderCheck(svx::AccessibilityIssueCollection& rIssueCollection) + : NodeCheck(rIssueCollection) + , nPreviousLevel(0) + { + } + + void check(SwNode* pCurrent) override + { + if (pCurrent->IsTextNode()) + { + SwTextNode* pTextNode = pCurrent->GetTextNode(); + SwTextFormatColl* pCollection = pTextNode->GetTextColl(); + int nLevel = pCollection->GetAssignedOutlineStyleLevel(); + if (nLevel < 0) + return; + + if (nLevel > nPreviousLevel && std::abs(nLevel - nPreviousLevel) > 1) + { + lclAddIssue(m_rIssueCollection, sHeadingsOrder); + } + nPreviousLevel = nLevel; + } + } +}; + class DocumentCheck : public BaseCheck { public: @@ -606,6 +638,7 @@ void AccessibilityCheck::check() aNodeChecks.push_back(std::make_unique<HyperlinkCheck>(m_aIssueCollection)); aNodeChecks.push_back(std::make_unique<TextContrastCheck>(m_aIssueCollection)); aNodeChecks.push_back(std::make_unique<BlinkingTextCheck>(m_aIssueCollection)); + aNodeChecks.push_back(std::make_unique<HeaderCheck>(m_aIssueCollection)); auto const& pNodes = m_pDoc->GetNodes(); SwNode* pNode = nullptr; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits