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_ACCESSIBLECELL_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLECELL_HXX
23 #include "AccessibleCellBase.hxx"
25 #include "viewdata.hxx"
26 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
27 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
28 #include <rtl/ref.hxx>
29 #include <unotools/accessiblerelationsethelper.hxx>
30 #include <editeng/AccessibleStaticTextBase.hxx>
31 #include <comphelper/uno3.hxx>
34 class ScAccessibleDocument
;
36 typedef cppu::ImplHelper1
< css::accessibility::XAccessibleExtendedAttributes
>
37 ScAccessibleCellAttributeImpl
;
40 This base class provides an implementation of the
41 <code>AccessibleCell</code> service.
43 class ScAccessibleCell
44 : public ScAccessibleCellBase
,
45 public accessibility::AccessibleStaticTextBase
,
46 public ScAccessibleCellAttributeImpl
49 static rtl::Reference
<ScAccessibleCell
> create(
50 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParent
,
51 ScTabViewShell
* pViewShell
,
52 ScAddress
& rCellAddress
,
55 ScAccessibleDocument
* pAccDoc
);
59 const css::uno::Reference
<css::accessibility::XAccessible
>& rxParent
,
60 ScTabViewShell
* pViewShell
,
61 ScAddress
& rCellAddress
,
64 ScAccessibleDocument
* pAccDoc
);
66 virtual void Init() override
;
68 using ScAccessibleCellBase::disposing
;
69 virtual void SAL_CALL
disposing() override
;
72 virtual ~ScAccessibleCell();
74 using ScAccessibleCellBase::IsDefunc
;
77 ///===== XInterface =====================================================
81 ///===== XTypeProvider ===================================================
83 DECLARE_XTYPEPROVIDER()
85 ///===== XAccessibleComponent ============================================
87 virtual css::uno::Reference
< css::accessibility::XAccessible
>
88 SAL_CALL
getAccessibleAtPoint( const css::awt::Point
& rPoint
)
89 throw (css::uno::RuntimeException
, std::exception
) override
;
91 virtual void SAL_CALL
grabFocus( )
92 throw (css::uno::RuntimeException
, std::exception
) override
;
95 /// Return the object's current bounding box relative to the desktop.
96 virtual Rectangle
GetBoundingBoxOnScreen() const
97 throw (css::uno::RuntimeException
, std::exception
) override
;
99 /// Return the object's current bounding box relative to the parent object.
100 virtual Rectangle
GetBoundingBox() const
101 throw (css::uno::RuntimeException
, std::exception
) override
;
104 ///===== XAccessibleContext ==============================================
106 /// Return the number of currently visible children.
107 /// override to calculate this on demand
108 virtual sal_Int32 SAL_CALL
109 getAccessibleChildCount()
110 throw (css::uno::RuntimeException
, std::exception
) override
;
112 /// Return the specified child or NULL if index is invalid.
113 /// override to calculate this on demand
114 virtual css::uno::Reference
< css::accessibility::XAccessible
> SAL_CALL
115 getAccessibleChild(sal_Int32 nIndex
)
116 throw (css::uno::RuntimeException
,
117 css::lang::IndexOutOfBoundsException
, std::exception
) override
;
119 /// Return the set of current states.
120 virtual css::uno::Reference
<
121 css::accessibility::XAccessibleStateSet
> SAL_CALL
122 getAccessibleStateSet()
123 throw (css::uno::RuntimeException
, std::exception
) override
;
125 virtual css::uno::Reference
<
126 css::accessibility::XAccessibleRelationSet
> SAL_CALL
127 getAccessibleRelationSet()
128 throw (css::uno::RuntimeException
, std::exception
) override
;
130 ///===== XServiceInfo ====================================================
132 /** Returns an identifier for the implementation of this object.
134 virtual OUString SAL_CALL
135 getImplementationName()
136 throw (css::uno::RuntimeException
, std::exception
) override
;
138 /** Returns a list of all supported services.
140 virtual css::uno::Sequence
< OUString
> SAL_CALL
141 getSupportedServiceNames()
142 throw (css::uno::RuntimeException
, std::exception
) override
;
144 virtual css::uno::Any SAL_CALL
getExtendedAttributes()
145 throw (css::lang::IndexOutOfBoundsException
,
146 css::uno::RuntimeException
,
147 std::exception
) override
;
149 // Override this method to handle cell's ParaIndent attribute specially.
150 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
getCharacterAttributes( sal_Int32 nIndex
, const css::uno::Sequence
< OUString
>& aRequestedAttributes
)
151 throw (css::lang::IndexOutOfBoundsException
, css::uno::RuntimeException
, std::exception
) override
;
153 ScTabViewShell
* mpViewShell
;
154 ScAccessibleDocument
* mpAccDoc
;
156 ScSplitPos meSplitPos
;
159 const css::uno::Reference
<css::accessibility::XAccessibleStateSet
>& rxParentStates
);
160 virtual bool IsEditable(
161 const css::uno::Reference
<css::accessibility::XAccessibleStateSet
>& rxParentStates
) override
;
163 const css::uno::Reference
<css::accessibility::XAccessibleStateSet
>& rxParentStates
);
166 static ScDocument
* GetDocument(ScTabViewShell
* mpViewShell
);
168 ::std::unique_ptr
< SvxEditSource
> CreateEditSource(ScTabViewShell
* pViewShell
, ScAddress aCell
, ScSplitPos eSplitPos
);
170 void FillDependends(utl::AccessibleRelationSetHelper
* pRelationSet
);
171 void FillPrecedents(utl::AccessibleRelationSetHelper
* pRelationSet
);
172 void AddRelation(const ScAddress
& rCell
,
173 const sal_uInt16 aRelationType
,
174 ::utl::AccessibleRelationSetHelper
* pRelationSet
);
175 void AddRelation(const ScRange
& rRange
,
176 const sal_uInt16 aRelationType
,
177 ::utl::AccessibleRelationSetHelper
* pRelationSet
);
178 bool IsFormulaMode();
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */