1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: AccessibleDocument.hxx,v $
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_ACCESSIBLEDOCUMENT_HXX
33 #define _SC_ACCESSIBLEDOCUMENT_HXX
35 #include "AccessibleDocumentBase.hxx"
36 #include "viewdata.hxx"
37 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
38 #include <com/sun/star/view/XSelectionChangeListener.hpp>
39 #include <cppuhelper/implbase2.hxx>
40 #include <svx/IAccessibleViewForwarder.hxx>
43 class ScAccessibleSpreadsheet
;
44 class ScChildrenShapes
;
45 class ScAccessibleEditObject
;
47 namespace accessibility
49 class AccessibleShape
;
53 class AccessibleRelationSetHelper
;
57 This base class provides an implementation of the
58 <code>AccessibleContext</code> service.
61 typedef cppu::ImplHelper2
< ::com::sun::star::accessibility::XAccessibleSelection
,
62 ::com::sun::star::view::XSelectionChangeListener
>
63 ScAccessibleDocumentImpl
;
65 class ScAccessibleDocument
66 : public ScAccessibleDocumentBase
,
67 public ScAccessibleDocumentImpl
,
68 public accessibility::IAccessibleViewForwarder
71 //===== internal ========================================================
73 const ::com::sun::star::uno::Reference
<
74 ::com::sun::star::accessibility::XAccessible
>& rxParent
,
75 ScTabViewShell
* pViewShell
,
76 ScSplitPos eSplitPos
);
81 DECL_LINK( WindowChildEventListener
, VclSimpleEvent
* );
83 virtual ~ScAccessibleDocument(void);
85 using ScAccessibleDocumentBase::IsDefunc
;
89 virtual void SAL_CALL
disposing();
91 ///===== SfxListener =====================================================
93 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
95 ///===== XInterface =====================================================
97 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
98 ::com::sun::star::uno::Type
const & rType
)
99 throw (::com::sun::star::uno::RuntimeException
);
101 virtual void SAL_CALL
acquire() throw ();
103 virtual void SAL_CALL
release() throw ();
105 ///===== XAccessibleComponent ============================================
107 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>
108 SAL_CALL
getAccessibleAtPoint(
109 const ::com::sun::star::awt::Point
& rPoint
)
110 throw (::com::sun::star::uno::RuntimeException
);
112 virtual void SAL_CALL
grabFocus( )
113 throw (::com::sun::star::uno::RuntimeException
);
115 ///===== XAccessibleContext ==============================================
117 /// Return the number of currently visible children.
118 virtual sal_Int32 SAL_CALL
119 getAccessibleChildCount(void)
120 throw (::com::sun::star::uno::RuntimeException
);
122 /// Return the specified child or NULL if index is invalid.
123 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
124 getAccessibleChild(sal_Int32 nIndex
)
125 throw (::com::sun::star::uno::RuntimeException
,
126 ::com::sun::star::lang::IndexOutOfBoundsException
);
128 /// Return the set of current states.
129 virtual ::com::sun::star::uno::Reference
<
130 ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
131 getAccessibleStateSet(void)
132 throw (::com::sun::star::uno::RuntimeException
);
134 ///===== XAccessibleSelection ===========================================
136 virtual void SAL_CALL
137 selectAccessibleChild( sal_Int32 nChildIndex
)
138 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
139 ::com::sun::star::uno::RuntimeException
);
141 virtual sal_Bool SAL_CALL
142 isAccessibleChildSelected( sal_Int32 nChildIndex
)
143 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
144 ::com::sun::star::uno::RuntimeException
);
146 virtual void SAL_CALL
147 clearAccessibleSelection( )
148 throw (::com::sun::star::uno::RuntimeException
);
150 virtual void SAL_CALL
151 selectAllAccessibleChildren( )
152 throw (::com::sun::star::uno::RuntimeException
);
154 virtual sal_Int32 SAL_CALL
155 getSelectedAccessibleChildCount( )
156 throw (::com::sun::star::uno::RuntimeException
);
158 virtual ::com::sun::star::uno::Reference
<
159 ::com::sun::star::accessibility::XAccessible
> SAL_CALL
160 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
)
161 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
162 ::com::sun::star::uno::RuntimeException
);
164 virtual void SAL_CALL
165 deselectAccessibleChild( sal_Int32 nChildIndex
)
166 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
167 ::com::sun::star::uno::RuntimeException
);
169 ///===== XSelectionListener =============================================
171 virtual void SAL_CALL
selectionChanged( const ::com::sun::star::lang::EventObject
& aEvent
)
172 throw (::com::sun::star::uno::RuntimeException
);
174 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
175 throw (::com::sun::star::uno::RuntimeException
);
177 ///===== XServiceInfo ===================================================
179 /** Returns an identifier for the implementation of this object.
181 virtual ::rtl::OUString SAL_CALL
182 getImplementationName(void)
183 throw (::com::sun::star::uno::RuntimeException
);
185 /** Returns a list of all supported services.
187 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
188 getSupportedServiceNames(void)
189 throw (::com::sun::star::uno::RuntimeException
);
191 ///===== XTypeProvider ===================================================
193 /// returns the possible types
194 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
196 throw (::com::sun::star::uno::RuntimeException
);
198 /** Returns a implementation id.
200 virtual ::com::sun::star::uno::Sequence
<sal_Int8
> SAL_CALL
201 getImplementationId(void)
202 throw (::com::sun::star::uno::RuntimeException
);
204 ///===== IAccessibleViewForwarder ========================================
206 /** This method informs you about the state of the forwarder. Do not
207 use it when the returned value is <false/>.
210 Return <true/> if the view forwarder is valid and <false/> else.
212 virtual sal_Bool
IsValid (void) const;
214 /** Returns the area of the underlying document that is visible in the
215 * corresponding window.
218 The rectangle of the visible part of the document. The values
219 are, contrary to the base class, in internal coordinates.
221 virtual Rectangle
GetVisibleArea() const;
223 /** Transform the specified point from internal coordinates to an
224 absolute screen position.
227 Point in internal coordinates.
230 The same point but in screen coordinates relative to the upper
231 left corner of the (current) screen.
233 virtual Point
LogicToPixel (const Point
& rPoint
) const;
235 /** Transform the specified size from internal coordinates to a screen
236 * oriented pixel size.
239 Size in internal coordinates.
242 The same size but in screen coordinates.
244 virtual Size
LogicToPixel (const Size
& rSize
) const;
246 /** Transform the specified point from absolute screen coordinates to
247 internal coordinates.
250 Point in screen coordinates relative to the upper left corner of
251 the (current) screen.
254 The same point but in internal coordinates.
256 virtual Point
PixelToLogic (const Point
& rPoint
) const;
258 /** Transform the specified size from screen coordinates to internal
262 Size in screen coordinates.
265 The same size but in internal coordinates.
267 virtual Size
PixelToLogic (const Size
& rSize
) const;
269 ///======== internal =====================================================
271 utl::AccessibleRelationSetHelper
* GetRelationSet(const ScAddress
* pAddress
) const;
273 ::com::sun::star::uno::Reference
274 < ::com::sun::star::accessibility::XAccessible
>
275 GetAccessibleSpreadsheet();
278 /// Return this object's description.
279 virtual ::rtl::OUString SAL_CALL
280 createAccessibleDescription(void)
281 throw (::com::sun::star::uno::RuntimeException
);
283 /// Return the object's current name.
284 virtual ::rtl::OUString SAL_CALL
285 createAccessibleName(void)
286 throw (::com::sun::star::uno::RuntimeException
);
288 /// Return the object's current bounding box relative to the desktop.
289 virtual Rectangle
GetBoundingBoxOnScreen(void) const
290 throw (::com::sun::star::uno::RuntimeException
);
292 /// Return the object's current bounding box relative to the parent object.
293 virtual Rectangle
GetBoundingBox(void) const
294 throw (::com::sun::star::uno::RuntimeException
);
297 ScTabViewShell
* mpViewShell
;
298 ScSplitPos meSplitPos
;
299 ScAccessibleSpreadsheet
* mpAccessibleSpreadsheet
;
300 ScChildrenShapes
* mpChildrenShapes
;
301 ScAccessibleEditObject
* mpTempAccEdit
;
302 com::sun::star::uno::Reference
<com::sun::star::accessibility::XAccessible
> mxTempAcc
;
304 sal_Bool mbCompleteSheetSelected
;
307 SCTAB
getVisibleTable() const; // use it in ScChildrenShapes
310 void FreeAccessibleSpreadsheet();
312 sal_Bool
IsTableSelected() const;
315 const com::sun::star::uno::Reference
<
316 ::com::sun::star::accessibility::XAccessibleStateSet
>& rxParentStates
);
318 const com::sun::star::uno::Reference
<
319 ::com::sun::star::accessibility::XAccessibleStateSet
>& rxParentStates
);
321 void AddChild(const com::sun::star::uno::Reference
<com::sun::star::accessibility::XAccessible
>& xAcc
, sal_Bool bFireEvent
);
322 void RemoveChild(const com::sun::star::uno::Reference
<com::sun::star::accessibility::XAccessible
>& xAcc
, sal_Bool bFireEvent
);
324 rtl::OUString
GetCurrentCellName() const;
325 rtl::OUString
GetCurrentCellDescription() const;
327 Rectangle
GetVisibleArea_Impl() const;