1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLEDOCUMENT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLEDOCUMENT_HXX
23 #include "AccessibleDocumentBase.hxx"
24 #include "viewdata.hxx"
25 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
26 #include <com/sun/star/view/XSelectionChangeListener.hpp>
27 #include <cppuhelper/implbase3.hxx>
28 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
29 #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
30 #include <svx/IAccessibleViewForwarder.hxx>
33 class ScAccessibleSpreadsheet
;
34 class ScChildrenShapes
;
35 class ScAccessibleEditObject
;
39 class AccessibleRelationSetHelper
;
43 This base class provides an implementation of the
44 <code>AccessibleContext</code> service.
47 typedef cppu::ImplHelper3
< ::com::sun::star::accessibility::XAccessibleSelection
,
48 ::com::sun::star::accessibility::XAccessibleExtendedAttributes
,
49 ::com::sun::star::view::XSelectionChangeListener
>
50 ScAccessibleDocumentImpl
;
52 class ScAccessibleDocument
53 : public ScAccessibleDocumentBase
,
54 public ScAccessibleDocumentImpl
,
55 public com::sun::star::accessibility::XAccessibleGetAccFlowTo
,
56 public accessibility::IAccessibleViewForwarder
59 //===== internal ========================================================
61 const ::com::sun::star::uno::Reference
<
62 ::com::sun::star::accessibility::XAccessible
>& rxParent
,
63 ScTabViewShell
* pViewShell
,
64 ScSplitPos eSplitPos
);
66 virtual void Init() SAL_OVERRIDE
;
68 DECL_LINK( WindowChildEventListener
, VclSimpleEvent
* );
70 virtual ~ScAccessibleDocument();
72 using ScAccessibleDocumentBase::IsDefunc
;
76 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
78 ///===== SfxListener =====================================================
80 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
82 ///===== XInterface =====================================================
84 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
85 ::com::sun::star::uno::Type
const & rType
)
86 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
88 virtual void SAL_CALL
acquire() throw () SAL_OVERRIDE
;
90 virtual void SAL_CALL
release() throw () SAL_OVERRIDE
;
92 ///===== XAccessibleComponent ============================================
94 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>
95 SAL_CALL
getAccessibleAtPoint(
96 const ::com::sun::star::awt::Point
& rPoint
)
97 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual void SAL_CALL
grabFocus( )
100 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 ///===== XAccessibleContext ==============================================
104 /// Return the number of currently visible children.
105 virtual sal_Int32 SAL_CALL
106 getAccessibleChildCount()
107 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 /// Return the specified child or NULL if index is invalid.
110 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
111 getAccessibleChild(sal_Int32 nIndex
)
112 throw (::com::sun::star::uno::RuntimeException
,
113 ::com::sun::star::lang::IndexOutOfBoundsException
, std::exception
) SAL_OVERRIDE
;
115 /// Return the set of current states.
116 virtual ::com::sun::star::uno::Reference
<
117 ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
118 getAccessibleStateSet()
119 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
121 virtual OUString SAL_CALL
123 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
125 virtual ::com::sun::star::uno::Any SAL_CALL
getExtendedAttributes()
126 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 ///===== XAccessibleSelection ===========================================
129 virtual void SAL_CALL
130 selectAccessibleChild( sal_Int32 nChildIndex
)
131 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
132 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
134 virtual sal_Bool SAL_CALL
135 isAccessibleChildSelected( sal_Int32 nChildIndex
)
136 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
137 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
139 virtual void SAL_CALL
140 clearAccessibleSelection( )
141 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
143 virtual void SAL_CALL
144 selectAllAccessibleChildren( )
145 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 virtual sal_Int32 SAL_CALL
148 getSelectedAccessibleChildCount( )
149 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
151 virtual ::com::sun::star::uno::Reference
<
152 ::com::sun::star::accessibility::XAccessible
> SAL_CALL
153 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
)
154 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
155 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
157 virtual void SAL_CALL
158 deselectAccessibleChild( sal_Int32 nChildIndex
)
159 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
160 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
162 ///===== XSelectionListener =============================================
164 virtual void SAL_CALL
selectionChanged( const ::com::sun::star::lang::EventObject
& aEvent
)
165 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
167 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
)
168 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
170 ///===== XServiceInfo ===================================================
172 /** Returns an identifier for the implementation of this object.
174 virtual OUString SAL_CALL
175 getImplementationName()
176 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
178 /** Returns a list of all supported services.
180 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
181 getSupportedServiceNames()
182 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
184 ///===== XTypeProvider ===================================================
186 /// returns the possible types
187 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
189 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
191 /** Returns a implementation id.
193 virtual ::com::sun::star::uno::Sequence
<sal_Int8
> SAL_CALL
194 getImplementationId()
195 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
197 ///===== IAccessibleViewForwarder ========================================
199 /** This method informs you about the state of the forwarder. Do not
200 use it when the returned value is <false/>.
203 Return <true/> if the view forwarder is valid and <false/> else.
205 virtual bool IsValid() const SAL_OVERRIDE
;
207 /** Returns the area of the underlying document that is visible in the
208 * corresponding window.
211 The rectangle of the visible part of the document. The values
212 are, contrary to the base class, in internal coordinates.
214 virtual Rectangle
GetVisibleArea() const SAL_OVERRIDE
;
216 /** Transform the specified point from internal coordinates to an
217 absolute screen position.
220 Point in internal coordinates.
223 The same point but in screen coordinates relative to the upper
224 left corner of the (current) screen.
226 virtual Point
LogicToPixel (const Point
& rPoint
) const SAL_OVERRIDE
;
228 /** Transform the specified size from internal coordinates to a screen
229 * oriented pixel size.
232 Size in internal coordinates.
235 The same size but in screen coordinates.
237 virtual Size
LogicToPixel (const Size
& rSize
) const SAL_OVERRIDE
;
239 /** Transform the specified point from absolute screen coordinates to
240 internal coordinates.
243 Point in screen coordinates relative to the upper left corner of
244 the (current) screen.
247 The same point but in internal coordinates.
249 virtual Point
PixelToLogic (const Point
& rPoint
) const SAL_OVERRIDE
;
251 /** Transform the specified size from screen coordinates to internal
255 Size in screen coordinates.
258 The same size but in internal coordinates.
260 virtual Size
PixelToLogic (const Size
& rSize
) const SAL_OVERRIDE
;
262 ///======== internal =====================================================
264 utl::AccessibleRelationSetHelper
* GetRelationSet(const ScAddress
* pAddress
) const;
266 ::com::sun::star::uno::Reference
267 < ::com::sun::star::accessibility::XAccessible
>
268 GetAccessibleSpreadsheet();
271 /// Return this object's description.
272 virtual OUString SAL_CALL
273 createAccessibleDescription()
274 throw (::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
276 /// Return the object's current name.
277 virtual OUString SAL_CALL
278 createAccessibleName()
279 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
281 /// Return the object's current bounding box relative to the desktop.
282 virtual Rectangle
GetBoundingBoxOnScreen() const
283 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
285 /// Return the object's current bounding box relative to the parent object.
286 virtual Rectangle
GetBoundingBox() const
287 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
290 ScTabViewShell
* mpViewShell
;
291 ScSplitPos meSplitPos
;
292 ScAccessibleSpreadsheet
* mpAccessibleSpreadsheet
;
293 ScChildrenShapes
* mpChildrenShapes
;
294 ScAccessibleEditObject
* mpTempAccEdit
;
295 com::sun::star::uno::Reference
<com::sun::star::accessibility::XAccessible
> mxTempAcc
;
297 bool mbCompleteSheetSelected
;
300 SCTAB
getVisibleTable() const; // use it in ScChildrenShapes
303 void FreeAccessibleSpreadsheet();
305 bool IsTableSelected() const;
308 const com::sun::star::uno::Reference
<
309 ::com::sun::star::accessibility::XAccessibleStateSet
>& rxParentStates
);
311 void AddChild(const com::sun::star::uno::Reference
<com::sun::star::accessibility::XAccessible
>& xAcc
, bool bFireEvent
);
312 void RemoveChild(const com::sun::star::uno::Reference
<com::sun::star::accessibility::XAccessible
>& xAcc
, bool bFireEvent
);
314 OUString
GetCurrentCellName() const;
315 static OUString
GetCurrentCellDescription();
317 Rectangle
GetVisibleArea_Impl() const;
318 com::sun::star::uno::Sequence
< com::sun::star::uno::Any
> GetScAccFlowToSequence();
320 ScDocument
*GetDocument() const ;
321 ScAddress
GetCurCellAddress() const;
322 //===== XAccessibleGetAccFromXShape ============================================
323 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>
324 SAL_CALL
getAccFlowTo(const ::com::sun::star::uno::Any
& rAny
, sal_Int32 nType
)
325 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
327 virtual sal_Int32 SAL_CALL
getForeground( )
328 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
330 virtual sal_Int32 SAL_CALL
getBackground( )
331 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
333 void SwitchViewFireFocus() SAL_OVERRIDE
;
338 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */