[Libreoffice-commits] core.git: include/svx svx/Library_svx.mk svx/source svx/uiconfig svx/UIConfig_svx.mk sw/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 26 10:32:53 UTC 2019


 include/svx/AccessibilityCheckDialog.hxx       |   55 ++++++++++
 include/svx/AccessibilityIssue.hxx             |   27 ++++
 svx/Library_svx.mk                             |    1 
 svx/UIConfig_svx.mk                            |    2 
 svx/source/dialog/AccessibilityCheckDialog.cxx |   52 +++++++++
 svx/uiconfig/ui/accessibilitycheckdialog.ui    |  136 +++++++++++++++++++++++++
 svx/uiconfig/ui/accessibilitycheckentry.ui     |   25 ++++
 sw/source/core/access/AccessibilityCheck.cxx   |    4 
 sw/source/core/inc/AccessibilityCheck.hxx      |   11 --
 sw/source/uibase/shells/basesh.cxx             |    4 
 10 files changed, 307 insertions(+), 10 deletions(-)

New commits:
commit c823c7007e041028e517d8837aac2093b1dca217
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Thu Dec 5 22:24:49 2019 +0100
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Dec 26 11:32:20 2019 +0100

    Accessibility check dialog
    
    This adds the accessibility check dialog which is responsible to
    show all the accessibility check issues in the current document.
    Currently this just shows the text message in a list that comes
    from AccessibilityCheck.
    
    Change-Id: I8fd27038e3d85cd31fe172eee5e391fd4b7243ae
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85821
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/svx/AccessibilityCheckDialog.hxx b/include/svx/AccessibilityCheckDialog.hxx
new file mode 100644
index 000000000000..12b0262ded0f
--- /dev/null
+++ b/include/svx/AccessibilityCheckDialog.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBILITYCHECKDIALOG_HXX
+#define INCLUDED_SVX_ACCESSIBILITYCHECKDIALOG_HXX
+
+#include <sal/types.h>
+#include <svx/svxdllapi.h>
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+#include <vcl/weld.hxx>
+#include <svx/AccessibilityIssue.hxx>
+
+class SVX_DLLPUBLIC AccessibilityCheckEntry final
+{
+private:
+    std::unique_ptr<weld::Builder> m_xBuilder;
+    std::unique_ptr<weld::Container> m_xContainer;
+    std::unique_ptr<weld::Label> m_xLabel;
+
+    svx::AccessibilityIssue const& m_rAccessibilityIssue;
+
+public:
+    AccessibilityCheckEntry(weld::Container* pParent,
+                            svx::AccessibilityIssue const& rAccessibilityIssue);
+    weld::Widget* get_widget() const { return m_xContainer.get(); }
+};
+
+class SVX_DLLPUBLIC AccessibilityCheckDialog final : public weld::GenericDialogController
+{
+private:
+    std::vector<svx::AccessibilityIssue> m_rAccessibilityIssueCollection;
+    std::vector<std::unique_ptr<AccessibilityCheckEntry>> m_aAccessibilityCheckEntries;
+
+    // Controls
+    std::unique_ptr<weld::Box> m_xAccessibilityCheckBox;
+
+public:
+    AccessibilityCheckDialog(
+        weld::Window* pParent,
+        std::vector<svx::AccessibilityIssue> const& rAccessibilityIssueCollection);
+    virtual ~AccessibilityCheckDialog() override;
+    virtual short run() override;
+};
+
+#endif // INCLUDED_SVX_ACCESSIBILITYCHECKDIALOG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/AccessibilityIssue.hxx b/include/svx/AccessibilityIssue.hxx
new file mode 100644
index 000000000000..894439c54fec
--- /dev/null
+++ b/include/svx/AccessibilityIssue.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_SVX_ACCESSIBILITYISSUE_HXX
+#define INCLUDED_SVX_ACCESSIBILITYISSUE_HXX
+
+#include <svx/svxdllapi.h>
+
+namespace svx
+{
+class SVX_DLLPUBLIC AccessibilityIssue
+{
+public:
+    OUString m_aIssueText;
+};
+}
+
+#endif // INCLUDED_SVX_ACCESSIBILITYISSUE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk
index bdbdda1f555c..af4264047401 100644
--- a/svx/Library_svx.mk
+++ b/svx/Library_svx.mk
@@ -105,6 +105,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
     svx/source/customshapes/EnhancedCustomShapeEngine \
     svx/source/customshapes/EnhancedCustomShapeFontWork \
     svx/source/customshapes/EnhancedCustomShapeHandle \
