Line data Source code
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 :
21 : #ifndef _SC_ACCESSIBLESPREADSHEET_HXX
22 : #define _SC_ACCESSIBLESPREADSHEET_HXX
23 :
24 : #include "AccessibleTableBase.hxx"
25 : #include "viewdata.hxx"
26 :
27 : #include <vector>
28 :
29 0 : class ScMyAddress : public ScAddress
30 : {
31 : public:
32 : ScMyAddress() : ScAddress() {}
33 0 : ScMyAddress(SCCOL nColP, SCROW nRowP, SCTAB nTabP) : ScAddress(nColP, nRowP, nTabP) {}
34 : ScMyAddress(const ScAddress& rAddress) : ScAddress(rAddress) {}
35 :
36 0 : sal_Bool operator< ( const ScMyAddress& rAddress ) const
37 : {
38 0 : if( Row() != rAddress.Row() )
39 0 : return (Row() < rAddress.Row());
40 : else
41 0 : return (Col() < rAddress.Col());
42 : }
43 : };
44 :
45 : class ScTabViewShell;
46 : class ScAccessibleDocument;
47 : class ScAccessibleCell;
48 : class ScRangeList;
49 :
50 : /** @descr
51 : This base class provides an implementation of the
52 : <code>AccessibleTable</code> service.
53 : */
54 : class ScAccessibleSpreadsheet
55 : : public ScAccessibleTableBase
56 : {
57 : public:
58 : //===== internal ========================================================
59 : ScAccessibleSpreadsheet(
60 : ScAccessibleDocument* pAccDoc,
61 : ScTabViewShell* pViewShell,
62 : SCTAB nTab,
63 : ScSplitPos eSplitPos);
64 : protected:
65 : ScAccessibleSpreadsheet(
66 : ScAccessibleSpreadsheet& rParent,
67 : const ScRange& rRange );
68 :
69 : virtual ~ScAccessibleSpreadsheet();
70 :
71 : void ConstructScAccessibleSpreadsheet(
72 : ScAccessibleDocument* pAccDoc,
73 : ScTabViewShell* pViewShell,
74 : SCTAB nTab,
75 : ScSplitPos eSplitPos);
76 :
77 : using ScAccessibleTableBase::IsDefunc;
78 :
79 : public:
80 : using ScAccessibleTableBase::disposing;
81 :
82 : virtual void SAL_CALL disposing();
83 :
84 : void CompleteSelectionChanged(sal_Bool bNewState);
85 :
86 : virtual void LostFocus();
87 : virtual void GotFocus();
88 :
89 : void BoundingBoxChanged();
90 : void VisAreaChanged();
91 :
92 : ///===== SfxListener =====================================================
93 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
94 :
95 : ///===== XAccessibleTable ================================================
96 :
97 : /// Returns the row headers as an AccessibleTable.
98 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
99 : getAccessibleRowHeaders( )
100 : throw (::com::sun::star::uno::RuntimeException);
101 :
102 : /// Returns the column headers as an AccessibleTable.
103 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
104 : getAccessibleColumnHeaders( )
105 : throw (::com::sun::star::uno::RuntimeException);
106 :
107 : /// Returns the selected rows in a table.
108 : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
109 : getSelectedAccessibleRows( )
110 : throw (::com::sun::star::uno::RuntimeException);
111 :
112 : /// Returns the selected columns in a table.
113 : virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
114 : getSelectedAccessibleColumns( )
115 : throw (::com::sun::star::uno::RuntimeException);
116 :
117 : /// Returns a boolean value indicating whether the specified row is selected.
118 : virtual sal_Bool SAL_CALL
119 : isAccessibleRowSelected( sal_Int32 nRow )
120 : throw (::com::sun::star::uno::RuntimeException,
121 : ::com::sun::star::lang::IndexOutOfBoundsException);
122 :
123 : /// Returns a boolean value indicating whether the specified column is selected.
124 : virtual sal_Bool SAL_CALL
125 : isAccessibleColumnSelected( sal_Int32 nColumn )
126 : throw (::com::sun::star::uno::RuntimeException,
127 : ::com::sun::star::lang::IndexOutOfBoundsException);
128 :
129 : /// Returns the Accessible at a specified row and column in the table.
130 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
131 : getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
132 : throw (::com::sun::star::uno::RuntimeException,
133 : ::com::sun::star::lang::IndexOutOfBoundsException);
134 :
135 : ScAccessibleCell* GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn);
136 :
137 : /// Returns a boolean value indicating whether the accessible at a specified row and column is selected.
138 : virtual sal_Bool SAL_CALL
139 : isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
140 : throw (::com::sun::star::uno::RuntimeException,
141 : ::com::sun::star::lang::IndexOutOfBoundsException);
142 :
143 : ///===== XAccessibleComponent ============================================
144 :
145 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
146 : SAL_CALL getAccessibleAtPoint(
147 : const ::com::sun::star::awt::Point& rPoint )
148 : throw (::com::sun::star::uno::RuntimeException);
149 :
150 : virtual void SAL_CALL grabFocus( )
151 : throw (::com::sun::star::uno::RuntimeException);
152 :
153 : virtual sal_Int32 SAL_CALL getForeground( )
154 : throw (::com::sun::star::uno::RuntimeException);
155 :
156 : virtual sal_Int32 SAL_CALL getBackground( )
157 : throw (::com::sun::star::uno::RuntimeException);
158 :
159 : ///===== XAccessibleContext ==============================================
160 :
161 : /// Return NULL to indicate that an empty relation set.
162 : virtual ::com::sun::star::uno::Reference<
163 : ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
164 : getAccessibleRelationSet(void)
165 : throw (::com::sun::star::uno::RuntimeException);
166 :
167 : /// Return the set of current states.
168 : virtual ::com::sun::star::uno::Reference<
169 : ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
170 : getAccessibleStateSet(void)
171 : throw (::com::sun::star::uno::RuntimeException);
172 :
173 : ///===== XAccessibleSelection ===========================================
174 :
175 : virtual void SAL_CALL
176 : selectAccessibleChild( sal_Int32 nChildIndex )
177 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
178 : ::com::sun::star::uno::RuntimeException);
179 :
180 : virtual void SAL_CALL
181 : clearAccessibleSelection( )
182 : throw (::com::sun::star::uno::RuntimeException);
183 :
184 : virtual void SAL_CALL
185 : selectAllAccessibleChildren( )
186 : throw (::com::sun::star::uno::RuntimeException);
187 :
188 : virtual sal_Int32 SAL_CALL
189 : getSelectedAccessibleChildCount( )
190 : throw (::com::sun::star::uno::RuntimeException);
191 :
192 : virtual ::com::sun::star::uno::Reference<
193 : ::com::sun::star::accessibility::XAccessible > SAL_CALL
194 : getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
195 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
196 : ::com::sun::star::uno::RuntimeException);
197 :
198 : virtual void SAL_CALL
199 : deselectAccessibleChild( sal_Int32 nChildIndex )
200 : throw (::com::sun::star::lang::IndexOutOfBoundsException,
201 : ::com::sun::star::uno::RuntimeException);
202 :
203 : ///===== XServiceInfo ====================================================
204 :
205 : /** Returns an identifier for the implementation of this object.
206 : */
207 : virtual ::rtl::OUString SAL_CALL
208 : getImplementationName(void)
209 : throw (::com::sun::star::uno::RuntimeException);
210 :
211 : /** Returns a list of all supported services.
212 : */
213 : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
214 : getSupportedServiceNames(void)
215 : throw (::com::sun::star::uno::RuntimeException);
216 :
217 : ///===== XTypeProvider ===================================================
218 :
219 : /** Returns a implementation id.
220 : */
221 : virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
222 : getImplementationId(void)
223 : throw (::com::sun::star::uno::RuntimeException);
224 :
225 : ///===== XAccessibleEventBroadcaster =====================================
226 :
227 : /** Add listener that is informed of future changes of name,
228 : description and so on events.
229 : */
230 : virtual void SAL_CALL
231 : addAccessibleEventListener(
232 : const ::com::sun::star::uno::Reference<
233 : ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
234 : throw (com::sun::star::uno::RuntimeException);
235 :
236 : protected:
237 : /// Return the object's current bounding box relative to the desktop.
238 : virtual Rectangle GetBoundingBoxOnScreen(void) const
239 : throw (::com::sun::star::uno::RuntimeException);
240 :
241 : /// Return the object's current bounding box relative to the parent object.
242 : virtual Rectangle GetBoundingBox(void) const
243 : throw (::com::sun::star::uno::RuntimeException);
244 : private:
245 : ScTabViewShell* mpViewShell;
246 : ScRangeList* mpMarkedRanges;
247 : std::vector<ScMyAddress>* mpSortedMarkedCells;
248 : ScAccessibleDocument* mpAccDoc;
249 : ScAccessibleCell* mpAccCell;
250 : Rectangle maVisCells;
251 : ScSplitPos meSplitPos;
252 : ScAddress maActiveCell;
253 : SCTAB mnTab;
254 : sal_Bool mbIsSpreadsheet;
255 : sal_Bool mbHasSelection;
256 : sal_Bool mbDelIns;
257 : sal_Bool mbIsFocusSend;
258 :
259 : sal_Bool IsDefunc(
260 : const com::sun::star::uno::Reference<
261 : ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
262 : sal_Bool IsEditable(
263 : const com::sun::star::uno::Reference<
264 : ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
265 : sal_Bool IsFocused();
266 : sal_Bool IsCompleteSheetSelected();
267 :
268 : void SelectCell(sal_Int32 nRow, sal_Int32 nCol, sal_Bool bDeselect);
269 : void CreateSortedMarkedCells();
270 : void AddMarkedRange(const ScRange& rRange);
271 :
272 : ScDocument* GetDocument(ScTabViewShell* pViewShell);
273 : Rectangle GetVisArea(ScTabViewShell* pViewShell, ScSplitPos eSplitPos);
274 : Rectangle GetVisCells(const Rectangle& rVisArea);
275 : };
276 :
277 : #endif
278 :
279 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|