1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: acctable.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
33 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
35 #ifndef _ACCCONTEXT_HXX
36 #include "acccontext.hxx"
40 class SwAccessibleTableData_Impl
;
43 class SwAccessibleTable
:
44 public SwAccessibleContext
,
45 public ::com::sun::star::accessibility::XAccessibleTable
,
46 public ::com::sun::star::accessibility::XAccessibleSelection
,
49 SwAccessibleTableData_Impl
*mpTableData
; // the table's data, prot by Sol-Mutex
50 ::rtl::OUString sDesc
;
51 const SwSelBoxes
*GetSelBoxes() const;
53 void FireTableChangeEvent( const SwAccessibleTableData_Impl
& rTableData
);
55 /** get the SwTableBox* for the given child */
56 const SwTableBox
* GetTableBox( sal_Int32
) const;
58 sal_Bool
IsChildSelected( sal_Int32 nChildIndex
) const;
60 sal_Int32
GetIndexOfSelectedChild( sal_Int32 nSelectedChildIndex
) const;
64 // Set states for getAccessibleStateSet.
65 // This drived class additinaly sets MULTISELECTABLE(+)
66 virtual void GetStates( ::utl::AccessibleStateSetHelper
& rStateSet
);
68 virtual ~SwAccessibleTable();
70 // --> OD 2007-06-27 #i77106#
71 inline void SetDesc( ::rtl::OUString sNewDesc
)
76 // --> OD 2007-06-28 #i77106#
77 virtual SwAccessibleTableData_Impl
* CreateNewTableData();
80 // force update of table data
81 void UpdateTableData();
83 // remove the current table data
84 void ClearTableData();
86 // get table data, update if necessary
87 inline SwAccessibleTableData_Impl
& GetTableData();
89 // Is table data evailable?
90 sal_Bool
HasTableData() const { return (mpTableData
!= 0); }
94 SwAccessibleTable( SwAccessibleMap
* pInitMap
, const SwTabFrm
* pTableFrm
);
96 virtual void Modify( SfxPoolItem
*pOld
, SfxPoolItem
*pNew
);
98 //===== XInterface ======================================================
100 // (XInterface methods need to be implemented to disambigouate
101 // between those inherited through SwAcessibleContext and
102 // XAccessibleTable).
104 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
105 const ::com::sun::star::uno::Type
& aType
)
106 throw (::com::sun::star::uno::RuntimeException
);
108 virtual void SAL_CALL
acquire( ) throw ()
109 { SwAccessibleContext::acquire(); };
111 virtual void SAL_CALL
release( ) throw ()
112 { SwAccessibleContext::release(); };
114 //====== XTypeProvider ====================================================
115 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes( ) throw(::com::sun::star::uno::RuntimeException
);
116 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId( ) throw(::com::sun::star::uno::RuntimeException
);
118 //===== XAccessibleContext ==============================================
120 /// Return this object's description.
121 virtual ::rtl::OUString SAL_CALL
122 getAccessibleDescription (void)
123 throw (com::sun::star::uno::RuntimeException
);
125 //===== XAccessibleTable ================================================
127 virtual sal_Int32 SAL_CALL
getAccessibleRowCount()
128 throw (::com::sun::star::uno::RuntimeException
);
129 virtual sal_Int32 SAL_CALL
getAccessibleColumnCount( )
130 throw (::com::sun::star::uno::RuntimeException
);
131 virtual ::rtl::OUString SAL_CALL
getAccessibleRowDescription(
133 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
134 ::com::sun::star::uno::RuntimeException
);
135 virtual ::rtl::OUString SAL_CALL
getAccessibleColumnDescription(
137 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
138 ::com::sun::star::uno::RuntimeException
);
139 virtual sal_Int32 SAL_CALL
getAccessibleRowExtentAt(
140 sal_Int32 nRow
, sal_Int32 nColumn
)
141 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
142 ::com::sun::star::uno::RuntimeException
);
143 virtual sal_Int32 SAL_CALL
getAccessibleColumnExtentAt(
144 sal_Int32 nRow
, sal_Int32 nColumn
)
145 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
146 ::com::sun::star::uno::RuntimeException
);
147 virtual ::com::sun::star::uno::Reference
<
148 ::com::sun::star::accessibility::XAccessibleTable
>
149 SAL_CALL
getAccessibleRowHeaders( )
150 throw (::com::sun::star::uno::RuntimeException
);
151 virtual ::com::sun::star::uno::Reference
<
152 ::com::sun::star::accessibility::XAccessibleTable
>
153 SAL_CALL
getAccessibleColumnHeaders( )
154 throw (::com::sun::star::uno::RuntimeException
);
155 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
156 getSelectedAccessibleRows( )
157 throw (::com::sun::star::uno::RuntimeException
);
158 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
159 getSelectedAccessibleColumns( )
160 throw (::com::sun::star::uno::RuntimeException
);
161 virtual sal_Bool SAL_CALL
isAccessibleRowSelected( sal_Int32 nRow
)
162 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
163 ::com::sun::star::uno::RuntimeException
);
164 virtual sal_Bool SAL_CALL
isAccessibleColumnSelected( sal_Int32 nColumn
)
165 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
166 ::com::sun::star::uno::RuntimeException
);
167 virtual ::com::sun::star::uno::Reference
<
168 ::com::sun::star::accessibility::XAccessible
> SAL_CALL
169 getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
)
170 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
171 ::com::sun::star::uno::RuntimeException
);
172 virtual ::com::sun::star::uno::Reference
<
173 ::com::sun::star::accessibility::XAccessible
> SAL_CALL
174 getAccessibleCaption( )
175 throw (::com::sun::star::uno::RuntimeException
);
176 virtual ::com::sun::star::uno::Reference
<
177 ::com::sun::star::accessibility::XAccessible
> SAL_CALL
178 getAccessibleSummary( )
179 throw (::com::sun::star::uno::RuntimeException
);
180 virtual sal_Bool SAL_CALL
isAccessibleSelected(
181 sal_Int32 nRow
, sal_Int32 nColumn
)
182 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
183 ::com::sun::star::uno::RuntimeException
);
184 virtual sal_Int32 SAL_CALL
getAccessibleIndex(
185 sal_Int32 nRow
, sal_Int32 nColumn
)
186 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
187 ::com::sun::star::uno::RuntimeException
);
188 virtual sal_Int32 SAL_CALL
getAccessibleRow( sal_Int32 nChildIndex
)
189 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
190 ::com::sun::star::uno::RuntimeException
);
191 virtual sal_Int32 SAL_CALL
getAccessibleColumn( sal_Int32 nChildIndex
)
192 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
193 ::com::sun::star::uno::RuntimeException
);
195 //===== XServiceInfo ====================================================
197 /** Returns an identifier for the implementation of this object.
199 virtual ::rtl::OUString SAL_CALL
200 getImplementationName (void)
201 throw (::com::sun::star::uno::RuntimeException
);
203 /** Return whether the specified service is supported by this class.
205 virtual sal_Bool SAL_CALL
206 supportsService (const ::rtl::OUString
& sServiceName
)
207 throw (::com::sun::star::uno::RuntimeException
);
209 /** Returns a list of all supported services. In this case that is just
210 the AccessibleContext service.
212 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
213 getSupportedServiceNames (void)
214 throw (::com::sun::star::uno::RuntimeException
);
216 //===== C++ interface ======================================================
218 // The object has been moved by the layout
219 virtual void InvalidatePosOrSize( const SwRect
& rOldBox
);
221 // The object is not visible an longer and should be destroyed
222 virtual void Dispose( sal_Bool bRecursive
= sal_False
);
224 virtual void DisposeChild( const SwFrmOrObj
& rFrmOrObj
, sal_Bool bRecursive
);
225 virtual void InvalidateChildPosOrSize( const SwFrmOrObj
& rFrmOrObj
,
226 const SwRect
& rFrm
);
228 //===== XAccessibleSelection ============================================
230 virtual void SAL_CALL
selectAccessibleChild(
231 sal_Int32 nChildIndex
)
232 throw ( ::com::sun::star::lang::IndexOutOfBoundsException
,
233 ::com::sun::star::uno::RuntimeException
);
235 virtual sal_Bool SAL_CALL
isAccessibleChildSelected(
236 sal_Int32 nChildIndex
)
237 throw ( ::com::sun::star::lang::IndexOutOfBoundsException
,
238 ::com::sun::star::uno::RuntimeException
);
240 virtual void SAL_CALL
clearAccessibleSelection( )
241 throw ( ::com::sun::star::uno::RuntimeException
);
243 virtual void SAL_CALL
selectAllAccessibleChildren( )
244 throw ( ::com::sun::star::uno::RuntimeException
);
246 virtual sal_Int32 SAL_CALL
getSelectedAccessibleChildCount( )
247 throw ( ::com::sun::star::uno::RuntimeException
);
249 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
getSelectedAccessibleChild(
250 sal_Int32 nSelectedChildIndex
)
251 throw ( ::com::sun::star::lang::IndexOutOfBoundsException
,
252 ::com::sun::star::uno::RuntimeException
);
254 // --> OD 2004-11-16 #111714# - index has to be treated as global child index.
255 virtual void SAL_CALL
deselectAccessibleChild(
256 sal_Int32 nChildIndex
)
257 throw ( ::com::sun::star::lang::IndexOutOfBoundsException
,
258 ::com::sun::star::uno::RuntimeException
);
262 inline SwAccessibleTableData_Impl
& SwAccessibleTable::GetTableData()
269 // --> OD 2007-06-28 #i77106#
270 // subclass to represent table column headers
271 class SwAccessibleTableColHeaders
: public SwAccessibleTable
275 virtual ~SwAccessibleTableColHeaders()
278 virtual SwAccessibleTableData_Impl
* CreateNewTableData();
282 SwAccessibleTableColHeaders( SwAccessibleMap
*pMap
, const SwTabFrm
*pTabFrm
);
284 virtual void Modify( SfxPoolItem
*pOld
, SfxPoolItem
*pNew
);
286 //===== XInterface ======================================================
288 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
289 const ::com::sun::star::uno::Type
& aType
)
290 throw (::com::sun::star::uno::RuntimeException
);
292 virtual void SAL_CALL
acquire( ) throw ()
293 { SwAccessibleContext::acquire(); };
295 virtual void SAL_CALL
release( ) throw ()
296 { SwAccessibleContext::release(); };
298 //===== XAccessibleContext ==============================================
300 /// Return the number of currently visible children.
301 virtual sal_Int32 SAL_CALL
getAccessibleChildCount (void)
302 throw (::com::sun::star::uno::RuntimeException
);
304 /// Return the specified child or NULL if index is invalid.
305 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
306 getAccessibleChild (sal_Int32 nIndex
)
307 throw (::com::sun::star::uno::RuntimeException
,
308 ::com::sun::star::lang::IndexOutOfBoundsException
);
310 //===== XAccessibleTable ================================================
312 virtual ::com::sun::star::uno::Reference
<
313 ::com::sun::star::accessibility::XAccessibleTable
>
314 SAL_CALL
getAccessibleRowHeaders( )
315 throw (::com::sun::star::uno::RuntimeException
);
316 virtual ::com::sun::star::uno::Reference
<
317 ::com::sun::star::accessibility::XAccessibleTable
>
318 SAL_CALL
getAccessibleColumnHeaders( )
319 throw (::com::sun::star::uno::RuntimeException
);
321 //===== XServiceInfo ====================================================
323 /** Returns an identifier for the implementation of this object.
325 virtual ::rtl::OUString SAL_CALL
326 getImplementationName (void)
327 throw (::com::sun::star::uno::RuntimeException
);