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 EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX
25 #define EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX
26 
27 #include <comphelper/broadcasthelper.hxx>
28 #include "loadlisteneradapter.hxx"
29 #include <com/sun/star/awt/XControlContainer.hpp>
30 
31 class BibDataManager;
32 
33 //.........................................................................
34 namespace bib
35 {
36 //.........................................................................
37 
38 	//=====================================================================
39 	//= FormControlContainer
40 	//=====================================================================
41 	class FormControlContainer
42 			:public ::comphelper::OBaseMutex
43 			,public ::bib::OLoadListener
44 	{
45 	private:
46 		OLoadListenerAdapter*	m_pFormAdapter;
47 		::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >
48 								m_xForm;
49 	private:
50 		void	implSetDesignMode( sal_Bool _bDesign );
51 
52 	protected:
53 		FormControlContainer( );
54 		~FormControlContainer( );
55 
isFormConnected() const56 		sal_Bool	isFormConnected() const { return NULL != m_pFormAdapter; }
57 		void		connectForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable >& _rxForm );
58 		void		disconnectForm();
59 
60 		void		ensureDesignMode();
61 
62 		virtual	::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
63 					getControlContainer() = 0;
64 
65 	protected:
66 	// XLoadListener equivalents
67 		virtual void _loaded( const ::com::sun::star::lang::EventObject& _rEvent );
68 		virtual void _unloading( const ::com::sun::star::lang::EventObject& _rEvent );
69 		virtual void _unloaded( const ::com::sun::star::lang::EventObject& _rEvent );
70 		virtual void _reloading( const ::com::sun::star::lang::EventObject& _rEvent );
71 		virtual void _reloaded( const ::com::sun::star::lang::EventObject& _rEvent );
72 
73 	};
74 
75 //.........................................................................
76 }	// namespace bib
77 //.........................................................................
78 
79 #endif // EXTENSIONS_BIB_FORMCONTROLCONTAINER_HXX
80 
81