13334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
33334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
43334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
53334a7e6SAndrew Rist  * distributed with this work for additional information
63334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
73334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
83334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
93334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
103334a7e6SAndrew Rist  *
113334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
123334a7e6SAndrew Rist  *
133334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
143334a7e6SAndrew Rist  * software distributed under the License is distributed on an
153334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
163334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
173334a7e6SAndrew Rist  * specific language governing permissions and limitations
183334a7e6SAndrew Rist  * under the License.
193334a7e6SAndrew Rist  *
203334a7e6SAndrew Rist  *************************************************************/
213334a7e6SAndrew Rist 
223334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CELL_HXX
25cdf0e10cSrcweir #define _SVX_ACCESSIBILITY_ACCESSIBLE_CELL_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp>
28cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
29cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp>
30cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <rtl/ref.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <editeng/AccessibleContextBase.hxx>
35cdf0e10cSrcweir #include <editeng/AccessibleComponentBase.hxx>
36cdf0e10cSrcweir #include <svx/IAccessibleViewForwarderListener.hxx>
37cdf0e10cSrcweir #include <svx/AccessibleTextHelper.hxx>
38cdf0e10cSrcweir #include <svx/AccessibleShapeTreeInfo.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include "cell.hxx"
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include <boost/noncopyable.hpp>
45cdf0e10cSrcweir 
46*9b8096d0SSteve Yin #include <svx/AccessibleTableShape.hxx>
47*9b8096d0SSteve Yin 
48cdf0e10cSrcweir class SdrObject;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace accessibility
52cdf0e10cSrcweir {
53cdf0e10cSrcweir 
54cdf0e10cSrcweir class AccessibleShapeInfo;
55cdf0e10cSrcweir class AccessibleShapeTreeInfo;
56cdf0e10cSrcweir class IAccessibleParent;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir typedef ::cppu::ImplInheritanceHelper1< AccessibleContextBase, ::com::sun::star::accessibility::XAccessibleExtendedComponent > AccessibleCellBase;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir class AccessibleCell : boost::noncopyable, public AccessibleCellBase, public AccessibleComponentBase, public IAccessibleViewForwarderListener
61cdf0e10cSrcweir {
62cdf0e10cSrcweir public:
63cdf0e10cSrcweir 	AccessibleCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, const sdr::table::CellRef& rCell, sal_Int32 nIndex, const AccessibleShapeTreeInfo& rShapeTreeInfo);
64cdf0e10cSrcweir 	virtual ~AccessibleCell (void);
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     virtual void Init (void);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     virtual bool operator== (const AccessibleCell& rAccessibleCell);
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 	virtual sal_Bool SetState (sal_Int16 aState);
71cdf0e10cSrcweir 	virtual sal_Bool ResetState (sal_Int16 aState);
72cdf0e10cSrcweir     sal_Bool GetState (sal_Int16 aState);
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	// XInterface
75cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
76cdf0e10cSrcweir     virtual void SAL_CALL acquire(  ) throw ();
77cdf0e10cSrcweir     virtual void SAL_CALL release(  ) throw ();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	// XAccessibleContext
80cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleChildCount(void) throw(::com::sun::star::uno::RuntimeException);
81cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int32 nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
82cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet(void) throw(::com::sun::star::uno::RuntimeException);
83cdf0e10cSrcweir 	virtual	sal_Int32 SAL_CALL getAccessibleIndexInParent(void) throw(::com::sun::star::uno::RuntimeException);
84cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
85*9b8096d0SSteve Yin 	sdr::table::CellRef getCellRef();
86*9b8096d0SSteve Yin 	void UpdateChildren();
87*9b8096d0SSteve Yin 	::rtl::OUString getCellName( sal_Int32 nCol, sal_Int32 nRow );
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	// XAccessibleComponent
90cdf0e10cSrcweir     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException);
91cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const ::com::sun::star::awt::Point& aPoint) throw(::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir 	virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(void) throw(::com::sun::star::uno::RuntimeException);
93cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocation(void) throw(::com::sun::star::uno::RuntimeException);
94cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(void) throw(::com::sun::star::uno::RuntimeException);
95cdf0e10cSrcweir     virtual ::com::sun::star::awt::Size SAL_CALL getSize(void) throw(::com::sun::star::uno::RuntimeException);
96cdf0e10cSrcweir     virtual void SAL_CALL addFocusListener ( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener) throw (::com::sun::star::uno::RuntimeException);
97cdf0e10cSrcweir 	virtual void SAL_CALL removeFocusListener (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
98cdf0e10cSrcweir     virtual void SAL_CALL grabFocus (void) throw (::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getForeground(void) throw(::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getBackground(void) throw(::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir     // XAccessibleExtendedComponent
103cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont (void) throw (::com::sun::star::uno::RuntimeException);
104cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getTitledBorderText (void) throw (::com::sun::star::uno::RuntimeException);
105cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getToolTipText (void) throw (::com::sun::star::uno::RuntimeException);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     // XAccessibleEventBroadcaster
108cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) throw(::com::sun::star::uno::RuntimeException);
109cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& rxListener) throw(::com::sun::star::uno::RuntimeException);
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	// XServiceInfo
112cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName (void) throw(::com::sun::star::uno::RuntimeException);
113cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames (void) throw(::com::sun::star::uno::RuntimeException);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     // IAccessibleViewForwarderListener
116cdf0e10cSrcweir     virtual void ViewForwarderChanged (ChangeType aChangeType, const IAccessibleViewForwarder* pViewForwarder);
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 	using cppu::WeakComponentImplHelperBase::addEventListener;
119cdf0e10cSrcweir 	using cppu::WeakComponentImplHelperBase::removeEventListener;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     // Misc
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	/** set the index _nIndex at the accessible cell param	_nIndex The new index in parent.
124cdf0e10cSrcweir 	*/
setIndexInParent(sal_Int32 _nIndex)125cdf0e10cSrcweir 	inline void setIndexInParent(sal_Int32 _nIndex) { mnIndexInParent = _nIndex; }
126cdf0e10cSrcweir 
127*9b8096d0SSteve Yin 	//Get the parent table
GetParentTable()128*9b8096d0SSteve Yin 	AccessibleTableShape* GetParentTable() { return pAccTable; }
129cdf0e10cSrcweir protected:
130cdf0e10cSrcweir     /// Bundle of information passed to all shapes in a document tree.
131cdf0e10cSrcweir     AccessibleShapeTreeInfo maShapeTreeInfo;
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	/// the index in parent.
134cdf0e10cSrcweir 	sal_Int32 mnIndexInParent;
135cdf0e10cSrcweir 
136cdf0e10cSrcweir     /// The accessible text engine.  May be NULL if it can not be created.
137cdf0e10cSrcweir     AccessibleTextHelper* mpText;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	sdr::table::CellRef mxCell;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     /// This method is called from the component helper base class while disposing.
142cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
143cdf0e10cSrcweir 
144*9b8096d0SSteve Yin 	AccessibleTableShape *pAccTable;
145*9b8096d0SSteve Yin 
146cdf0e10cSrcweir private:
147cdf0e10cSrcweir     explicit AccessibleCell(void);	// not implemented
148cdf0e10cSrcweir     explicit AccessibleCell(const AccessibleCell&); // not implemented
149cdf0e10cSrcweir     AccessibleCell& operator=(const AccessibleCell&); // not implemented
150cdf0e10cSrcweir };
151cdf0e10cSrcweir 
152cdf0e10cSrcweir } // end of namespace accessibility
153cdf0e10cSrcweir 
154cdf0e10cSrcweir #endif
155