xref: /aoo41x/main/toolkit/source/layout/core/flow.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 #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         throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
63     virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
64         throw (css::uno::RuntimeException);
65 
66     virtual css::uno::Sequence< css::uno::Reference
67                                 < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
68         throw (css::uno::RuntimeException);
69 
70     virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
71         const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
72         throw (css::uno::RuntimeException);
73 
74     virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
75         throw (css::uno::RuntimeException);
76 
77     virtual css::awt::Size SAL_CALL getMinimumSize()
78         throw(css::uno::RuntimeException);
79     virtual sal_Bool SAL_CALL hasHeightForWidth()
80         throw(css::uno::RuntimeException);
81     virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
82         throw(css::uno::RuntimeException);
83 
84 private:
85     // shared between getMinimumSize() and getHeightForWidth()
86     css::awt::Size calculateSize( long nMaxWidth );
87 };
88 
89 } //  namespace layoutimpl
90 
91 #endif /* LAYOUT_FLOW_CORE_HXX */
92