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
< ::com::sun::star::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 ::com::sun::star::uno::Reference
<
51 ::com::sun::star::accessibility::XAccessible
>& rxParent
,
52 ScTabViewShell
* pViewShell
,
53 ScAddress
& rCellAddress
,
56 ScAccessibleDocument
* pAccDoc
);
60 const ::com::sun::star::uno::Reference
<
61 ::com::sun::star::accessibility::XAccessible
>& rxParent
,
62 ScTabViewShell
* pViewShell
,
63 ScAddress
& rCellAddress
,
66 ScAccessibleDocument
* pAccDoc
);
68 virtual void Init() SAL_OVERRIDE
;
70 using ScAccessibleCellBase::disposing
;
71 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
74 virtual ~ScAccessibleCell();
76 using ScAccessibleCellBase::IsDefunc
;
79 ///===== XInterface =====================================================
83 ///===== XTypeProvider ===================================================
85 DECLARE_XTYPEPROVIDER()
87 ///===== XAccessibleComponent ============================================
89 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>
90 SAL_CALL
getAccessibleAtPoint(
91 const ::com::sun::star::awt::Point
& rPoint
)
92 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual void SAL_CALL
grabFocus( )
95 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 /// Return the object's current bounding box relative to the desktop.
99 virtual Rectangle
GetBoundingBoxOnScreen() const
100 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 /// Return the object's current bounding box relative to the parent object.
103 virtual Rectangle
GetBoundingBox() const
104 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
107 ///===== XAccessibleContext ==============================================
109 /// Return the number of currently visible children.
110 /// override to calculate this on demand
111 virtual sal_Int32 SAL_CALL
112 getAccessibleChildCount()
113 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
115 /// Return the specified child or NULL if index is invalid.
116 /// override to calculate this on demand
117 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> SAL_CALL
118 getAccessibleChild(sal_Int32 nIndex
)
119 throw (::com::sun::star::uno::RuntimeException
,
120 ::com::sun::star::lang::IndexOutOfBoundsException
, std::exception
) SAL_OVERRIDE
;
122 /// Return the set of current states.
123 virtual ::com::sun::star::uno::Reference
<
124 ::com::sun::star::accessibility::XAccessibleStateSet
> SAL_CALL
125 getAccessibleStateSet()
126 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual ::com::sun::star::uno::Reference
<
129 ::com::sun::star::accessibility::XAccessibleRelationSet
> SAL_CALL
130 getAccessibleRelationSet()
131 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 ///===== XServiceInfo ====================================================
135 /** Returns an identifier for the implementation of this object.
137 virtual OUString SAL_CALL
138 getImplementationName()
139 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
141 /** Returns a list of all supported services.
143 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
144 getSupportedServiceNames()
145 throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
147 virtual ::com::sun::star::uno::Any SAL_CALL
getExtendedAttributes()
148 throw (::com::sun::star::lang::IndexOutOfBoundsException
,
149 ::com::sun::star::uno::RuntimeException
,
150 std::exception
) SAL_OVERRIDE
;
152 // Override this method to handle cell's ParaIndent attribute specially.
153 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> SAL_CALL
getCharacterAttributes( sal_Int32 nIndex
, const ::com::sun::star::uno::Sequence
< OUString
>& aRequestedAttributes
)
154 throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 ScTabViewShell
* mpViewShell
;
157 ScAccessibleDocument
* mpAccDoc
;
159 ScSplitPos meSplitPos
;
162 const com::sun::star::uno::Reference
<
163 ::com::sun::star::accessibility::XAccessibleStateSet
>& rxParentStates
);
164 virtual bool IsEditable(
165 const com::sun::star::uno::Reference
<
166 ::com::sun::star::accessibility::XAccessibleStateSet
>& rxParentStates
) SAL_OVERRIDE
;
168 const com::sun::star::uno::Reference
<
169 ::com::sun::star::accessibility::XAccessibleStateSet
>& rxParentStates
);
172 static ScDocument
* GetDocument(ScTabViewShell
* mpViewShell
);
174 ::std::unique_ptr
< SvxEditSource
> CreateEditSource(ScTabViewShell
* pViewShell
, ScAddress aCell
, ScSplitPos eSplitPos
);
176 void FillDependends(utl::AccessibleRelationSetHelper
* pRelationSet
);
177 void FillPrecedents(utl::AccessibleRelationSetHelper
* pRelationSet
);
178 void AddRelation(const ScAddress
& rCell
,
179 const sal_uInt16 aRelationType
,
180 ::utl::AccessibleRelationSetHelper
* pRelationSet
);
181 void AddRelation(const ScRange
& rRange
,
182 const sal_uInt16 aRelationType
,
183 ::utl::AccessibleRelationSetHelper
* pRelationSet
);
184 bool IsFormulaMode();
190 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */