include/sfx2/AccessibilityIssue.hxx | 1 sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx | 26 +++++----- sw/source/core/access/AccessibilityCheck.cxx | 6 +- sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx | 35 ++++++++++---- sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx | 15 +++--- sw/uiconfig/swriter/ui/a11ycheckissuespanel.ui | 36 +++++++++++++-- 6 files changed, 83 insertions(+), 36 deletions(-)
New commits: commit e74a5bea04483dc96ef6d4b34edd8735ec73bcd8 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Tue Jun 18 16:15:06 2024 +0200 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Thu Jun 20 10:59:18 2024 +0200 tdf#159906 - A11Y: Add new direct character formatting group level for Formatted warnings and keep them not expanded (default) to avoid to many visible warning message on the sidebar. Change-Id: Ic251909d793198c3c4ce5e132b763c15ac1c9a9e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169110 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/include/sfx2/AccessibilityIssue.hxx b/include/sfx2/AccessibilityIssue.hxx index 92bef3d7d6a2..d6dd7eb3f4bf 100644 --- a/include/sfx2/AccessibilityIssue.hxx +++ b/include/sfx2/AccessibilityIssue.hxx @@ -33,6 +33,7 @@ enum class AccessibilityIssueID NO_ALT_SHAPE, TABLE_MERGE_SPLIT, TEXT_FORMATTING, + DIRECT_FORMATTING, TABLE_FORMATTING, HYPERLINK_IS_TEXT, HYPERLINK_SHORT, diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index 8c3845332310..d3355bcfdd43 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -69,7 +69,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckParagraphIssues) aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); } CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckBackgroundImage) @@ -143,7 +143,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckHighlightedText) aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); } CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testNumberingCheck) @@ -315,8 +315,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues()); auto aIssues = scanAccessibilityIssuesOnNodes(pDoc); CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[1]->m_eIssueID); checkIssuePosition(aIssues[0], __LINE__, 0, 32, SwNodeOffset(9)); checkIssuePosition(aIssues[1], __LINE__, 33, 136, SwNodeOffset(9)); @@ -334,8 +334,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) aIssues = scanAccessibilityIssuesOnNodes(pDoc); CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[1]->m_eIssueID); checkIssuePosition(aIssues[0], __LINE__, 0, 32, SwNodeOffset(9)); checkIssuePosition(aIssues[1], __LINE__, 0, 103, SwNodeOffset(10)); @@ -354,9 +354,9 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues()); aIssues = scanAccessibilityIssuesOnNodes(pDoc); CPPUNIT_ASSERT_EQUAL(size_t(3), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[2]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[2]->m_eIssueID); checkIssuePosition(aIssues[0], __LINE__, 0, 32, SwNodeOffset(9)); checkIssuePosition(aIssues[1], __LINE__, 0, 23, SwNodeOffset(10)); checkIssuePosition(aIssues[2], __LINE__, 0, 80, SwNodeOffset(11)); @@ -371,8 +371,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues()); aIssues = scanAccessibilityIssuesOnNodes(pDoc); CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[1]->m_eIssueID); checkIssuePosition(aIssues[0], __LINE__, 0, 32, SwNodeOffset(9)); checkIssuePosition(aIssues[1], __LINE__, 0, 103, SwNodeOffset(10)); @@ -386,8 +386,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testOnlineNodeSplitAppend) getParagraph(1)->getString()); aIssues = scanAccessibilityIssuesOnNodes(pDoc); CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[1]->m_eIssueID); checkIssuePosition(aIssues[0], __LINE__, 0, 32, SwNodeOffset(9)); checkIssuePosition(aIssues[1], __LINE__, 33, 136, SwNodeOffset(9)); } diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index ae767b597698..cd75edac31db 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -565,7 +565,7 @@ private: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING), - sfx::AccessibilityIssueID::TEXT_FORMATTING); + sfx::AccessibilityIssueID::DIRECT_FORMATTING); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); SwDoc& rDocument = pTextNode->GetDoc(); @@ -720,7 +720,7 @@ public: o3tl::remove_duplicates(aFormattings); auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING), - sfx::AccessibilityIssueID::TEXT_FORMATTING); + sfx::AccessibilityIssueID::DIRECT_FORMATTING); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); SwDoc& rDocument = pTextNode->GetDoc(); @@ -772,7 +772,7 @@ public: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING), - sfx::AccessibilityIssueID::TEXT_FORMATTING); + sfx::AccessibilityIssueID::DIRECT_FORMATTING); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); SwDoc& rDocument = pTextNode->GetDoc(); diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx index dc91eaebfca9..a8de69432188 100644 --- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx +++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx @@ -123,10 +123,11 @@ A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* pParent, SfxBindings* p m_xExpanders[3] = m_xBuilder->weld_expander(u"expand_no_alt"_ustr); m_xExpanders[4] = m_xBuilder->weld_expander(u"expand_table"_ustr); m_xExpanders[5] = m_xBuilder->weld_expander(u"expand_formatting"_ustr); - m_xExpanders[6] = m_xBuilder->weld_expander(u"expand_hyperlink"_ustr); - m_xExpanders[7] = m_xBuilder->weld_expander(u"expand_fakes"_ustr); - m_xExpanders[8] = m_xBuilder->weld_expander(u"expand_numbering"_ustr); - m_xExpanders[9] = m_xBuilder->weld_expander(u"expand_other"_ustr); + m_xExpanders[6] = m_xBuilder->weld_expander(u"expand_direct_formatting"_ustr); + m_xExpanders[7] = m_xBuilder->weld_expander(u"expand_hyperlink"_ustr); + m_xExpanders[8] = m_xBuilder->weld_expander(u"expand_fakes"_ustr); + m_xExpanders[9] = m_xBuilder->weld_expander(u"expand_numbering"_ustr); + m_xExpanders[10] = m_xBuilder->weld_expander(u"expand_other"_ustr); m_xBoxes[0] = m_xBuilder->weld_box(u"box_document"_ustr); m_xBoxes[1] = m_xBuilder->weld_box(u"box_styles"_ustr); @@ -134,10 +135,11 @@ A11yCheckIssuesPanel::A11yCheckIssuesPanel(weld::Widget* pParent, SfxBindings* p m_xBoxes[3] = m_xBuilder->weld_box(u"box_no_alt"_ustr); m_xBoxes[4] = m_xBuilder->weld_box(u"box_table"_ustr); m_xBoxes[5] = m_xBuilder->weld_box(u"box_formatting"_ustr); - m_xBoxes[6] = m_xBuilder->weld_box(u"box_hyperlink"_ustr); - m_xBoxes[7] = m_xBuilder->weld_box(u"box_fakes"_ustr); - m_xBoxes[8] = m_xBuilder->weld_box(u"box_numbering"_ustr); - m_xBoxes[9] = m_xBuilder->weld_box(u"box_other"_ustr); + m_xBoxes[6] = m_xBuilder->weld_box(u"box_direct_formatting"_ustr); + m_xBoxes[7] = m_xBuilder->weld_box(u"box_hyperlink"_ustr); + m_xBoxes[8] = m_xBuilder->weld_box(u"box_fakes"_ustr); + m_xBoxes[9] = m_xBuilder->weld_box(u"box_numbering"_ustr); + m_xBoxes[10] = m_xBuilder->weld_box(u"box_other"_ustr); mxUpdateLinkButton->connect_activate_link( LINK(this, A11yCheckIssuesPanel, UpdateLinkButtonClicked)); @@ -243,7 +245,8 @@ void A11yCheckIssuesPanel::populateIssues() removeAllEntries(); - std::vector<sal_Int32> nIndices(10, 0); + std::vector<sal_Int32> nIndices(11, 0); + sal_Int32 nDirectFormats = 0; for (std::shared_ptr<sfx::AccessibilityIssue> const& pIssue : m_aIssueCollection.getIssues()) { @@ -284,6 +287,12 @@ void A11yCheckIssuesPanel::populateIssues() addEntryForGroup(AccessibilityCheckGroups::Formatting, nIndices, pIssue); } break; + case sfx::AccessibilityIssueID::DIRECT_FORMATTING: + { + addEntryForGroup(AccessibilityCheckGroups::DirectFormatting, nIndices, pIssue); + nDirectFormats++; + } + break; case sfx::AccessibilityIssueID::HYPERLINK_IS_TEXT: case sfx::AccessibilityIssueID::HYPERLINK_SHORT: { @@ -314,6 +323,14 @@ void A11yCheckIssuesPanel::populateIssues() break; }; } + + // add DirectFormats (if have) as last element to Formatting AccessibilityCheckGroup + if (nDirectFormats > 0) + { + size_t nGroupFormatIndex = size_t(AccessibilityCheckGroups::Formatting); + nIndices[nGroupFormatIndex]++; + } + size_t nGroupIndex = 0; for (sal_Int32 nIndex : nIndices) { diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx index ef8d4da0e186..b48520ca3257 100644 --- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx +++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.hxx @@ -51,10 +51,11 @@ enum class AccessibilityCheckGroups : size_t NoAlt = 3, Table = 4, Formatting = 5, - Hyperlink = 6, - Fakes = 7, - Numbering = 8, - Other = 9, + DirectFormatting = 6, + Hyperlink = 7, + Fakes = 8, + Numbering = 9, + Other = 10, LAST = Other }; @@ -75,9 +76,9 @@ public: virtual ~A11yCheckIssuesPanel() override; private: - std::array<std::vector<std::unique_ptr<AccessibilityCheckEntry>>, 10> m_aEntries; - std::array<std::unique_ptr<weld::Expander>, 10> m_xExpanders; - std::array<std::unique_ptr<weld::Box>, 10> m_xBoxes; + std::array<std::vector<std::unique_ptr<AccessibilityCheckEntry>>, 11> m_aEntries; + std::array<std::unique_ptr<weld::Expander>, 11> m_xExpanders; + std::array<std::unique_ptr<weld::Box>, 11> m_xBoxes; std::unique_ptr<weld::Box> mxAccessibilityBox; std::unique_ptr<weld::Box> mxUpdateBox; std::unique_ptr<weld::LinkButton> mxUpdateLinkButton; diff --git a/sw/uiconfig/swriter/ui/a11ycheckissuespanel.ui b/sw/uiconfig/swriter/ui/a11ycheckissuespanel.ui index 3918611f7590..7bf6885fd49a 100644 --- a/sw/uiconfig/swriter/ui/a11ycheckissuespanel.ui +++ b/sw/uiconfig/swriter/ui/a11ycheckissuespanel.ui @@ -176,6 +176,34 @@ <property name="can-focus">False</property> <property name="margin-start">6</property> <property name="orientation">vertical</property> + <child> + <object class="GtkExpander" id="expand_direct_formatting"> + <property name="can-focus">True</property> + <child> + <object class="GtkBox" id="box_direct_formatting"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="margin-start">6</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="expand_direct_formatting_label"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="a11ycheckissuespanel|expand_formatting_label">Direct Formatting</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> <placeholder/> </child> @@ -221,7 +249,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">6</property> + <property name="position">7</property> </packing> </child> <child> @@ -250,7 +278,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">7</property> + <property name="position">8</property> </packing> </child> <child> @@ -279,7 +307,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">8</property> + <property name="position">9</property> </packing> </child> <child> @@ -308,7 +336,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">9</property> + <property name="position">10</property> </packing> </child> </object>