xref: /aoo41x/main/sc/source/ui/inc/AccessibleCell.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 
29 #ifndef _SC_ACCESSIBLECELL_HXX
30 #define _SC_ACCESSIBLECELL_HXX
31 
32 #include "AccessibleCellBase.hxx"
33 #include "global.hxx"
34 #include "viewdata.hxx"
35 #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
36 #include <unotools/accessiblerelationsethelper.hxx>
37 #include <editeng/AccessibleStaticTextBase.hxx>
38 #include <comphelper/uno3.hxx>
39 
40 class ScTabViewShell;
41 class ScAccessibleDocument;
42 
43 /**	@descr
44         This base class provides an implementation of the
45         <code>AccessibleCell</code> service.
46 */
47 class ScAccessibleCell
48 	:	public	ScAccessibleCellBase,
49         public  accessibility::AccessibleStaticTextBase
50 {
51 public:
52 	//=====  internal  ========================================================
53 	ScAccessibleCell(
54         const ::com::sun::star::uno::Reference<
55         ::com::sun::star::accessibility::XAccessible>& rxParent,
56 		ScTabViewShell* pViewShell,
57 		ScAddress& rCellAddress,
58 		sal_Int32 nIndex,
59 		ScSplitPos eSplitPos,
60         ScAccessibleDocument* pAccDoc);
61 
62 	virtual void Init();
63 
64     using ScAccessibleCellBase::disposing;
65     virtual void SAL_CALL disposing();
66 
67 protected:
68 	virtual ~ScAccessibleCell();
69 
70     using ScAccessibleCellBase::IsDefunc;
71 
72 public:
73 	///=====  XInterface  =====================================================
74 
75 	DECLARE_XINTERFACE()
76 
77     ///=====  XTypeProvider  ===================================================
78 
79     DECLARE_XTYPEPROVIDER()
80 
81     ///=====  XAccessibleComponent  ============================================
82 
83     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
84 		SAL_CALL getAccessibleAtPoint(
85 		const ::com::sun::star::awt::Point& rPoint )
86 		throw (::com::sun::star::uno::RuntimeException);
87 
88     virtual void SAL_CALL grabFocus(  )
89 		throw (::com::sun::star::uno::RuntimeException);
90 
91 protected:
92     ///	Return the object's current bounding box relative to the desktop.
93 	virtual Rectangle GetBoundingBoxOnScreen(void) const
94 		throw (::com::sun::star::uno::RuntimeException);
95 
96 	///	Return the object's current bounding box relative to the parent object.
97 	virtual Rectangle GetBoundingBox(void) const
98 		throw (::com::sun::star::uno::RuntimeException);
99 
100 public:
101 	///=====  XAccessibleContext  ==============================================
102 
103     ///	Return the number of currently visible children.
104     // is overloaded to calculate this on demand
105     virtual sal_Int32 SAL_CALL
106     	getAccessibleChildCount(void)
107     				throw (::com::sun::star::uno::RuntimeException);
108 
109     ///	Return the specified child or NULL if index is invalid.
110     // is overloaded to calculate this on demand
111     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
112     	getAccessibleChild(sal_Int32 nIndex)
113         throw (::com::sun::star::uno::RuntimeException,
114 				::com::sun::star::lang::IndexOutOfBoundsException);
115 
116 	///	Return the set of current states.
117 	virtual ::com::sun::star::uno::Reference<
118             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
119     	getAccessibleStateSet(void)
120         throw (::com::sun::star::uno::RuntimeException);
121 
122 	virtual ::com::sun::star::uno::Reference<
123 		::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
124    		getAccessibleRelationSet(void)
125 		throw (::com::sun::star::uno::RuntimeException);
126 
127 	///=====  XServiceInfo  ====================================================
128 
129     /**	Returns an identifier for the implementation of this object.
130     */
131 	virtual ::rtl::OUString SAL_CALL
132     	getImplementationName(void)
133         throw (::com::sun::star::uno::RuntimeException);
134 
135 	/** Returns a list of all supported services.
136     */
137 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
138     	getSupportedServiceNames(void)
139         throw (::com::sun::star::uno::RuntimeException);
140 
141 private:
142 	ScTabViewShell* mpViewShell;
143     ScAccessibleDocument* mpAccDoc;
144 
145 	ScSplitPos meSplitPos;
146 
147 	sal_Bool IsDefunc(
148 		const com::sun::star::uno::Reference<
149 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
150 	virtual sal_Bool IsEditable(
151 		const com::sun::star::uno::Reference<
152 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
153 	sal_Bool IsOpaque(
154 		const com::sun::star::uno::Reference<
155 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
156 	sal_Bool IsSelected();
157 
158 	ScDocument* GetDocument(ScTabViewShell* mpViewShell);
159 
160 	::std::auto_ptr< SvxEditSource > CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos);
161 
162 	void FillDependends(utl::AccessibleRelationSetHelper* pRelationSet);
163 	void FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet);
164 	void AddRelation(const ScAddress& rCell,
165 		const sal_uInt16 aRelationType,
166 		::utl::AccessibleRelationSetHelper* pRelationSet);
167 	void AddRelation(const ScRange& rRange,
168 		const sal_uInt16 aRelationType,
169 		::utl::AccessibleRelationSetHelper* pRelationSet);
170 };
171 
172 
173 #endif
174