diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc index 0b5068b6fcae..96ab2285b4ee 100644 --- a/cui/inc/strings.hrc +++ b/cui/inc/strings.hrc @@ -421,6 +421,7 @@ #define STR_AVOID_NEWLINES_SPACE NC_("STR_AVOID_NEWLINES_SPACE", "Check if document contains new lines to create space.") #define STR_AVOID_SPACES_SPACE NC_("STR_AVOID_SPACES_SPACE", "Check if document contains extra spaces to create space.") #define STR_AVOID_TABS_FORMATTING NC_("STR_AVOID_TABS_FORMATTING", "Check if document contains tabs for formatting.") +#define STR_AVOID_EMPTY_NUM_PARA NC_("STR_AVOID_EMPTY_NUM_PARA", "Check if document contains new empty lines between numbered paragraphs.") #define STR_HEADINGS_NOT_IN_ORDER NC_("STR_HEADINGS_NOT_IN_ORDER", "Check if the outline levels of all headings are in sequential order.") #define STR_TEXT_FORMATTING_CONVEYS_MEAN NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "Check if the document contains direct formatting.") #define STR_NON_INTERACTIVE_FORMS NC_("STR_NON_INTERACTIVE_FORMS", "Check if the document contains interactive input fields.") diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx index 41cb13f358ac..27971df71360 100644 --- a/cui/source/options/optaccessibility.cxx +++ b/cui/source/options/optaccessibility.cxx @@ -37,10 +37,13 @@ namespace { u"NoAltOleObj"_ustr, { sfx::AccessibilityIssueID::NO_ALT_OLE, STR_NO_ALT_OLE } }, { u"NoAltGraphicObj"_ustr, { sfx::AccessibilityIssueID::NO_ALT_GRAPHIC, STR_NO_ALT_GRAPHIC } }, { u"NoAltShapeObj"_ustr, { sfx::AccessibilityIssueID::NO_ALT_SHAPE, STR_NO_ALT_SHAPE } }, - { u"TextFormattings"_ustr, { sfx::AccessibilityIssueID::TEXT_FORMATTING, STR_AVOID_NEWLINES_SPACE } }, + { u"TableMergeSplit"_ustr, { sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, STR_TABLE_MERGE_SPLIT } }, + { u"TextNewLines"_ustr, { sfx::AccessibilityIssueID::TEXT_NEW_LINES, STR_AVOID_NEWLINES_SPACE } }, + { u"TextSpaces"_ustr, { sfx::AccessibilityIssueID::TEXT_SPACES, STR_AVOID_SPACES_SPACE } }, + { u"TextTabs"_ustr, { sfx::AccessibilityIssueID::TEXT_TABS, STR_AVOID_TABS_FORMATTING } }, + { u"TextEmptyNums"_ustr, { sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA, STR_AVOID_EMPTY_NUM_PARA } }, { u"DirectFormattings"_ustr, { sfx::AccessibilityIssueID::DIRECT_FORMATTING, STR_TEXT_FORMATTING_CONVEYS_MEAN } }, { u"TableFormattings"_ustr, { sfx::AccessibilityIssueID::TABLE_FORMATTING, STR_TABLE_FORMATTING } }, - { u"TableMergeSplit"_ustr, { sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, STR_TABLE_MERGE_SPLIT } }, { u"HyperlinkText"_ustr, { sfx::AccessibilityIssueID::HYPERLINK_IS_TEXT, STR_HYPERLINK_TEXT_IS_LINK } }, { u"HyperlinkShort"_ustr, { sfx::AccessibilityIssueID::HYPERLINK_SHORT, STR_HYPERLINK_TEXT_IS_SHORT } }, { u"HyperlinkNoName"_ustr, { sfx::AccessibilityIssueID::HYPERLINK_NO_NAME, STR_HYPERLINK_NO_NAME } }, @@ -198,8 +201,20 @@ bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* ) officecfg::Office::Common::AccessibilityIssues::NoAltShapeObj::set(bChecked, batch); break; - case sfx::AccessibilityIssueID::TEXT_FORMATTING: - officecfg::Office::Common::AccessibilityIssues::TextFormattings::set(bChecked, batch); + case sfx::AccessibilityIssueID::TEXT_NEW_LINES: + officecfg::Office::Common::AccessibilityIssues::TextNewLines::set(bChecked, batch); + break; + + case sfx::AccessibilityIssueID::TEXT_SPACES: + officecfg::Office::Common::AccessibilityIssues::TextSpaces::set(bChecked, batch); + break; + + case sfx::AccessibilityIssueID::TEXT_TABS: + officecfg::Office::Common::AccessibilityIssues::TextTabs::set(bChecked, batch); + break; + + case sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA: + officecfg::Office::Common::AccessibilityIssues::TextEmptyNums::set(bChecked, batch); break; case sfx::AccessibilityIssueID::DIRECT_FORMATTING: @@ -394,8 +409,20 @@ void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet* ) bChecked = officecfg::Office::Common::AccessibilityIssues::NoAltShapeObj::get(); break; - case sfx::AccessibilityIssueID::TEXT_FORMATTING: - bChecked = officecfg::Office::Common::AccessibilityIssues::TextFormattings::get(); + case sfx::AccessibilityIssueID::TEXT_NEW_LINES: + bChecked = officecfg::Office::Common::AccessibilityIssues::TextNewLines::get(); + break; + + case sfx::AccessibilityIssueID::TEXT_SPACES: + bChecked = officecfg::Office::Common::AccessibilityIssues::TextSpaces::get(); + break; + + case sfx::AccessibilityIssueID::TEXT_TABS: + bChecked = officecfg::Office::Common::AccessibilityIssues::TextTabs::get(); + break; + + case sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA: + bChecked = officecfg::Office::Common::AccessibilityIssues::TextEmptyNums::get(); break; case sfx::AccessibilityIssueID::DIRECT_FORMATTING: diff --git a/include/sfx2/AccessibilityIssue.hxx b/include/sfx2/AccessibilityIssue.hxx index abb7a1318f05..65174e0fdfdb 100644 --- a/include/sfx2/AccessibilityIssue.hxx +++ b/include/sfx2/AccessibilityIssue.hxx @@ -31,7 +31,10 @@ enum class AccessibilityIssueID NO_ALT_GRAPHIC, NO_ALT_SHAPE, TABLE_MERGE_SPLIT, - TEXT_FORMATTING, + TEXT_NEW_LINES, + TEXT_SPACES, + TEXT_TABS, + TEXT_EMPTY_NUM_PARA, DIRECT_FORMATTING, TABLE_FORMATTING, HYPERLINK_IS_TEXT, diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 4ed3683d2fc3..67e62985321c 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -6340,13 +6340,43 @@ true - + - Enables accessibility check of Text formattings, inside the document structure - while the user edits the document. + Enables accessibility check of empty new line text formattings, inside the document + structure while the user edits the document. - + + + true + + + + + Enables accessibility check of extra spaces for formattings, inside the document + structure while the user edits the document. + + + + true + + + + + Enables accessibility check of extra tabs for formattings, inside the document + structure while the user edits the document. + + + + true + + + + + Enables accessibility check of empty new line between numberings, inside the document + structure while the user edits the document. + + true diff --git a/sw/inc/AccessibilityCheckStrings.hrc b/sw/inc/AccessibilityCheckStrings.hrc index 11a5b5299ab1..6acfa0761157 100644 --- a/sw/inc/AccessibilityCheckStrings.hrc +++ b/sw/inc/AccessibilityCheckStrings.hrc @@ -30,6 +30,7 @@ #define STR_AVOID_NEWLINES_SPACE NC_("STR_AVOID_NEWLINES_SPACE", "Avoid newlines to create space.") #define STR_AVOID_SPACES_SPACE NC_("STR_AVOID_SPACES_SPACE", "Avoid spaces to create space.") #define STR_AVOID_TABS_FORMATTING NC_("STR_AVOID_TABS_FORMATTING", "Avoid using tabs for formatting.") +#define STR_AVOID_EMPTY_NUM_PARA NC_("STR_AVOID_EMPTY_NUM_PARA", "Avoid new empty lines between numbered paragraphs.") #define STR_HEADINGS_NOT_IN_ORDER NC_("STR_HEADINGS_NOT_IN_ORDER", "Outline levels of headings not in sequential order.") #define STR_TEXT_FORMATTING_CONVEYS_MEANING NC_("STR_TEXT_FORMATTING_CONVEYS_MEANING", "The text formatting conveys additional meaning.") #define STR_NON_INTERACTIVE_FORMS NC_("STR_NON_INTERACTIVE_FORMS", "Use interactive input fields.") diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx index 6bdba45e753c..1f820b47ed02 100644 --- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx +++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx @@ -106,12 +106,24 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckNewlineSpace) auto& aIssues = aCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(4), aIssues.size()); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[1]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[2]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[3]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[3]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueLevel::WARNLEV, aIssues[3]->m_eIssueLvl); } +CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testEmptyLineBetweenNumberings) +{ + createSwDoc("EmptyNumSpace.odt"); + SwDoc* pDoc = getSwDoc(); + sw::AccessibilityCheck aCheck(pDoc); + aCheck.check(); + auto& aIssues = aCheck.getIssueCollection().getIssues(); + CPPUNIT_ASSERT_EQUAL(size_t(1), aIssues.size()); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueLevel::WARNLEV, aIssues[0]->m_eIssueLvl); +} + CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) { createSwDoc("SpaceTest.odt"); @@ -121,7 +133,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckSpacebarSpace) auto& aIssues = aCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(3), aIssues.size()); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_SPACES, aIssues[1]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[2]->m_eIssueID); } @@ -223,15 +235,15 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckTabsFormatting) aCheck.check(); auto& aIssues = aCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(10), aIssues.size()); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[0]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[0]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[1]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[2]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[2]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[3]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[4]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[4]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[5]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[6]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[6]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[7]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[8]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_TABS, aIssues[8]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DIRECT_FORMATTING, aIssues[9]->m_eIssueID); } @@ -261,13 +273,13 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testDeleteHeader) CPPUNIT_ASSERT_EQUAL(size_t(8), aIssues.size()); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_TITLE, aIssues[0]->m_eIssueID); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueLevel::ERRORLEV, aIssues[0]->m_eIssueLvl); - 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::TEXT_FORMATTING, aIssues[3]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[4]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[5]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[6]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aIssues[7]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[2]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[3]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[4]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[5]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[6]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aIssues[7]->m_eIssueID); SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); CPPUNIT_ASSERT(pWrtShell); @@ -285,8 +297,8 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testDeleteHeader) aResultIssues = aReCheck.getIssueCollection().getIssues(); CPPUNIT_ASSERT_EQUAL(size_t(3), aResultIssues.size()); CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_TITLE, aResultIssues[0]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aResultIssues[1]->m_eIssueID); - CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_FORMATTING, aResultIssues[2]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aResultIssues[1]->m_eIssueID); + CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TEXT_NEW_LINES, aResultIssues[2]->m_eIssueID); } CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testStylesWithHeader) diff --git a/sw/qa/core/accessibilitycheck/data/EmptyNumSpace.odt b/sw/qa/core/accessibilitycheck/data/EmptyNumSpace.odt new file mode 100644 index 000000000000..8f55e6700753 Binary files /dev/null and b/sw/qa/core/accessibilitycheck/data/EmptyNumSpace.odt differ diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index 39a4999f1965..42936d33bc4b 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -134,9 +134,27 @@ void lcl_SetHiddenIssues(std::shared_ptr& pIssue) pIssue->setHidden(true); } break; - case sfx::AccessibilityIssueID::TEXT_FORMATTING: + case sfx::AccessibilityIssueID::TEXT_NEW_LINES: { - if (!officecfg::Office::Common::AccessibilityIssues::TextFormattings::get()) + if (!officecfg::Office::Common::AccessibilityIssues::TextNewLines::get()) + pIssue->setHidden(true); + } + break; + case sfx::AccessibilityIssueID::TEXT_SPACES: + { + if (!officecfg::Office::Common::AccessibilityIssues::TextSpaces::get()) + pIssue->setHidden(true); + } + break; + case sfx::AccessibilityIssueID::TEXT_TABS: + { + if (!officecfg::Office::Common::AccessibilityIssues::TextTabs::get()) + pIssue->setHidden(true); + } + break; + case sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA: + { + if (!officecfg::Office::Common::AccessibilityIssues::TextEmptyNums::get()) pIssue->setHidden(true); } break; @@ -1699,7 +1717,7 @@ public: if (pPrevTextNode->GetText().getLength() == 0) { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_NEWLINES_SPACE), - sfx::AccessibilityIssueID::TEXT_FORMATTING, + sfx::AccessibilityIssueID::TEXT_NEW_LINES, sfx::AccessibilityIssueLevel::WARNLEV); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); @@ -1726,7 +1744,7 @@ public: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_NEWLINES_SPACE), - sfx::AccessibilityIssueID::TEXT_FORMATTING, + sfx::AccessibilityIssueID::TEXT_NEW_LINES, sfx::AccessibilityIssueLevel::WARNLEV); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); @@ -1800,7 +1818,7 @@ public: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_TABS_FORMATTING), - sfx::AccessibilityIssueID::TEXT_FORMATTING, + sfx::AccessibilityIssueID::TEXT_TABS, sfx::AccessibilityIssueLevel::WARNLEV); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); @@ -1818,7 +1836,7 @@ public: { auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_SPACES_SPACE), - sfx::AccessibilityIssueID::TEXT_FORMATTING, + sfx::AccessibilityIssueID::TEXT_SPACES, sfx::AccessibilityIssueLevel::WARNLEV); pIssue->setIssueObject(IssueObject::TEXT); pIssue->setNode(pTextNode); @@ -2310,6 +2328,101 @@ public: } }; +class EmptyLineBetweenNumberingCheck : public NodeCheck +{ +private: + static SwTextNode* getPrevTextNode(SwNode* pCurrent) + { + SwTextNode* pTextNode = nullptr; + + auto nIndex = pCurrent->GetIndex(); + + nIndex--; // go to previous node + + while (pTextNode == nullptr && nIndex >= SwNodeOffset(0)) + { + auto pNode = pCurrent->GetNodes()[nIndex]; + if (pNode->IsTextNode()) + pTextNode = pNode->GetTextNode(); + nIndex--; + } + + return pTextNode; + } + + static SwTextNode* getNextTextNode(SwNode* pCurrent) + { + SwTextNode* pTextNode = nullptr; + + auto nIndex = pCurrent->GetIndex(); + + nIndex++; // go to next node + + while (pTextNode == nullptr && nIndex < pCurrent->GetNodes().Count()) + { + auto pNode = pCurrent->GetNodes()[nIndex]; + if (pNode->IsTextNode()) + pTextNode = pNode->GetTextNode(); + nIndex++; + } + + return pTextNode; + } + +public: + EmptyLineBetweenNumberingCheck(sfx::AccessibilityIssueCollection& rIssueCollection) + : NodeCheck(rIssueCollection) + { + } + void check(SwNode* pCurrent) override + { + if (!pCurrent->IsTextNode()) + return; + + // Don't count empty table box text nodes + if (pCurrent->GetTableBox()) + return; + + SwTextNode* pTextNode = pCurrent->GetTextNode(); + SwDoc& rDocument = pTextNode->GetDoc(); + SwDocShell* pDocShell = rDocument.GetDocShell(); + if (!pDocShell) + return; + + SwWrtShell* pWrtShell = pDocShell->GetWrtShell(); + if (!pWrtShell) + return; + + auto nParagraphLength = pTextNode->GetText().getLength(); + if (nParagraphLength == 0 && !pTextNode->GetNumRule()) + { + SwTextNode* pPrevTextNode = getPrevTextNode(pCurrent); + if (!pPrevTextNode) + return; + + SwTextNode* pNextTextNode = getNextTextNode(pCurrent); + if (!pNextTextNode) + return; + + if (pPrevTextNode->getLayoutFrame(pWrtShell->GetLayout()) + && pNextTextNode->getLayoutFrame(pWrtShell->GetLayout())) + { + const SwNumRule* pPrevRule = pPrevTextNode->GetNumRule(); + const SwNumRule* pNextRule = pNextTextNode->GetNumRule(); + if (pPrevRule && pNextRule) + { + auto pIssue = lclAddIssue(m_rIssueCollection, SwResId(STR_AVOID_EMPTY_NUM_PARA), + sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA, + sfx::AccessibilityIssueLevel::WARNLEV); + pIssue->setIssueObject(IssueObject::TEXT); + pIssue->setNode(pTextNode); + pIssue->setDoc(rDocument); + } + } + } + } +}; + class DocumentCheck : public BaseCheck { public: @@ -2564,6 +2677,7 @@ void AccessibilityCheck::init() m_aNodeChecks.emplace_back(new FakeFootnoteCheck(m_aIssueCollection)); m_aNodeChecks.emplace_back(new FakeCaptionCheck(m_aIssueCollection)); m_aNodeChecks.emplace_back(new ContentControlCheck(m_aIssueCollection)); + m_aNodeChecks.emplace_back(new EmptyLineBetweenNumberingCheck(m_aIssueCollection)); } } diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx index 3446176bdbbe..a898f9c5384d 100644 --- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx +++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx @@ -363,7 +363,10 @@ void A11yCheckIssuesPanel::populateIssues() addEntryForGroup(AccessibilityCheckGroups::Table, nIndices, pIssue); } break; - case sfx::AccessibilityIssueID::TEXT_FORMATTING: + case sfx::AccessibilityIssueID::TEXT_NEW_LINES: + case sfx::AccessibilityIssueID::TEXT_SPACES: + case sfx::AccessibilityIssueID::TEXT_TABS: + case sfx::AccessibilityIssueID::TEXT_EMPTY_NUM_PARA: case sfx::AccessibilityIssueID::TABLE_FORMATTING: { if (!pIssue->getHidden())