xref: /AOO41X/main/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx (revision ffad8df045fe8db79e3e50f731c1fa6ab6501c83)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX
25 #define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX
26 
27 #include "AccessibleBrowseBoxTable.hxx"
28 #include <comphelper/uno3.hxx>
29 #include <cppuhelper/implbase1.hxx>
30 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
31 
32 class SvHeaderTabListBox;
33 
34 // ============================================================================
35 
36 namespace accessibility {
37 
38 typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection >
39             AccessibleTabListBoxTableImplHelper;
40 
41 class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper
42 {
43 private:
44     SvHeaderTabListBox*     m_pTabListBox;
45 
46     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >  m_xCurChild;
47 
48     void                    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
49     DECL_LINK(              WindowEventListener, VclSimpleEvent* );
50 
51     // helpers ----------------------------------------------------------------
52 
53     /** Throws an exception, if nIndex is not a valid child index. */
54     void ensureValidIndex( sal_Int32 _nIndex ) const
55         SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) );
56 
57     /** Returns true, if the specified row is selected. */
58     sal_Bool implIsRowSelected( sal_Int32 _nRow ) const;
59     /** Selects the specified row. */
60     void implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect );
61 
62     /** Returns the count of rows in the table. */
63     sal_Int32 implGetRowCount() const;
64     /** Returns the total column count in the table. */
65     sal_Int32 implGetColumnCount() const;
66     /** Returns the count of selected rows in the table. */
67     sal_Int32 implGetSelRowCount() const;
68     /** Returns the total cell count in the table (including header). */
implGetCellCount() const69     inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); }
70 
71     /** Returns the row index from cell index. */
implGetRow(sal_Int32 _nIndex) const72     inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); }
73     /** Returns the column index from cell index. */
implGetColumn(sal_Int32 _nIndex) const74     inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); }
75     /** Returns the absolute row index of the nSelRow-th selected row. */
76     sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const;
77     /** Returns the child index from cell position. */
implGetIndex(sal_Int32 _nRow,sal_Int32 _nColumn) const78     inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; }
79 
80 public:
81     /** ctor()
82         @param rxParent  XAccessible interface of the parent object.
83         @param rBox  The HeaderTabListBox control. */
84     AccessibleTabListBoxTable(
85         const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
86         SvHeaderTabListBox& rBox );
87 
88 protected:
89     /** dtor() */
90     virtual ~AccessibleTabListBoxTable();
91 
92 public:
93     // XInterface
94     DECLARE_XINTERFACE( )
95 
96     // XTypeProvider
97     DECLARE_XTYPEPROVIDER( )
98 
99     // XServiceInfo
100     virtual ::rtl::OUString SAL_CALL getImplementationName (void)
101         throw (::com::sun::star::uno::RuntimeException);
102 
103     // XAccessibleSelection
104     void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
105     sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
106     void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
107     void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
108     sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
109     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
110     void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
111 };
112 
113 // ============================================================================
114 
115 } // namespace accessibility
116 
117 // ============================================================================
118 
119 #endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX
120 
121