[Libreoffice-commits] core.git: sw/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Dec 26 10:35:00 UTC 2019
sw/source/core/access/AccessibilityCheck.cxx | 55 +++++++++++++++++++++++++++
sw/source/core/inc/AccessibilityCheck.hxx | 1
2 files changed, 56 insertions(+)
New commits:
commit 1cafd1e50cbed6cf25730e03dc238bf687de5621
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Dec 7 13:12:12 2019 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Dec 26 11:34:25 2019 +0100
acc. check: add check for Tables
Tables shouldn't use splitted or merge cells.
Change-Id: Ife6726413d9dd1ead098c081e03f4f82540f1012
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85827
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 870f67169e11..31cd12c8b07e 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -19,6 +19,55 @@
namespace
{
OUString sNoAlt("No alt text for graphic '%OBJECT_NAME%'");
+OUString sTableMergeSplit("Table '%OBJECT_NAME%' contains merges or splits");
+}
+
+void AccessibilityCheck::checkTableNode(SwTableNode* pTableNode)
+{
+ if (!pTableNode)
+ return;
+
+ SwTable const& rTable = pTableNode->GetTable();
+ if (rTable.IsTableComplex())
+ {
+ OUString sName = rTable.GetTableStyleName();
+ svx::AccessibilityIssue aIssue;
+ aIssue.m_aIssueText = sTableMergeSplit.replaceAll("%OBJECT_NAME%", sName);
+ m_aAccessibilityIssueCollection.push_back(aIssue);
+ }
+ else
+ {
+ if (rTable.GetTabLines().size() > 1)
+ {
+ int i = 0;
+ size_t nFirstLineSize = 0;
+ bool bAllColumnsSameSize = true;
+
+ for (SwTableLine const* pTableLine : rTable.GetTabLines())
+ {
+ if (i == 0)
+ {
+ nFirstLineSize = pTableLine->GetTabBoxes().size();
+ }
+ else
+ {
+ size_t nLineSize = pTableLine->GetTabBoxes().size();
+ if (nFirstLineSize != nLineSize)
+ {
+ bAllColumnsSameSize = false;
+ }
+ }
+ i++;
+ }
+ if (!bAllColumnsSameSize)
+ {
+ OUString sName = rTable.GetTableStyleName();
+ svx::AccessibilityIssue aIssue;
+ aIssue.m_aIssueText = sTableMergeSplit.replaceAll("%OBJECT_NAME%", sName);
+ m_aAccessibilityIssueCollection.push_back(aIssue);
+ }
+ }
+ }
}
// Check NoTextNodes: Graphic, OLE
@@ -73,6 +122,12 @@ void AccessibilityCheck::check()
if (pNoTextNode)
checkNoTextNode(pNoTextNode);
}
+ if (pNode->GetNodeType() & SwNodeType::Table)
+ {
+ SwTableNode* pTableNode = pNode->GetTableNode();
+ if (pTableNode)
+ checkTableNode(pTableNode);
+ }
}
}
diff --git a/sw/source/core/inc/AccessibilityCheck.hxx b/sw/source/core/inc/AccessibilityCheck.hxx
index 4648b06dce70..5d268856d67e 100644
--- a/sw/source/core/inc/AccessibilityCheck.hxx
+++ b/sw/source/core/inc/AccessibilityCheck.hxx
@@ -32,6 +32,7 @@ public:
}
void check();
+ void checkTableNode(SwTableNode* pTableNode);
void checkNoTextNode(SwNoTextNode* pNoTextNode);
void checkObject(SdrObject* pObject);
};
More information about the Libreoffice-commits
mailing list