Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETABLISTBOXTABLE_HXX
21 : #define INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETABLISTBOXTABLE_HXX
22 :
23 : #include "AccessibleBrowseBoxTable.hxx"
24 : #include <comphelper/uno3.hxx>
25 : #include <cppuhelper/implbase1.hxx>
26 : #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 :
28 : class SvHeaderTabListBox;
29 :
30 :
31 :
32 : namespace accessibility {
33 :
34 : typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection >
35 : AccessibleTabListBoxTableImplHelper;
36 :
37 : class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper
38 : {
39 : private:
40 : VclPtr<SvHeaderTabListBox> m_pTabListBox;
41 :
42 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xCurChild;
43 :
44 : void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
45 : DECL_LINK( WindowEventListener, VclSimpleEvent* );
46 :
47 : // helpers ----------------------------------------------------------------
48 :
49 : /** Throws an exception, if nIndex is not a valid child index. */
50 : void ensureValidIndex( sal_Int32 _nIndex ) const;
51 :
52 : /** Returns true, if the specified row is selected. */
53 : bool implIsRowSelected( sal_Int32 _nRow ) const;
54 : /** Selects the specified row. */
55 : void implSelectRow( sal_Int32 _nRow, bool _bSelect );
56 :
57 : /** Returns the count of rows in the table. */
58 : sal_Int32 implGetRowCount() const SAL_OVERRIDE;
59 : /** Returns the total column count in the table. */
60 : sal_Int32 implGetColumnCount() const SAL_OVERRIDE;
61 : /** Returns the count of selected rows in the table. */
62 : sal_Int32 implGetSelRowCount() const;
63 : /** Returns the total cell count in the table (including header). */
64 0 : inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); }
65 :
66 : /** Returns the row index from cell index. */
67 0 : inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); }
68 : /** Returns the column index from cell index. */
69 : inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); }
70 : /** Returns the absolute row index of the nSelRow-th selected row. */
71 : sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const;
72 : /** Returns the child index from cell position. */
73 : inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; }
74 :
75 : public:
76 : /** ctor()
77 : @param rxParent XAccessible interface of the parent object.
78 : @param rBox The HeaderTabListBox control. */
79 : AccessibleTabListBoxTable(
80 : const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
81 : SvHeaderTabListBox& rBox );
82 :
83 : protected:
84 : /** dtor() */
85 : virtual ~AccessibleTabListBoxTable();
86 :
87 : public:
88 : // XInterface
89 : DECLARE_XINTERFACE( )
90 :
91 : // XTypeProvider
92 : DECLARE_XTYPEPROVIDER( )
93 :
94 : // XServiceInfo
95 : virtual OUString SAL_CALL getImplementationName()
96 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 :
98 : // XAccessibleSelection
99 : void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
100 : sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 : void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : ::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, std::exception) SAL_OVERRIDE;
105 : void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 : };
107 :
108 :
109 :
110 : } // namespace accessibility
111 :
112 :
113 :
114 : #endif // INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETABLISTBOXTABLE_HXX
115 :
116 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|