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