summaryrefslogtreecommitdiff
path: root/sw/source/core/access
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2023-09-03 18:47:30 +0200
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-10-22 15:25:19 +0200
commit70cddea8cb780f2fe0acdd15b72d13ce2d1ad649 (patch)
treef4f249e184bde827a5634e2c3e8cc8053d69227d /sw/source/core/access
parentf1cb3bb7739b2917a2ba2bce45885bd20f6f7fba (diff)
lok: a11y: send list item prefix length to client
Implemented getListPrefixSize function which relies on UNO_NAME_NUMBERING_LEVEL, UNO_NAME_NUMBERING character attributes. The former provides the list item level, the latter is a boolean that says if a prefix (bullet/number) is present or not for the list item. It has been needed to modify SwAccessibleParagraph::_getSupplementalAttributesImpl so that it returns such properties for list item only and not for simple paragraph too. In fact for a simple paragraph the default value for the level property was returned which is 0 exactly the same value for top list item. Change-Id: Ia651af4d4b2372eed42c90b0752e16fd47a4fdec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156816 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Gökay ŞATIR <gokaysatir@collabora.com> (cherry picked from commit 038903d2e066de9525a3baffdd232484ef44ff51) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157780 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw/source/core/access')
-rw-r--r--sw/source/core/access/accpara.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 7226ea72d35d..96e58f35f1c3 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -910,6 +910,7 @@ static uno::Sequence< OUString > const & getSupplementalAttributeNames()
{
// sorted list of strings
UNO_NAME_NUMBERING_LEVEL,
+ UNO_NAME_NUMBERING,
UNO_NAME_NUMBERING_RULES,
UNO_NAME_PARA_ADJUST,
UNO_NAME_PARA_BOTTOM_MARGIN,
@@ -1360,6 +1361,9 @@ uno::Sequence<PropertyValue> SwAccessibleParagraph::getCharacterAttributes(
tAccParaPropValMap aRunAttrSeq;
_getRunAttributesImpl( nIndex, aNames, aRunAttrSeq );
+ // this allows to request one or more supplemental attributes, only
+ bSupplementalMode = bSupplementalMode || aDefAttrSeq.empty() || aRunAttrSeq.empty();
+
// merge default and run attributes
std::vector< PropertyValue > aValues( aDefAttrSeq.size() );
sal_Int32 i = 0;
@@ -1765,6 +1769,7 @@ void SwAccessibleParagraph::_getSupplementalAttributesImpl(
if ( pTextNode->HasBullet() || pTextNode->HasNumber() )
{
aSet.Put( pTextNode->GetAttr(RES_PARATR_LIST_LEVEL) );
+ aSet.Put( pTextNode->GetAttr(RES_PARATR_LIST_ISCOUNTED) );
}
aSet.Put( pTextNode->SwContentNode::GetAttr(RES_UL_SPACE) );
aSet.Put( pTextNode->SwContentNode::GetAttr(RES_MARGIN_FIRSTLINE) );
@@ -1778,6 +1783,15 @@ void SwAccessibleParagraph::_getSupplementalAttributesImpl(
aSwMapProvider.GetPropertyMapEntries( PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE ) );
for (const auto & rEntry : pPropMap)
{
+ // For a paragraph, list level property is not set but when queried the returned default
+ // value is 0, exactly the same value of top level list item; that prevents using
+ // list level property for discerning simple paragraph from list item;
+ // the following check allows not to return the list level property at all
+ // when we are dealing with a simple paragraph
+ if ((rEntry.nWID == RES_PARATR_LIST_LEVEL || rEntry.nWID == RES_PARATR_LIST_ISCOUNTED) &&
+ !aSet.HasItem( rEntry.nWID ))
+ continue;
+
const SfxPoolItem* pItem = aSet.GetItem( rEntry.nWID );
if ( pItem )
{