Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / AccessibleDocument.hxx
blobb0fba0aafaf47bb4e511c20d705add6da9f8817c
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_ACCESSIBLEDOCUMENT_HXX
22 #define _SC_ACCESSIBLEDOCUMENT_HXX
24 #include "AccessibleDocumentBase.hxx"
25 #include "viewdata.hxx"
26 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
27 #include <com/sun/star/view/XSelectionChangeListener.hpp>
28 #include <cppuhelper/implbase2.hxx>
29 #include <svx/IAccessibleViewForwarder.hxx>
31 class ScTabViewShell;
32 class ScAccessibleSpreadsheet;
33 class ScChildrenShapes;
34 class ScAccessibleEditObject;
36 namespace utl
38 class AccessibleRelationSetHelper;
41 /** @descr
42 This base class provides an implementation of the
43 <code>AccessibleContext</code> service.
46 typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleSelection,
47 ::com::sun::star::view::XSelectionChangeListener >
48 ScAccessibleDocumentImpl;
50 class ScAccessibleDocument
51 : public ScAccessibleDocumentBase,
52 public ScAccessibleDocumentImpl,
53 public accessibility::IAccessibleViewForwarder
55 public:
56 //===== internal ========================================================
57 ScAccessibleDocument(
58 const ::com::sun::star::uno::Reference<
59 ::com::sun::star::accessibility::XAccessible>& rxParent,
60 ScTabViewShell* pViewShell,
61 ScSplitPos eSplitPos);
63 virtual void Init();
66 DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
67 protected:
68 virtual ~ScAccessibleDocument(void);
70 using ScAccessibleDocumentBase::IsDefunc;
72 public:
74 virtual void SAL_CALL disposing();
76 ///===== SfxListener =====================================================
78 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
80 ///===== XInterface =====================================================
82 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
83 ::com::sun::star::uno::Type const & rType )
84 throw (::com::sun::star::uno::RuntimeException);
86 virtual void SAL_CALL acquire() throw ();
88 virtual void SAL_CALL release() throw ();
90 ///===== XAccessibleComponent ============================================
92 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
93 SAL_CALL getAccessibleAtPoint(
94 const ::com::sun::star::awt::Point& rPoint )
95 throw (::com::sun::star::uno::RuntimeException);
97 virtual void SAL_CALL grabFocus( )
98 throw (::com::sun::star::uno::RuntimeException);
100 ///===== XAccessibleContext ==============================================
102 /// Return the number of currently visible children.
103 virtual sal_Int32 SAL_CALL
104 getAccessibleChildCount(void)
105 throw (::com::sun::star::uno::RuntimeException);
107 /// Return the specified child or NULL if index is invalid.
108 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
109 getAccessibleChild(sal_Int32 nIndex)
110 throw (::com::sun::star::uno::RuntimeException,
111 ::com::sun::star::lang::IndexOutOfBoundsException);
113 /// Return the set of current states.
114 virtual ::com::sun::star::uno::Reference<
115 ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
116 getAccessibleStateSet(void)
117 throw (::com::sun::star::uno::RuntimeException);
119 ///===== XAccessibleSelection ===========================================
121 virtual void SAL_CALL
122 selectAccessibleChild( sal_Int32 nChildIndex )
123 throw (::com::sun::star::lang::IndexOutOfBoundsException,
124 ::com::sun::star::uno::RuntimeException);
126 virtual sal_Bool SAL_CALL
127 isAccessibleChildSelected( sal_Int32 nChildIndex )
128 throw (::com::sun::star::lang::IndexOutOfBoundsException,
129 ::com::sun::star::uno::RuntimeException);
131 virtual void SAL_CALL
132 clearAccessibleSelection( )
133 throw (::com::sun::star::uno::RuntimeException);
135 virtual void SAL_CALL
136 selectAllAccessibleChildren( )
137 throw (::com::sun::star::uno::RuntimeException);
139 virtual sal_Int32 SAL_CALL
140 getSelectedAccessibleChildCount( )
141 throw (::com::sun::star::uno::RuntimeException);
143 virtual ::com::sun::star::uno::Reference<
144 ::com::sun::star::accessibility::XAccessible > SAL_CALL
145 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
146 throw (::com::sun::star::lang::IndexOutOfBoundsException,
147 ::com::sun::star::uno::RuntimeException);
149 virtual void SAL_CALL
150 deselectAccessibleChild( sal_Int32 nChildIndex )
151 throw (::com::sun::star::lang::IndexOutOfBoundsException,
152 ::com::sun::star::uno::RuntimeException);
154 ///===== XSelectionListener =============================================
156 virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent )
157 throw (::com::sun::star::uno::RuntimeException);
159 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
160 throw (::com::sun::star::uno::RuntimeException);
162 ///===== XServiceInfo ===================================================
164 /** Returns an identifier for the implementation of this object.
166 virtual OUString SAL_CALL
167 getImplementationName(void)
168 throw (::com::sun::star::uno::RuntimeException);
170 /** Returns a list of all supported services.
172 virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
173 getSupportedServiceNames(void)
174 throw (::com::sun::star::uno::RuntimeException);
176 ///===== XTypeProvider ===================================================
178 /// returns the possible types
179 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL
180 getTypes()
181 throw (::com::sun::star::uno::RuntimeException);
183 /** Returns a implementation id.
185 virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
186 getImplementationId(void)
187 throw (::com::sun::star::uno::RuntimeException);
189 ///===== IAccessibleViewForwarder ========================================
191 /** This method informs you about the state of the forwarder. Do not
192 use it when the returned value is <false/>.
194 @return
195 Return <true/> if the view forwarder is valid and <false/> else.
197 virtual sal_Bool IsValid (void) const;
199 /** Returns the area of the underlying document that is visible in the
200 * corresponding window.
202 @return
203 The rectangle of the visible part of the document. The values
204 are, contrary to the base class, in internal coordinates.
206 virtual Rectangle GetVisibleArea() const;
208 /** Transform the specified point from internal coordinates to an
209 absolute screen position.
211 @param rPoint
212 Point in internal coordinates.
214 @return
215 The same point but in screen coordinates relative to the upper
216 left corner of the (current) screen.
218 virtual Point LogicToPixel (const Point& rPoint) const;
220 /** Transform the specified size from internal coordinates to a screen
221 * oriented pixel size.
223 @param rSize
224 Size in internal coordinates.
226 @return
227 The same size but in screen coordinates.
229 virtual Size LogicToPixel (const Size& rSize) const;
231 /** Transform the specified point from absolute screen coordinates to
232 internal coordinates.
234 @param rPoint
235 Point in screen coordinates relative to the upper left corner of
236 the (current) screen.
238 @return
239 The same point but in internal coordinates.
241 virtual Point PixelToLogic (const Point& rPoint) const;
243 /** Transform the specified size from screen coordinates to internal
244 coordinates.
246 @param rSize
247 Size in screen coordinates.
249 @return
250 The same size but in internal coordinates.
252 virtual Size PixelToLogic (const Size& rSize) const;
254 ///======== internal =====================================================
256 utl::AccessibleRelationSetHelper* GetRelationSet(const ScAddress* pAddress) const;
258 ::com::sun::star::uno::Reference
259 < ::com::sun::star::accessibility::XAccessible >
260 GetAccessibleSpreadsheet();
262 protected:
263 /// Return this object's description.
264 virtual OUString SAL_CALL
265 createAccessibleDescription(void)
266 throw (::com::sun::star::uno::RuntimeException);
268 /// Return the object's current name.
269 virtual OUString SAL_CALL
270 createAccessibleName(void)
271 throw (::com::sun::star::uno::RuntimeException);
273 /// Return the object's current bounding box relative to the desktop.
274 virtual Rectangle GetBoundingBoxOnScreen(void) const
275 throw (::com::sun::star::uno::RuntimeException);
277 /// Return the object's current bounding box relative to the parent object.
278 virtual Rectangle GetBoundingBox(void) const
279 throw (::com::sun::star::uno::RuntimeException);
281 private:
282 ScTabViewShell* mpViewShell;
283 ScSplitPos meSplitPos;
284 ScAccessibleSpreadsheet* mpAccessibleSpreadsheet;
285 ScChildrenShapes* mpChildrenShapes;
286 ScAccessibleEditObject* mpTempAccEdit;
287 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> mxTempAcc;
288 Rectangle maVisArea;
289 sal_Bool mbCompleteSheetSelected;
291 public:
292 SCTAB getVisibleTable() const; // use it in ScChildrenShapes
294 private:
295 void FreeAccessibleSpreadsheet();
297 sal_Bool IsTableSelected() const;
299 sal_Bool IsDefunc(
300 const com::sun::star::uno::Reference<
301 ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
302 sal_Bool IsEditable(
303 const com::sun::star::uno::Reference<
304 ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
306 void AddChild(const com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>& xAcc, sal_Bool bFireEvent);
307 void RemoveChild(const com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>& xAcc, sal_Bool bFireEvent);
309 OUString GetCurrentCellName() const;
310 OUString GetCurrentCellDescription() const;
312 Rectangle GetVisibleArea_Impl() const;
316 #endif
318 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */