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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_framework.hxx"
33 
34 //_________________________________________________________________________________________________________________
35 //	my own includes
36 //_________________________________________________________________________________________________________________
37 
38 #include "panel.hxx"
39 #include "helpers.hxx"
40 
41 //_________________________________________________________________________________________________________________
42 //	other includes
43 //_________________________________________________________________________________________________________________
44 
45 #include <vos/mutex.hxx>
46 #include <vcl/svapp.hxx>
47 #include <toolkit/unohlp.hxx>
48 
49 //_________________________________________________________________________________________________________________
50 //	namespace
51 //_________________________________________________________________________________________________________________
52 
53 using namespace ::com::sun::star;
54 
55 namespace framework
56 {
57 
58 Panel::Panel(
59     const uno::Reference< lang::XMultiServiceFactory >& rSMGR,
60     const uno::Reference< awt::XWindow >& rParent,
61     PanelPosition nPanel ) :
62     m_xSMGR(rSMGR), m_nPanelPosition(nPanel)
63 {
64     uno::Reference< awt::XWindowPeer > xWindowPeer( rParent, uno::UNO_QUERY );
65     m_xPanelWindow = uno::Reference< awt::XWindow >( createToolkitWindow( rSMGR, xWindowPeer, "splitwindow" ), uno::UNO_QUERY );
66 
67     vos::OGuard	aGuard( Application::GetSolarMutex() );
68     SplitWindow* pSplitWindow = dynamic_cast< SplitWindow* >( VCLUnoHelper::GetWindow( m_xPanelWindow ));
69 
70     if ( pSplitWindow )
71     {
72         // Set alignment
73         if (nPanel == PANEL_TOP)
74             pSplitWindow->SetAlign( WINDOWALIGN_TOP );
75         else if (nPanel == PANEL_BOTTOM)
76             pSplitWindow->SetAlign( WINDOWALIGN_BOTTOM );
77         else if (nPanel == PANEL_LEFT)
78             pSplitWindow->SetAlign( WINDOWALIGN_LEFT );
79         else
80             pSplitWindow->SetAlign( WINDOWALIGN_RIGHT );
81     }
82 }
83 
84 Panel::~Panel()
85 {
86 }
87 
88 } // namespace framework
89