browsebox a11y: Use cppu::ImplInheritanceHelper
[LibreOffice.git] / vcl / inc / accessibility / accessibletablistboxtable.hxx
blob8fa543e63ea459dd551303832ae97afc5fc8b518
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 <accessibility/AccessibleBrowseBoxTable.hxx>
23 #include <comphelper/uno3.hxx>
24 #include <cppuhelper/implbase1.hxx>
25 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 class SvHeaderTabListBox;
29 typedef ::cppu::ImplHelper1< css::accessibility::XAccessibleSelection >
30 AccessibleTabListBoxTableImplHelper;
32 class AccessibleTabListBoxTable final : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper
34 private:
35 VclPtr<SvHeaderTabListBox> m_pTabListBox;
37 css::uno::Reference< css::accessibility::XAccessible > m_xCurChild;
39 void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
40 DECL_LINK( WindowEventListener, VclWindowEvent&, void );
42 // helpers ----------------------------------------------------------------
44 /** Throws an exception, if nIndex is not a valid child index. */
45 void ensureValidIndex( sal_Int64 _nIndex ) const;
47 /** Selects the specified row. */
48 void implSelectRow( sal_Int32 _nRow, bool _bSelect );
50 /** Returns the count of rows in the table. */
51 sal_Int32 implGetRowCount() const override;
52 /** Returns the total column count in the table. */
53 sal_Int32 implGetColumnCount() const override;
54 /** Returns the count of selected rows in the table. */
55 sal_Int32 implGetSelRowCount() const;
57 /** Returns the row index from cell index. */
58 sal_Int32 implGetRow( sal_Int64 _nIndex ) const
60 auto nColCount = implGetColumnCount();
61 assert(nColCount != 0);
62 return _nIndex / nColCount;
65 /** Returns the absolute row index of the nSelRow-th selected row. */
66 sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const;
68 public:
69 /** ctor()
70 @param rxParent XAccessible interface of the parent object.
71 @param rBox The HeaderTabListBox control. */
72 AccessibleTabListBoxTable(
73 const css::uno::Reference< css::accessibility::XAccessible >& rxParent,
74 SvHeaderTabListBox& rBox );
76 private:
77 /** dtor() */
78 virtual ~AccessibleTabListBoxTable() override;
80 public:
81 // XInterface
82 DECLARE_XINTERFACE( )
84 // XTypeProvider
85 DECLARE_XTYPEPROVIDER( )
87 // XServiceInfo
88 virtual OUString SAL_CALL getImplementationName() override;
90 // XAccessibleSelection
91 void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override;
92 sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override;
93 void SAL_CALL clearAccessibleSelection( ) override;
94 void SAL_CALL selectAllAccessibleChildren( ) override;
95 sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override;
96 css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override;
97 void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override;
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */