tdf#164090: a11y sw: add new warning for non numbered empty paragraph
Add new warning for empty paragraph between numbering paragraphs. Change-Id: Ib85b376da77a72a87ab05a3e8271be43e223f129 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177493 Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de> Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Tested-by: Jenkins
This commit is contained in:
parent
863f5d26f9
commit
16b2cae80e
9 changed files with 226 additions and 35 deletions
|
@ -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.")
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -6340,13 +6340,43 @@
|
|||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
<prop oor:name="TextFormattings" oor:type="xs:boolean" oor:nillable="false">
|
||||
<prop oor:name="TextNewLines" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>
|
||||
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.
|
||||
</desc>
|
||||
<label>Enable/Disable Text formattings accessibility check.</label>
|
||||
<label>Enable/Disable empty new line Text formattings accessibility check.</label>
|
||||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
<prop oor:name="TextSpaces" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>
|
||||
Enables accessibility check of extra spaces for formattings, inside the document
|
||||
structure while the user edits the document.
|
||||
</desc>
|
||||
<label>Enable/Disable extra spaces for Text formattings accessibility check.</label>
|
||||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
<prop oor:name="TextTabs" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>
|
||||
Enables accessibility check of extra tabs for formattings, inside the document
|
||||
structure while the user edits the document.
|
||||
</desc>
|
||||
<label>Enable/Disable extra tabs for Text formattings accessibility check.</label>
|
||||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
<prop oor:name="TextEmptyNums" oor:type="xs:boolean" oor:nillable="false">
|
||||
<info>
|
||||
<desc>
|
||||
Enables accessibility check of empty new line between numberings, inside the document
|
||||
structure while the user edits the document.
|
||||
</desc>
|
||||
<label>Enable/Disable empty new line between numberings accessibility check.</label>
|
||||
</info>
|
||||
<value>true</value>
|
||||
</prop>
|
||||
|
|
|
@ -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.")
|
||||
|
|
|
@ -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)
|
||||
|
|
BIN
sw/qa/core/accessibilitycheck/data/EmptyNumSpace.odt
Normal file
BIN
sw/qa/core/accessibilitycheck/data/EmptyNumSpace.odt
Normal file
Binary file not shown.
|
@ -134,9 +134,27 @@ void lcl_SetHiddenIssues(std::shared_ptr<sw::AccessibilityIssue>& 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue