Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / ui / inc / AccessibleDocument.hxx
blob70b2c37b6c84f62c8a61807eeb0412f7841418e3
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 .
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>
32 class ScTabViewShell;
33 class ScAccessibleSpreadsheet;
34 class ScChildrenShapes;
35 class ScAccessibleEditObject;
37 namespace utl
39 class AccessibleRelationSetHelper;
42 /** @descr
43 This base class provides an implementation of the
44 <code>AccessibleContext</code> service.
47 typedef cppu::ImplHelper3< css::accessibility::XAccessibleSelection,
48 css::accessibility::XAccessibleExtendedAttributes,
49 css::view::XSelectionChangeListener >
50 ScAccessibleDocumentImpl;
52 class ScAccessibleDocument
53 : public ScAccessibleDocumentBase,
54 public ScAccessibleDocumentImpl,
55 public css::accessibility::XAccessibleGetAccFlowTo,
56 public accessibility::IAccessibleViewForwarder
58 public:
59 //===== internal ========================================================
60 ScAccessibleDocument(
61 const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
62 ScTabViewShell* pViewShell,
63 ScSplitPos eSplitPos);
65 void PreInit();
67 virtual void Init() override;
69 DECL_LINK_TYPED( WindowChildEventListener, VclWindowEvent&, void );
70 protected:
71 virtual ~ScAccessibleDocument();
73 using ScAccessibleDocumentBase::IsDefunc;
75 public:
77 virtual void SAL_CALL disposing() override;
79 ///===== SfxListener =====================================================
81 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
83 ///===== XInterface =====================================================
85 virtual css::uno::Any SAL_CALL queryInterface(
86 css::uno::Type const & rType )
87 throw (css::uno::RuntimeException, std::exception) override;
89 virtual void SAL_CALL acquire() throw () override;
91 virtual void SAL_CALL release() throw () override;
93 ///===== XAccessibleComponent ============================================
95 virtual css::uno::Reference< css::accessibility::XAccessible >
96 SAL_CALL getAccessibleAtPoint(
97 const css::awt::Point& rPoint )
98 throw (css::uno::RuntimeException, std::exception) override;
100 virtual void SAL_CALL grabFocus( )
101 throw (css::uno::RuntimeException, std::exception) override;
103 ///===== XAccessibleContext ==============================================
105 /// Return the number of currently visible children.
106 virtual sal_Int32 SAL_CALL
107 getAccessibleChildCount()
108 throw (css::uno::RuntimeException, std::exception) override;
110 /// Return the specified child or NULL if index is invalid.
111 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
112 getAccessibleChild(sal_Int32 nIndex)
113 throw (css::uno::RuntimeException,
114 css::lang::IndexOutOfBoundsException, std::exception) override;
116 /// Return the set of current states.
117 virtual css::uno::Reference<
118 css::accessibility::XAccessibleStateSet> SAL_CALL
119 getAccessibleStateSet()
120 throw (css::uno::RuntimeException, std::exception) override;
122 virtual OUString SAL_CALL
123 getAccessibleName()
124 throw (css::uno::RuntimeException, std::exception) override;
126 virtual css::uno::Any SAL_CALL getExtendedAttributes()
127 throw (css::lang::IndexOutOfBoundsException, css::uno::RuntimeException, std::exception) override ;
128 ///===== XAccessibleSelection ===========================================
130 virtual void SAL_CALL
131 selectAccessibleChild( sal_Int32 nChildIndex )
132 throw (css::lang::IndexOutOfBoundsException,
133 css::uno::RuntimeException, std::exception) override;
135 virtual sal_Bool SAL_CALL
136 isAccessibleChildSelected( sal_Int32 nChildIndex )
137 throw (css::lang::IndexOutOfBoundsException,
138 css::uno::RuntimeException, std::exception) override;
140 virtual void SAL_CALL
141 clearAccessibleSelection( )
142 throw (css::uno::RuntimeException, std::exception) override;
144 virtual void SAL_CALL
145 selectAllAccessibleChildren( )
146 throw (css::uno::RuntimeException, std::exception) override;
148 virtual sal_Int32 SAL_CALL
149 getSelectedAccessibleChildCount( )
150 throw (css::uno::RuntimeException, std::exception) override;
152 virtual css::uno::Reference<
153 css::accessibility::XAccessible > SAL_CALL
154 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
155 throw (css::lang::IndexOutOfBoundsException,
156 css::uno::RuntimeException, std::exception) override;
158 virtual void SAL_CALL
159 deselectAccessibleChild( sal_Int32 nChildIndex )
160 throw (css::lang::IndexOutOfBoundsException,
161 css::uno::RuntimeException, std::exception) override;
163 ///===== XSelectionListener =============================================
165 virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent )
166 throw (css::uno::RuntimeException, std::exception) override;
168 virtual void SAL_CALL disposing( const css::lang::EventObject& Source )
169 throw (css::uno::RuntimeException, std::exception) override;
171 ///===== XServiceInfo ===================================================
173 /** Returns an identifier for the implementation of this object.
175 virtual OUString SAL_CALL
176 getImplementationName()
177 throw (css::uno::RuntimeException, std::exception) override;
179 /** Returns a list of all supported services.
181 virtual css::uno::Sequence< OUString> SAL_CALL
182 getSupportedServiceNames()
183 throw (css::uno::RuntimeException, std::exception) override;
185 ///===== XTypeProvider ===================================================
187 /// returns the possible types
188 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
189 getTypes()
190 throw (css::uno::RuntimeException, std::exception) override;
192 /** Returns a implementation id.
194 virtual css::uno::Sequence<sal_Int8> SAL_CALL
195 getImplementationId()
196 throw (css::uno::RuntimeException, std::exception) override;
198 ///===== IAccessibleViewForwarder ========================================
200 /** Returns the area of the underlying document that is visible in the
201 * corresponding window.
203 @return
204 The rectangle of the visible part of the document. The values
205 are, contrary to the base class, in internal coordinates.
207 virtual Rectangle GetVisibleArea() const override;
209 /** Transform the specified point from internal coordinates to an
210 absolute screen position.
212 @param rPoint
213 Point in internal coordinates.
215 @return
216 The same point but in screen coordinates relative to the upper
217 left corner of the (current) screen.
219 virtual Point LogicToPixel (const Point& rPoint) const override;
221 /** Transform the specified size from internal coordinates to a screen
222 * oriented pixel size.
224 @param rSize
225 Size in internal coordinates.
227 @return
228 The same size but in screen coordinates.
230 virtual Size LogicToPixel (const Size& rSize) const override;
232 ///======== internal =====================================================
234 utl::AccessibleRelationSetHelper* GetRelationSet(const ScAddress* pAddress) const;
236 css::uno::Reference< css::accessibility::XAccessible >
237 GetAccessibleSpreadsheet();
239 protected:
240 /// Return this object's description.
241 virtual OUString SAL_CALL
242 createAccessibleDescription()
243 throw (css::uno::RuntimeException, std::exception) override;
245 /// Return the object's current name.
246 virtual OUString SAL_CALL
247 createAccessibleName()
248 throw (css::uno::RuntimeException, std::exception) override;
250 /// Return the object's current bounding box relative to the desktop.
251 virtual Rectangle GetBoundingBoxOnScreen() const
252 throw (css::uno::RuntimeException, std::exception) override;
254 /// Return the object's current bounding box relative to the parent object.
255 virtual Rectangle GetBoundingBox() const
256 throw (css::uno::RuntimeException, std::exception) override;
258 private:
259 ScTabViewShell* mpViewShell;
260 ScSplitPos meSplitPos;
261 rtl::Reference<ScAccessibleSpreadsheet> mpAccessibleSpreadsheet;
262 ScChildrenShapes* mpChildrenShapes;
263 ScAccessibleEditObject* mpTempAccEdit;
264 css::uno::Reference<css::accessibility::XAccessible> mxTempAcc;
265 Rectangle maVisArea;
266 bool mbCompleteSheetSelected;
268 public:
269 SCTAB getVisibleTable() const; // use it in ScChildrenShapes
271 private:
272 void FreeAccessibleSpreadsheet();
274 bool IsTableSelected() const;
276 bool IsDefunc(
277 const css::uno::Reference<css::accessibility::XAccessibleStateSet>& rxParentStates);
279 void AddChild(const css::uno::Reference<css::accessibility::XAccessible>& xAcc, bool bFireEvent);
280 void RemoveChild(const css::uno::Reference<css::accessibility::XAccessible>& xAcc, bool bFireEvent);
282 OUString GetCurrentCellName() const;
283 static OUString GetCurrentCellDescription();
285 Rectangle GetVisibleArea_Impl() const;
286 css::uno::Sequence< css::uno::Any > GetScAccFlowToSequence();
287 public:
288 ScDocument *GetDocument() const ;
289 ScAddress GetCurCellAddress() const;
290 //===== XAccessibleGetAccFromXShape ============================================
291 css::uno::Sequence< css::uno::Any >
292 SAL_CALL getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType)
293 throw ( css::uno::RuntimeException, std::exception ) override;
295 virtual sal_Int32 SAL_CALL getForeground( )
296 throw (css::uno::RuntimeException, std::exception) override;
298 virtual sal_Int32 SAL_CALL getBackground( )
299 throw (css::uno::RuntimeException, std::exception) override;
302 #endif
304 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */