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 .
23 #include "AccessibleCellBase.hxx"
24 #include "viewdata.hxx"
25 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
26 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
27 #include <rtl/ref.hxx>
28 #include <editeng/AccessibleStaticTextBase.hxx>
29 #include <comphelper/uno3.hxx>
31 namespace com::sun::star::accessibility
{ class XAccessibleRelationSet
; }
32 namespace utl
{ class AccessibleRelationSetHelper
; }
35 class ScAccessibleDocument
;
37 typedef cppu::ImplHelper1
< css::accessibility::XAccessibleExtendedAttributes
>
38 ScAccessibleCellAttributeImpl
;
40 using css::accessibility::AccessibleRelationType
;
43 This base class provides an implementation of the
44 <code>AccessibleCell</code> service.
46 class ScAccessibleCell
47 : public ScAccessibleCellBase
,
48 public accessibility::AccessibleStaticTextBase
,
49 public ScAccessibleCellAttributeImpl
52 static rtl::Reference
<ScAccessibleCell
> create(
53 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParent
,
54 ScTabViewShell
* pViewShell
,
55 const ScAddress
& rCellAddress
,
58 ScAccessibleDocument
* pAccDoc
);
62 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParent
,
63 ScTabViewShell
* pViewShell
,
64 const ScAddress
& rCellAddress
,
67 ScAccessibleDocument
* pAccDoc
);
69 virtual void Init() override
;
71 using ScAccessibleCellBase::disposing
;
72 virtual void SAL_CALL
disposing() override
;
75 virtual ~ScAccessibleCell() override
;
77 using ScAccessibleCellBase::IsDefunc
;
80 ///===== XInterface =====================================================
84 ///===== XTypeProvider ===================================================
86 DECLARE_XTYPEPROVIDER()
88 ///===== XAccessibleComponent ============================================
90 virtual css::uno::Reference
< css::accessibility::XAccessible
>
91 SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& rPoint
) override
;
93 virtual void SAL_CALL
grabFocus( ) override
;
96 /// Return the object's current bounding box relative to the desktop.
97 virtual AbsoluteScreenPixelRectangle
GetBoundingBoxOnScreen() const override
;
99 /// Return the object's current bounding box relative to the parent object.
100 virtual tools::Rectangle
GetBoundingBox() const override
;
103 ///===== XAccessibleContext ==============================================
105 /// Return the number of currently visible children.
106 /// override to calculate this on demand
107 virtual sal_Int64 SAL_CALL
108 getAccessibleChildCount() override
;
110 /// Return the specified child or NULL if index is invalid.
111 /// override to calculate this on demand
112 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
113 getAccessibleChild(sal_Int64 nIndex
) override
;
115 /// Return the set of current states.
116 virtual sal_Int64 SAL_CALL
117 getAccessibleStateSet() override
;
119 virtual css::uno::Reference
<
120 css::accessibility::XAccessibleRelationSet
> SAL_CALL
121 getAccessibleRelationSet() override
;
123 ///===== XServiceInfo ====================================================
125 /** Returns an identifier for the implementation of this object.
127 virtual OUString SAL_CALL
128 getImplementationName() override
;
130 /** Returns a list of all supported services.
132 virtual css::uno::Sequence
< OUString
> SAL_CALL
133 getSupportedServiceNames() override
;
135 virtual css::uno::Any SAL_CALL
getExtendedAttributes() override
;
137 // Override this method to handle cell's ParaIndent attribute specially.
138 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
getCharacterAttributes( sal_Int32 nIndex
, const css::uno::Sequence
< OUString
>& aRequestedAttributes
) override
;
140 ScTabViewShell
* mpViewShell
;
141 ScAccessibleDocument
* mpAccDoc
;
143 ScSplitPos meSplitPos
;
145 bool IsDefunc(sal_Int64 nParentStates
);
146 virtual bool IsEditable(sal_Int64 nParentStates
) override
;
147 bool IsOpaque() const;
148 bool IsFocused() const;
151 static ScDocument
* GetDocument(ScTabViewShell
* mpViewShell
);
153 ::std::unique_ptr
< SvxEditSource
> CreateEditSource(ScTabViewShell
* pViewShell
, ScAddress aCell
, ScSplitPos eSplitPos
);
155 void FillDependents(utl::AccessibleRelationSetHelper
* pRelationSet
);
156 void FillPrecedents(utl::AccessibleRelationSetHelper
* pRelationSet
);
157 void AddRelation(const ScAddress
& rCell
,
158 const AccessibleRelationType eRelationType
,
159 ::utl::AccessibleRelationSetHelper
* pRelationSet
);
160 void AddRelation(const ScRange
& rRange
,
161 const AccessibleRelationType eRelationType
,
162 ::utl::AccessibleRelationSetHelper
* pRelationSet
);
163 bool IsFormulaMode();
164 bool IsDropdown() const;
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */