xref: /aoo41x/main/sw/source/core/access/acccontext.hxx (revision 4d7c9de0)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
101d2dbeb0SAndrew Rist  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
121d2dbeb0SAndrew Rist  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
191d2dbeb0SAndrew Rist  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _ACCBASE_HXX
24cdf0e10cSrcweir #define _ACCBASE_HXX
25cdf0e10cSrcweir #include <accframe.hxx>
26cdf0e10cSrcweir #include <accmap.hxx>
27cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
28cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
31cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
32cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class Window;
35cdf0e10cSrcweir class SwAccessibleMap;
36cdf0e10cSrcweir class SwCrsrShell;
37cdf0e10cSrcweir class SdrObject;
38cdf0e10cSrcweir class SwPaM;
39cdf0e10cSrcweir namespace utl {
40cdf0e10cSrcweir     class AccessibleStateSetHelper;
41cdf0e10cSrcweir }
42cdf0e10cSrcweir namespace accessibility {
43cdf0e10cSrcweir     class AccessibleShape;
44cdf0e10cSrcweir }
45cdf0e10cSrcweir class SwFmtFld;
46cdf0e10cSrcweir class SwAccessibleChildContainer;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir const sal_Char sAccessibleServiceName[] = "com.sun.star.accessibility.Accessible";
49cdf0e10cSrcweir 
50cdf0e10cSrcweir class SwAccessibleContext :
51cdf0e10cSrcweir 	public ::cppu::WeakImplHelper5<
52cdf0e10cSrcweir 				::com::sun::star::accessibility::XAccessible,
53cdf0e10cSrcweir                 ::com::sun::star::accessibility::XAccessibleContext,
54cdf0e10cSrcweir                 ::com::sun::star::accessibility::XAccessibleComponent,
55cdf0e10cSrcweir 				::com::sun::star::accessibility::XAccessibleEventBroadcaster,
56cdf0e10cSrcweir                 ::com::sun::star::lang::XServiceInfo
57cdf0e10cSrcweir                 >,
58cdf0e10cSrcweir 	public SwAccessibleFrame
59cdf0e10cSrcweir {
60cdf0e10cSrcweir     // The implements for the XAccessibleSelection interface has been
61cdf0e10cSrcweir     // 'externalized' and wants access to the protected members like
62cdf0e10cSrcweir     // GetMap, GetChild, GetParent, and GetFrm.
63cdf0e10cSrcweir     friend class SwAccessibleSelectionHelper;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir protected:
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	mutable ::osl::Mutex aListenerMutex;
69cdf0e10cSrcweir 	mutable ::vos::OMutex aMutex;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir private:
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	::rtl::OUString sName;	// immutable outside constructor
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	// The parent if it has been retrieved. This is always an
76cdf0e10cSrcweir 	// SwAccessibleContext. (protected by Mutex)
77cdf0e10cSrcweir 	::com::sun::star::uno::WeakReference <
78cdf0e10cSrcweir 		::com::sun::star::accessibility::XAccessible > xWeakParent;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	SwAccessibleMap *pMap; 	// must be protected by solar mutex
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     sal_uInt32 nClientId;   // client id in the AccessibleEventNotifier queue
83cdf0e10cSrcweir     sal_Int16 nRole;		// immutable outside constructor
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	// The current states (protected by mutex)
86cdf0e10cSrcweir 	sal_Bool bIsShowingState : 1;
87cdf0e10cSrcweir 	sal_Bool bIsEditableState : 1;
88cdf0e10cSrcweir 	sal_Bool bIsOpaqueState : 1;
89cdf0e10cSrcweir 	sal_Bool bIsDefuncState : 1;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	// Are we currently disposing that object (protected by solar mutex)?
92cdf0e10cSrcweir 	sal_Bool bDisposing : 1;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     // --> OD 2008-03-10 #i85634#
95cdf0e10cSrcweir     // boolean, indicating if the accessible context is in general registered at
96cdf0e10cSrcweir     // the accessible map.
97cdf0e10cSrcweir     bool bRegisteredAtAccessibleMap;
98cdf0e10cSrcweir     // <--
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	void InitStates();
101*ca62e2c2SSteve Yin 	//Solution:Add a member to identify the firt time that document load
102*ca62e2c2SSteve Yin 	sal_Bool bBeginDocumentLoad;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir protected:
SetName(const::rtl::OUString & rName)105cdf0e10cSrcweir 	void SetName( const ::rtl::OUString& rName ) { sName = rName; }
GetRole() const106cdf0e10cSrcweir     inline sal_Int16 GetRole() const
107cdf0e10cSrcweir     {
108cdf0e10cSrcweir         return nRole;
109cdf0e10cSrcweir     }
110*ca62e2c2SSteve Yin 	//Solution:Add a member to identify if the document is Asyn load.
111*ca62e2c2SSteve Yin     sal_Bool isIfAsynLoad;
112*ca62e2c2SSteve Yin 	//This flag is used to mark the object's selected state.
113*ca62e2c2SSteve Yin 	sal_Bool   bIsSeletedInDoc;
114cdf0e10cSrcweir 	void SetParent( SwAccessibleContext *pParent );
115cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> GetWeakParent() const;
116cdf0e10cSrcweir 
IsDisposing() const117cdf0e10cSrcweir 	sal_Bool IsDisposing() const { return bDisposing; }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	Window *GetWindow();
GetMap()120cdf0e10cSrcweir 	SwAccessibleMap *GetMap() { return pMap; }
GetMap() const121cdf0e10cSrcweir 	const SwAccessibleMap *GetMap() const { return pMap; }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     /** convenience method to get the SwViewShell through accessibility map */
GetShell()124cdf0e10cSrcweir     inline ViewShell* GetShell()
125cdf0e10cSrcweir     {
126cdf0e10cSrcweir         return GetMap()->GetShell();
127cdf0e10cSrcweir     }
GetShell() const128cdf0e10cSrcweir     inline const ViewShell* GetShell() const
129cdf0e10cSrcweir     {
130cdf0e10cSrcweir         return GetMap()->GetShell();
131cdf0e10cSrcweir     }
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     /** convenience method to get SwCrsrShell through accessibility map
134cdf0e10cSrcweir      * @returns SwCrsrShell, or NULL if none is found */
135cdf0e10cSrcweir     SwCrsrShell* GetCrsrShell();
136cdf0e10cSrcweir     const SwCrsrShell* GetCrsrShell() const;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	// Notify all children that the vis araea has changed.
139cdf0e10cSrcweir 	// The SwFrm might belong to the current object or to any other child or
140cdf0e10cSrcweir 	// grandchild.
141cdf0e10cSrcweir 	void ChildrenScrolled( const SwFrm *pFrm, const SwRect& rOldVisArea );
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	// The context's showing state changed. May only be called for context that
144cdf0e10cSrcweir 	// exist even if they aren't visible.
145cdf0e10cSrcweir 	void Scrolled( const SwRect& rOldVisArea );
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 	// A child has been moved while setting the vis area
148cdf0e10cSrcweir 	void ScrolledWithin( const SwRect& rOldVisArea );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 	// The has been added while setting the vis area
151cdf0e10cSrcweir 	void ScrolledIn();
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	// The context has to be removed while setting the vis area
154cdf0e10cSrcweir 	void ScrolledOut( const SwRect& rOldVisArea );
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	// Invalidate the states of all children of the specified SwFrm. The
157cdf0e10cSrcweir 	// SwFrm might belong the the current object or to any child or grandchild!
158cdf0e10cSrcweir     // --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
159cdf0e10cSrcweir     void InvalidateChildrenStates( const SwFrm* _pFrm,
160cdf0e10cSrcweir                                    tAccessibleStates _nStates );
161cdf0e10cSrcweir     // <--
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	// Dispose children of the specified SwFrm. The SwFrm might belong to
164cdf0e10cSrcweir 	// the current object or to any other child or grandchild.
165cdf0e10cSrcweir 	void DisposeChildren( const SwFrm *pFrm,
166cdf0e10cSrcweir 									   sal_Bool bRecursive );
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	void DisposeShape( const SdrObject *pObj,
169cdf0e10cSrcweir 								::accessibility::AccessibleShape *pAccImpl );
170cdf0e10cSrcweir 	void ScrolledInShape( const SdrObject *pObj,
171cdf0e10cSrcweir 								::accessibility::AccessibleShape *pAccImpl );
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 	virtual void _InvalidateContent( sal_Bool bVisibleDataFired );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	virtual void _InvalidateCursorPos();
176cdf0e10cSrcweir 	virtual void _InvalidateFocus();
177cdf0e10cSrcweir 
178cdf0e10cSrcweir public:
179cdf0e10cSrcweir 
SetMap(SwAccessibleMap * pM)180*ca62e2c2SSteve Yin 	void SetMap(SwAccessibleMap *pM){pMap = pM;}
181cdf0e10cSrcweir 	void FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventObject& rEvent );
182cdf0e10cSrcweir 
183cdf0e10cSrcweir protected:
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 	// broadcast visual data event
186cdf0e10cSrcweir 	void FireVisibleDataEvent();
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	// broadcast state change event
189cdf0e10cSrcweir 	void FireStateChangedEvent( sal_Int16 nState, sal_Bool bNewState );
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 	// Set states for getAccessibleStateSet.
192cdf0e10cSrcweir 	// This base class sets DEFUNC(0/1), EDITABLE(0/1), ENABLED(1),
193cdf0e10cSrcweir 	// SHOWING(0/1), OPAQUE(0/1) and VISIBLE(1).
194cdf0e10cSrcweir 	virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
195cdf0e10cSrcweir 
196cdf0e10cSrcweir  	sal_Bool IsEditableState();
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL
199cdf0e10cSrcweir         getBoundsImpl(sal_Bool bRelative)
200cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
201cdf0e10cSrcweir 
202cdf0e10cSrcweir     // --> OD 2008-03-10 #i85634#
NotRegisteredAtAccessibleMap()203cdf0e10cSrcweir     inline void NotRegisteredAtAccessibleMap()
204cdf0e10cSrcweir     {
205cdf0e10cSrcweir         bRegisteredAtAccessibleMap = false;
206cdf0e10cSrcweir     }
207cdf0e10cSrcweir     void RemoveFrmFromAccessibleMap();
208cdf0e10cSrcweir     // <--
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	virtual ~SwAccessibleContext();
211cdf0e10cSrcweir 
212cdf0e10cSrcweir public:
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 	SwAccessibleContext( SwAccessibleMap *pMap, sal_Int16 nRole,
215cdf0e10cSrcweir 						 const SwFrm *pFrm );
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	//=====  XAccessible  =====================================================
218cdf0e10cSrcweir 
219cdf0e10cSrcweir     ///	Return the XAccessibleContext.
220cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
221cdf0e10cSrcweir     	getAccessibleContext (void) throw (com::sun::star::uno::RuntimeException);
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	//=====  XAccessibleContext  ==============================================
224cdf0e10cSrcweir 
225cdf0e10cSrcweir     ///	Return the number of currently visible children.
226cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
227cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     ///	Return the specified child or NULL if index is invalid.
230cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
231cdf0e10cSrcweir     	getAccessibleChild (sal_Int32 nIndex)
232cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException,
233cdf0e10cSrcweir 				::com::sun::star::lang::IndexOutOfBoundsException);
234cdf0e10cSrcweir 
235cdf0e10cSrcweir     ///	Return a reference to the parent.
236cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
237cdf0e10cSrcweir     	getAccessibleParent (void)
238cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
239cdf0e10cSrcweir 
240cdf0e10cSrcweir     ///	Return this objects index among the parents children.
241cdf0e10cSrcweir 	virtual	sal_Int32 SAL_CALL
242cdf0e10cSrcweir     	getAccessibleIndexInParent (void)
243cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
244cdf0e10cSrcweir 
245cdf0e10cSrcweir     ///	Return this object's role.
246cdf0e10cSrcweir 	virtual sal_Int16 SAL_CALL
247cdf0e10cSrcweir     	getAccessibleRole (void)
248cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
249cdf0e10cSrcweir 
250cdf0e10cSrcweir     ///	Return this object's description.
251cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
252cdf0e10cSrcweir     	getAccessibleDescription (void)
253cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
254cdf0e10cSrcweir 
255cdf0e10cSrcweir     ///	Return the object's current name.
256cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
257cdf0e10cSrcweir     	getAccessibleName (void)
258cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	///	Return NULL to indicate that an empty relation set.
261cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference<
262cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
263cdf0e10cSrcweir     	getAccessibleRelationSet (void)
264cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
265cdf0e10cSrcweir 
266cdf0e10cSrcweir     ///	Return the set of current states.
267cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference<
268cdf0e10cSrcweir             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
269cdf0e10cSrcweir     	getAccessibleStateSet (void)
270cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 	/**	Return the parents locale or throw exception if this object has no
273cdf0e10cSrcweir     	parent yet/anymore.
274cdf0e10cSrcweir     */
275cdf0e10cSrcweir 	virtual ::com::sun::star::lang::Locale SAL_CALL
276cdf0e10cSrcweir     	getLocale (void)
277cdf0e10cSrcweir 		throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 	//=====  XAccessibleEventBroadcaster  =====================================
280cdf0e10cSrcweir 
281cdf0e10cSrcweir     virtual void SAL_CALL addEventListener(
282cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference<
283cdf0e10cSrcweir 				::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
284cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
285cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener(
286cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference<
287cdf0e10cSrcweir 				::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
288cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	//=====  XAccessibleComponent  ============================================
291cdf0e10cSrcweir     virtual sal_Bool SAL_CALL containsPoint(
292cdf0e10cSrcweir 			const ::com::sun::star::awt::Point& aPoint )
293cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
294cdf0e10cSrcweir 
295cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
296cdf0e10cSrcweir 		::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
297cdf0e10cSrcweir 				const ::com::sun::star::awt::Point& aPoint )
298cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
299cdf0e10cSrcweir 
300cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
301cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
302cdf0e10cSrcweir 
303cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
304cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
305cdf0e10cSrcweir 
306cdf0e10cSrcweir     virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
307cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
308cdf0e10cSrcweir 
309cdf0e10cSrcweir     virtual ::com::sun::star::awt::Size SAL_CALL getSize()
310cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
311cdf0e10cSrcweir 
312cdf0e10cSrcweir     virtual void SAL_CALL grabFocus()
313cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
314cdf0e10cSrcweir 
315cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
316cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
317cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getForeground()
318cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
319cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getBackground()
320cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 	//=====  XServiceInfo  ====================================================
324cdf0e10cSrcweir 
325cdf0e10cSrcweir     /**	Returns an identifier for the implementation of this object.
326cdf0e10cSrcweir     */
327cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL
328cdf0e10cSrcweir     	getImplementationName (void)
329cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
330cdf0e10cSrcweir 
331cdf0e10cSrcweir     /**	Return whether the specified service is supported by this class.
332cdf0e10cSrcweir     */
333cdf0e10cSrcweir     virtual sal_Bool SAL_CALL
334cdf0e10cSrcweir     	supportsService (const ::rtl::OUString& sServiceName)
335cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
336cdf0e10cSrcweir 
337cdf0e10cSrcweir     /** Returns a list of all supported services.  In this case that is just
338cdf0e10cSrcweir     	the AccessibleContext service.
339cdf0e10cSrcweir     */
340cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
341cdf0e10cSrcweir     	getSupportedServiceNames (void)
342cdf0e10cSrcweir              throw (::com::sun::star::uno::RuntimeException);
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 	//====== thread safe C++ interface ========================================
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 	// The object is not visible an longer and should be destroyed
347cdf0e10cSrcweir 	virtual void Dispose( sal_Bool bRecursive = sal_False );
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 	// The child object is not visible an longer and should be destroyed
350cdf0e10cSrcweir     virtual void DisposeChild( const sw::access::SwAccessibleChild& rFrmOrObj, sal_Bool bRecursive );
351cdf0e10cSrcweir 
352cdf0e10cSrcweir 	// The object has been moved by the layout
353cdf0e10cSrcweir 	virtual void InvalidatePosOrSize( const SwRect& rFrm );
354cdf0e10cSrcweir 
355cdf0e10cSrcweir 	// The vhild object has been moved by the layout
356cdf0e10cSrcweir     virtual void InvalidateChildPosOrSize( const sw::access::SwAccessibleChild& rFrmOrObj,
357cdf0e10cSrcweir 										   const SwRect& rFrm );
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	// The content may have changed (but it hasn't tohave changed)
360cdf0e10cSrcweir 	void InvalidateContent();
361cdf0e10cSrcweir 
362cdf0e10cSrcweir 	// The caretPos has changed
363cdf0e10cSrcweir 	void InvalidateCursorPos();
364cdf0e10cSrcweir 
365cdf0e10cSrcweir 	// The Focus state has changed
366cdf0e10cSrcweir 	void InvalidateFocus();
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 	// Check states
369cdf0e10cSrcweir     // --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
370cdf0e10cSrcweir     void InvalidateStates( tAccessibleStates _nStates );
371cdf0e10cSrcweir     // <--
372cdf0e10cSrcweir 
373cdf0e10cSrcweir     // the XAccessibleRelationSet may have changed
374cdf0e10cSrcweir     void InvalidateRelation( sal_uInt16 nType );
375cdf0e10cSrcweir 
376cdf0e10cSrcweir     /** text selection has changed
377cdf0e10cSrcweir 
378cdf0e10cSrcweir         OD 2005-12-14 #i27301#
379cdf0e10cSrcweir 
380cdf0e10cSrcweir         @author OD
381cdf0e10cSrcweir     */
382cdf0e10cSrcweir     void InvalidateTextSelection();
383cdf0e10cSrcweir 
384cdf0e10cSrcweir     /** attributes has changed
385cdf0e10cSrcweir 
386cdf0e10cSrcweir         OD 2009-01-06 #i88069#
387cdf0e10cSrcweir 
388cdf0e10cSrcweir         @author OD
389cdf0e10cSrcweir     */
390cdf0e10cSrcweir     void InvalidateAttr();
391cdf0e10cSrcweir 
392cdf0e10cSrcweir     bool HasAdditionalAccessibleChildren();
393cdf0e10cSrcweir 
394cdf0e10cSrcweir     /** get additional child by index
395cdf0e10cSrcweir 
396cdf0e10cSrcweir         OD 2010-01-27 #i88070#
397cdf0e10cSrcweir 
398cdf0e10cSrcweir         @author OD
399cdf0e10cSrcweir     */
400cdf0e10cSrcweir     Window* GetAdditionalAccessibleChild( const sal_Int32 nIndex );
401cdf0e10cSrcweir 
402cdf0e10cSrcweir     /** get all additional accessible children
403cdf0e10cSrcweir 
404cdf0e10cSrcweir         OD 2010-01-27 #i88070#
405cdf0e10cSrcweir 
406cdf0e10cSrcweir         @author OD
407cdf0e10cSrcweir     */
408cdf0e10cSrcweir     void GetAdditionalAccessibleChildren( std::vector< Window* >* pChildren );
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 
GetName() const411cdf0e10cSrcweir 	const ::rtl::OUString& GetName() const { return sName; }
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 	virtual sal_Bool HasCursor();	// required by map to remember that object
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 	sal_Bool Select( SwPaM *pPaM, SdrObject *pObj, sal_Bool bAdd );
Select(SwPaM & rPaM)416cdf0e10cSrcweir     inline sal_Bool Select( SwPaM& rPaM )
417cdf0e10cSrcweir     {
418cdf0e10cSrcweir         return Select( &rPaM, 0, sal_False );
419cdf0e10cSrcweir     }
Select(SdrObject * pObj,sal_Bool bAdd)420cdf0e10cSrcweir     inline sal_Bool Select( SdrObject *pObj, sal_Bool bAdd )
421cdf0e10cSrcweir     {
422cdf0e10cSrcweir         return Select( 0, pObj, bAdd );
423cdf0e10cSrcweir     }
424*ca62e2c2SSteve Yin 	//This method is used to updated the selected state and fire the selected state changed event.
425*ca62e2c2SSteve Yin 	virtual sal_Bool SetSelectedState(sal_Bool bSeleted);
IsSeletedInDoc()426*ca62e2c2SSteve Yin 	sal_Bool  IsSeletedInDoc(){  return bIsSeletedInDoc; }
427cdf0e10cSrcweir 
428cdf0e10cSrcweir     static ::rtl::OUString GetResource( sal_uInt16 nResId,
429cdf0e10cSrcweir                                         const ::rtl::OUString *pArg1 = 0,
430cdf0e10cSrcweir                                         const ::rtl::OUString *pArg2 = 0 );
431cdf0e10cSrcweir };
432cdf0e10cSrcweir 
433cdf0e10cSrcweir // some heaviliy used exception support
434cdf0e10cSrcweir const sal_Char sDefunc[] = "object is defunctional";
435cdf0e10cSrcweir const sal_Char sMissingWindow[] = "window is missing";
436cdf0e10cSrcweir 
437cdf0e10cSrcweir #define THROW_RUNTIME_EXCEPTION( ifc, msg ) 								\
438cdf0e10cSrcweir 	::com::sun::star::uno::Reference < ifc > xThis( this );					\
439cdf0e10cSrcweir 	::com::sun::star::uno::RuntimeException aExcept(                        \
440cdf0e10cSrcweir         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(msg) ), xThis );		\
441cdf0e10cSrcweir 	throw aExcept;
442cdf0e10cSrcweir 
443cdf0e10cSrcweir #define CHECK_FOR_DEFUNC_THIS( ifc, ths )									\
444cdf0e10cSrcweir 	if( !(GetFrm() && GetMap()) )											\
445cdf0e10cSrcweir 	{																		\
446cdf0e10cSrcweir 		::com::sun::star::uno::Reference < ifc > xThis( ths );				\
447cdf0e10cSrcweir 		::com::sun::star::lang::DisposedException aExcept( 					\
448cdf0e10cSrcweir 		    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(sDefunc) ),        \
449cdf0e10cSrcweir             xThis );												        \
450cdf0e10cSrcweir 		throw aExcept;														\
451cdf0e10cSrcweir 	}
452cdf0e10cSrcweir 
453cdf0e10cSrcweir #define CHECK_FOR_DEFUNC( ifc )												\
454cdf0e10cSrcweir 	CHECK_FOR_DEFUNC_THIS( ifc, this )
455cdf0e10cSrcweir 
456cdf0e10cSrcweir #define CHECK_FOR_WINDOW( i, w ) 											\
457cdf0e10cSrcweir 	if( !(w) )																\
458cdf0e10cSrcweir 	{																		\
459cdf0e10cSrcweir 		THROW_RUNTIME_EXCEPTION( i, sMissingWindow );						\
460cdf0e10cSrcweir 	}
461cdf0e10cSrcweir #endif
462cdf0e10cSrcweir 
463