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