LibreOffice Module svx (master) 1
AccessibleTableShape.hxx
Go to the documentation of this file.
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_SVX_INC_ACCESSIBLETABLESHAPE_HXX
21#define INCLUDED_SVX_INC_ACCESSIBLETABLESHAPE_HXX
22
23#include <com/sun/star/accessibility/XAccessibleTable.hpp>
24
25#include <rtl/ref.hxx>
26
28
30#include <com/sun/star/view/XSelectionChangeListener.hpp>
31#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
32
33namespace sdr::table { class SvxTableController; }
34
35namespace accessibility
36{
37 class AccessibleTableShapeImpl;
38 class AccessibleCell;
39
40 typedef ::cppu::ImplInheritanceHelper< AccessibleShape,
41 css::accessibility::XAccessibleTable,
42 css::view::XSelectionChangeListener
44class AccessibleTableShape final : public AccessibleTableShape_Base, public css::accessibility::XAccessibleTableSelection
45{
47public:
48 AccessibleTableShape( const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo );
49 virtual ~AccessibleTableShape( ) override;
52
53 virtual void Init() override;
54
55 // XInterface
56 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
57 virtual void SAL_CALL acquire( ) noexcept override;
58 virtual void SAL_CALL release( ) noexcept override;
59
60 // XAccessibleContext
61 virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
62 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
63 virtual sal_Int16 SAL_CALL getAccessibleRole() override;
64
65 // XAccessibleTable
66 virtual sal_Int32 SAL_CALL getAccessibleRowCount() override;
67 virtual sal_Int32 SAL_CALL getAccessibleColumnCount( ) override;
68 virtual OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) override;
69 virtual OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) override;
70 virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) override;
71 virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) override;
72 virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders( ) override;
73 virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders( ) override;
74 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows( ) override;
75 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns( ) override;
76 virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) override;
77 virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) override;
78 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) override;
79 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCaption( ) override;
80 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleSummary( ) override;
81 virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) override;
82 virtual sal_Int64 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) override;
83 virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int64 nChildIndex ) override;
84 virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int64 nChildIndex ) override;
85
86 // XAccessibleSelection
87 virtual void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override;
88 virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override;
89 virtual void SAL_CALL clearAccessibleSelection( ) override;
90 virtual void SAL_CALL selectAllAccessibleChildren( ) override;
91 virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override;
92 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override;
93 virtual void SAL_CALL deselectAccessibleChild( sal_Int64 nChildIndex ) override;
94 // XAccessibleTableSelection
95 virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) override ;
96 virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) override ;
97 virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) override ;
98 virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) override ;
99
100 // XServiceInfo
101 virtual OUString SAL_CALL getImplementationName( ) override;
102
103 // XComponent
104 virtual void SAL_CALL disposing( ) override;
105
106 // XSelectionChangeListener
107 virtual void SAL_CALL
108 disposing (const css::lang::EventObject& Source) override;
109 virtual void SAL_CALL
110 selectionChanged (const css::lang::EventObject& rEvent) override;
113
115 void getColumnAndRow( sal_Int64 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow );
116 // overwrite the SetState & ResetState to do special operation for table cell's internal text
117 virtual bool SetState (sal_Int64 aState) override;
118 virtual bool ResetState (sal_Int64 aState) override;
119 // The following two methods are used to set state directly on table object, instead of the internal cell or paragraph.
120 bool SetStateDirectly (sal_Int64 aState);
121 bool ResetStateDirectly (sal_Int64 aState);
122 // Get the currently active cell which is text editing
124
125private:
126 virtual OUString CreateAccessibleBaseName() override;
127
128 sdr::table::SvxTableController* getTableController();
129
131 void checkCellPosition( sal_Int32 nCol, sal_Int32 nRow );
132
134 sal_Int64 GetIndexOfSelectedChild( sal_Int64 nSelectedChildIndex ) const;
135};
136
137typedef ::cppu::WeakImplHelper<
138 css::accessibility::XAccessible,
139 css::accessibility::XAccessibleComponent,
140 css::accessibility::XAccessibleContext,
141 css::accessibility::XAccessibleTable,
142 css::accessibility::XAccessibleTableSelection >
144
146{
147public:
148 // bRow, true means rowheader, false means columnheader
150 virtual ~AccessibleTableHeaderShape() override;
153
154 // XAccessible
155 virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext( ) override;
156
157 // XAccessibleContext
158 virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override;
159 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override;
160 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
161 virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
162 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
163 virtual OUString SAL_CALL getAccessibleDescription( ) override;
164 virtual OUString SAL_CALL getAccessibleName( ) override;
165 virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override;
166 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
167 virtual css::lang::Locale SAL_CALL getLocale( ) override;
168
169 //XAccessibleComponent
170 virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
171 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
172 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
173 virtual css::awt::Point SAL_CALL getLocation( ) override;
174 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
175 virtual css::awt::Size SAL_CALL getSize( ) override;
176 virtual sal_Int32 SAL_CALL getForeground( ) override;
177 virtual sal_Int32 SAL_CALL getBackground( ) override;
178 virtual void SAL_CALL grabFocus( ) override;
179
180 // XAccessibleTable
181 virtual sal_Int32 SAL_CALL getAccessibleRowCount() override;
182 virtual sal_Int32 SAL_CALL getAccessibleColumnCount( ) override;
183 virtual OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) override;
184 virtual OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) override;
185 virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) override;
186 virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) override;
187 virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders( ) override;
188 virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders( ) override;
189 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows( ) override;
190 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns( ) override;
191 virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) override;
192 virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) override;
193 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) override;
194 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCaption( ) override;
195 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleSummary( ) override;
196 virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) override;
197 virtual sal_Int64 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) override;
198 virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int64 nChildIndex ) override;
199 virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int64 nChildIndex ) override;
200
201 // XAccessibleTableSelection
202 virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) override ;
203 virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) override ;
204 virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) override ;
205 virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) override ;
206private:
207 bool mbRow;
209};
210
211} // end of namespace accessibility
212
213#endif
214
215/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@descr This class is a container for the information specific for a single shape that is passed to th...
This class bundles all information that is passed down the tree of accessible shapes so that each sha...
This base class provides a base implementation for all shapes.
rtl::Reference< AccessibleTableShape > mpTable
AccessibleTableHeaderShape(const AccessibleTableHeaderShape &)=delete
AccessibleTableHeaderShape & operator=(const AccessibleTableHeaderShape &)=delete
virtual sal_Bool SAL_CALL unselectRow(sal_Int32 row) override
virtual bool ResetState(sal_Int64 aState) override
virtual sal_Bool SAL_CALL isAccessibleSelected(sal_Int32 nRow, sal_Int32 nColumn) override
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns() override
virtual sal_Int32 SAL_CALL getAccessibleColumn(sal_Int64 nChildIndex) override
rtl::Reference< AccessibleTableShapeImpl > mxImpl
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int64 nChildIndex) override
virtual sal_Bool SAL_CALL selectRow(sal_Int32 row) override
sdr::table::SvxTableController * getTableController()
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) override
AccessibleTableShape(const AccessibleTableShape &)=delete
virtual void SAL_CALL clearAccessibleSelection() override
virtual OUString CreateAccessibleBaseName() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int64 i) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int64 nSelectedChildIndex) override
virtual sal_Int64 SAL_CALL getAccessibleIndex(sal_Int32 nRow, sal_Int32 nColumn) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleSummary() override
virtual bool SetState(sal_Int64 aState) override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders() override
virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders() override
virtual sal_Bool SAL_CALL isAccessibleColumnSelected(sal_Int32 nColumn) override
virtual sal_Int32 SAL_CALL getAccessibleRow(sal_Int64 nChildIndex) override
void getColumnAndRow(sal_Int64 nChildIndex, sal_Int32 &rnColumn, sal_Int32 &rnRow)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCaption() override
virtual void SAL_CALL selectionChanged(const css::lang::EventObject &rEvent) override
virtual sal_Bool SAL_CALL isAccessibleRowSelected(sal_Int32 nRow) override
AccessibleTableShape(const AccessibleShapeInfo &rShapeInfo, const AccessibleShapeTreeInfo &rShapeTreeInfo)
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows() override
virtual sal_Bool SAL_CALL selectColumn(sal_Int32 column) override
virtual void SAL_CALL selectAccessibleChild(sal_Int64 nChildIndex) override
void checkCellPosition(sal_Int32 nCol, sal_Int32 nRow)
virtual sal_Int16 SAL_CALL getAccessibleRole() override
virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override
virtual void SAL_CALL disposing() override
virtual OUString SAL_CALL getAccessibleRowDescription(sal_Int32 nRow) override
virtual void SAL_CALL release() noexcept override
virtual OUString SAL_CALL getImplementationName() override
sal_Int64 GetIndexOfSelectedChild(sal_Int64 nSelectedChildIndex) const
virtual sal_Int32 SAL_CALL getAccessibleColumnCount() override
virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt(sal_Int32 nRow, sal_Int32 nColumn) override
virtual void SAL_CALL deselectAccessibleChild(sal_Int64 nChildIndex) override
virtual void SAL_CALL selectAllAccessibleChildren() override
virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt(sal_Int32 nRow, sal_Int32 nColumn) override
virtual sal_Int32 SAL_CALL getAccessibleRowCount() override
virtual sal_Int64 SAL_CALL getAccessibleChildCount() override
virtual OUString SAL_CALL getAccessibleColumnDescription(sal_Int32 nColumn) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
AccessibleTableShape & operator=(const AccessibleTableShape &)=delete
virtual sal_Bool SAL_CALL unselectColumn(sal_Int32 column) override
virtual void SAL_CALL acquire() noexcept override
::cppu::ImplInheritanceHelper< AccessibleShape, css::accessibility::XAccessibleTable, css::view::XSelectionChangeListener > AccessibleTableShape_Base
::cppu::WeakImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleComponent, css::accessibility::XAccessibleContext, css::accessibility::XAccessibleTable, css::accessibility::XAccessibleTableSelection > AccessibleTableHeaderShape_BASE
const LanguageTag & getLocale()
unsigned char sal_Bool