include/vcl/accessibletable.hxx                         |   61 ---------------
 toolkit/inc/controls/table/tablecontrol.hxx             |   64 ++++++++--------
 toolkit/source/controls/table/AccessibleGridControl.cxx |   26 ++----
 toolkit/source/controls/table/tablecontrol.cxx          |   18 ----
 4 files changed, 42 insertions(+), 127 deletions(-)

New commits:
commit ae8ff1c875b4cacabc64d5183f25baed8c6890c5
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Jan 27 14:44:08 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Jan 27 22:24:25 2025 +0100

    a11y: Drop IAccessibleTable
    
    Now that all related code is in the toolkit module
    and the interface (abstract base class) is no more
    needed to break a dependency cycle, drop the interface altogether.
    
    (An earlier version of this change resulted in LO clang plugins
    pointing out some oddities. These have in the meantime been addressed
    separately in previous commits to prepare for this change.)
    
    Change-Id: I6295695d9f0bf02be26175c45142965351ec5eff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180797
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/include/vcl/accessibletable.hxx b/include/vcl/accessibletable.hxx
index fa7b86def548..7f2d2954c885 100644
--- a/include/vcl/accessibletable.hxx
+++ b/include/vcl/accessibletable.hxx
@@ -20,13 +20,6 @@
 #ifndef INCLUDED_VCL_ACCESSIBLETABLE_HXX
 #define INCLUDED_VCL_ACCESSIBLETABLE_HXX
 
-#include <tools/gen.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/accessibility/XAccessible.hpp>
-#include <cppuhelper/implbase.hxx>
-
-namespace vcl { class Window; }
-
 namespace vcl::table
 {
 
@@ -41,58 +34,6 @@ enum class AccessibleTableControlObjType
     COLUMNHEADERCELL,    /// A cell of the column header bar.
 };
 
-
-/** This abstract class provides methods to implement an accessible table 
object.
-*/
-class IAccessibleTable
-{
-public:
-    /** @return  The position of the current row. */
-    virtual sal_Int32               GetCurrentRow() const = 0;
-    /** @return  The position of the current column. */
-    virtual sal_Int32               GetCurrentColumn() const = 0;
-    virtual OUString GetAccessibleObjectName(AccessibleTableControlObjType 
eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0;
-    virtual void    GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0;
-    virtual bool    HasColHeader() = 0;
-    virtual bool    HasRowHeader() = 0;
-
-    /** return the description of the specified object.
-        @param  eObjType
-            The type to ask for
-        @return
-            The description of the specified object.
-    */
-    virtual OUString 
GetAccessibleObjectDescription(AccessibleTableControlObjType eObjType) const= 0;
-
-    /** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
-            the accessible object), depending on the specified object type. */
-    virtual void FillAccessibleStateSet( sal_Int64& rStateSet,
-            AccessibleTableControlObjType eObjType ) const= 0;
-
-    // Window
-    virtual sal_Int32 GetAccessibleControlCount() const = 0;
-    virtual sal_Int32 GetRowCount() const= 0;
-    virtual sal_Int32 GetColumnCount() const= 0;
-    virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& 
_rnColPos, const Point& _rPoint )= 0;
-    virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar ) = 0;
-    virtual tools::Rectangle calcHeaderCellRect( bool _bColHeader, sal_Int32 
_nPos ) = 0;
-    virtual tools::Rectangle calcTableRect() = 0;
-    virtual tools::Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 
_nColPos ) = 0;
-    virtual void FillAccessibleStateSetForCell( sal_Int64& _rStateSet, 
sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const= 0;
-    virtual OUString GetRowName(sal_Int32 _nIndex) const = 0;
-    virtual OUString GetColumnName( sal_Int32 _nIndex ) const = 0;
-    virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 
_nColPos) const = 0;
-
-    virtual sal_Int32 GetSelectedRowCount() const = 0;
-    virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) 
const = 0;
-    virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const = 0;
-    virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) 
= 0;
-    virtual void SelectAllRows( bool const i_select ) = 0;
-
-protected:
-    ~IAccessibleTable() {}
-};
-
 } // namespace vcl::table
 
 #endif // INCLUDED_VCL_ACCESSIBLETABLE_HXX
diff --git a/toolkit/inc/controls/table/tablecontrol.hxx 
b/toolkit/inc/controls/table/tablecontrol.hxx
index 6e7879ae37f0..482330fef39b 100644
--- a/toolkit/inc/controls/table/tablecontrol.hxx
+++ b/toolkit/inc/controls/table/tablecontrol.hxx
@@ -49,9 +49,8 @@ namespace svt::table
 
         The control supports the concept of a <em>current</em> (or 
<em>active</em>
         cell).
-        The control supports accessibility, this is encapsulated in 
IAccessibleTable
     */
-    class TableControl final : public Control, public 
vcl::table::IAccessibleTable
+    class TableControl final : public Control
     {
     private:
         std::shared_ptr<TableControl_Impl>            m_pImpl;
@@ -76,7 +75,7 @@ namespace svt::table
                 if there is no active cell, e.g. because the table does
                 not contain any rows or columns.
         */
-        sal_Int32 GetCurrentRow() const override;
+        sal_Int32 GetCurrentRow() const;
 
         /** retrieves the current column
 
@@ -87,7 +86,7 @@ namespace svt::table
                 if there is no active cell, e.g. because the table does
                 not contain any rows or columns.
         */
-        sal_Int32  GetCurrentColumn() const override;
+        sal_Int32 GetCurrentColumn() const;
 
         /** activates the cell at the given position
         */
@@ -110,10 +109,13 @@ namespace svt::table
 
         /** Creates and returns the accessible object of the whole 
GridControl. */
         virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessible() override;
-        virtual OUString 
GetAccessibleObjectName(vcl::table::AccessibleTableControlObjType eObjType, 
sal_Int32 _nRow, sal_Int32 _nCol) const override;
-        virtual void GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ) 
override;
-        virtual OUString 
GetAccessibleObjectDescription(vcl::table::AccessibleTableControlObjType 
eObjType) const override;
-        virtual void FillAccessibleStateSet( sal_Int64& rStateSet, 
vcl::table::AccessibleTableControlObjType eObjType ) const override;
+        OUString 
GetAccessibleObjectName(vcl::table::AccessibleTableControlObjType eObjType,
+                                         sal_Int32 _nRow, sal_Int32 _nCol) 
const;
+        void GoToCell(sal_Int32 _nColumnPos, sal_Int32 _nRow);
+        OUString
+        
GetAccessibleObjectDescription(vcl::table::AccessibleTableControlObjType 
eObjType) const;
+        void FillAccessibleStateSet(sal_Int64& rStateSet,
+                                    vcl::table::AccessibleTableControlObjType 
eObjType) const;
 
         // temporary methods
         // Those do not really belong into the public API - they're intended 
for firing A11Y-related events. However,
@@ -122,28 +124,28 @@ namespace svt::table
         void commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, 
const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
         void commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, 
const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
 
-
-        // IAccessibleTable
-        virtual sal_Int32 GetAccessibleControlCount() const override;
-        virtual sal_Int32 GetRowCount() const override;
-        virtual sal_Int32 GetColumnCount() const override;
-        virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& 
_rnColPos, const Point& _rPoint ) override;
-        virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar ) override;
-        virtual tools::Rectangle calcHeaderCellRect( bool _bIsColumnBar, 
sal_Int32 nPos) override;
-        virtual tools::Rectangle calcTableRect() override;
-        virtual tools::Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 
_nColPos ) override;
-        virtual void FillAccessibleStateSetForCell( sal_Int64& _rStateSet, 
sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const override;
-        virtual OUString GetRowName(sal_Int32 _nIndex) const override;
-        virtual OUString GetColumnName( sal_Int32 _nIndex ) const override;
-        virtual bool HasRowHeader() override;
-        virtual bool HasColHeader() override;
-        virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 
_nColPos) const override;
-
-        virtual sal_Int32 GetSelectedRowCount() const override;
-        virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const 
i_selectionIndex ) const override;
-        virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const 
override;
-        virtual void SelectRow( sal_Int32 const i_rowIndex, bool const 
i_select ) override;
-        virtual void SelectAllRows( bool const i_select ) override;
+        sal_Int32 GetAccessibleControlCount() const;
+        sal_Int32 GetRowCount() const;
+        sal_Int32 GetColumnCount() const;
+        bool ConvertPointToCellAddress(sal_Int32& _rnRow, sal_Int32& _rnColPos,
+                                       const Point& _rPoint);
+        tools::Rectangle calcHeaderRect(bool _bIsColumnBar);
+        tools::Rectangle calcHeaderCellRect(bool _bIsColumnBar, sal_Int32 
nPos);
+        tools::Rectangle calcTableRect();
+        tools::Rectangle calcCellRect(sal_Int32 _nRowPos, sal_Int32 _nColPos);
+        void FillAccessibleStateSetForCell(sal_Int64& _rStateSet, sal_Int32 
_nRow,
+                                           sal_uInt16 _nColumnPos) const;
+        OUString GetRowName(sal_Int32 _nIndex) const;
+        OUString GetColumnName(sal_Int32 _nIndex) const;
+        bool HasRowHeader();
+        bool HasColHeader();
+        OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) 
const;
+
+        sal_Int32 GetSelectedRowCount() const;
+        sal_Int32 GetSelectedRowIndex(sal_Int32 const i_selectionIndex) const;
+        bool IsRowSelected(sal_Int32 const i_rowIndex) const;
+        void SelectRow(sal_Int32 const i_rowIndex, bool const i_select);
+        void SelectAllRows(bool const i_select);
 
         TableCell hitTest(const Point& rPoint) const;
         void invalidate(const TableArea aArea);