+    svx/source/dialog/AccessibilityCheckDialog \
     svx/source/dialog/_bmpmask \
     svx/source/dialog/charmap \
     svx/source/dialog/searchcharmap \
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index db7a92fcb0ae..6193d0c52475 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -11,6 +11,8 @@ $(eval $(call gb_UIConfig_UIConfig,svx))
 
 $(eval $(call gb_UIConfig_add_uifiles,svx,\
 	svx/uiconfig/ui/acceptrejectchangesdialog \
+	svx/uiconfig/ui/accessibilitycheckdialog \
+	svx/uiconfig/ui/accessibilitycheckentry \
 	svx/uiconfig/ui/addconditiondialog \
 	svx/uiconfig/ui/adddataitemdialog \
 	svx/uiconfig/ui/addinstancedialog \
diff --git a/svx/source/dialog/AccessibilityCheckDialog.cxx b/svx/source/dialog/AccessibilityCheckDialog.cxx
new file mode 100644
index 000000000000..27e013507f5d
--- /dev/null
+++ b/svx/source/dialog/AccessibilityCheckDialog.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include <svx/AccessibilityCheckDialog.hxx>
+#include <svx/AccessibilityIssue.hxx>
+#include <vcl/svapp.hxx>
+
+AccessibilityCheckEntry::AccessibilityCheckEntry(weld::Container* pParent,
+                                                 svx::AccessibilityIssue const& rAccessibilityIssue)
+    : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/accessibilitycheckentry.ui"))
+    , m_xContainer(m_xBuilder->weld_container("accessibilityCheckEntryBox"))
+    , m_xLabel(m_xBuilder->weld_label("accessibilityCheckEntryLabel"))
+    , m_rAccessibilityIssue(rAccessibilityIssue)
+{
+    m_xLabel->set_label(m_rAccessibilityIssue.m_aIssueText);
+    m_xContainer->show();
+}
+
+AccessibilityCheckDialog::AccessibilityCheckDialog(
+    weld::Window* pParent,
+    std::vector<svx::AccessibilityIssue> const& rAccessibilityIssueCollection)
+    : GenericDialogController(pParent, "svx/ui/accessibilitycheckdialog.ui",
+                              "AccessibilityCheckDialog")
+    , m_rAccessibilityIssueCollection(rAccessibilityIssueCollection)
+    , m_xAccessibilityCheckBox(m_xBuilder->weld_box("accessibilityCheckBox"))
+{
+}
+
+AccessibilityCheckDialog::~AccessibilityCheckDialog() {}
+
+short AccessibilityCheckDialog::run()
+{
+    sal_Int32 i = 0;
+
+    for (svx::AccessibilityIssue const& rResult : m_rAccessibilityIssueCollection)
+    {
+        auto xEntry
+            = std::make_unique<AccessibilityCheckEntry>(m_xAccessibilityCheckBox.get(), rResult);
+        m_xAccessibilityCheckBox->reorder_child(xEntry->get_widget(), i++);
+        m_aAccessibilityCheckEntries.push_back(std::move(xEntry));
+    }
+    return GenericDialogController::run();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/uiconfig/ui/accessibilitycheckdialog.ui b/svx/uiconfig/ui/accessibilitycheckdialog.ui
new file mode 100644
index 000000000000..891a4b9ed24e
--- /dev/null
+++ b/svx/uiconfig/ui/accessibilitycheckdialog.ui
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="svx">
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkDialog" id="AccessibilityCheckDialog">
+    <property name="width_request">640</property>
+    <property name="height_request">480</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes" context="accessibilitycheckdialog|AccessibilityCheckDialog">Accessibility Check</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialogBox1">
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialogButtons">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkScrolledWindow">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkViewport">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <child>
+                      <object class="GtkBox" id="accessibilityCheckBox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-5">ok</action-widget>
+      <action-widget response="-6">cancel</action-widget>
+      <action-widget response="-11">help</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/svx/uiconfig/ui/accessibilitycheckentry.ui b/svx/uiconfig/ui/accessibilitycheckentry.ui
new file mode 100644
index 000000000000..bfd013491e51
--- /dev/null
+++ b/svx/uiconfig/ui/accessibilitycheckentry.ui
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="svx">
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkBox" id="accessibilityCheckEntryBox">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">3</property>
+    <child>
+      <object class="GtkLabel" id="accessibilityCheckEntryLabel">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="selectable">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+  </object>
+</interface>
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx
index 64c51e131d45..4460bb9a28ca 100644
--- a/sw/source/core/access/AccessibilityCheck.cxx
+++ b/sw/source/core/access/AccessibilityCheck.cxx
@@ -38,7 +38,7 @@ void AccessibilityCheck::check()
                     if (sAlternative.isEmpty())
                     {
                         OUString sName = pNoTextNode->GetFlyFormat()->GetName();
-                        AccessibilityIssue aIssue;
+                        svx::AccessibilityIssue aIssue;
                         aIssue.m_aIssueText = sNoAlt.replaceAll("%OBJECT_NAME%", sName);
                         m_aAccessibilityIssueCollection.push_back(aIssue);
                     }
@@ -63,7 +63,7 @@ void AccessibilityCheck::check()
                 if (sAlternative.isEmpty())
                 {
                     OUString sName = pObject->GetName();
-                    AccessibilityIssue aIssue;
+                    svx::AccessibilityIssue aIssue;
                     aIssue.m_aIssueText = sNoAlt.replaceAll("%OBJECT_NAME%", sName);
                     m_aAccessibilityIssueCollection.push_back(aIssue);
                 }
diff --git a/sw/source/core/inc/AccessibilityCheck.hxx b/sw/source/core/inc/AccessibilityCheck.hxx
index 800f6cb9da2f..670ed0416225 100644
--- a/sw/source/core/inc/AccessibilityCheck.hxx
+++ b/sw/source/core/inc/AccessibilityCheck.hxx
@@ -12,17 +12,12 @@
 #define INCLUDED_SW_SOURCE_CORE_ACCESSIBILITYCHECK_HXX
 
 #include <doc.hxx>
-
-class AccessibilityIssue
-{
-public:
-    OUString m_aIssueText;
-};
+#include <svx/AccessibilityIssue.hxx>
 
 class AccessibilityCheck
 {
     SwDoc* m_pDoc;
-    std::vector<AccessibilityIssue> m_aAccessibilityIssueCollection;
+    std::vector<svx::AccessibilityIssue> m_aAccessibilityIssueCollection;
 
 public:
     AccessibilityCheck(SwDoc* pDoc)
@@ -30,7 +25,7 @@ public:
     {
     }
 
-    std::vector<AccessibilityIssue> const& getIssueCollecton()
+    std::vector<svx::AccessibilityIssue> const& getIssueCollecton()
     {
         return m_aAccessibilityIssueCollection;
     }
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 80514a60aeb7..c0c71f403be3 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -141,6 +141,8 @@ static sal_uInt8 nFooterPos;
 #include <swslots.hxx>
 
 #include <AccessibilityCheck.hxx>
+#include <svx/AccessibilityCheckDialog.hxx>
+
 namespace
 {
     SvxContourDlg* GetContourDlg(SwView const &rView)
@@ -2681,6 +2683,8 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
         {
             AccessibilityCheck aCheck(rSh.GetDoc());
             aCheck.check();
+            AccessibilityCheckDialog aDialog(pMDI, aCheck.getIssueCollecton());
+            aDialog.run();
         }
         break;
         default:OSL_FAIL("wrong Dispatcher (basesh.cxx)");


More information about the Libreoffice-commits mailing list