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 __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_
25 #define __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_
26 
27 //_________________________________________________________________________________________________________________
28 //	my own includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <threadhelp/threadhelpbase.hxx>
32 #include <macros/generic.hxx>
33 #include <macros/debug.hxx>
34 #include <macros/xinterface.hxx>
35 #include <macros/xtypeprovider.hxx>
36 #include <macros/xserviceinfo.hxx>
37 #include <general.h>
38 #include <stdtypes.h>
39 #include "panel.hxx"
40 #include <uielement/uielement.hxx>
41 
42 //_________________________________________________________________________________________________________________
43 //	interface includes
44 //_________________________________________________________________________________________________________________
45 
46 #include <com/sun/star/lang/XTypeProvider.hpp>
47 #include <com/sun/star/awt/XWindow.hpp>
48 #include <com/sun/star/beans/XPropertySet.hpp>
49 #include <com/sun/star/container/XNameAccess.hpp>
50 #include <com/sun/star/awt/XDockableWindowListener.hpp>
51 #include <com/sun/star/frame/XFrame.hpp>
52 
53 //_________________________________________________________________________________________________________________
54 //	other includes
55 //_________________________________________________________________________________________________________________
56 
57 #include <cppuhelper/weak.hxx>
58 #include <vcl/window.hxx>
59 
60 //_________________________________________________________________________________________________________________
61 //	namespace
62 //_________________________________________________________________________________________________________________
63 
64 namespace framework
65 {
66 
67 class PanelManager : private ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses.
68 {
69 	public:
70 		PanelManager(
71             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMGR,
72             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
73 		virtual ~PanelManager();
74 
75 		bool createPanels();
76         ::com::sun::star::awt::Rectangle getPreferredSize() const;
77         void layoutPanels( const ::com::sun::star::awt::Rectangle newSize );
78 
79         UIElement* findDockingWindow( const ::rtl::OUString& rResourceName );
80         bool addDockingWindow( const ::rtl::OUString& rResourceName, const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement );
81         bool destroyDockingWindow( const ::rtl::OUString& rResourceName );
82 
83         //---------------------------------------------------------------------------------------------------------
84 		//  XDockableWindowListener
85 		//---------------------------------------------------------------------------------------------------------
86 		virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
87 		virtual ::com::sun::star::awt::DockingData SAL_CALL docking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
88 		virtual void SAL_CALL endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
89 		virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
90 		virtual void SAL_CALL toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
91 		virtual void SAL_CALL closed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
92         virtual void SAL_CALL endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& e ) throw (::com::sun::star::uno::RuntimeException);
93 
94 	private:
95 		Panel*                                                 m_aPanels[PANEL_COUNT];
96         css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
97         css::uno::Reference< css::frame::XFrame >              m_xFrame;
98 };
99 
100 } // namespace framework
101 
102 #endif // __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_
103