[Libreoffice-commits] core.git: sw/inc sw/source

Ivan Stefanenko (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 9 06:03:33 UTC 2020


 sw/inc/AccessibilityCheckStrings.hrc         |    1 +
 sw/source/core/access/AccessibilityCheck.cxx |   13 +++++++++++++
 2 files changed, 14 insertions(+)

New commits:
commit 59301a4ab8ffc1bb8d5516825627a9a371c640f0
Author:     Ivan Stefanenko <ivan.stefanenko at collabora.com>
AuthorDate: Sat Nov 7 22:14:00 2020 +0300
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Nov 9 07:02:53 2020 +0100

    tdf#138052 Added a check for fontworks.
    
    Fontworks should be warned about coz they reprezent a stylized text,
    which is hard to recognize for digital readers.
    Check is added to checkObject() function as fontwork is an object.
    
    Change-Id: I2ed5a5784dfe96bbf05ec7cf4c09dc97e1fb29d5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105436
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/AccessibilityCheckStrings.hrc b/sw/inc/AccessibilityCheckStrings.hrc
index 7470ab4b9248..25e6c5ec9253 100644
--- a/sw/inc/AccessibilityCheckStrings.hrc
+++ b/sw/inc/AccessibilityCheckStrings.hrc
@@ -27,6 +27,7 @@
 #define STR_FLOATING_TEXT               NC_("STR_FLOATING_TEXT", "Avoid floating text.")
 #define STR_HEADING_IN_TABLE            NC_("STR_HEADING_IN_TABLE", "Tables must not contain headings.")
 #define STR_HEADING_ORDER               NC_("STR_HEADING_ORDER", "Keep headings' levels ordered. Heading level %LEVEL_CURRENT% must not go after %LEVEL_PREV%.")
+#define STR_FONTWORKS                   NC_("STR_FONTWORKS", "Avoid fontworks in your documents. Be sure you're using it in order to show a sample or another meaningless text.")
 
 #define STR_DOCUMENT_DEFAULT_LANGUAGE   NC_("STR_DOCUMENT_DEFAULT_LANGUAGE", "Document default language is not set")
 #define STR_STYLE_NO_LANGUAGE           NC_("STR_STYLE_NO_LANGUAGE", "Style '%STYLE_NAME%' has no language set")
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 3f97837d97d0..b2299ca36c59 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -35,6 +35,8 @@
 #include <svx/swframetypes.hxx>
 #include <fmtanchr.hxx>
 #include <dcontact.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/sdasitm.hxx>
 
 namespace sw
 {
@@ -876,6 +878,17 @@ void AccessibilityCheck::checkObject(SdrObject* pObject)
     if (!pObject)
         return;
 
+    // Check for fontworks.
+    if (SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>(pObject))
+    {
+        const SdrCustomShapeGeometryItem& rGeometryItem
+            = pCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY);
+
+        if (const uno::Any* pAny = rGeometryItem.GetPropertyValueByName("Type"))
+            if (pAny->get<OUString>().startsWith("fontwork-"))
+                lclAddIssue(m_aIssueCollection, SwResId(STR_FONTWORKS));
+    }
+
     // Checking if there is floating Writer text draw object and if so, throwing a warning.
     // (Floating objects with text create problems with reading order)
     if (pObject->HasText()


More information about the Libreoffice-commits mailing list