Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / AccessibleSpreadsheet.hxx
blob132f7e0eb0907fa4a8b7afe21e113b6f5cd4489a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #ifndef _SC_ACCESSIBLESPREADSHEET_HXX
22 #define _SC_ACCESSIBLESPREADSHEET_HXX
24 #include "AccessibleTableBase.hxx"
25 #include "viewdata.hxx"
27 #include <vector>
29 class ScMyAddress : public ScAddress
31 public:
32 ScMyAddress() : ScAddress() {}
33 ScMyAddress(SCCOL nColP, SCROW nRowP, SCTAB nTabP) : ScAddress(nColP, nRowP, nTabP) {}
34 ScMyAddress(const ScAddress& rAddress) : ScAddress(rAddress) {}
36 sal_Bool operator< ( const ScMyAddress& rAddress ) const
38 if( Row() != rAddress.Row() )
39 return (Row() < rAddress.Row());
40 else
41 return (Col() < rAddress.Col());
45 class ScTabViewShell;
46 class ScAccessibleDocument;
47 class ScAccessibleCell;
48 class ScRangeList;
50 /** @descr
51 This base class provides an implementation of the
52 <code>AccessibleTable</code> service.
54 class ScAccessibleSpreadsheet
55 : public ScAccessibleTableBase
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 );
69 virtual ~ScAccessibleSpreadsheet();
71 void ConstructScAccessibleSpreadsheet(
72 ScAccessibleDocument* pAccDoc,
73 ScTabViewShell* pViewShell,
74 SCTAB nTab,
75 ScSplitPos eSplitPos);
77 using ScAccessibleTableBase::IsDefunc;
79 public:
80 using ScAccessibleTableBase::disposing;
82 virtual void SAL_CALL disposing();
84 void CompleteSelectionChanged(sal_Bool bNewState);
86 virtual void LostFocus();
87 virtual void GotFocus();
89 void BoundingBoxChanged();
90 void VisAreaChanged();
92 ///===== SfxListener =====================================================
93 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
95 ///===== XAccessibleTable ================================================
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);
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);
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);
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);
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);
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);
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);
135 ScAccessibleCell* GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn);
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);
143 ///===== XAccessibleComponent ============================================
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);
150 virtual void SAL_CALL grabFocus( )
151 throw (::com::sun::star::uno::RuntimeException);
153 virtual sal_Int32 SAL_CALL getForeground( )
154 throw (::com::sun::star::uno::RuntimeException);
156 virtual sal_Int32 SAL_CALL getBackground( )
157 throw (::com::sun::star::uno::RuntimeException);
159 ///===== XAccessibleContext ==============================================
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);
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);
173 ///===== XAccessibleSelection ===========================================
175 virtual void SAL_CALL
176 selectAccessibleChild( sal_Int32 nChildIndex )
177 throw (::com::sun::star::lang::IndexOutOfBoundsException,
178 ::com::sun::star::uno::RuntimeException);
180 virtual void SAL_CALL
181 clearAccessibleSelection( )
182 throw (::com::sun::star::uno::RuntimeException);
184 virtual void SAL_CALL
185 selectAllAccessibleChildren( )
186 throw (::com::sun::star::uno::RuntimeException);
188 virtual sal_Int32 SAL_CALL
189 getSelectedAccessibleChildCount( )
190 throw (::com::sun::star::uno::RuntimeException);
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);
198 virtual void SAL_CALL
199 deselectAccessibleChild( sal_Int32 nChildIndex )
200 throw (::com::sun::star::lang::IndexOutOfBoundsException,
201 ::com::sun::star::uno::RuntimeException);
203 ///===== XServiceInfo ====================================================
205 /** Returns an identifier for the implementation of this object.
207 virtual OUString SAL_CALL
208 getImplementationName(void)
209 throw (::com::sun::star::uno::RuntimeException);
211 /** Returns a list of all supported services.
213 virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
214 getSupportedServiceNames(void)
215 throw (::com::sun::star::uno::RuntimeException);
217 ///===== XTypeProvider ===================================================
219 /** Returns a implementation id.
221 virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
222 getImplementationId(void)
223 throw (::com::sun::star::uno::RuntimeException);
225 ///===== XAccessibleEventBroadcaster =====================================
227 /** Add listener that is informed of future changes of name,
228 description and so on events.
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);
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);
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;
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();
268 void SelectCell(sal_Int32 nRow, sal_Int32 nCol, sal_Bool bDeselect);
269 void CreateSortedMarkedCells();
270 void AddMarkedRange(const ScRange& rRange);
272 ScDocument* GetDocument(ScTabViewShell* pViewShell);
273 Rectangle GetVisArea(ScTabViewShell* pViewShell, ScSplitPos eSplitPos);
274 Rectangle GetVisCells(const Rectangle& rVisArea);
277 #endif
279 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */