xref: /trunk/main/toolkit/source/layout/core/flow.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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_CORE_FLOW_HXX
25 #define LAYOUT_CORE_FLOW_HXX
26 
27 #include <layout/core/container.hxx>
28 
29 #include <list>
30 
31 namespace layoutimpl
32 {
33 
34 class Flow : public Container
35 {
36 protected:
37     // Box properties (i.e. affect all children)
38     sal_Int32 mnSpacing;
39     sal_Bool mbHomogeneous;
40 
41 public:
42     // Children properties
43     struct ChildData
44     {
45         css::awt::Size aRequisition;
46         css::uno::Reference< css::awt::XLayoutConstrains > xChild;
47         css::uno::Reference< css::beans::XPropertySet >    xProps;
48         bool isVisible();
49     };
50 
51 protected:
52     std::list< ChildData * > maChildren;
53     long mnEachWidth;  // on homogeneous, the width of every child
54 
55 public:
56     Flow();
57 
58     bool emptyVisible ();
59 
60     // css::awt::XLayoutContainer
61     virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child );
62     virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child );
63 
64     virtual css::uno::Sequence< css::uno::Reference
65                                 < css::awt::XLayoutConstrains > > SAL_CALL getChildren();
66 
67     virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
68         const css::uno::Reference< css::awt::XLayoutConstrains >& Child );
69 
70     virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea );
71 
72     virtual css::awt::Size SAL_CALL getMinimumSize();
73     virtual sal_Bool SAL_CALL hasHeightForWidth();
74     virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth );
75 
76 private:
77     // shared between getMinimumSize() and getHeightForWidth()
78     css::awt::Size calculateSize( long nMaxWidth );
79 };
80 
81 } //  namespace layoutimpl
82 
83 #endif /* LAYOUT_FLOW_CORE_HXX */
84