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 LAYOUT_AWT_VCLXSPLITTER_HXX
29 #define LAYOUT_AWT_VCLXSPLITTER_HXX
30 
31 #include <com/sun/star/awt/MaxChildrenException.hpp>
32 #include <com/sun/star/beans/XPropertySet.hpp>
33 #include <comphelper/uno3.hxx>
34 #include <layout/core/box-base.hxx>
35 #include <toolkit/awt/vclxwindow.hxx>
36 
37 class Splitter;
38 
39 namespace layoutimpl
40 {
41 
42 class VCLXSplitter :public VCLXWindow
43                    ,public Box_Base
44 {
45 private:
46     VCLXSplitter( const VCLXSplitter& );            // never implemented
47     VCLXSplitter& operator=( const VCLXSplitter& ); // never implemented
48 
49 public:
50     VCLXSplitter( bool bHorizontal );
51 
52 protected:
53     ~VCLXSplitter();
54 
55     // XInterface
56     DECLARE_XINTERFACE()
57 
58     // XTypeProvider
59     DECLARE_XTYPEPROVIDER()
60 
61     // XComponent
62     void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
63 
64     // ::com::sun::star::awt::XLayoutContainer
65     virtual void SAL_CALL addChild(
66         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child )
67         throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException);
68 
69     virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea )
70         throw (::com::sun::star::uno::RuntimeException);
71 
72     virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize()
73         throw(::com::sun::star::uno::RuntimeException);
74 
75     // unimplemented:
76     virtual sal_Bool SAL_CALL hasHeightForWidth()
77         throw(css::uno::RuntimeException)
78     { return false; }
79     virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ )
80     throw(css::uno::RuntimeException)
81     { return maRequisition.Height; }
82 
83     // VclWindowPeer
84     virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
85     virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
86 
87     // VCLXWindow
88     void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
89 
90 public:
91     // Maps page ids to child references
92     struct ChildData : public Box_Base::ChildData
93     {
94         sal_Bool mbShrink;
95         ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
96     };
97 
98     struct ChildProps : public Box_Base::ChildProps
99     {
100         ChildProps( VCLXSplitter::ChildData *pData );
101     };
102 
103 protected:
104 
105     ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
106     ChildProps *createChildProps( Box_Base::ChildData* pData );
107 
108     ChildData* getChild( int i );
109 
110     float mnHandleRatio;
111     bool mbHandlePressed;
112 
113     DECL_LINK( HandleMovedHdl, Splitter* );
114     bool mbHorizontal;
115     Splitter *mpSplitter;
116     void ensureSplitter();
117 };
118 
119 } // namespace layoutimpl
120 
121 #endif /* LAYOUT_AWT_VCLXSPLITTER_HXX */
122