1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2008 by Sun Microsystems, Inc.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * $RCSfile: layoutmanager.hxx,v $
10  * $Revision: 1.34 $
11  *
12  * This file is part of OpenOffice.org.
13  *
14  * OpenOffice.org is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License version 3
16  * only, as published by the Free Software Foundation.
17  *
18  * OpenOffice.org is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU Lesser General Public License version 3 for more details
22  * (a copy is included in the LICENSE file that accompanied this code).
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * version 3 along with OpenOffice.org.  If not, see
26  * <http://www.openoffice.org/license.html>
27  * for a copy of the LGPLv3 License.
28  *
29  ************************************************************************/
30 
31 #ifndef __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_
32 #define __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_
33 
34 //_________________________________________________________________________________________________________________
35 //	my own includes
36 //_________________________________________________________________________________________________________________
37 
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/generic.hxx>
40 #include <macros/debug.hxx>
41 #include <macros/xinterface.hxx>
42 #include <macros/xtypeprovider.hxx>
43 #include <macros/xserviceinfo.hxx>
44 #include <general.h>
45 #include <stdtypes.h>
46 #include "panel.hxx"
47 #include <uielement/uielement.hxx>
48 
49 //_________________________________________________________________________________________________________________
50 //	interface includes
51 //_________________________________________________________________________________________________________________
52 
53 #include <com/sun/star/lang/XTypeProvider.hpp>
54 #include <com/sun/star/awt/XWindow.hpp>
55 #include <com/sun/star/beans/XPropertySet.hpp>
56 #include <com/sun/star/container/XNameAccess.hpp>
57 #include <com/sun/star/awt/XDockableWindowListener.hpp>
58 #include <com/sun/star/frame/XFrame.hpp>
59 
60 //_________________________________________________________________________________________________________________
61 //	other includes
62 //_________________________________________________________________________________________________________________
63 
64 #include <cppuhelper/weak.hxx>
65 #include <vcl/window.hxx>
66 
67 //_________________________________________________________________________________________________________________
68 //	namespace
69 //_________________________________________________________________________________________________________________
70 
71 namespace framework
72 {
73 
74 class PanelManager : private ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses.
75 {
76 	public:
77 		PanelManager(
78             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMGR,
79             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
80 		virtual ~PanelManager();
81 
82 		bool createPanels();
83         ::com::sun::star::awt::Rectangle getPreferredSize() const;
84         void layoutPanels( const ::com::sun::star::awt::Rectangle newSize );
85 
86         UIElement* findDockingWindow( const ::rtl::OUString& rResourceName );
87         bool addDockingWindow( const ::rtl::OUString& rResourceName, const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement );
88         bool destroyDockingWindow( const ::rtl::OUString& rResourceName );
89 
90         //---------------------------------------------------------------------------------------------------------
91 		//  XDockableWindowListener
92 		//---------------------------------------------------------------------------------------------------------
93 		virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
94 		virtual ::com::sun::star::awt::DockingData SAL_CALL docking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
95 		virtual void SAL_CALL endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
96 		virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
97 		virtual void SAL_CALL toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
98 		virtual void SAL_CALL closed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
99         virtual void SAL_CALL endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& e ) throw (::com::sun::star::uno::RuntimeException);
100 
101 	private:
102 		Panel*                                                 m_aPanels[PANEL_COUNT];
103         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
104         css::uno::Reference< css::frame::XFrame >              m_xFrame;
105 };
106 
107 } // namespace framework
108 
109 #endif // __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_
110