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 .
22 #include "AccessibleDocumentBase.hxx"
23 #include "viewdata.hxx"
24 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
25 #include <com/sun/star/view/XSelectionChangeListener.hpp>
26 #include <cppuhelper/implbase3.hxx>
27 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
28 #include <svx/IAccessibleViewForwarder.hxx>
31 class ScAccessibleSpreadsheet
;
32 class ScChildrenShapes
;
33 class ScAccessibleEditObject
;
38 class AccessibleRelationSetHelper
;
42 This base class provides an implementation of the
43 <code>AccessibleContext</code> service.
46 typedef cppu::ImplHelper3
< css::accessibility::XAccessibleSelection
,
47 css::accessibility::XAccessibleExtendedAttributes
,
48 css::view::XSelectionChangeListener
>
49 ScAccessibleDocumentImpl
;
51 class ScAccessibleDocument
52 : public ScAccessibleDocumentBase
,
53 public ScAccessibleDocumentImpl
,
54 public accessibility::IAccessibleViewForwarder
57 //===== internal ========================================================
59 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParent
,
60 ScTabViewShell
* pViewShell
,
61 ScSplitPos eSplitPos
);
65 virtual void Init() override
;
67 DECL_LINK( WindowChildEventListener
, VclWindowEvent
&, void );
69 virtual ~ScAccessibleDocument() override
;
71 using ScAccessibleDocumentBase::IsDefunc
;
75 virtual void SAL_CALL
disposing() override
;
77 ///===== SfxListener =====================================================
79 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
81 ///===== XInterface =====================================================
83 virtual css::uno::Any SAL_CALL
queryInterface(
84 css::uno::Type
const & rType
) override
;
86 virtual void SAL_CALL
acquire() noexcept override
;
88 virtual void SAL_CALL
release() noexcept override
;
90 ///===== XAccessibleComponent ============================================
92 virtual css::uno::Reference
< css::accessibility::XAccessible
>
93 SAL_CALL
getAccessibleAtPoint(
94 const css::awt::Point
& rPoint
) override
;
96 virtual void SAL_CALL
grabFocus( ) override
;
98 ///===== XAccessibleContext ==============================================
100 /// Return the number of currently visible children.
101 virtual sal_Int64 SAL_CALL
102 getAccessibleChildCount() override
;
104 /// Return the specified child or NULL if index is invalid.
105 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
106 getAccessibleChild(sal_Int64 nIndex
) override
;
108 /// Return the set of current states.
109 virtual sal_Int64 SAL_CALL
110 getAccessibleStateSet() override
;
112 virtual OUString SAL_CALL
113 getAccessibleName() override
;
115 virtual css::uno::Any SAL_CALL
getExtendedAttributes() override
;
116 ///===== XAccessibleSelection ===========================================
118 virtual void SAL_CALL
119 selectAccessibleChild( sal_Int64 nChildIndex
) override
;
121 virtual sal_Bool SAL_CALL
122 isAccessibleChildSelected( sal_Int64 nChildIndex
) override
;
124 virtual void SAL_CALL
125 clearAccessibleSelection( ) override
;
127 virtual void SAL_CALL
128 selectAllAccessibleChildren( ) override
;
130 virtual sal_Int64 SAL_CALL
131 getSelectedAccessibleChildCount( ) override
;
133 virtual css::uno::Reference
<
134 css::accessibility::XAccessible
> SAL_CALL
135 getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex
) override
;
137 virtual void SAL_CALL
138 deselectAccessibleChild( sal_Int64 nChildIndex
) override
;
140 ///===== XSelectionListener =============================================
142 virtual void SAL_CALL
selectionChanged( const css::lang::EventObject
& aEvent
) override
;
144 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) override
;
146 ///===== XServiceInfo ===================================================
148 /** Returns an identifier for the implementation of this object.
150 virtual OUString SAL_CALL
151 getImplementationName() override
;
153 /** Returns a list of all supported services.
155 virtual css::uno::Sequence
< OUString
> SAL_CALL
156 getSupportedServiceNames() override
;
158 ///===== XTypeProvider ===================================================
160 /// returns the possible types
161 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
164 /** Returns an implementation id.
166 virtual css::uno::Sequence
<sal_Int8
> SAL_CALL
167 getImplementationId() override
;
169 ///===== IAccessibleViewForwarder ========================================
171 /** Returns the area of the underlying document that is visible in the
172 * corresponding window.
175 The rectangle of the visible part of the document. The values
176 are, contrary to the base class, in internal coordinates.
178 virtual tools::Rectangle
GetVisibleArea() const override
;
180 /** Transform the specified point from internal coordinates to an
181 absolute screen position.
184 Point in internal coordinates.
187 The same point but in screen coordinates relative to the upper
188 left corner of the (current) screen.
190 virtual Point
LogicToPixel (const Point
& rPoint
) const override
;
192 /** Transform the specified size from internal coordinates to a screen
193 * oriented pixel size.
196 Size in internal coordinates.
199 The same size but in screen coordinates.
201 virtual Size
LogicToPixel (const Size
& rSize
) const override
;
203 ///======== internal =====================================================
205 rtl::Reference
<utl::AccessibleRelationSetHelper
> GetRelationSet(const ScAddress
* pAddress
) const;
207 css::uno::Reference
< css::accessibility::XAccessible
>
208 GetAccessibleSpreadsheet();
211 /// Return this object's description.
213 createAccessibleDescription() override
;
215 /// Return the object's current name.
217 createAccessibleName() override
;
219 /// Return the object's current bounding box relative to the desktop.
220 virtual AbsoluteScreenPixelRectangle
GetBoundingBoxOnScreen() const override
;
222 /// Return the object's current bounding box relative to the parent object.
223 virtual tools::Rectangle
GetBoundingBox() const override
;
226 ScTabViewShell
* mpViewShell
;
227 ScSplitPos meSplitPos
;
228 rtl::Reference
<ScAccessibleSpreadsheet
> mpAccessibleSpreadsheet
;
229 std::unique_ptr
<ScChildrenShapes
> mpChildrenShapes
;
230 rtl::Reference
<ScAccessibleEditObject
> mpTempAccEdit
;
231 css::uno::Reference
<css::accessibility::XAccessible
> mxTempAcc
;
232 tools::Rectangle maVisArea
;
233 bool mbCompleteSheetSelected
;
236 SCTAB
getVisibleTable() const; // use it in ScChildrenShapes
239 void FreeAccessibleSpreadsheet();
241 bool IsTableSelected() const;
243 bool IsDefunc(sal_Int64 nParentStates
);
245 void AddChild(const css::uno::Reference
<css::accessibility::XAccessible
>& xAcc
, bool bFireEvent
);
246 void RemoveChild(const css::uno::Reference
<css::accessibility::XAccessible
>& xAcc
, bool bFireEvent
);
248 OUString
GetCurrentCellName() const;
249 static const OUString
& GetCurrentCellDescription();
251 tools::Rectangle
GetVisibleArea_Impl() const;
253 ScDocument
*GetDocument() const ;
254 ScAddress
GetCurCellAddress() const;
256 virtual sal_Int32 SAL_CALL
getForeground( ) override
;
258 virtual sal_Int32 SAL_CALL
getBackground( ) override
;
261 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */