xref: /aoo42x/main/sc/source/ui/inc/AccessibleCell.hxx (revision 4937ceef)
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 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
36 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
37 #endif
38 
39 class ScTabViewShell;
40 class ScAccessibleDocument;
41 
42 typedef cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleExtendedAttributes>
43 					ScAccessibleCellAttributeImpl;
44 
45 /**	@descr
46         This base class provides an implementation of the
47         <code>AccessibleCell</code> service.
48 */
49 class ScAccessibleCell
50 	:	public	ScAccessibleCellBase,
51         public  accessibility::AccessibleStaticTextBase,
52 		public  ScAccessibleCellAttributeImpl
53 {
54 public:
55 	//=====  internal  ========================================================
56 	ScAccessibleCell(
57         const ::com::sun::star::uno::Reference<
58         ::com::sun::star::accessibility::XAccessible>& rxParent,
59 		ScTabViewShell* pViewShell,
60 		ScAddress& rCellAddress,
61 		sal_Int32 nIndex,
62 		ScSplitPos eSplitPos,
63         ScAccessibleDocument* pAccDoc);
64 
65 	virtual void Init();
66 
67     using ScAccessibleCellBase::disposing;
68     virtual void SAL_CALL disposing();
69 
70 protected:
71 	virtual ~ScAccessibleCell();
72 
73     using ScAccessibleCellBase::IsDefunc;
74 
75 public:
76 	///=====  XInterface  =====================================================
77 
78 	DECLARE_XINTERFACE()
79 
80     ///=====  XTypeProvider  ===================================================
81 
82     DECLARE_XTYPEPROVIDER()
83 
84     ///=====  XAccessibleComponent  ============================================
85 
86     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
87 		SAL_CALL getAccessibleAtPoint(
88 		const ::com::sun::star::awt::Point& rPoint )
89 		throw (::com::sun::star::uno::RuntimeException);
90 
91     virtual void SAL_CALL grabFocus(  )
92 		throw (::com::sun::star::uno::RuntimeException);
93 
94 protected:
95     ///	Return the object's current bounding box relative to the desktop.
96 	virtual Rectangle GetBoundingBoxOnScreen(void) const
97 		throw (::com::sun::star::uno::RuntimeException);
98 
99 	///	Return the object's current bounding box relative to the parent object.
100 	virtual Rectangle GetBoundingBox(void) const
101 		throw (::com::sun::star::uno::RuntimeException);
102 
103 public:
104 	///=====  XAccessibleContext  ==============================================
105 
106     ///	Return the number of currently visible children.
107     // is overloaded to calculate this on demand
108     virtual sal_Int32 SAL_CALL
109     	getAccessibleChildCount(void)
110     				throw (::com::sun::star::uno::RuntimeException);
111 
112     ///	Return the specified child or NULL if index is invalid.
113     // is overloaded to calculate this on demand
114     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
115     	getAccessibleChild(sal_Int32 nIndex)
116         throw (::com::sun::star::uno::RuntimeException,
117 				::com::sun::star::lang::IndexOutOfBoundsException);
118 
119 	///	Return the set of current states.
120 	virtual ::com::sun::star::uno::Reference<
121             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
122     	getAccessibleStateSet(void)
123         throw (::com::sun::star::uno::RuntimeException);
124 
125 	virtual ::com::sun::star::uno::Reference<
126 		::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
127    		getAccessibleRelationSet(void)
128 		throw (::com::sun::star::uno::RuntimeException);
129 
130 	///=====  XServiceInfo  ====================================================
131 
132     /**	Returns an identifier for the implementation of this object.
133     */
134 	virtual ::rtl::OUString SAL_CALL
135     	getImplementationName(void)
136         throw (::com::sun::star::uno::RuntimeException);
137 
138 	/** Returns a list of all supported services.
139     */
140 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
141     	getSupportedServiceNames(void)
142         throw (::com::sun::star::uno::RuntimeException);
143 
144     virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
145 		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
146 
147 	// Override this method to handle cell's ParaIndent attribute specially.
148     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
149 		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
150 private:
151 	ScTabViewShell* mpViewShell;
152     ScAccessibleDocument* mpAccDoc;
153 
154 	ScSplitPos meSplitPos;
155 
156 	sal_Bool IsDefunc(
157 		const com::sun::star::uno::Reference<
158 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
159 	virtual sal_Bool IsEditable(
160 		const com::sun::star::uno::Reference<
161 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
162 	sal_Bool IsOpaque(
163 		const com::sun::star::uno::Reference<
164 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
165 	sal_Bool IsSelected();
166 
167 	ScDocument* GetDocument(ScTabViewShell* mpViewShell);
168 
169 	::std::auto_ptr< SvxEditSource > CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos);
170 
171 	void FillDependends(utl::AccessibleRelationSetHelper* pRelationSet);
172 	void FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet);
173 	void AddRelation(const ScAddress& rCell,
174 		const sal_uInt16 aRelationType,
175 		::utl::AccessibleRelationSetHelper* pRelationSet);
176 	void AddRelation(const ScRange& rRange,
177 		const sal_uInt16 aRelationType,
178 		::utl::AccessibleRelationSetHelper* pRelationSet);
179 	sal_Bool IsFormulaMode();
180 	sal_Bool IsDropdown();
181 };
182 
183 
184 #endif
185