commit 24a2dd9cbe6c2079d379921e35c45331c19e723e
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Jan 27 14:36:16 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Jan 27 22:24:19 2025 +0100

    toolkit: Drop now unused TableControl::ConvertPointToControlIndex
    
    Change-Id: I15fa134992de8ada04346c8bfd881ed76f9e4b4a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180793
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/include/vcl/accessibletable.hxx b/include/vcl/accessibletable.hxx
index 16d328ca880d..fa7b86def548 100644
--- a/include/vcl/accessibletable.hxx
+++ b/include/vcl/accessibletable.hxx
@@ -71,7 +71,6 @@ public:
 
     // Window
     virtual sal_Int32 GetAccessibleControlCount() const = 0;
-    virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& 
_rPoint )= 0;
     virtual sal_Int32 GetRowCount() const= 0;
     virtual sal_Int32 GetColumnCount() const= 0;
     virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& 
_rnColPos, const Point& _rPoint )= 0;
diff --git a/toolkit/inc/controls/table/tablecontrol.hxx 
b/toolkit/inc/controls/table/tablecontrol.hxx
index 505ddb2e0699..6e7879ae37f0 100644
--- a/toolkit/inc/controls/table/tablecontrol.hxx
+++ b/toolkit/inc/controls/table/tablecontrol.hxx
@@ -125,7 +125,6 @@ namespace svt::table
 
         // IAccessibleTable
         virtual sal_Int32 GetAccessibleControlCount() const override;
-        virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const 
Point& _rPoint ) override;
         virtual sal_Int32 GetRowCount() const override;
         virtual sal_Int32 GetColumnCount() const override;
         virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& 
_rnColPos, const Point& _rPoint ) override;
diff --git a/toolkit/source/controls/table/tablecontrol.cxx 
b/toolkit/source/controls/table/tablecontrol.cxx
index 860ed4892d1f..eb67a8f8370a 100644
--- a/toolkit/source/controls/table/tablecontrol.cxx
+++ b/toolkit/source/controls/table/tablecontrol.cxx
@@ -531,16 +531,6 @@ namespace svt::table
         return count;
     }
 
-
-    bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const 
Point& _rPoint )
-    {
-        sal_Int32 nRow = m_pImpl->getRowAtPoint( _rPoint );
-        sal_Int32 nCol = m_pImpl->getColAtPoint( _rPoint );
-        _rnIndex = nRow * GetColumnCount() + nCol;
-        return nRow >= 0;
-    }
-
-
     sal_Int32 TableControl::GetRowCount() const
     {
         return GetModel()->getRowCount();
commit 76677a804f23ebd1fac0a098883c861816103b91
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Jan 27 14:19:10 2025 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Mon Jan 27 22:24:12 2025 +0100

    a11y: Drop non-functional bits from 
AccessibleGridControl::getAccessibleAtPoint
    
    XAccessibleComponent::getAccessibleAtPoint should return
    the direct child at the given point.
    
    AccessibleGridControl can have up to 3 children,
    see AccessibleGridControl::getAccessibleChild:
    
    * a row header (AccessibleGridControlHeader)
    * a column header (AccessibleGridControlHeader)
    * the table (AccessibleGridControlTable)
    
    TableControl::ConvertPointToControlIndex on the other
    hand returns the child index of a cell within
    the table, so could only be relevant when
    calling AccessibleGridControlTable::getAccessibleAtPoint on the
    AccessibleGridControlTable child
    (and AccessibleGridControlTable::getAccessibleAtPoint does similar,
    but uses a method called TableControl::ConvertPointToCellAddress
    instead).
    
    In addition, TableControl::CreateAccessibleControl that
    was called with the index retrieved that way was
    warning it should be overriden (Where?) and unconditionally
    returning nullptr.
    
    Drop that broken code path. The remaining logic
    to iterate over the children looks reasonable in principle.
    
    Without this commit in place, using the "Inspect object under mouse"
    feature in Accerciser when the mouse is over a cell of the grid control
    of the sample doc attachment 198647 from tdf#164783 with the qt6 VCL plugin
    would result in the top-level's TableControl's a11y object getting selected
    in Accerciser's treeview of the LO a11y and its full area getting
    highlighted.
    Now, it selects/highlights the column header cell - even if the mouse cursor
    is over one of the regular cells - which is still not fully correct,
    but that is a different issue.
    
    Change-Id: Ib4a0d05145c66a96dcb72a6a50805182c17fb2f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180792
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/include/vcl/accessibletable.hxx b/include/vcl/accessibletable.hxx
index 467aa8262149..16d328ca880d 100644
--- a/include/vcl/accessibletable.hxx
+++ b/include/vcl/accessibletable.hxx
@@ -51,7 +51,6 @@ public:
     virtual sal_Int32               GetCurrentRow() const = 0;
     /** @return  The position of the current column. */
     virtual sal_Int32               GetCurrentColumn() const = 0;
-    virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleControl( sal_Int32 _nIndex )= 0;
     virtual OUString GetAccessibleObjectName(AccessibleTableControlObjType 
eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const= 0;
     virtual void    GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow )= 0;
     virtual bool    HasColHeader() = 0;
diff --git a/toolkit/inc/controls/table/tablecontrol.hxx 
b/toolkit/inc/controls/table/tablecontrol.hxx
index 4b08ab023f64..505ddb2e0699 100644
--- a/toolkit/inc/controls/table/tablecontrol.hxx
+++ b/toolkit/inc/controls/table/tablecontrol.hxx
@@ -110,7 +110,6 @@ namespace svt::table
 
         /** Creates and returns the accessible object of the whole 
GridControl. */
         virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessible() override;
-        virtual css::uno::Reference< css::accessibility::XAccessible > 
CreateAccessibleControl( sal_Int32 _nIndex ) override;
         virtual OUString 
GetAccessibleObjectName(vcl::table::AccessibleTableControlObjType eObjType, 
sal_Int32 _nRow, sal_Int32 _nCol) const override;
         virtual void GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ) 
override;
         virtual OUString 
GetAccessibleObjectDescription(vcl::table::AccessibleTableControlObjType 
eObjType) const override;
diff --git a/toolkit/source/controls/table/AccessibleGridControl.cxx 
b/toolkit/source/controls/table/AccessibleGridControl.cxx
index 463821ae5b8c..740431ad73e3 100644
--- a/toolkit/source/controls/table/AccessibleGridControl.cxx
+++ b/toolkit/source/controls/table/AccessibleGridControl.cxx
@@ -147,24 +147,18 @@ AccessibleGridControl::getAccessibleAtPoint( const 
awt::Point& rPoint )
     SolarMutexGuard aSolarGuard;
     ensureAlive();
 
-    sal_Int32 nIndex = 0;
-    if (m_aTable.ConvertPointToControlIndex(nIndex, 
vcl::unohelper::ConvertToVCLPoint(rPoint)))
-        return m_aTable.CreateAccessibleControl(nIndex);
-    else
+    // try whether point is in one of the fixed children
+    // (table, header bars, corner control)
+    Point aPoint(vcl::unohelper::ConvertToVCLPoint(rPoint));
+    for (sal_Int32 nIndex = 0; nIndex < 3; ++nIndex)
     {
-        // try whether point is in one of the fixed children
-        // (table, header bars, corner control)
-        Point aPoint(vcl::unohelper::ConvertToVCLPoint(rPoint));
-        for (nIndex = 0; nIndex < 3; ++nIndex)
-        {
-            css::uno::Reference< css::accessibility::XAccessible > xCurrChild( 
implGetFixedChild( nIndex ) );
-            css::uno::Reference< css::accessibility::XAccessibleComponent >
-            xCurrChildComp( xCurrChild, uno::UNO_QUERY );
+        css::uno::Reference<css::accessibility::XAccessible> 
xCurrChild(implGetFixedChild(nIndex));
+        css::uno::Reference<css::accessibility::XAccessibleComponent> 
xCurrChildComp(
+            xCurrChild, uno::UNO_QUERY);
 
-            if (xCurrChildComp.is()
-                && 
vcl::unohelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint))
-                return xCurrChild;
-        }
+        if (xCurrChildComp.is()
+            && 
vcl::unohelper::ConvertToVCLRect(xCurrChildComp->getBounds()).Contains(aPoint))
+            return xCurrChild;
     }
     return nullptr;
 }
diff --git a/toolkit/source/controls/table/tablecontrol.cxx 
b/toolkit/source/controls/table/tablecontrol.cxx
index 4caccefa4d09..860ed4892d1f 100644
--- a/toolkit/source/controls/table/tablecontrol.cxx
+++ b/toolkit/source/controls/table/tablecontrol.cxx
@@ -322,14 +322,6 @@ namespace svt::table
         return m_pImpl->getAccessible( *pParent );
     }
 
-
-    Reference<XAccessible> TableControl::CreateAccessibleControl( sal_Int32 )
-    {
-        SAL_WARN( "svtools", "TableControl::CreateAccessibleControl: to be 
overwritten!" );
-        return nullptr;
-    }
-
-
     OUString TableControl::GetAccessibleObjectName( 
vcl::table::AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 
_nCol) const
     {
         OUString aRetText;

Reply via email to