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 #ifndef ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE
25 #define ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE
26 
27 #include <com/sun/star/uno/RuntimeException.hpp>
28 #include <tools/link.hxx>
29 
30 class SvTreeListBox;
31 class VclSimpleEvent;
32 class VclWindowEvent;
33 
34 //........................................................................
35 namespace accessibility
36 {
37 //........................................................................
38 
39 	//====================================================================
40 	//= ListBoxAccessibleBase
41 	//====================================================================
42 	/** helper class which couples it's life time to the life time of an
43 		SvTreeListBox
44 	*/
45 	class ListBoxAccessibleBase
46 	{
47 	private:
48 		SvTreeListBox* m_pWindow;
49 
50 	protected:
getListBox() const51 		inline SvTreeListBox*		getListBox() const
52 		{
53 			return	const_cast< ListBoxAccessibleBase* >( this )->m_pWindow;
54 		}
55 
isAlive() const56 		inline	bool					isAlive() const		{ return NULL != m_pWindow; }
57 
58 	public:
59 		ListBoxAccessibleBase( SvTreeListBox& _rWindow );
60 
61 	protected:
62 		virtual ~ListBoxAccessibleBase( );
63 
64 		// own overridables
65 		/// will be called for any VclWindowEvent events broadcasted by our VCL window
66 		virtual void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
67 
68 		/** will be called when our window broadcasts the VCLEVENT_OBJECT_DYING event
69 
70 			<p>Usually, you derive your class from both ListBoxAccessibleBase and XComponent,
71 			and call XComponent::dispose here.</p>
72 		*/
73 		virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ) = 0;
74 
75 		/// to be called in the dispose method of your derived class
76 		void disposing();
77 
78 	private:
79 		DECL_LINK( WindowEventListener, VclSimpleEvent* );
80 
81 	private:
82 		ListBoxAccessibleBase( );											// never implemented
83 		ListBoxAccessibleBase( const ListBoxAccessibleBase& );				// never implemented
84 		ListBoxAccessibleBase& operator=( const ListBoxAccessibleBase& );	// never implemented
85 	};
86 
87 //........................................................................
88 }	// namespace accessibility
89 //........................................................................
90 
91 #endif // ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE
92