vcl/inc/accessibility/IComboListBoxHelper.hxx        |    2 +-
 vcl/inc/accessibility/listboxhelper.hxx              |    2 +-
 vcl/inc/accessibility/vclxaccessibletextfield.hxx    |    8 ++++----
 vcl/source/accessibility/vclxaccessiblebox.cxx       |    2 +-
 vcl/source/accessibility/vclxaccessiblelistitem.cxx  |    8 ++++----
 vcl/source/accessibility/vclxaccessibletextfield.cxx |    4 ++--
 6 files changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 2041fbab92f8d4e789bda625d7f98f486bb791a6
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Mar 15 14:13:46 2025 -0700
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun Mar 16 08:28:46 2025 +0100

    vcl a11y: Use sal_Int32 in IComboListBoxHelper::GetBoundingRectangle
    
    Align the param type with what both, ComboBox::GetBoundingRectangle
    and ListBox::GetBoundingRectangle have, which get called by the
    implementation in the only subclass implementation in
    VCLListBoxHelper::GetBoundingRectangle.
    
    Drop unnecessary casting in VCLXAccessibleListItem.
    
    Change-Id: I8f8b7c9f355768a05174b753ac28d0dd60374673
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182985
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/accessibility/IComboListBoxHelper.hxx 
b/vcl/inc/accessibility/IComboListBoxHelper.hxx
index a3412853d9a9..5f4b5437b8c5 100644
--- a/vcl/inc/accessibility/IComboListBoxHelper.hxx
+++ b/vcl/inc/accessibility/IComboListBoxHelper.hxx
@@ -40,7 +40,7 @@ public:
 
     virtual OUString        GetEntry( sal_Int32  nPos ) const = 0;
     virtual tools::Rectangle       GetDropDownPosSizePixel( ) const = 0;
-    virtual tools::Rectangle       GetBoundingRectangle( sal_uInt16 nItem ) 
const = 0;
+    virtual tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const = 0;
     virtual bool            IsEnabled() const = 0;
     virtual bool            IsEntryVisible( sal_Int32  nPos ) const = 0;
     virtual sal_uInt16      GetDisplayLineCount() const = 0;
diff --git a/vcl/inc/accessibility/listboxhelper.hxx 
b/vcl/inc/accessibility/listboxhelper.hxx
index 0d872acfde20..b04e14c05c01 100644
--- a/vcl/inc/accessibility/listboxhelper.hxx
+++ b/vcl/inc/accessibility/listboxhelper.hxx
@@ -52,7 +52,7 @@ public:
         return m_aComboListBox.GetDropDownPosSizePixel();
     }
 
-    virtual tools::Rectangle       GetBoundingRectangle( sal_uInt16 nItem ) 
const override
+    virtual tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const 
override
     {
         tools::Rectangle aRect;
         if ( m_aComboListBox.IsInDropDown() && IsEntryVisible( nItem ) )
diff --git a/vcl/source/accessibility/vclxaccessiblelistitem.cxx 
b/vcl/source/accessibility/vclxaccessiblelistitem.cxx
index c437015ef73c..b3ccfc6dc4c3 100644
--- a/vcl/source/accessibility/vclxaccessiblelistitem.cxx
+++ b/vcl/source/accessibility/vclxaccessiblelistitem.cxx
@@ -69,7 +69,7 @@ VCLXAccessibleListItem::VCLXAccessibleListItem(sal_Int32 
_nIndexInParent,
     assert(m_xParent.is());
     IComboListBoxHelper* pListBoxHelper = m_xParent->getListBoxHelper();
     if (pListBoxHelper)
-        m_sEntryText = 
pListBoxHelper->GetEntry(static_cast<sal_uInt16>(_nIndexInParent));
+        m_sEntryText = pListBoxHelper->GetEntry(_nIndexInParent);
 }
 
 void VCLXAccessibleListItem::SetSelected( bool _bSelected )
@@ -132,7 +132,7 @@ awt::Rectangle VCLXAccessibleListItem::implGetBounds()
     IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? 
m_xParent->getListBoxHelper() : nullptr;
     if (pListBoxHelper)
     {
-        aRect = 
pListBoxHelper->GetBoundingRectangle(static_cast<sal_uInt16>(m_nIndexInParent));
+        aRect = pListBoxHelper->GetBoundingRectangle(m_nIndexInParent);
         // convert position relative to the combobox/listbox (parent's parent) 
to position relative
         // to direct parent by subtracting parent's relative position in the 
combobox/listbox
         aRect -= vcl::unohelper::ConvertToVCLPoint(m_xParent->getLocation());
@@ -323,7 +323,7 @@ awt::Rectangle SAL_CALL 
VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nI
     if (pListBoxHelper)
     {
         tools::Rectangle aCharRect = pListBoxHelper->GetEntryCharacterBounds( 
m_nIndexInParent, nIndex );
-        tools::Rectangle aItemRect = pListBoxHelper->GetBoundingRectangle( 
static_cast<sal_uInt16>(m_nIndexInParent) );
+        tools::Rectangle aItemRect = 
pListBoxHelper->GetBoundingRectangle(m_nIndexInParent);
         aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
         aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect);
     }
@@ -347,7 +347,7 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( 
const awt::Point& aP
     if (pListBoxHelper)
     {
         sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND;
-        tools::Rectangle aItemRect = pListBoxHelper->GetBoundingRectangle( 
static_cast<sal_uInt16>(m_nIndexInParent) );
+        tools::Rectangle aItemRect = 
pListBoxHelper->GetBoundingRectangle(m_nIndexInParent);
         Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint));
         aPnt += aItemRect.TopLeft();
         sal_Int32 nI = pListBoxHelper->GetIndexForPoint( aPnt, nPos );
commit ecb19ca12010bc78e9cce3fffdb0c730b64fbec4
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sat Mar 15 13:59:57 2025 -0700
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sun Mar 16 08:28:37 2025 +0100

    vcl a11y: Use more specific ListBox subclass in VCLXAccessibleTextField ctor
    
    Use a ListBox* param instead of having a vcl::Window*
    param and documentation stating that this is expected
    to be a ListBox.
    
    VCLXAccessibleTextField::implGetText does a cast to
    ListBox.
    
    Change-Id: I9ef6c4cb8fc7c7fa38af79a8aac7b95d984075b5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182984
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/inc/accessibility/vclxaccessibletextfield.hxx 
b/vcl/inc/accessibility/vclxaccessibletextfield.hxx
index d441037b73ed..8c6983d4be32 100644
--- a/vcl/inc/accessibility/vclxaccessibletextfield.hxx
+++ b/vcl/inc/accessibility/vclxaccessibletextfield.hxx
@@ -22,10 +22,10 @@
 #include <accessibility/vclxaccessibletextcomponent.hxx>
 
 #include <cppuhelper/implbase.hxx>
+#include <vcl/toolkit/lstbox.hxx>
 
-/** This class represents non editable text fields.  The object passed to
-    the constructor is expected to be a list (a ListBox to be
-    more specific).  From this always the selected item is token to be made
+/** This class represents non editable text fields.
+    From the ListBox passed to the constructer, always the selected item is 
token to be made
     accessible by this class.  When the selected item changes then also the
     exported text changes.
 */
@@ -33,7 +33,7 @@ class VCLXAccessibleTextField final :
     public cppu::ImplInheritanceHelper<VCLXAccessibleTextComponent, 
css::accessibility::XAccessible>
 {
 public:
-    VCLXAccessibleTextField(vcl::Window* pWindow,
+    VCLXAccessibleTextField(ListBox* pListBox,
                             const 
css::uno::Reference<css::accessibility::XAccessible>& _xParent);
 
     // XAccessible
diff --git a/vcl/source/accessibility/vclxaccessiblebox.cxx 
b/vcl/source/accessibility/vclxaccessiblebox.cxx
index 27547347bcaf..463adaef512e 100644
--- a/vcl/source/accessibility/vclxaccessiblebox.cxx
+++ b/vcl/source/accessibility/vclxaccessiblebox.cxx
@@ -317,7 +317,7 @@ Reference<XAccessible> SAL_CALL 
VCLXAccessibleBox::getAccessibleChild (sal_Int64
                     m_xText = pComboBox->GetSubEdit()->GetAccessible();
             }
             else if (m_bIsDropDownBox)
-                m_xText = new VCLXAccessibleTextField(GetWindow(), this);
+                m_xText = new VCLXAccessibleTextField(GetAs<ListBox>(), this);
         }
         return m_xText;
     }
diff --git a/vcl/source/accessibility/vclxaccessibletextfield.cxx 
b/vcl/source/accessibility/vclxaccessibletextfield.cxx
index 9b4d2af3237c..b27d68456bd1 100644
--- a/vcl/source/accessibility/vclxaccessibletextfield.cxx
+++ b/vcl/source/accessibility/vclxaccessibletextfield.cxx
@@ -30,8 +30,8 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::accessibility;
 
 
-VCLXAccessibleTextField::VCLXAccessibleTextField(vcl::Window* pWindow, const 
Reference<XAccessible>& _xParent)
-    : ImplInheritanceHelper(pWindow)
+VCLXAccessibleTextField::VCLXAccessibleTextField(ListBox* pListBox, const 
Reference<XAccessible>& _xParent)
+    : ImplInheritanceHelper(pListBox)
     , m_xParent( _xParent )
 {
 }

Reply via email to