Update ooo320-m1
[ooovba.git] / sc / source / ui / inc / AccessibleSpreadsheet.hxx
blobce4d1925b925ac4f5e794c7c1deb7a2492e7dc56
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleSpreadsheet.hxx,v $
10 * $Revision: 1.30 $
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 #ifndef _SC_ACCESSIBLESPREADSHEET_HXX
33 #define _SC_ACCESSIBLESPREADSHEET_HXX
35 #include "AccessibleTableBase.hxx"
36 #include "viewdata.hxx"
38 #include <vector>
40 class ScMyAddress : public ScAddress
42 public:
43 ScMyAddress() : ScAddress() {}
44 ScMyAddress(SCCOL nColP, SCROW nRowP, SCTAB nTabP) : ScAddress(nColP, nRowP, nTabP) {}
45 ScMyAddress(const ScAddress& rAddress) : ScAddress(rAddress) {}
47 sal_Bool operator< ( const ScMyAddress& rAddress ) const
49 if( Row() != rAddress.Row() )
50 return (Row() < rAddress.Row());
51 else
52 return (Col() < rAddress.Col());
56 class ScTabViewShell;
57 class ScAccessibleDocument;
58 class ScAccessibleCell;
60 /** @descr
61 This base class provides an implementation of the
62 <code>AccessibleTable</code> service.
64 class ScAccessibleSpreadsheet
65 : public ScAccessibleTableBase
67 public:
68 //===== internal ========================================================
69 ScAccessibleSpreadsheet(
70 ScAccessibleDocument* pAccDoc,
71 ScTabViewShell* pViewShell,
72 SCTAB nTab,
73 ScSplitPos eSplitPos);
74 protected:
75 ScAccessibleSpreadsheet(
76 ScAccessibleSpreadsheet& rParent,
77 const ScRange& rRange );
79 virtual ~ScAccessibleSpreadsheet();
81 void ConstructScAccessibleSpreadsheet(
82 ScAccessibleDocument* pAccDoc,
83 ScTabViewShell* pViewShell,
84 SCTAB nTab,
85 ScSplitPos eSplitPos);
87 using ScAccessibleTableBase::IsDefunc;
89 public:
90 using ScAccessibleTableBase::addEventListener;
91 using ScAccessibleTableBase::disposing;
93 virtual void SAL_CALL disposing();
95 void CompleteSelectionChanged(sal_Bool bNewState);
97 virtual void LostFocus();
99 virtual void GotFocus();
101 void BoundingBoxChanged();
103 void VisAreaChanged();
105 ///===== SfxListener =====================================================
107 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
109 ///===== XAccessibleTable ================================================
111 /// Returns the row headers as an AccessibleTable.
112 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
113 getAccessibleRowHeaders( )
114 throw (::com::sun::star::uno::RuntimeException);
116 /// Returns the column headers as an AccessibleTable.
117 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
118 getAccessibleColumnHeaders( )
119 throw (::com::sun::star::uno::RuntimeException);
121 /// Returns the selected rows in a table.
122 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
123 getSelectedAccessibleRows( )
124 throw (::com::sun::star::uno::RuntimeException);
126 /// Returns the selected columns in a table.
127 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
128 getSelectedAccessibleColumns( )
129 throw (::com::sun::star::uno::RuntimeException);
131 /// Returns a boolean value indicating whether the specified row is selected.
132 virtual sal_Bool SAL_CALL
133 isAccessibleRowSelected( sal_Int32 nRow )
134 throw (::com::sun::star::uno::RuntimeException,
135 ::com::sun::star::lang::IndexOutOfBoundsException);
137 /// Returns a boolean value indicating whether the specified column is selected.
138 virtual sal_Bool SAL_CALL
139 isAccessibleColumnSelected( sal_Int32 nColumn )
140 throw (::com::sun::star::uno::RuntimeException,
141 ::com::sun::star::lang::IndexOutOfBoundsException);
143 /// Returns the Accessible at a specified row and column in the table.
144 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
145 getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
146 throw (::com::sun::star::uno::RuntimeException,
147 ::com::sun::star::lang::IndexOutOfBoundsException);
149 ScAccessibleCell* GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn);
151 /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
152 virtual sal_Bool SAL_CALL
153 isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
154 throw (::com::sun::star::uno::RuntimeException,
155 ::com::sun::star::lang::IndexOutOfBoundsException);
157 ///===== XAccessibleComponent ============================================
159 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
160 SAL_CALL getAccessibleAtPoint(
161 const ::com::sun::star::awt::Point& rPoint )
162 throw (::com::sun::star::uno::RuntimeException);
164 virtual void SAL_CALL grabFocus( )
165 throw (::com::sun::star::uno::RuntimeException);
167 virtual sal_Int32 SAL_CALL getForeground( )
168 throw (::com::sun::star::uno::RuntimeException);
170 virtual sal_Int32 SAL_CALL getBackground( )
171 throw (::com::sun::star::uno::RuntimeException);
173 ///===== XAccessibleContext ==============================================
175 /// Return NULL to indicate that an empty relation set.
176 virtual ::com::sun::star::uno::Reference<
177 ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
178 getAccessibleRelationSet(void)
179 throw (::com::sun::star::uno::RuntimeException);
181 /// Return the set of current states.
182 virtual ::com::sun::star::uno::Reference<
183 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
184 getAccessibleStateSet(void)
185 throw (::com::sun::star::uno::RuntimeException);
187 ///===== XAccessibleSelection ===========================================
189 virtual void SAL_CALL
190 selectAccessibleChild( sal_Int32 nChildIndex )
191 throw (::com::sun::star::lang::IndexOutOfBoundsException,
192 ::com::sun::star::uno::RuntimeException);
194 virtual void SAL_CALL
195 clearAccessibleSelection( )
196 throw (::com::sun::star::uno::RuntimeException);
198 virtual void SAL_CALL
199 selectAllAccessibleChildren( )
200 throw (::com::sun::star::uno::RuntimeException);
202 virtual sal_Int32 SAL_CALL
203 getSelectedAccessibleChildCount( )
204 throw (::com::sun::star::uno::RuntimeException);
206 virtual ::com::sun::star::uno::Reference<
207 ::com::sun::star::accessibility::XAccessible > SAL_CALL
208 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
209 throw (::com::sun::star::lang::IndexOutOfBoundsException,
210 ::com::sun::star::uno::RuntimeException);
212 virtual void SAL_CALL
213 deselectAccessibleChild( sal_Int32 nChildIndex )
214 throw (::com::sun::star::lang::IndexOutOfBoundsException,
215 ::com::sun::star::uno::RuntimeException);
217 ///===== XServiceInfo ====================================================
219 /** Returns an identifier for the implementation of this object.
221 virtual ::rtl::OUString SAL_CALL
222 getImplementationName(void)
223 throw (::com::sun::star::uno::RuntimeException);
225 /** Returns a list of all supported services.
227 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
228 getSupportedServiceNames(void)
229 throw (::com::sun::star::uno::RuntimeException);
231 ///===== XTypeProvider ===================================================
233 /** Returns a implementation id.
235 virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
236 getImplementationId(void)
237 throw (::com::sun::star::uno::RuntimeException);
239 ///===== XAccessibleEventBroadcaster =====================================
241 /** Add listener that is informed of future changes of name,
242 description and so on events.
244 virtual void SAL_CALL
245 addEventListener(
246 const ::com::sun::star::uno::Reference<
247 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
248 throw (com::sun::star::uno::RuntimeException);
250 protected:
251 /// Return the object's current bounding box relative to the desktop.
252 virtual Rectangle GetBoundingBoxOnScreen(void) const
253 throw (::com::sun::star::uno::RuntimeException);
255 /// Return the object's current bounding box relative to the parent object.
256 virtual Rectangle GetBoundingBox(void) const
257 throw (::com::sun::star::uno::RuntimeException);
258 private:
259 ScTabViewShell* mpViewShell;
260 ScRangeList* mpMarkedRanges;
261 std::vector<ScMyAddress>* mpSortedMarkedCells;
262 ScAccessibleDocument* mpAccDoc;
263 ScAccessibleCell* mpAccCell;
264 Rectangle maVisCells;
265 ScSplitPos meSplitPos;
266 ScAddress maActiveCell;
267 SCTAB mnTab;
268 sal_Bool mbIsSpreadsheet;
269 sal_Bool mbHasSelection;
270 sal_Bool mbDelIns;
271 sal_Bool mbIsFocusSend;
273 sal_Bool IsDefunc(
274 const com::sun::star::uno::Reference<
275 ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
276 sal_Bool IsEditable(
277 const com::sun::star::uno::Reference<
278 ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
279 sal_Bool IsFocused();
280 sal_Bool IsCompleteSheetSelected();
282 void SelectCell(sal_Int32 nRow, sal_Int32 nCol, sal_Bool bDeselect);
283 void CreateSortedMarkedCells();
284 void AddMarkedRange(const ScRange& rRange);
286 ScDocument* GetDocument(ScTabViewShell* pViewShell);
287 Rectangle GetVisArea(ScTabViewShell* pViewShell, ScSplitPos eSplitPos);
288 Rectangle GetVisCells(const Rectangle& rVisArea);
292 #endif