sw/source/core/access/AccessibilityCheck.cxx | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-)
New commits: commit 9942e9bedf363284532da5a13a2087bc49df8b3f Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Jan 5 20:43:09 2020 +0100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Mon Jan 6 23:15:07 2020 +0100 acc. check: table split/merge - check for row span, simplify This extends table split/merge check to also check for row span and simplifies the code a bit by removing code duplication of adding a new accessibility issue for the table to the collecton. Change-Id: If3eb1fa05174f606767e170a61fd0f4af7567aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86249 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 0e994e0e9e29..5aee7b69c682 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -134,21 +134,27 @@ public: class TableNodeMergeSplitCheck : public NodeCheck { private: + void addTableIssue(SwTable const& rTable, SwDoc* pDoc) + { + const SwTableFormat* pFormat = rTable.GetFrameFormat(); + OUString sName = pFormat->GetName(); + OUString sIssueText = sTableMergeSplit.replaceAll("%OBJECT_NAME%", sName); + auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText); + pIssue->setDoc(pDoc); + pIssue->setIssueObject(IssueObject::TABLE); + pIssue->setObjectID(sName); + } + void checkTableNode(SwTableNode* pTableNode) { if (!pTableNode) return; SwTable const& rTable = pTableNode->GetTable(); + SwDoc* pDoc = pTableNode->GetDoc(); if (rTable.IsTableComplex()) { - const SwTableFormat* pFormat = rTable.GetFrameFormat(); - OUString sName = pFormat->GetName(); - OUString sIssueText = sTableMergeSplit.replaceAll("%OBJECT_NAME%", sName); - auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText); - pIssue->setDoc(pTableNode->GetDoc()); - pIssue->setIssueObject(IssueObject::TABLE); - pIssue->setObjectID(sName); + addTableIssue(rTable, pDoc); } else { @@ -157,6 +163,7 @@ private: int i = 0; size_t nFirstLineSize = 0; bool bAllColumnsSameSize = true; + bool bCellSpansOverMoreRows = false; for (SwTableLine const* pTableLine : rTable.GetTabLines()) { @@ -173,16 +180,17 @@ private: } } i++; + + // Check for row span in each table box (cell) + for (SwTableBox const* pBox : pTableLine->GetTabBoxes()) + { + if (pBox->getRowSpan() > 1) + bCellSpansOverMoreRows = true; + } } - if (!bAllColumnsSameSize) + if (!bAllColumnsSameSize || bCellSpansOverMoreRows) { - const SwTableFormat* pFormat = rTable.GetFrameFormat(); - OUString sName = pFormat->GetName(); - OUString sIssueText = sTableMergeSplit.replaceAll("%OBJECT_NAME%", sName); - auto pIssue = lclAddIssue(m_rIssueCollection, sIssueText); - pIssue->setDoc(pTableNode->GetDoc()); - pIssue->setIssueObject(IssueObject::TABLE); - pIssue->setObjectID(sName); + addTableIssue(rTable, pDoc); } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits