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