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: AccessibleCsvControl.hxx,v $
10 * $Revision: 1.15.32.2 $
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 ************************************************************************/
31 // ============================================================================
33 #ifndef _SC_ACCESSIBLECSVCONTROL_HXX
34 #define _SC_ACCESSIBLECSVCONTROL_HXX
36 #include <com/sun/star/accessibility/XAccessibleText.hpp>
37 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
38 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
39 #include <tools/gen.hxx>
40 #include <tools/string.hxx>
41 #include <rtl/ustrbuf.hxx>
42 #include <cppuhelper/implbase1.hxx>
43 #include <cppuhelper/implbase2.hxx>
44 #include <svx/AccessibleStaticTextBase.hxx>
45 #include <comphelper/uno3.hxx>
46 #include "AccessibleContextBase.hxx"
49 // ============================================================================
52 namespace utl
{ class AccessibleStateSetHelper
; }
54 /** Accessible base class used for CSV controls. */
55 class ScAccessibleCsvControl
: public ScAccessibleContextBase
58 typedef ::com::sun::star::uno::Reference
<
59 ::com::sun::star::accessibility::XAccessible
> XAccessibleRef
;
60 typedef ::com::sun::star::uno::Reference
<
61 ::com::sun::star::accessibility::XAccessibleRelationSet
> XAccessibleRelationSetRef
;
62 typedef ::com::sun::star::uno::Reference
<
63 ::com::sun::star::accessibility::XAccessibleStateSet
> XAccessibleStateSetRef
;
65 typedef ::com::sun::star::awt::Point AwtPoint
;
66 typedef ::com::sun::star::awt::Size AwtSize
;
67 typedef ::com::sun::star::awt::Rectangle AwtRectangle
;
70 ScCsvControl
* mpControl
; /// Pointer to the VCL control.
73 explicit ScAccessibleCsvControl(
74 const XAccessibleRef
& rxParent
,
75 ScCsvControl
& rControl
,
77 virtual ~ScAccessibleCsvControl();
79 using ScAccessibleContextBase::disposing
;
80 virtual void SAL_CALL
disposing();
82 // XAccessibleComponent ---------------------------------------------------
84 /** Returns the child at the specified point (cell returns NULL). */
85 virtual XAccessibleRef SAL_CALL
getAccessibleAtPoint( const AwtPoint
& rPoint
)
86 throw( ::com::sun::star::uno::RuntimeException
);
88 /** Returns true, if the control is visible. */
89 virtual sal_Bool SAL_CALL
isVisible() throw( ::com::sun::star::uno::RuntimeException
);
91 /** Sets the focus to this control. */
92 virtual void SAL_CALL
grabFocus() throw( ::com::sun::star::uno::RuntimeException
);
94 // events -----------------------------------------------------------------
96 /** Sends a GetFocus or LoseFocus event to all listeners. */
97 virtual void SendFocusEvent( bool bFocused
);
98 /** Sends a caret changed event to all listeners. */
99 virtual void SendCaretEvent();
100 /** Sends a visible area changed event to all listeners. */
101 virtual void SendVisibleEvent();
102 /** Sends a selection changed event to all listeners. */
103 virtual void SendSelectionEvent();
104 /** Sends a table model changed event for changed cell contents to all listeners. */
105 virtual void SendTableUpdateEvent( sal_uInt32 nFirstColumn
, sal_uInt32 nLastColumn
, bool bAllRows
);
106 /** Sends a table model changed event for an inserted column to all listeners. */
107 virtual void SendInsertColumnEvent( sal_uInt32 nFirstColumn
, sal_uInt32 nLastColumn
);
108 /** Sends a table model changed event for a removed column to all listeners. */
109 virtual void SendRemoveColumnEvent( sal_uInt32 nFirstColumn
, sal_uInt32 nLastColumn
);
111 // helpers ----------------------------------------------------------------
113 /** Returns this object's current bounding box relative to the desktop. */
114 virtual Rectangle
GetBoundingBoxOnScreen() const throw( ::com::sun::star::uno::RuntimeException
);
115 /** Returns this object's current bounding box relative to the parent object. */
116 virtual Rectangle
GetBoundingBox() const throw( ::com::sun::star::uno::RuntimeException
);
118 /** Creates a new UUID in rSeq, if it is empty. Locks mutex internally. */
119 void getUuid( ::com::sun::star::uno::Sequence
< sal_Int8
>& rSeq
);
121 /** Returns whether the object is alive. Must be called with locked mutex. */
122 inline bool implIsAlive() const { return !rBHelper
.bDisposed
&& !rBHelper
.bInDispose
&& mpControl
; }
123 /** Throws an exception, if the object is disposed/disposing or any pointer
124 is missing. Should be used with locked mutex! */
125 void ensureAlive() const throw( ::com::sun::star::lang::DisposedException
);
127 /** Returns the VCL control. Assumes a living object. */
128 ScCsvControl
& implGetControl() const;
130 /** Returns the first child of rxParentObj, which has the role nRole. */
131 XAccessibleRef
implGetChildByRole( const XAccessibleRef
& rxParentObj
, sal_uInt16 nRole
)
132 throw( ::com::sun::star::uno::RuntimeException
);
133 /** Creates a StateSetHelper and fills it with DEFUNC, OPAQUE, ENABLED, SHOWING and VISIBLE. */
134 ::utl::AccessibleStateSetHelper
* implCreateStateSet();
136 /** Disposes the object. This is a helper called from destructors only. */
139 /** Converts the control-relative position to an absolute screen position. */
140 Point
implGetAbsPos( const Point
& rPos
) const;
144 // ============================================================================
148 typedef ::cppu::ImplHelper1
<
149 ::com::sun::star::accessibility::XAccessibleText
>
150 ScAccessibleCsvRulerImpl
;
152 /** Accessible class representing the CSV ruler control. */
153 class ScAccessibleCsvRuler
: public ScAccessibleCsvControl
, public ScAccessibleCsvRulerImpl
156 typedef ::com::sun::star::uno::Sequence
<
157 ::com::sun::star::beans::PropertyValue
> PropertyValueSeq
;
160 ::rtl::OUStringBuffer maBuffer
; /// Contains the text representation of the ruler.
163 explicit ScAccessibleCsvRuler( ScCsvRuler
& rRuler
);
164 virtual ~ScAccessibleCsvRuler();
166 // XAccessibleComponent -----------------------------------------------------
168 virtual sal_Int32 SAL_CALL
getForeground( )
169 throw (::com::sun::star::uno::RuntimeException
);
171 virtual sal_Int32 SAL_CALL
getBackground( )
172 throw (::com::sun::star::uno::RuntimeException
);
174 // XAccessibleContext -----------------------------------------------------
176 /** Returns the child count (the ruler does not have children). */
177 virtual sal_Int32 SAL_CALL
getAccessibleChildCount()
178 throw( ::com::sun::star::uno::RuntimeException
);
180 /** Throws an exception (the ruler does not have childern). */
181 virtual XAccessibleRef SAL_CALL
getAccessibleChild( sal_Int32 nIndex
)
182 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
184 /** Returns the relation to the grid control. */
185 virtual XAccessibleRelationSetRef SAL_CALL
getAccessibleRelationSet()
186 throw( ::com::sun::star::uno::RuntimeException
);
188 /** Returns the current set of states. */
189 virtual XAccessibleStateSetRef SAL_CALL
getAccessibleStateSet()
190 throw( ::com::sun::star::uno::RuntimeException
);
192 // XAccessibleText --------------------------------------------------------
194 /** Return the position of the caret. */
195 virtual sal_Int32 SAL_CALL
getCaretPosition() throw( ::com::sun::star::uno::RuntimeException
);
197 /** Sets the position of the caret. */
198 virtual sal_Bool SAL_CALL
setCaretPosition( sal_Int32 nIndex
)
199 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
201 /** Returns the specified character. */
202 virtual sal_Unicode SAL_CALL
getCharacter( sal_Int32 nIndex
)
203 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
205 /** Returns the attributes of the specified character. */
206 virtual PropertyValueSeq SAL_CALL
getCharacterAttributes( sal_Int32 nIndex
, const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& aRequestedAttributes
)
207 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
209 /** Returns the screen coordinates of the specified character. */
210 virtual AwtRectangle SAL_CALL
getCharacterBounds( sal_Int32 nIndex
)
211 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
213 /** Returns the count of characters. */
214 virtual sal_Int32 SAL_CALL
getCharacterCount() throw( ::com::sun::star::uno::RuntimeException
);
216 /** Returns the character index at the specified coordinate (object's coordinate system). */
217 virtual sal_Int32 SAL_CALL
getIndexAtPoint( const AwtPoint
& rPoint
)
218 throw( ::com::sun::star::uno::RuntimeException
);
220 /** Returns the selected text (ruler returns empty string). */
221 virtual ::rtl::OUString SAL_CALL
getSelectedText() throw( ::com::sun::star::uno::RuntimeException
);
223 /** Returns the start index of the selection (ruler returns -1). */
224 virtual sal_Int32 SAL_CALL
getSelectionStart() throw( ::com::sun::star::uno::RuntimeException
);
226 /** Returns the end index of the selection (ruler returns -1). */
227 virtual sal_Int32 SAL_CALL
getSelectionEnd() throw( ::com::sun::star::uno::RuntimeException
);
229 /** Selects a part of the text (ruler does nothing). */
230 virtual sal_Bool SAL_CALL
setSelection( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
)
231 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
233 /** Returns the entire text. */
234 virtual ::rtl::OUString SAL_CALL
getText() throw( ::com::sun::star::uno::RuntimeException
);
236 /** Returns the specified range [Start,End) of the text. */
237 virtual ::rtl::OUString SAL_CALL
getTextRange( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
)
238 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
240 /** Returns the specified text portion. */
241 virtual ::com::sun::star::accessibility::TextSegment SAL_CALL
getTextAtIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
242 virtual ::com::sun::star::accessibility::TextSegment SAL_CALL
getTextBeforeIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
243 virtual ::com::sun::star::accessibility::TextSegment SAL_CALL
getTextBehindIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
);
245 /** Copies the specified text range into the clipboard (ruler does nothing). */
246 virtual sal_Bool SAL_CALL
copyText( sal_Int32 nStartIndex
, sal_Int32 nEndIndex
)
247 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
249 // XInterface -------------------------------------------------------------
251 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
252 throw( ::com::sun::star::uno::RuntimeException
);
254 virtual void SAL_CALL
acquire() throw();
256 virtual void SAL_CALL
release() throw();
258 // XServiceInfo -----------------------------------------------------------
260 /** Returns an identifier for the implementation of this object. */
261 virtual ::rtl::OUString SAL_CALL
getImplementationName()
262 throw( ::com::sun::star::uno::RuntimeException
);
264 // XTypeProvider ----------------------------------------------------------
266 /** Returns a sequence with all supported interface types. */
267 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
268 throw( ::com::sun::star::uno::RuntimeException
);
270 /** Returns an implementation ID. */
271 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
272 throw( ::com::sun::star::uno::RuntimeException
);
274 // events -----------------------------------------------------------------
276 /** Sends a caret changed event to all listeners. */
277 virtual void SendCaretEvent();
279 // helpers ----------------------------------------------------------------
281 /** Returns this object's name. */
282 virtual ::rtl::OUString SAL_CALL
createAccessibleName()
283 throw( ::com::sun::star::uno::RuntimeException
);
284 /** Returns this object's description. */
285 virtual ::rtl::OUString SAL_CALL
createAccessibleDescription()
286 throw( ::com::sun::star::uno::RuntimeException
);
288 /** Throws an exception, if the specified character position is invalid (outside 0..len-1). */
289 void ensureValidIndex( sal_Int32 nIndex
) const
290 throw( ::com::sun::star::lang::IndexOutOfBoundsException
);
291 /** Throws an exception, if the specified character position is invalid (outside 0..len). */
292 void ensureValidIndexWithEnd( sal_Int32 nIndex
) const
293 throw( ::com::sun::star::lang::IndexOutOfBoundsException
);
294 /** Throws an exception, if the specified character range [Start,End) is invalid.
295 @descr If Start>End, swaps Start and End before checking. */
296 void ensureValidRange( sal_Int32
& rnStartIndex
, sal_Int32
& rnEndIndex
) const
297 throw( ::com::sun::star::lang::IndexOutOfBoundsException
);
299 /** Returns the VCL ruler control. Assumes a living object. */
300 ScCsvRuler
& implGetRuler() const;
302 /** Builds the entire string buffer. */
303 void constructStringBuffer() throw( ::com::sun::star::uno::RuntimeException
);
304 /** Returns the character count of the text. */
305 sal_Int32
implGetTextLength() const;
307 /** Returns true, if the character at the specified index has a split. */
308 bool implHasSplit( sal_Int32 nApiPos
);
310 /** Returns the first character index with equal formatting as at nApiPos. */
311 sal_Int32
implGetFirstEqualFormatted( sal_Int32 nApiPos
);
312 /** Returns the last character index with equal formatting as at nApiPos. */
313 sal_Int32
implGetLastEqualFormatted( sal_Int32 nApiPos
);
317 // ============================================================================
321 typedef ::cppu::ImplHelper2
<
322 ::com::sun::star::accessibility::XAccessibleTable
,
323 ::com::sun::star::accessibility::XAccessibleSelection
>
324 ScAccessibleCsvGridImpl
;
326 /** Accessible class representing the CSV grid control. */
327 class ScAccessibleCsvGrid
: public ScAccessibleCsvControl
, public ScAccessibleCsvGridImpl
330 typedef ::com::sun::star::uno::Reference
<
331 ::com::sun::star::accessibility::XAccessibleTable
> XAccessibleTableRef
;
334 explicit ScAccessibleCsvGrid( ScCsvGrid
& rGrid
);
335 virtual ~ScAccessibleCsvGrid();
337 // XAccessibleComponent ---------------------------------------------------
339 /** Returns the cell at the specified point. */
340 virtual XAccessibleRef SAL_CALL
getAccessibleAtPoint( const AwtPoint
& rPoint
)
341 throw( ::com::sun::star::uno::RuntimeException
);
343 virtual sal_Int32 SAL_CALL
getForeground( )
344 throw (::com::sun::star::uno::RuntimeException
);
346 virtual sal_Int32 SAL_CALL
getBackground( )
347 throw (::com::sun::star::uno::RuntimeException
);
349 // XAccessibleContext -----------------------------------------------------
351 /** Returns the child count (count of cells in the table). */
352 virtual sal_Int32 SAL_CALL
getAccessibleChildCount()
353 throw( ::com::sun::star::uno::RuntimeException
);
355 /** Returns the specified child cell. */
356 virtual XAccessibleRef SAL_CALL
getAccessibleChild( sal_Int32 nIndex
)
357 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
359 /** Returns the relation to the ruler control. */
360 virtual XAccessibleRelationSetRef SAL_CALL
getAccessibleRelationSet()
361 throw( ::com::sun::star::uno::RuntimeException
);
363 /** Returns the current set of states. */
364 virtual XAccessibleStateSetRef SAL_CALL
getAccessibleStateSet()
365 throw( ::com::sun::star::uno::RuntimeException
);
367 // XAccessibleTable -------------------------------------------------------
369 /** Returns the number of rows in the table. */
370 virtual sal_Int32 SAL_CALL
getAccessibleRowCount()
371 throw( ::com::sun::star::uno::RuntimeException
);
373 /** Returns the number of columns in the table. */
374 virtual sal_Int32 SAL_CALL
getAccessibleColumnCount()
375 throw( ::com::sun::star::uno::RuntimeException
);
377 /** Returns the description of the specified row in the table. */
378 virtual ::rtl::OUString SAL_CALL
getAccessibleRowDescription( sal_Int32 nRow
)
379 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
381 /** Returns the description text of the specified column in the table. */
382 virtual ::rtl::OUString SAL_CALL
getAccessibleColumnDescription( sal_Int32 nColumn
)
383 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
385 /** Returns the number of rows occupied at a specified row and column.
386 @descr Returns always 1 (Merged cells not supported). */
387 virtual sal_Int32 SAL_CALL
getAccessibleRowExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
)
388 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
390 /** Returns the number of rows occupied at a specified row and column.
391 @descr Returns always 1 (Merged cells not supported). */
392 virtual sal_Int32 SAL_CALL
getAccessibleColumnExtentAt( sal_Int32 nRow
, sal_Int32 nColumn
)
393 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
395 /** Returns the row headers as an AccessibleTable. */
396 virtual XAccessibleTableRef SAL_CALL
getAccessibleRowHeaders()
397 throw( ::com::sun::star::uno::RuntimeException
);
399 /** Returns the column headers as an AccessibleTable. */
400 virtual XAccessibleTableRef SAL_CALL
getAccessibleColumnHeaders()
401 throw( ::com::sun::star::uno::RuntimeException
);
403 /** Returns the selected rows as a sequence. */
404 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
getSelectedAccessibleRows()
405 throw( ::com::sun::star::uno::RuntimeException
);
407 /** Returns the selected columns as a sequence. */
408 virtual ::com::sun::star::uno::Sequence
< sal_Int32
> SAL_CALL
getSelectedAccessibleColumns()
409 throw( ::com::sun::star::uno::RuntimeException
);
411 /** Returns true, if the specified row is selected. */
412 virtual sal_Bool SAL_CALL
isAccessibleRowSelected( sal_Int32 nRow
)
413 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
415 /** Returns true, if the specified column is selected. */
416 virtual sal_Bool SAL_CALL
isAccessibleColumnSelected( sal_Int32 nColumn
)
417 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
419 /** Returns the accessible cell object at the specified position. */
420 virtual XAccessibleRef SAL_CALL
getAccessibleCellAt( sal_Int32 nRow
, sal_Int32 nColumn
)
421 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
423 /** Returns the caption object of the table. */
424 virtual XAccessibleRef SAL_CALL
getAccessibleCaption()
425 throw( ::com::sun::star::uno::RuntimeException
);
427 /** Returns the summary description object of the table. */
428 virtual XAccessibleRef SAL_CALL
getAccessibleSummary()
429 throw( ::com::sun::star::uno::RuntimeException
);
431 /** Returns true, if the cell at a specified position is selected. */
432 virtual sal_Bool SAL_CALL
isAccessibleSelected( sal_Int32 nRow
, sal_Int32 nColumn
)
433 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
435 /** Returns the child index of the cell at the specified position. */
436 virtual sal_Int32 SAL_CALL
getAccessibleIndex( sal_Int32 nRow
, sal_Int32 nColumn
)
437 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
439 /** Returns the row index of the specified child. */
440 virtual sal_Int32 SAL_CALL
getAccessibleRow( sal_Int32 nChildIndex
)
441 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
443 /** Returns the column index of the specified child. */
444 virtual sal_Int32 SAL_CALL
getAccessibleColumn( sal_Int32 nChildIndex
)
445 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
447 // XAccessibleSelection ---------------------------------------------------
449 /** Selects the specified child (selects the entire column or the entire table). */
450 virtual void SAL_CALL
selectAccessibleChild( sal_Int32 nChildIndex
)
451 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
453 /** Returns true, if the specified child is selected. */
454 virtual sal_Bool SAL_CALL
isAccessibleChildSelected( sal_Int32 nChildIndex
)
455 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
457 /** Deselects all cells. */
458 virtual void SAL_CALL
clearAccessibleSelection()
459 throw( ::com::sun::star::uno::RuntimeException
);
461 /** Selects all cells. */
462 virtual void SAL_CALL
selectAllAccessibleChildren()
463 throw( ::com::sun::star::uno::RuntimeException
);
465 /** Returns the count of selected children. */
466 virtual sal_Int32 SAL_CALL
getSelectedAccessibleChildCount()
467 throw( ::com::sun::star::uno::RuntimeException
);
469 /** Returns the child with the specified index in all selected children. */
470 virtual XAccessibleRef SAL_CALL
getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
)
471 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
473 /** Deselects the child with the specified index in all selected children. */
474 virtual void SAL_CALL
deselectAccessibleChild( sal_Int32 nSelectedChildIndex
)
475 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
477 // XInterface -------------------------------------------------------------
479 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
480 throw( ::com::sun::star::uno::RuntimeException
);
482 virtual void SAL_CALL
acquire() throw();
484 virtual void SAL_CALL
release() throw();
486 // XServiceInfo -----------------------------------------------------------
488 /** Returns an identifier for the implementation of this object. */
489 virtual ::rtl::OUString SAL_CALL
getImplementationName()
490 throw( ::com::sun::star::uno::RuntimeException
);
492 // XTypeProvider ----------------------------------------------------------
494 /** Returns a sequence with all supported interface types. */
495 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
496 throw( ::com::sun::star::uno::RuntimeException
);
498 /** Returns an implementation ID. */
499 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
500 throw( ::com::sun::star::uno::RuntimeException
);
502 // events -----------------------------------------------------------------
504 /** Sends a GetFocus or LoseFocus event to all listeners. */
505 virtual void SendFocusEvent( bool bFocused
);
506 /** Sends a table model changed event for changed cell contents to all listeners. */
507 virtual void SendTableUpdateEvent( sal_uInt32 nFirstColumn
, sal_uInt32 nLastColumn
, bool bAllRows
);
508 /** Sends a table model changed event for an inserted column to all listeners. */
509 virtual void SendInsertColumnEvent( sal_uInt32 nFirstColumn
, sal_uInt32 nLastColumn
);
510 /** Sends a table model changed event for a removed column to all listeners. */
511 virtual void SendRemoveColumnEvent( sal_uInt32 nFirstColumn
, sal_uInt32 nLastColumn
);
513 // helpers ----------------------------------------------------------------
515 /** Returns this object's name. */
516 virtual ::rtl::OUString SAL_CALL
createAccessibleName()
517 throw( ::com::sun::star::uno::RuntimeException
);
518 /** Returns this object's description. */
519 virtual ::rtl::OUString SAL_CALL
createAccessibleDescription()
520 throw( ::com::sun::star::uno::RuntimeException
);
522 /** Throws an exception, if nIndex is not a valid child index. */
523 void ensureValidIndex( sal_Int32 nIndex
) const
524 throw( ::com::sun::star::lang::IndexOutOfBoundsException
);
525 /** Throws an exception, if the specified position is invalid. */
526 void ensureValidPosition( sal_Int32 nRow
, sal_Int32 nColumn
) const
527 throw( ::com::sun::star::lang::IndexOutOfBoundsException
);
529 /** Returns the VCL grid control. Assumes a living object. */
530 ScCsvGrid
& implGetGrid() const;
532 /** Returns true, if the specified column (including header) is selected. */
533 bool implIsColumnSelected( sal_Int32 nColumn
) const;
534 /** Selects the specified column (including header). */
535 void implSelectColumn( sal_Int32 nColumn
, bool bSelect
);
537 /** Returns the count of visible rows in the table (including header). */
538 sal_Int32
implGetRowCount() const;
539 /** Returns the total column count in the table (including header). */
540 sal_Int32
implGetColumnCount() const;
541 /** Returns the count of selected columns in the table. */
542 sal_Int32
implGetSelColumnCount() const;
543 /** Returns the total cell count in the table (including header). */
544 inline sal_Int32
implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); }
546 /** Returns the row index from cell index (including header). */
547 inline sal_Int32
implGetRow( sal_Int32 nIndex
) const { return nIndex
/ implGetColumnCount(); }
548 /** Returns the column index from cell index (including header). */
549 inline sal_Int32
implGetColumn( sal_Int32 nIndex
) const { return nIndex
% implGetColumnCount(); }
550 /** Returns the absolute column index of the nSelColumn-th selected column. */
551 sal_Int32
implGetSelColumn( sal_Int32 nSelColumn
) const;
552 /** Returns the child index from cell position (including header). */
553 inline sal_Int32
implGetIndex( sal_Int32 nRow
, sal_Int32 nColumn
) const { return nRow
* implGetColumnCount() + nColumn
; }
555 /** Returns the contents of the specified cell (including header). Indexes must be valid. */
556 String
implGetCellText( sal_Int32 nRow
, sal_Int32 nColumn
) const;
557 /** Creates a new accessible object of the specified cell. Indexes must be valid. */
558 ScAccessibleCsvControl
* implCreateCellObj( sal_Int32 nRow
, sal_Int32 nColumn
) const;
562 // ============================================================================
564 /** Accessible class representing a cell of the CSV grid control. */
565 class ScAccessibleCsvCell
: public ScAccessibleCsvControl
, public accessibility::AccessibleStaticTextBase
568 typedef ::com::sun::star::uno::Sequence
<
569 ::com::sun::star::beans::PropertyValue
> PropertyValueSeq
;
570 typedef ::std::auto_ptr
< SvxEditSource
> SvxEditSourcePtr
;
573 String maCellText
; /// The text contents of this cell.
574 sal_Int32 mnLine
; /// The grid line index (core index).
575 sal_uInt32 mnColumn
; /// The grid column index (core index).
576 sal_Int32 mnIndex
; /// The index of the cell in the table.
579 explicit ScAccessibleCsvCell(
581 const String
& rCellText
,
582 sal_Int32 nRow
, sal_Int32 nColumn
);
583 virtual ~ScAccessibleCsvCell();
585 using ScAccessibleCsvControl::disposing
;
586 virtual void SAL_CALL
disposing();
588 // XAccessibleComponent ---------------------------------------------------
590 /** Sets the focus to the column of this cell. */
591 virtual void SAL_CALL
grabFocus() throw( ::com::sun::star::uno::RuntimeException
);
593 virtual sal_Int32 SAL_CALL
getForeground( )
594 throw (::com::sun::star::uno::RuntimeException
);
596 virtual sal_Int32 SAL_CALL
getBackground( )
597 throw (::com::sun::star::uno::RuntimeException
);
599 // XAccessibleContext -----------------------------------------------------
601 /** Returns the child count. */
602 virtual sal_Int32 SAL_CALL
getAccessibleChildCount()
603 throw( ::com::sun::star::uno::RuntimeException
);
605 /** Returns the specified child. */
606 virtual XAccessibleRef SAL_CALL
getAccessibleChild( sal_Int32 nIndex
)
607 throw( ::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
);
609 /** Returns the index of this cell in the table. */
610 virtual sal_Int32 SAL_CALL
getAccessibleIndexInParent()
611 throw( ::com::sun::star::uno::RuntimeException
);
613 /** Returns the relation to the ruler control. */
614 virtual XAccessibleRelationSetRef SAL_CALL
getAccessibleRelationSet()
615 throw( ::com::sun::star::uno::RuntimeException
);
617 /** Returns the current set of states. */
618 virtual XAccessibleStateSetRef SAL_CALL
getAccessibleStateSet()
619 throw( ::com::sun::star::uno::RuntimeException
);
621 // XInterface -------------------------------------------------------------
625 // XTypeProvider ----------------------------------------------------------
627 DECLARE_XTYPEPROVIDER()
629 // XServiceInfo -----------------------------------------------------------
631 /** Returns an identifier for the implementation of this object. */
632 virtual ::rtl::OUString SAL_CALL
getImplementationName()
633 throw( ::com::sun::star::uno::RuntimeException
);
635 // helpers ----------------------------------------------------------------
637 /** Returns this object's current bounding box relative to the desktop. */
638 virtual Rectangle
GetBoundingBoxOnScreen() const throw( ::com::sun::star::uno::RuntimeException
);
639 /** Returns this object's current bounding box relative to the parent object. */
640 virtual Rectangle
GetBoundingBox() const throw( ::com::sun::star::uno::RuntimeException
);
643 /** Returns this object's name. */
644 virtual ::rtl::OUString SAL_CALL
createAccessibleName()
645 throw( ::com::sun::star::uno::RuntimeException
);
646 /** Returns this object's description. */
647 virtual ::rtl::OUString SAL_CALL
createAccessibleDescription()
648 throw( ::com::sun::star::uno::RuntimeException
);
650 /** Returns the VCL grid control. Assumes a living object. */
651 ScCsvGrid
& implGetGrid() const;
652 /** Returns the pixel position of the cell (rel. to parent), regardless of visibility. */
653 Point
implGetRealPos() const;
654 /** Returns the width of the character count */
655 sal_uInt32
implCalcPixelWidth(sal_uInt32 nChars
) const;
656 /** Returns the pixel size of the cell, regardless of visibility. */
657 Size
implGetRealSize() const;
658 /** Returns the bounding box of the cell relative in the table. */
659 Rectangle
implGetBoundingBox() const;
661 /** Creates the edit source the text helper needs. */
662 ::std::auto_ptr
< SvxEditSource
> implCreateEditSource();
666 // ============================================================================