sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |   39 +++++++++++++++++-----
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx |    1 
 2 files changed, 32 insertions(+), 8 deletions(-)

New commits:
commit a2389bcd630b8c011e3dc236a33c7d2de43fd2be
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Wed Jun 28 19:44:54 2023 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Thu Jun 29 14:18:28 2023 +0200

    tdf#156032 - A11Y: fix remove of empty issue sections
    
    Remove issue categories if there is no more issue in it.
    
    Change-Id: Ic5dddf3db59c574d1e8712d79bdf203a6b637eb0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153724
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
    Tested-by: Jenkins
    (cherry picked from commit 3b250bcd95f6be183b2694c57512eba9b1a0ca67)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153708

diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index 123ce7e1fa57..162724a1035c 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -159,31 +159,54 @@ void A11yCheckIssuesPanel::ImplDestroy()
 
 A11yCheckIssuesPanel::~A11yCheckIssuesPanel() { 
suppress_fun_call_w_exception(ImplDestroy()); }
 
-void A11yCheckIssuesPanel::populateIssues()
+void A11yCheckIssuesPanel::removeOldWidgets()
 {
-    if (!mpDoc)
-        return;
-    sw::AccessibilityCheck aCheck(mpDoc);
-    aCheck.check();
-    m_aIssueCollection = aCheck.getIssueCollection();
-
-    // Remove old issue widgets
     for (auto const& xEntry : m_aDocumentEntries)
         m_xBoxDocument->move(xEntry->get_widget(), nullptr);
+    m_xExpanderDocument->set_visible(false);
+
     for (auto const& xEntry : m_aStylesEntries)
         m_xBoxStyles->move(xEntry->get_widget(), nullptr);
+    m_xExpanderStyles->set_visible(false);
+
     for (auto const& xEntry : m_aNoAltEntries)
         m_xBoxNoAlt->move(xEntry->get_widget(), nullptr);
+    m_xExpanderNoAlt->set_visible(false);
+
     for (auto const& xEntry : m_aTableEntries)
         m_xBoxTable->move(xEntry->get_widget(), nullptr);
+    m_xExpanderTable->set_visible(false);
+
     for (auto const& xEntry : m_aFormattingEntries)
         m_xBoxFormatting->move(xEntry->get_widget(), nullptr);
+    m_xExpanderFormatting->set_visible(false);
+
     for (auto const& xEntry : m_aHyperlinkEntries)
         m_xBoxHyperlink->move(xEntry->get_widget(), nullptr);
+    m_xExpanderHyperlink->set_visible(false);
+
     for (auto const& xEntry : m_aFakesEntries)
         m_xBoxFakes->move(xEntry->get_widget(), nullptr);
+    m_xExpanderFakes->set_visible(false);
+
     for (auto const& xEntry : m_aNumberingEntries)
         m_xBoxNumbering->move(xEntry->get_widget(), nullptr);
+    m_xExpanderNumbering->set_visible(false);
+
+    for (auto const& xEntry : m_aOtherEntries)
+        m_xBoxOther->move(xEntry->get_widget(), nullptr);
+    m_xExpanderOther->set_visible(false);
+}
+
+void A11yCheckIssuesPanel::populateIssues()
+{
+    if (!mpDoc)
+        return;
+    sw::AccessibilityCheck aCheck(mpDoc);
+    aCheck.check();
+    m_aIssueCollection = aCheck.getIssueCollection();
+
+    removeOldWidgets();
 
     sal_Int32 iDocument = 0;
     sal_Int32 iStyles = 0;
diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
index d48f4cae2906..54e5ad560bdf 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx
@@ -89,6 +89,7 @@ private:
     std::unique_ptr<weld::Box> m_xBoxOther;
     sfx::AccessibilityIssueCollection m_aIssueCollection;
     std::function<sfx::AccessibilityIssueCollection()> m_getIssueCollection;
+    void removeOldWidgets();
     void populateIssues();
 
     SfxBindings* mpBindings;

Reply via email to