[Libreoffice-commits] core.git: sw/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Sat Dec 28 11:35:17 UTC 2019
sw/source/core/access/AccessibilityCheck.cxx | 32 +++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
New commits:
commit a9a1602affde43f2d910e9d63d36d42ebeb824d9
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sun Dec 15 10:26:22 2019 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Dec 28 12:34:45 2019 +0100
acc. check: check document contains a document title (metadata)
Change-Id: I09dd2143153e787730d1528de030d8777edcb05f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85855
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index e9cb9e898326..cce19f896e47 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -12,11 +12,13 @@
#include <ndgrf.hxx>
#include <ndole.hxx>
#include <ndtxt.hxx>
+#include <docsh.hxx>
#include <IDocumentDrawModelAccess.hxx>
#include <drawdoc.hxx>
#include <svx/svdpage.hxx>
#include <swtable.hxx>
#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <unoparagraph.hxx>
#include <tools/urlobj.hxx>
#include <editeng/langitem.hxx>
@@ -33,6 +35,7 @@ OUString sFakeNumbering("Fake numbering '%NUMBERING%'");
OUString sHyperlinkTextIsLink("Hyperlink text is the same as the link address '%LINK%'");
OUString sDocumentDefaultLanguage("Document default language is not set");
OUString sStyleNoLanguage("Style '%STYLE_NAME%' has no language set");
+OUString sDocumentTitle("Document title is not set");
class BaseCheck
{
@@ -305,6 +308,34 @@ public:
}
};
+class DocumentTitleCheck : public DocumentCheck
+{
+public:
+ DocumentTitleCheck(std::vector<svx::AccessibilityIssue>& rIssueCollection)
+ : DocumentCheck(rIssueCollection)
+ {
+ }
+
+ void check(SwDoc* pDoc) override
+ {
+ SwDocShell* pShell = pDoc->GetDocShell();
+ if (pShell)
+ {
+ const uno::Reference<document::XDocumentPropertiesSupplier> xDPS(pShell->GetModel(),
+ uno::UNO_QUERY_THROW);
+ const uno::Reference<document::XDocumentProperties> xDocumentProperties(
+ xDPS->getDocumentProperties());
+ OUString sTitle = xDocumentProperties->getTitle();
+ if (sTitle.isEmpty())
+ {
+ svx::AccessibilityIssue aIssue;
+ aIssue.m_aIssueText = sDocumentTitle;
+ m_rIssueCollection.push_back(aIssue);
+ }
+ }
+ }
+};
+
} // end anonymous namespace
// Check Shapes, TextBox
@@ -333,6 +364,7 @@ void AccessibilityCheck::check()
std::vector<std::unique_ptr<DocumentCheck>> aDocumentChecks;
aDocumentChecks.push_back(std::make_unique<DocumentDefaultLanguageCheck>(m_aIssueCollection));
+ aDocumentChecks.push_back(std::make_unique<DocumentTitleCheck>(m_aIssueCollection));
for (std::unique_ptr<DocumentCheck>& rpDocumentCheck : aDocumentChecks)
{
More information about the Libreoffice-commits
mailing list