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 : 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 : SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) );
52 :
53 : /** Returns true, if the specified row is selected. */
54 : sal_Bool implIsRowSelected( sal_Int32 _nRow ) const;
55 : /** Selects the specified row. */
56 : void implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect );
57 :
58 : /** Returns the count of rows in the table. */
59 : sal_Int32 implGetRowCount() const SAL_OVERRIDE;
60 : /** Returns the total column count in the table. */
61 : sal_Int32 implGetColumnCount() const SAL_OVERRIDE;
62 : /** Returns the count of selected rows in the table. */
63 : sal_Int32 implGetSelRowCount() const;
64 : /** Returns the total cell count in the table (including header). */
65 0 : inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); }
66 :
67 : /** Returns the row index from cell index. */
68 0 : inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); }
69 : /** Returns the column index from cell index. */
70 : inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); }
71 : /** Returns the absolute row index of the nSelRow-th selected row. */
72 : sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const;
73 : /** Returns the child index from cell position. */
74 : inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; }
75 :
76 : public:
77 : /** ctor()
78 : @param rxParent XAccessible interface of the parent object.
79 : @param rBox The HeaderTabListBox control. */
80 : AccessibleTabListBoxTable(
81 : const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
82 : SvHeaderTabListBox& rBox );
83 :
84 : protected:
85 : /** dtor() */
86 : virtual ~AccessibleTabListBoxTable();
87 :
88 : public:
89 : // XInterface
90 : DECLARE_XINTERFACE( )
91 :
92 : // XTypeProvider
93 : DECLARE_XTYPEPROVIDER( )
94 :
95 : // XServiceInfo
96 : virtual OUString SAL_CALL getImplementationName (void)
97 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
98 :
99 : // XAccessibleSelection
100 : void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 : sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 : void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 : sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
105 : ::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;
106 : void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 : };
108 :
109 :
110 :
111 : } // namespace accessibility
112 :
113 :
114 :
115 : #endif // INCLUDED_ACCESSIBILITY_INC_ACCESSIBILITY_EXTENDED_ACCESSIBLETABLISTBOXTABLE_HXX
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|