nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / ui / inc / AccessibleDocument.hxx
blob975046b55be5188d6772c27937e14147efdf62db
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 <svx/IAccessibleViewForwarder.hxx>
31 class ScTabViewShell;
32 class ScAccessibleSpreadsheet;
33 class ScChildrenShapes;
34 class ScAccessibleEditObject;
35 class VclWindowEvent;
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 accessibility::IAccessibleViewForwarder
57 public:
58 //===== internal ========================================================
59 ScAccessibleDocument(
60 const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
61 ScTabViewShell* pViewShell,
62 ScSplitPos eSplitPos);
64 void PreInit();
66 virtual void Init() override;
68 DECL_LINK( WindowChildEventListener, VclWindowEvent&, void );
69 protected:
70 virtual ~ScAccessibleDocument() override;
72 using ScAccessibleDocumentBase::IsDefunc;
74 public:
76 virtual void SAL_CALL disposing() override;
78 ///===== SfxListener =====================================================
80 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
82 ///===== XInterface =====================================================
84 virtual css::uno::Any SAL_CALL queryInterface(
85 css::uno::Type const & rType ) override;
87 virtual void SAL_CALL acquire() throw () override;
89 virtual void SAL_CALL release() throw () override;
91 ///===== XAccessibleComponent ============================================
93 virtual css::uno::Reference< css::accessibility::XAccessible >
94 SAL_CALL getAccessibleAtPoint(
95 const css::awt::Point& rPoint ) override;
97 virtual void SAL_CALL grabFocus( ) override;
99 ///===== XAccessibleContext ==============================================
101 /// Return the number of currently visible children.
102 virtual sal_Int32 SAL_CALL
103 getAccessibleChildCount() override;
105 /// Return the specified child or NULL if index is invalid.
106 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
107 getAccessibleChild(sal_Int32 nIndex) override;
109 /// Return the set of current states.
110 virtual css::uno::Reference<
111 css::accessibility::XAccessibleStateSet> SAL_CALL
112 getAccessibleStateSet() override;
114 virtual OUString SAL_CALL
115 getAccessibleName() override;
117 virtual css::uno::Any SAL_CALL getExtendedAttributes() override ;
118 ///===== XAccessibleSelection ===========================================
120 virtual void SAL_CALL
121 selectAccessibleChild( sal_Int32 nChildIndex ) override;
123 virtual sal_Bool SAL_CALL
124 isAccessibleChildSelected( sal_Int32 nChildIndex ) override;
126 virtual void SAL_CALL
127 clearAccessibleSelection( ) override;
129 virtual void SAL_CALL
130 selectAllAccessibleChildren( ) override;
132 virtual sal_Int32 SAL_CALL
133 getSelectedAccessibleChildCount( ) override;
135 virtual css::uno::Reference<
136 css::accessibility::XAccessible > SAL_CALL
137 getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override;
139 virtual void SAL_CALL
140 deselectAccessibleChild( sal_Int32 nChildIndex ) override;
142 ///===== XSelectionListener =============================================
144 virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override;
146 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
148 ///===== XServiceInfo ===================================================
150 /** Returns an identifier for the implementation of this object.
152 virtual OUString SAL_CALL
153 getImplementationName() override;
155 /** Returns a list of all supported services.
157 virtual css::uno::Sequence< OUString> SAL_CALL
158 getSupportedServiceNames() override;
160 ///===== XTypeProvider ===================================================
162 /// returns the possible types
163 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
164 getTypes() override;
166 /** Returns an implementation id.
168 virtual css::uno::Sequence<sal_Int8> SAL_CALL
169 getImplementationId() override;
171 ///===== IAccessibleViewForwarder ========================================
173 /** Returns the area of the underlying document that is visible in the
174 * corresponding window.
176 @return
177 The rectangle of the visible part of the document. The values
178 are, contrary to the base class, in internal coordinates.
180 virtual tools::Rectangle GetVisibleArea() const override;
182 /** Transform the specified point from internal coordinates to an
183 absolute screen position.
185 @param rPoint
186 Point in internal coordinates.
188 @return
189 The same point but in screen coordinates relative to the upper
190 left corner of the (current) screen.
192 virtual Point LogicToPixel (const Point& rPoint) const override;
194 /** Transform the specified size from internal coordinates to a screen
195 * oriented pixel size.
197 @param rSize
198 Size in internal coordinates.
200 @return
201 The same size but in screen coordinates.
203 virtual Size LogicToPixel (const Size& rSize) const override;
205 ///======== internal =====================================================
207 utl::AccessibleRelationSetHelper* GetRelationSet(const ScAddress* pAddress) const;
209 css::uno::Reference< css::accessibility::XAccessible >
210 GetAccessibleSpreadsheet();
212 protected:
213 /// Return this object's description.
214 virtual OUString
215 createAccessibleDescription() override;
217 /// Return the object's current name.
218 virtual OUString
219 createAccessibleName() override;
221 /// Return the object's current bounding box relative to the desktop.
222 virtual tools::Rectangle GetBoundingBoxOnScreen() const override;
224 /// Return the object's current bounding box relative to the parent object.
225 virtual tools::Rectangle GetBoundingBox() const override;
227 private:
228 ScTabViewShell* mpViewShell;
229 ScSplitPos meSplitPos;
230 rtl::Reference<ScAccessibleSpreadsheet> mpAccessibleSpreadsheet;
231 std::unique_ptr<ScChildrenShapes> mpChildrenShapes;
232 ScAccessibleEditObject* mpTempAccEdit;
233 css::uno::Reference<css::accessibility::XAccessible> mxTempAcc;
234 tools::Rectangle maVisArea;
235 bool mbCompleteSheetSelected;
237 public:
238 SCTAB getVisibleTable() const; // use it in ScChildrenShapes
240 private:
241 void FreeAccessibleSpreadsheet();
243 bool IsTableSelected() const;
245 bool IsDefunc(
246 const css::uno::Reference<css::accessibility::XAccessibleStateSet>& rxParentStates);
248 void AddChild(const css::uno::Reference<css::accessibility::XAccessible>& xAcc, bool bFireEvent);
249 void RemoveChild(const css::uno::Reference<css::accessibility::XAccessible>& xAcc, bool bFireEvent);
251 OUString GetCurrentCellName() const;
252 static OUString GetCurrentCellDescription();
254 tools::Rectangle GetVisibleArea_Impl() const;
255 public:
256 ScDocument *GetDocument() const ;
257 ScAddress GetCurCellAddress() const;
259 virtual sal_Int32 SAL_CALL getForeground( ) override;
261 virtual sal_Int32 SAL_CALL getBackground( ) override;
264 #endif
266 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */