svtools/source/control/valueacc.cxx |   33 ++++++++++++++-------------------
 svtools/source/control/valueimp.hxx |    5 ++---
 svtools/source/control/valueset.cxx |   12 ++++++------
 3 files changed, 22 insertions(+), 28 deletions(-)

New commits:
commit 91ee00bcc13408eed23335770eabaf363970c526
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Feb 24 18:44:24 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Feb 24 21:25:27 2025 +0100

    valueset a11y: Drop ValueItemAcc::mbIsTransientChildrenDisabled
    
    As is obvious since
    
        Change-Id: Iff97c47023e1a5d1f0758d0a898312f234479ff5
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon Feb 24 18:33:56 2025 +0100
    
            value set a11y: Drop always false ValueSetItem::GetAccessible param
    
    , this member is always set to `false`, so drop it altogether.
    
    Change-Id: I13062998ddb42edc91d752fd2c103f83973619e3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182115
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/svtools/source/control/valueacc.cxx 
b/svtools/source/control/valueacc.cxx
index ca85181872af..cebc5af5beb4 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -57,14 +57,13 @@ ValueSetItem::~ValueSetItem()
 const rtl::Reference< ValueItemAcc > & ValueSetItem::GetAccessible()
 {
     if( !mxAcc.is() )
-        mxAcc = new ValueItemAcc(this, false);
+        mxAcc = new ValueItemAcc(this);
 
     return mxAcc;
 }
 
-ValueItemAcc::ValueItemAcc(ValueSetItem* pValueSetItem, bool 
bIsTransientChildrenDisabled) :
-    mpValueSetItem(pValueSetItem),
-    mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled )
+ValueItemAcc::ValueItemAcc(ValueSetItem* pValueSetItem)
+    : mpValueSetItem(pValueSetItem)
 {
 }
 
@@ -200,9 +199,7 @@ sal_Int64 SAL_CALL ValueItemAcc::getAccessibleStateSet()
         nStateSet |= accessibility::AccessibleStateType::SENSITIVE;
         nStateSet |= accessibility::AccessibleStateType::SHOWING;
         nStateSet |= accessibility::AccessibleStateType::VISIBLE;
-        if ( !mbIsTransientChildrenDisabled )
-            nStateSet |= accessibility::AccessibleStateType::TRANSIENT;
-
+        nStateSet |= accessibility::AccessibleStateType::TRANSIENT;
         nStateSet |= accessibility::AccessibleStateType::SELECTABLE;
         nStateSet |= accessibility::AccessibleStateType::FOCUSABLE;
 
diff --git a/svtools/source/control/valueimp.hxx 
b/svtools/source/control/valueimp.hxx
index b2bcf3174339..ce4e32627b9a 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -193,11 +193,10 @@ private:
         css::accessibility::XAccessibleEventListener > >                
mxEventListeners;
     std::mutex                                                          
maMutex;
     ValueSetItem*                                                       
mpValueSetItem;
-    bool                                                                
mbIsTransientChildrenDisabled;
 
 public:
 
-    ValueItemAcc(ValueSetItem* pValueSetItem, bool 
bIsTransientChildrenDisabled);
+    ValueItemAcc(ValueSetItem* pValueSetItem);
     virtual ~ValueItemAcc() override;
 
     void    ValueSetItemDestroyed();
commit d144891269f8b2431d0c954c71894ef525a89335
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Feb 24 18:33:56 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Feb 24 21:25:19 2025 +0100

    valueset a11y: Drop always false ValueSetItem::GetAccessible param
    
    Since
    
        Change-Id: I502c4e2271c65dc4d4c35d1f22e247b0b6ea98b9
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon Feb 24 18:07:43 2025 +0100
    
            value set a11y: Simplify ValueItemAcc::getAccessibleIndexInParent
    
    , all callers explicitly pass `false` for the param, so simply
    drop it.
    
    I also don't see how `true` could ever have been passed before the
    above commit, because all callers explicitly passing either true or
    false were already passing false, and the 2 callers dropped
    in the above commit were passing the value of
    ValueItemAcc::mbIsTransientChildrenDisabled, which must be from
    a  ValueItemAcc created earlier (with the `false` parameter
    passed to ValueSetItem::GetAccessible).
    
    Now that false is already passed, 
ValueItemAcc::mbIsTransientChildrenDisabled
    can be dropped altogether in an upcoming commit.
    
    Change-Id: Iff97c47023e1a5d1f0758d0a898312f234479ff5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182114
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/svtools/source/control/valueacc.cxx 
b/svtools/source/control/valueacc.cxx
index ccc726414e68..ca85181872af 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -54,10 +54,10 @@ ValueSetItem::~ValueSetItem()
     }
 }
 
-const rtl::Reference< ValueItemAcc > & ValueSetItem::GetAccessible( bool 
bIsTransientChildrenDisabled )
+const rtl::Reference< ValueItemAcc > & ValueSetItem::GetAccessible()
 {
     if( !mxAcc.is() )
-        mxAcc = new ValueItemAcc( this, bIsTransientChildrenDisabled );
+        mxAcc = new ValueItemAcc(this, false);
 
     return mxAcc;
 }
@@ -494,7 +494,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL 
ValueSetAcc::getAccessible
     if( !pItem )
         throw lang::IndexOutOfBoundsException();
 
-    uno::Reference< accessibility::XAccessible >  xRet = pItem->GetAccessible( 
false/*bIsTransientChildrenDisabled*/ );
+    uno::Reference< accessibility::XAccessible >  xRet = 
pItem->GetAccessible();
     return xRet;
 }
 
@@ -687,7 +687,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL 
ValueSetAcc::getAccessible
         if( VALUESET_ITEM_NONEITEM != nItemPos )
         {
             ValueSetItem* const pItem = mpValueSet->mItemList[nItemPos].get();
-            xRet = pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ 
);
+            xRet = pItem->GetAccessible();
         }
     }
 
@@ -860,7 +860,7 @@ uno::Reference< accessibility::XAccessible > SAL_CALL 
ValueSetAcc::getSelectedAc
         ValueSetItem* pItem = getItem(i);
 
         if (pItem && mpValueSet->IsItemSelected(pItem->mnId) && 
(nSelectedChildIndex == static_cast< sal_Int64 >(nSel++)))
-            xRet = pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ 
);
+            xRet = pItem->GetAccessible();
     }
 
     return xRet;
diff --git a/svtools/source/control/valueimp.hxx 
b/svtools/source/control/valueimp.hxx
index b4fdff85e56e..b2bcf3174339 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -61,7 +61,7 @@ struct ValueSetItem
     explicit ValueSetItem( ValueSet& rParent );
     ~ValueSetItem();
 
-    const rtl::Reference< ValueItemAcc > & GetAccessible( bool 
bIsTransientChildrenDisabled );
+    const rtl::Reference< ValueItemAcc > & GetAccessible();
 };
 
 typedef comphelper::WeakComponentImplHelper<
diff --git a/svtools/source/control/valueset.cxx 
b/svtools/source/control/valueset.cxx
index f1437e6aa0be..7ad76cc3fa53 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -143,7 +143,7 @@ void ValueSet::ImplDeleteItems()
             Any aOldAny;
             Any aNewAny;
 
-            aOldAny <<= Reference< XAccessible >(pItem->GetAccessible( 
false/*bIsTransientChildrenDisabled*/ ));
+            aOldAny <<= Reference< XAccessible >(pItem->GetAccessible());
             ImplFireAccessibleEvent(AccessibleEventId::CHILD, aOldAny, 
aNewAny);
         }
 
@@ -774,7 +774,7 @@ void ValueSet::SelectItem( sal_uInt16 nItemId )
         if( nPos != VALUESET_ITEM_NOTFOUND )
         {
             rtl::Reference<ValueItemAcc> pItemAcc =
-                mItemList[nPos]->GetAccessible( 
false/*bIsTransientChildrenDisabled*/ );
+                mItemList[nPos]->GetAccessible();
 
             if( pItemAcc )
             {
@@ -800,7 +800,7 @@ void ValueSet::SelectItem( sal_uInt16 nItemId )
         ValueItemAcc* pItemAcc = nullptr;
         if (pItem != nullptr)
             pItemAcc =
-                pItem->GetAccessible(false 
/*bIsTransientChildrenDisabled*/).get();
+                pItem->GetAccessible().get();
 
         if (pItemAcc)
         {
@@ -1101,7 +1101,7 @@ void ValueSet::Format(vcl::RenderContext const & 
rRenderContext)
                     Any aOldAny;
                     Any aNewAny;
 
-                    aNewAny <<= 
Reference<XAccessible>(pItem->GetAccessible(false/*bIsTransientChildrenDisabled*/));
+                    aNewAny <<= Reference<XAccessible>(pItem->GetAccessible());
                     ImplFireAccessibleEvent(AccessibleEventId::CHILD, aOldAny, 
aNewAny);
                 }
 
@@ -1123,7 +1123,7 @@ void ValueSet::Format(vcl::RenderContext const & 
rRenderContext)
                     Any aOldAny;
                     Any aNewAny;
 
-                    aOldAny <<= 
Reference<XAccessible>(pItem->GetAccessible(false/*bIsTransientChildrenDisabled*/));
+                    aOldAny <<= Reference<XAccessible>(pItem->GetAccessible());
                     ImplFireAccessibleEvent(AccessibleEventId::CHILD, aOldAny, 
aNewAny);
                 }
 
@@ -1911,7 +1911,7 @@ void ValueSet::SetItemText(sal_uInt16 nItemId, const 
OUString& rText)
 
     if (ImplHasAccessibleListeners())
     {
-        rtl::Reference<ValueItemAcc> xAccessible(pItem->GetAccessible( 
false/*bIsTransientChildrenDisabled*/));
+        rtl::Reference<ValueItemAcc> xAccessible(pItem->GetAccessible());
         xAccessible->FireAccessibleEvent(AccessibleEventId::NAME_CHANGED, 
aOldName, aNewName);
     }
 }
commit 921609b4b01d65f840233cf332b76b26fcb10b15
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Mon Feb 24 18:07:43 2025 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Feb 24 21:25:13 2025 +0100

    valueset a11y: Simplify ValueItemAcc::getAccessibleIndexInParent
    
    Instead of calling ValueSetItem::GetAccessible
    on various ValueSetItems (first in a loop, and the first item later)
    in order to compare whether their returned accessible is self (`this`),
    instead check whether the ValueSetItem is
    `ValueItemAcc::mpValueSetItem`, i.e. the ValueSetItem for which
    `this` is the accessible object.
    
    Before and after this change, the reported child index is as expected
    in both, Writer's "Format" -> "Paragraph" dialog's "Borders" tab (see
    
        Change-Id: Id31a321c6bec2a3ef9a1cbb2e5264eb6deabc57f
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Mon Feb 24 17:17:34 2025 +0100
    
            value set a11y: Fix reported position
    
    for more details on how to get to the object of interest
    in Accerciser.) and in Calc's "Format" -> "Cells" dialog, "Background" tab
    when enabling the "Color" option when testing with the qt6 VCL plugin.
    (The single color rectangles in the palette are ValueSetItems,
    and when querying their index in the parent in Accerciser's IPython console,
    it matches, i.e. is n for the n-th child of the ValueSet.)
    
    Change-Id: I502c4e2271c65dc4d4c35d1f22e247b0b6ea98b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182113
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/svtools/source/control/valueacc.cxx 
b/svtools/source/control/valueacc.cxx
index 915582380f53..ccc726414e68 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -134,13 +134,11 @@ sal_Int64 SAL_CALL 
ValueItemAcc::getAccessibleIndexInParent()
                 pItem = nullptr;
             }
 
-            // Do not create an accessible object for the test.
-            if (pItem != nullptr && pItem->mxAcc.is())
-                if (pItem->GetAccessible( mbIsTransientChildrenDisabled 
).get() == this )
-                {
-                    nIndexInParent = i;
-                    bDone = true;
-                }
+            if (pItem && pItem == mpValueSetItem)
+            {
+                nIndexInParent = i;
+                bDone = true;
+            }
         }
     }
 
@@ -148,7 +146,7 @@ sal_Int64 SAL_CALL 
ValueItemAcc::getAccessibleIndexInParent()
     if (mpValueSetItem && ((mpValueSetItem->mrParent.GetStyle() & 
WB_NONEFIELD) != 0))
     {
         ValueSetItem* pFirstItem = 
mpValueSetItem->mrParent.ImplGetItem(VALUESET_ITEM_NONEITEM);
-        if( pFirstItem && pFirstItem 
->GetAccessible(mbIsTransientChildrenDisabled).get() == this )
+        if( pFirstItem && pFirstItem == mpValueSetItem)
             nIndexInParent = 0;
         else
             nIndexInParent++;

Reply via email to