Avoid potential negative array index access to cached text.
[LibreOffice.git] / accessibility / inc / extended / accessibletablistboxtable.hxx
blobb2f2b4277aaef2cae5031800079a6354f0307a81
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <extended/AccessibleBrowseBoxTable.hxx>
23 #include <comphelper/uno3.hxx>
24 #include <cppuhelper/implbase1.hxx>
25 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 class SvHeaderTabListBox;
30 namespace accessibility {
32 typedef ::cppu::ImplHelper1< css::accessibility::XAccessibleSelection >
33 AccessibleTabListBoxTableImplHelper;
35 class AccessibleTabListBoxTable final : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper
37 private:
38 VclPtr<SvHeaderTabListBox> m_pTabListBox;
40 css::uno::Reference< css::accessibility::XAccessible > m_xCurChild;
42 void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
43 DECL_LINK( WindowEventListener, VclWindowEvent&, void );
45 // helpers ----------------------------------------------------------------
47 /** Throws an exception, if nIndex is not a valid child index. */
48 void ensureValidIndex( sal_Int64 _nIndex ) const;
50 /** Selects the specified row. */
51 void implSelectRow( sal_Int32 _nRow, bool _bSelect );
53 /** Returns the count of rows in the table. */
54 sal_Int32 implGetRowCount() const override;
55 /** Returns the total column count in the table. */
56 sal_Int32 implGetColumnCount() const override;
57 /** Returns the count of selected rows in the table. */
58 sal_Int32 implGetSelRowCount() const;
60 /** Returns the row index from cell index. */
61 sal_Int32 implGetRow( sal_Int64 _nIndex ) const
63 auto nColCount = implGetColumnCount();
64 assert(nColCount != 0);
65 return _nIndex / nColCount;
68 /** Returns the absolute row index of the nSelRow-th selected row. */
69 sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const;
71 public:
72 /** ctor()
73 @param rxParent XAccessible interface of the parent object.
74 @param rBox The HeaderTabListBox control. */
75 AccessibleTabListBoxTable(
76 const css::uno::Reference< css::accessibility::XAccessible >& rxParent,
77 SvHeaderTabListBox& rBox );
79 private:
80 /** dtor() */
81 virtual ~AccessibleTabListBoxTable() override;
83 public:
84 // XInterface
85 DECLARE_XINTERFACE( )
87 // XTypeProvider
88 DECLARE_XTYPEPROVIDER( )
90 // XServiceInfo
91 virtual OUString SAL_CALL getImplementationName() override;
93 // XAccessibleSelection
94 void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override;
95 sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override;
96 void SAL_CALL clearAccessibleSelection( ) override;
97 void SAL_CALL selectAllAccessibleChildren( ) override;
98 sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override;
99 css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override;
100 void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override;
104 } // namespace accessibility
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */