sw/source/core/access/acccontext.cxx |    6 +--
 sw/source/core/access/accdoc.cxx     |   22 -------------
 sw/source/core/access/accdoc.hxx     |    7 ----
 sw/source/core/access/acctable.cxx   |   58 ++++++++++++-----------------------
 4 files changed, 24 insertions(+), 69 deletions(-)

New commits:
commit c6be26a067161126d4b2d2ba4982be2518dd8430
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Apr 16 13:43:30 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Apr 17 07:07:19 2025 +0200

    sw a11y: Drop always false 'bExact' param
    
    ... for SwAccessibleTableData_Impl::FindCell.
    
    Change-Id: I10db77f11e56b03186a99131d09c08856d334403
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184297
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/core/access/acctable.cxx 
b/sw/source/core/access/acctable.cxx
index 925f637dd57d..55cc64642aa1 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -82,8 +82,7 @@ class SwAccessibleTableData_Impl
 
     void CollectData( const SwFrame *pFrame );
 
-    bool FindCell( const Point& rPos, const SwFrame *pFrame ,
-                           bool bExact, const SwFrame *& rFrame ) const;
+    bool FindCell(const Point& rPos, const SwFrame* pFrame, const SwFrame*& 
rFrame) const;
 
     void GetSelection( const Point& rTabPos, const SwRect& rArea,
                        const SwSelBoxes& rSelBoxes, const SwFrame *pFrame,
@@ -163,9 +162,8 @@ void SwAccessibleTableData_Impl::CollectData( const SwFrame 
*pFrame )
     }
 }
 
-bool SwAccessibleTableData_Impl::FindCell(
-        const Point& rPos, const SwFrame *pFrame, bool bExact,
-        const SwFrame *& rRet ) const
+bool SwAccessibleTableData_Impl::FindCell(const Point& rPos, const SwFrame* 
pFrame,
+                                          const SwFrame*& rRet) const
 {
     bool bFound = false;
 
@@ -189,11 +187,7 @@ bool SwAccessibleTableData_Impl::FindCell(
                     OSL_ENSURE( rFrame.Left() <= rPos.X() && rFrame.Top() <= 
rPos.Y(),
                             "find frame moved to far!" );
                     bFound = true;
-                    if( !bExact ||
-                        (rFrame.Top() == rPos.Y() && rFrame.Left() == rPos.Y() 
) )
-                    {
-                        rRet = pLower;
-                    }
+                    rRet = pLower;
                 }
             }
             else
@@ -202,7 +196,7 @@ bool SwAccessibleTableData_Impl::FindCell(
                 if ( !pLower->IsRowFrame() ||
                      IncludeRow( *pLower ) )
                 {
-                    bFound = FindCell( rPos, pLower, bExact, rRet );
+                    bFound = FindCell(rPos, pLower, rRet);
                 }
             }
         }
@@ -328,7 +322,7 @@ const SwFrame *SwAccessibleTableData_Impl::GetCellAtPos(
     Point aPos( mpTabFrame->getFrameArea().Pos() );
     aPos.Move( nLeft, nTop );
     const SwFrame *pRet = nullptr;
-    FindCell( aPos, mpTabFrame, false/*bExact*/, pRet );
+    FindCell(aPos, mpTabFrame, pRet);
 
     return pRet;
 }
commit 9b90703fa89c8351336e1c97ba6448ca15255bca
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Apr 16 11:44:34 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Apr 17 07:07:14 2025 +0200

    sw a11y: Drop pThis param to SwAccessibleTableData_Impl::GetCell etc.
    
    Don't pass `this` around as `pThis` param to
    SwAccessibleTableData_Impl::GetCell and
    SwAccessibleTableData_Impl::CheckRowAndCol only
    to be able to pass it in the
    lang::IndexOutOfBoundsException.
    
    Drop the param instead.
    
    (If passing `this` to the exception were very relevant,
    the methods could also be made non-const instead, but
    for now, I see no real reason for that.)
    
    Change-Id: I4057fbdd813af3f0492ff7f3e64cd46b40a03d30
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184296
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sw/source/core/access/acctable.cxx 
b/sw/source/core/access/acctable.cxx
index c532f5a35d87..925f637dd57d 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -111,7 +111,7 @@ public:
 
     /// @throws lang::IndexOutOfBoundsException
     /// @throws  uno::RuntimeException
-    const SwFrame *GetCell( sal_Int32 nRow, sal_Int32 nColumn, 
SwAccessibleTable *pThis ) const;
+    const SwFrame* GetCell(sal_Int32 nRow, sal_Int32 nColumn) const;
     const SwFrame *GetCellAtPos( sal_Int32 nLeft, sal_Int32 nTop ) const;
     inline sal_Int32 GetRowCount() const;
     inline sal_Int32 GetColumnCount() const;
@@ -123,8 +123,7 @@ public:
                        bool bColumns ) const;
 
     /// @throws lang::IndexOutOfBoundsException
-    void CheckRowAndCol( sal_Int32 nRow, sal_Int32 nCol,
-                         SwAccessibleTable *pThis ) const;
+    void CheckRowAndCol(sal_Int32 nRow, sal_Int32 nCol) const;
 
     const Point& GetTablePos() const { return maTabFramePos; }
     void SetTablePos( const Point& rPos ) { maTabFramePos = rPos; }
@@ -278,11 +277,9 @@ void SwAccessibleTableData_Impl::GetSelection(
     }
 }
 
-const SwFrame *SwAccessibleTableData_Impl::GetCell(
-        sal_Int32 nRow, sal_Int32 nColumn,
-        SwAccessibleTable *pThis ) const
+const SwFrame* SwAccessibleTableData_Impl::GetCell(sal_Int32 nRow, sal_Int32 
nColumn) const
 {
-    CheckRowAndCol( nRow, nColumn, pThis );
+    CheckRowAndCol(nRow, nColumn);
 
     Int32Set_Impl::const_iterator aSttCol( GetColumnIter( nColumn ) );
     Int32Set_Impl::const_iterator aSttRow( GetRowIter( nRow ) );
@@ -392,17 +389,12 @@ inline Int32Set_Impl::const_iterator 
SwAccessibleTableData_Impl::GetColumnIter(
     return aCol;
 }
 
-void SwAccessibleTableData_Impl::CheckRowAndCol(
-        sal_Int32 nRow, sal_Int32 nCol, SwAccessibleTable *pThis ) const
+void SwAccessibleTableData_Impl::CheckRowAndCol(sal_Int32 nRow, sal_Int32 
nCol) const
 {
     if( ( nRow < 0 || o3tl::make_unsigned(nRow) >= maRows.size() ) ||
         ( nCol < 0 || o3tl::make_unsigned(nCol) >= maColumns.size() ) )
     {
-        uno::Reference < XAccessibleTable > xThis( pThis );
-        lang::IndexOutOfBoundsException aExcept(
-               u"row or column index out of range"_ustr,
-               xThis );
-        throw aExcept;
+        throw lang::IndexOutOfBoundsException(u"row or column index out of 
range"_ustr);
     }
 }
 
@@ -709,7 +701,7 @@ OUString SAL_CALL 
SwAccessibleTable::getAccessibleRowDescription(
     // in first column of row header table and return its text content.
     OUString sRowDesc;
 
-    GetTableData().CheckRowAndCol(nRow, 0, this);
+    GetTableData().CheckRowAndCol(nRow, 0);
 
     uno::Reference< XAccessibleTable > xTableRowHeader = 
getAccessibleRowHeaders();
     if ( xTableRowHeader.is() )
@@ -742,7 +734,7 @@ OUString SAL_CALL 
SwAccessibleTable::getAccessibleColumnDescription(
     // in <nColumn>th column of column header table and return its text 
content.
     OUString sColumnDesc;
 
-    GetTableData().CheckRowAndCol(0, nColumn, this);
+    GetTableData().CheckRowAndCol(0, nColumn);
 
     uno::Reference< XAccessibleTable > xTableColumnHeader = 
getAccessibleColumnHeaders();
     if ( xTableColumnHeader.is() )
@@ -778,7 +770,7 @@ sal_Int32 SAL_CALL 
SwAccessibleTable::getAccessibleRowExtentAt(
     ThrowIfDisposed();
 
     UpdateTableData();
-    GetTableData().CheckRowAndCol( nRow, nColumn, this );
+    GetTableData().CheckRowAndCol(nRow, nColumn);
 
     Int32Set_Impl::const_iterator aSttCol(
                                     GetTableData().GetColumnIter( nColumn ) );
@@ -808,7 +800,7 @@ sal_Int32 SAL_CALL 
SwAccessibleTable::getAccessibleColumnExtentAt(
     ThrowIfDisposed();
     UpdateTableData();
 
-    GetTableData().CheckRowAndCol( nRow, nColumn, this );
+    GetTableData().CheckRowAndCol(nRow, nColumn);
 
     Int32Set_Impl::const_iterator aSttCol(
                                     GetTableData().GetColumnIter( nColumn ) );
@@ -904,7 +896,7 @@ sal_Bool SAL_CALL 
SwAccessibleTable::isAccessibleRowSelected( sal_Int32 nRow )
 
     ThrowIfDisposed();
 
-    GetTableData().CheckRowAndCol( nRow, 0, this );
+    GetTableData().CheckRowAndCol(nRow, 0);
 
     bool bRet;
     const SwSelBoxes *pSelBoxes = GetSelBoxes();
@@ -930,7 +922,7 @@ sal_Bool SAL_CALL 
SwAccessibleTable::isAccessibleColumnSelected(
 
     ThrowIfDisposed();
 
-    GetTableData().CheckRowAndCol( 0, nColumn, this );
+    GetTableData().CheckRowAndCol(0, nColumn);
 
     bool bRet;
     const SwSelBoxes *pSelBoxes = GetSelBoxes();
@@ -959,8 +951,7 @@ uno::Reference< XAccessible > SAL_CALL 
SwAccessibleTable::getAccessibleCellAt(
 
     ThrowIfDisposed();
 
-    const SwFrame *pCellFrame =
-                    GetTableData().GetCell( nRow, nColumn, this );
+    const SwFrame* pCellFrame = GetTableData().GetCell(nRow, nColumn);
     if( pCellFrame )
         xRet = GetMap()->GetContext( pCellFrame );
 
@@ -988,8 +979,7 @@ sal_Bool SAL_CALL SwAccessibleTable::isAccessibleSelected(
 
     ThrowIfDisposed();
 
-    const SwFrame *pFrame =
-                    GetTableData().GetCell( nRow, nColumn, this );
+    const SwFrame* pFrame = GetTableData().GetCell(nRow, nColumn);
     if( pFrame && pFrame->IsCellFrame() )
     {
         const SwSelBoxes *pSelBoxes = GetSelBoxes();
@@ -1014,7 +1004,7 @@ sal_Int64 SAL_CALL SwAccessibleTable::getAccessibleIndex(
 
     ThrowIfDisposed();
 
-    SwAccessibleChild aCell( GetTableData().GetCell( nRow, nColumn, this ));
+    SwAccessibleChild aCell(GetTableData().GetCell(nRow, nColumn));
     if ( aCell.IsValid() )
     {
         nRet = GetChildIndex( *(GetMap()), aCell );
commit e08b118858e7822803faa3b4e91df92296b08bcf
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Apr 16 10:50:13 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Apr 17 07:07:08 2025 +0200

    sw a11y: Deduplicate logic for XAccessibleComponent methods
    
    In SwAccessibleContext, call SwAccessibleContext::getBounds
    instead of directly calling SwAccessibleContext::getBoundsImpl
    for some of the XAccessibleComponent method implementations
    
    This allows to reuse them for the SwAccessibleDocumentBase
    subclass, too, so drop its overrides of those methods.
    
    Change-Id: Ie629fecff4203437c21248e4d09de93c23a96af4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184276
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sw/source/core/access/acccontext.cxx 
b/sw/source/core/access/acccontext.cxx
index a2f729a9fa95..f11e64a75d2a 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -794,7 +794,7 @@ static bool lcl_PointInRectangle(const awt::Point & aPoint,
 sal_Bool SAL_CALL SwAccessibleContext::containsPoint(
             const awt::Point& aPoint )
 {
-    awt::Rectangle aPixBounds = getBoundsImpl(true);
+    awt::Rectangle aPixBounds = getBounds();
     aPixBounds.X = 0;
     aPixBounds.Y = 0;
 
@@ -917,7 +917,7 @@ awt::Rectangle SAL_CALL SwAccessibleContext::getBounds()
 
 awt::Point SAL_CALL SwAccessibleContext::getLocation()
 {
-    awt::Rectangle aRect = getBoundsImpl(true);
+    awt::Rectangle aRect = getBounds();
     awt::Point aPoint(aRect.X, aRect.Y);
 
     return aPoint;
@@ -943,7 +943,7 @@ awt::Point SAL_CALL 
SwAccessibleContext::getLocationOnScreen()
 
 awt::Size SAL_CALL SwAccessibleContext::getSize()
 {
-    awt::Rectangle aRect = getBoundsImpl(false);
+    awt::Rectangle aRect = getBounds();
     awt::Size aSize( aRect.Width, aRect.Height );
 
     return aSize;
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index ece52286a633..2b0d48169d23 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -234,12 +234,6 @@ awt::Rectangle SAL_CALL 
SwAccessibleDocumentBase::getBounds()
     }
 }
 
-awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
-{
-    const awt::Rectangle aBounds = getBounds();
-    return awt::Point(aBounds.X, aBounds.Y);
-}
-
 css::awt::Point SAL_CALL SwAccessibleDocumentBase::getLocationOnScreen()
 {
     SolarMutexGuard aGuard;
@@ -256,22 +250,6 @@ css::awt::Point SAL_CALL 
SwAccessibleDocumentBase::getLocationOnScreen()
     return aLoc;
 }
 
-css::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize()
-{
-    const awt::Rectangle aBounds = getBounds();
-    return awt::Size(aBounds.Width, aBounds.Height);
-}
-
-sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint(
-            const awt::Point& aPoint )
-{
-    const Size aSize = vcl::unohelper::ConvertToVCLSize(getSize());
-    tools::Rectangle aPixBounds(Point(0, 0), aSize);
-    Point aPixPoint( aPoint.X, aPoint.Y );
-
-    return aPixBounds.Contains( aPixPoint );
-}
-
 uno::Reference< XAccessible > SAL_CALL 
SwAccessibleDocumentBase::getAccessibleAtPoint(
                 const awt::Point& aPoint )
 {
diff --git a/sw/source/core/access/accdoc.hxx b/sw/source/core/access/accdoc.hxx
index e2012558382c..38ae588dbbdb 100644
--- a/sw/source/core/access/accdoc.hxx
+++ b/sw/source/core/access/accdoc.hxx
@@ -70,20 +70,13 @@ public:
     virtual OUString SAL_CALL getAccessibleName() override;
 
     // XAccessibleComponent
-    virtual sal_Bool SAL_CALL containsPoint(
-            const css::awt::Point& aPoint ) override;
-
     virtual css::uno::Reference<
         css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
                 const css::awt::Point& aPoint ) override;
 
     virtual css::awt::Rectangle SAL_CALL getBounds() override;
 
-    virtual css::awt::Point SAL_CALL getLocation() override;
-
     virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
-
-    virtual css::awt::Size SAL_CALL getSize() override;
 };
 
 using SwAccessibleDocument_BASE = 
cppu::ImplInheritanceHelper<SwAccessibleDocumentBase,

Reply via email to