xref: /aoo41x/main/toolkit/source/layout/core/bin.hxx (revision 50e6b072)
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 /* A few simple binary containers */
25 
26 #ifndef LAYOUT_CORE_BIN_HXX
27 #define LAYOUT_CORE_BIN_HXX
28 
29 #include <layout/core/container.hxx>
30 
31 namespace layoutimpl
32 {
33 
34 class Bin : public Container
35 {
36 protected:
37     // Child
38     css::awt::Size maChildRequisition;
39     css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
40 
41 public:
42     Bin();
~Bin()43     virtual ~Bin() {}
44 
45     // css::awt::XLayoutContainer
46     virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
47         throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
48     virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
49         throw (css::uno::RuntimeException);
50 
51     virtual css::uno::Sequence< css::uno::Reference
52                 < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
53         throw (css::uno::RuntimeException);
54 
55     virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
56         throw (css::uno::RuntimeException);
57 
58     virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
59         const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
60         throw (css::uno::RuntimeException);
61 
62     virtual sal_Bool SAL_CALL hasHeightForWidth()
63         throw(css::uno::RuntimeException);
64     virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
65         throw(css::uno::RuntimeException);
66 
67     // css::awt::XLayoutConstrains
68     virtual css::awt::Size SAL_CALL getMinimumSize()
69         throw(css::uno::RuntimeException);
70 };
71 
72 // Align gives control over child position on the allocated space.
73 class Align : public Bin
74 {
75     friend class AlignChildProps;
76 protected:
77     // properties
78     float fHorAlign, fVerAlign;
79     float fHorFill, fVerFill;
80 
81 public:
82     Align();
83 
84     bool emptyVisible ();
85 
86     // css::awt::XLayoutContainer
87     virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
88         throw (css::uno::RuntimeException);
89 };
90 
91 // Makes child request its or a specified size, whatever is larger.
92 class MinSize : public Bin
93 {
94 protected:
95     // properties
96     long mnMinWidth, mnMinHeight;
97 
98 public:
99     MinSize();
100 
101     bool emptyVisible ();
102     // css::awt::XLayoutContainer
103     virtual css::awt::Size SAL_CALL getMinimumSize()
104         throw(css::uno::RuntimeException);
105 };
106 
107 } //  namespace layoutimpl
108 
109 #endif /* LAYOUT_CORE_BIN_HXX */
110