xref: /aoo42x/main/sc/source/ui/inc/AccessibleCell.hxx (revision 38d50f7b)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 
25 #ifndef _SC_ACCESSIBLECELL_HXX
26 #define _SC_ACCESSIBLECELL_HXX
27 
28 #include "AccessibleCellBase.hxx"
29 #include "global.hxx"
30 #include "viewdata.hxx"
31 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
32 #include <unotools/accessiblerelationsethelper.hxx>
33 #include <editeng/AccessibleStaticTextBase.hxx>
34 #include <comphelper/uno3.hxx>
35 
36 class ScTabViewShell;
37 class ScAccessibleDocument;
38 
39 /**	@descr
40         This base class provides an implementation of the
41         <code>AccessibleCell</code> service.
42 */
43 class ScAccessibleCell
44 	:	public	ScAccessibleCellBase,
45         public  accessibility::AccessibleStaticTextBase
46 {
47 public:
48 	//=====  internal  ========================================================
49 	ScAccessibleCell(
50         const ::com::sun::star::uno::Reference<
51         ::com::sun::star::accessibility::XAccessible>& rxParent,
52 		ScTabViewShell* pViewShell,
53 		ScAddress& rCellAddress,
54 		sal_Int32 nIndex,
55 		ScSplitPos eSplitPos,
56         ScAccessibleDocument* pAccDoc);
57 
58 	virtual void Init();
59 
60     using ScAccessibleCellBase::disposing;
61     virtual void SAL_CALL disposing();
62 
63 protected:
64 	virtual ~ScAccessibleCell();
65 
66     using ScAccessibleCellBase::IsDefunc;
67 
68 public:
69 	///=====  XInterface  =====================================================
70 
71 	DECLARE_XINTERFACE()
72 
73     ///=====  XTypeProvider  ===================================================
74 
75     DECLARE_XTYPEPROVIDER()
76 
77     ///=====  XAccessibleComponent  ============================================
78 
79     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
80 		SAL_CALL getAccessibleAtPoint(
81 		const ::com::sun::star::awt::Point& rPoint )
82 		throw (::com::sun::star::uno::RuntimeException);
83 
84     virtual void SAL_CALL grabFocus(  )
85 		throw (::com::sun::star::uno::RuntimeException);
86 
87 protected:
88     ///	Return the object's current bounding box relative to the desktop.
89 	virtual Rectangle GetBoundingBoxOnScreen(void) const
90 		throw (::com::sun::star::uno::RuntimeException);
91 
92 	///	Return the object's current bounding box relative to the parent object.
93 	virtual Rectangle GetBoundingBox(void) const
94 		throw (::com::sun::star::uno::RuntimeException);
95 
96 public:
97 	///=====  XAccessibleContext  ==============================================
98 
99     ///	Return the number of currently visible children.
100     // is overloaded to calculate this on demand
101     virtual sal_Int32 SAL_CALL
102     	getAccessibleChildCount(void)
103     				throw (::com::sun::star::uno::RuntimeException);
104 
105     ///	Return the specified child or NULL if index is invalid.
106     // is overloaded to calculate this on demand
107     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
108     	getAccessibleChild(sal_Int32 nIndex)
109         throw (::com::sun::star::uno::RuntimeException,
110 				::com::sun::star::lang::IndexOutOfBoundsException);
111 
112 	///	Return the set of current states.
113 	virtual ::com::sun::star::uno::Reference<
114             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
115     	getAccessibleStateSet(void)
116         throw (::com::sun::star::uno::RuntimeException);
117 
118 	virtual ::com::sun::star::uno::Reference<
119 		::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
120    		getAccessibleRelationSet(void)
121 		throw (::com::sun::star::uno::RuntimeException);
122 
123 	///=====  XServiceInfo  ====================================================
124 
125     /**	Returns an identifier for the implementation of this object.
126     */
127 	virtual ::rtl::OUString SAL_CALL
128     	getImplementationName(void)
129         throw (::com::sun::star::uno::RuntimeException);
130 
131 	/** Returns a list of all supported services.
132     */
133 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
134     	getSupportedServiceNames(void)
135         throw (::com::sun::star::uno::RuntimeException);
136 
137 private:
138 	ScTabViewShell* mpViewShell;
139     ScAccessibleDocument* mpAccDoc;
140 
141 	ScSplitPos meSplitPos;
142 
143 	sal_Bool IsDefunc(
144 		const com::sun::star::uno::Reference<
145 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
146 	virtual sal_Bool IsEditable(
147 		const com::sun::star::uno::Reference<
148 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
149 	sal_Bool IsOpaque(
150 		const com::sun::star::uno::Reference<
151 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
152 	sal_Bool IsSelected();
153 
154 	ScDocument* GetDocument(ScTabViewShell* mpViewShell);
155 
156 	::std::auto_ptr< SvxEditSource > CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos);
157 
158 	void FillDependends(utl::AccessibleRelationSetHelper* pRelationSet);
159 	void FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet);
160 	void AddRelation(const ScAddress& rCell,
161 		const sal_uInt16 aRelationType,
162 		::utl::AccessibleRelationSetHelper* pRelationSet);
163 	void AddRelation(const ScRange& rRange,
164 		const sal_uInt16 aRelationType,
165 		::utl::AccessibleRelationSetHelper* pRelationSet);
166 };
167 
168 
169 #endif
170