Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #ifndef _SC_ACCESSIBLESPREADSHEET_HXX
31 : : #define _SC_ACCESSIBLESPREADSHEET_HXX
32 : :
33 : : #include "AccessibleTableBase.hxx"
34 : : #include "viewdata.hxx"
35 : :
36 : : #include <vector>
37 : :
38 : 0 : class ScMyAddress : public ScAddress
39 : : {
40 : : public:
41 : : ScMyAddress() : ScAddress() {}
42 : 0 : ScMyAddress(SCCOL nColP, SCROW nRowP, SCTAB nTabP) : ScAddress(nColP, nRowP, nTabP) {}
43 : : ScMyAddress(const ScAddress& rAddress) : ScAddress(rAddress) {}
44 : :
45 : 0 : sal_Bool operator< ( const ScMyAddress& rAddress ) const
46 : : {
47 [ # # ]: 0 : if( Row() != rAddress.Row() )
48 : 0 : return (Row() < rAddress.Row());
49 : : else
50 : 0 : return (Col() < rAddress.Col());
51 : : }
52 : : };
53 : :
54 : : class ScTabViewShell;
55 : : class ScAccessibleDocument;
56 : : class ScAccessibleCell;
57 : : class ScRangeList;
58 : :
59 : : /** @descr
60 : : This base class provides an implementation of the
61 : : <code>AccessibleTable</code> service.
62 : : */
63 : : class ScAccessibleSpreadsheet
64 : : : public ScAccessibleTableBase
65 : : {
66 : : public:
67 : : //===== internal ========================================================
68 : : ScAccessibleSpreadsheet(
69 : : ScAccessibleDocument* pAccDoc,
70 : : ScTabViewShell* pViewShell,
71 : : SCTAB nTab,
72 : : ScSplitPos eSplitPos);
73 : : protected:
74 : : ScAccessibleSpreadsheet(
75 : : ScAccessibleSpreadsheet& rParent,
76 : : const ScRange& rRange );
77 : :
78 : : virtual ~ScAccessibleSpreadsheet();
79 : :
80 : : void ConstructScAccessibleSpreadsheet(
81 : : ScAccessibleDocument* pAccDoc,
82 : : ScTabViewShell* pViewShell,
83 : : SCTAB nTab,
84 : : ScSplitPos eSplitPos);
85 : :
86 : : using ScAccessibleTableBase::IsDefunc;
87 : :
88 : : public:
89 : : using ScAccessibleTableBase::addEventListener;
90 : : using ScAccessibleTableBase::disposing;
91 : :
92 : : virtual void SAL_CALL disposing();
93 : :
94 : : void CompleteSelectionChanged(sal_Bool bNewState);
95 : :
96 : : virtual void LostFocus();
97 : : virtual void GotFocus();
98 : :
99 : : void BoundingBoxChanged();
100 : : void VisAreaChanged();
101 : :
102 : : ///===== SfxListener =====================================================
103 : : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
104 : :
105 : : ///===== XAccessibleTable ================================================
106 : :
107 : : /// Returns the row headers as an AccessibleTable.
108 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
109 : : getAccessibleRowHeaders( )
110 : : throw (::com::sun::star::uno::RuntimeException);
111 : :
112 : : /// Returns the column headers as an AccessibleTable.
113 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
114 : : getAccessibleColumnHeaders( )
115 : : throw (::com::sun::star::uno::RuntimeException);
116 : :
117 : : /// Returns the selected rows in a table.
118 : : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
119 : : getSelectedAccessibleRows( )
120 : : throw (::com::sun::star::uno::RuntimeException);
121 : :
122 : : /// Returns the selected columns in a table.
123 : : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
124 : : getSelectedAccessibleColumns( )
125 : : throw (::com::sun::star::uno::RuntimeException);
126 : :
127 : : /// Returns a boolean value indicating whether the specified row is selected.
128 : : virtual sal_Bool SAL_CALL
129 : : isAccessibleRowSelected( sal_Int32 nRow )
130 : : throw (::com::sun::star::uno::RuntimeException,
131 : : ::com::sun::star::lang::IndexOutOfBoundsException);
132 : :
133 : : /// Returns a boolean value indicating whether the specified column is selected.
134 : : virtual sal_Bool SAL_CALL
135 : : isAccessibleColumnSelected( sal_Int32 nColumn )
136 : : throw (::com::sun::star::uno::RuntimeException,
137 : : ::com::sun::star::lang::IndexOutOfBoundsException);
138 : :
139 : : /// Returns the Accessible at a specified row and column in the table.
140 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
141 : : getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
142 : : throw (::com::sun::star::uno::RuntimeException,
143 : : ::com::sun::star::lang::IndexOutOfBoundsException);
144 : :
145 : : ScAccessibleCell* GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn);
146 : :
147 : : /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
148 : : virtual sal_Bool SAL_CALL
149 : : isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
150 : : throw (::com::sun::star::uno::RuntimeException,
151 : : ::com::sun::star::lang::IndexOutOfBoundsException);
152 : :
153 : : ///===== XAccessibleComponent ============================================
154 : :
155 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
156 : : SAL_CALL getAccessibleAtPoint(
157 : : const ::com::sun::star::awt::Point& rPoint )
158 : : throw (::com::sun::star::uno::RuntimeException);
159 : :
160 : : virtual void SAL_CALL grabFocus( )
161 : : throw (::com::sun::star::uno::RuntimeException);
162 : :
163 : : virtual sal_Int32 SAL_CALL getForeground( )
164 : : throw (::com::sun::star::uno::RuntimeException);
165 : :
166 : : virtual sal_Int32 SAL_CALL getBackground( )
167 : : throw (::com::sun::star::uno::RuntimeException);
168 : :
169 : : ///===== XAccessibleContext ==============================================
170 : :
171 : : /// Return NULL to indicate that an empty relation set.
172 : : virtual ::com::sun::star::uno::Reference<
173 : : ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
174 : : getAccessibleRelationSet(void)
175 : : throw (::com::sun::star::uno::RuntimeException);
176 : :
177 : : /// Return the set of current states.
178 : : virtual ::com::sun::star::uno::Reference<
179 : : ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
180 : : getAccessibleStateSet(void)
181 : : throw (::com::sun::star::uno::RuntimeException);
182 : :
183 : : ///===== XAccessibleSelection ===========================================
184 : :
185 : : virtual void SAL_CALL
186 : : selectAccessibleChild( sal_Int32 nChildIndex )
187 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
188 : : ::com::sun::star::uno::RuntimeException);
189 : :
190 : : virtual void SAL_CALL
191 : : clearAccessibleSelection( )
192 : : throw (::com::sun::star::uno::RuntimeException);
193 : :
194 : : virtual void SAL_CALL
195 : : selectAllAccessibleChildren( )
196 : : throw (::com::sun::star::uno::RuntimeException);
197 : :
198 : : virtual sal_Int32 SAL_CALL
199 : : getSelectedAccessibleChildCount( )
200 : : throw (::com::sun::star::uno::RuntimeException);
201 : :
202 : : virtual ::com::sun::star::uno::Reference<
203 : : ::com::sun::star::accessibility::XAccessible > SAL_CALL
204 : : getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
205 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
206 : : ::com::sun::star::uno::RuntimeException);
207 : :
208 : : virtual void SAL_CALL
209 : : deselectAccessibleChild( sal_Int32 nChildIndex )
210 : : throw (::com::sun::star::lang::IndexOutOfBoundsException,
211 : : ::com::sun::star::uno::RuntimeException);
212 : :
213 : : ///===== XServiceInfo ====================================================
214 : :
215 : : /** Returns an identifier for the implementation of this object.
216 : : */
217 : : virtual ::rtl::OUString SAL_CALL
218 : : getImplementationName(void)
219 : : throw (::com::sun::star::uno::RuntimeException);
220 : :
221 : : /** Returns a list of all supported services.
222 : : */
223 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
224 : : getSupportedServiceNames(void)
225 : : throw (::com::sun::star::uno::RuntimeException);
226 : :
227 : : ///===== XTypeProvider ===================================================
228 : :
229 : : /** Returns a implementation id.
230 : : */
231 : : virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
232 : : getImplementationId(void)
233 : : throw (::com::sun::star::uno::RuntimeException);
234 : :
235 : : ///===== XAccessibleEventBroadcaster =====================================
236 : :
237 : : /** Add listener that is informed of future changes of name,
238 : : description and so on events.
239 : : */
240 : : virtual void SAL_CALL
241 : : addEventListener(
242 : : const ::com::sun::star::uno::Reference<
243 : : ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
244 : : throw (com::sun::star::uno::RuntimeException);
245 : :
246 : : protected:
247 : : /// Return the object's current bounding box relative to the desktop.
248 : : virtual Rectangle GetBoundingBoxOnScreen(void) const
249 : : throw (::com::sun::star::uno::RuntimeException);
250 : :
251 : : /// Return the object's current bounding box relative to the parent object.
252 : : virtual Rectangle GetBoundingBox(void) const
253 : : throw (::com::sun::star::uno::RuntimeException);
254 : : private:
255 : : ScTabViewShell* mpViewShell;
256 : : ScRangeList* mpMarkedRanges;
257 : : std::vector<ScMyAddress>* mpSortedMarkedCells;
258 : : ScAccessibleDocument* mpAccDoc;
259 : : ScAccessibleCell* mpAccCell;
260 : : Rectangle maVisCells;
261 : : ScSplitPos meSplitPos;
262 : : ScAddress maActiveCell;
263 : : SCTAB mnTab;
264 : : sal_Bool mbIsSpreadsheet;
265 : : sal_Bool mbHasSelection;
266 : : sal_Bool mbDelIns;
267 : : sal_Bool mbIsFocusSend;
268 : :
269 : : sal_Bool IsDefunc(
270 : : const com::sun::star::uno::Reference<
271 : : ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
272 : : sal_Bool IsEditable(
273 : : const com::sun::star::uno::Reference<
274 : : ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
275 : : sal_Bool IsFocused();
276 : : sal_Bool IsCompleteSheetSelected();
277 : :
278 : : void SelectCell(sal_Int32 nRow, sal_Int32 nCol, sal_Bool bDeselect);
279 : : void CreateSortedMarkedCells();
280 : : void AddMarkedRange(const ScRange& rRange);
281 : :
282 : : ScDocument* GetDocument(ScTabViewShell* pViewShell);
283 : : Rectangle GetVisArea(ScTabViewShell* pViewShell, ScSplitPos eSplitPos);
284 : : Rectangle GetVisCells(const Rectangle& rVisArea);
285 : : };
286 : :
287 : : #endif
288 : :
289 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|