summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-01-05 20:43:09 +0100
committerTomaž Vajngerl <quikee@gmail.com>2020-01-06 23:15:07 +0100
commit9942e9bedf363284532da5a13a2087bc49df8b3f (patch)
treefb1a58bd277be9e1925f4942965827f837ef5fba /sw
parent12fe9d6e0d645df0ece4d545ff9e9a7dcf99cb90 (diff)
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 <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/access/AccessibilityCheck.cxx38
1 files changed, 23 insertions, 15 deletions
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);
}
}
}