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_BOX_BASE_HXX
29 #define LAYOUT_CORE_BOX_BASE_HXX
30 
31 #include <layout/core/container.hxx>
32 
33 #include <list>
34 
35 namespace layoutimpl
36 {
37 
38 class Box_Base : public Container
39 {
40 public:
41     // Children properties
42     struct ChildData
43     {
44         css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
45         css::uno::Reference< css::beans::XPropertySet > mxProps;
46         css::awt::Size maRequisition;
47         virtual bool isVisible();
48 
49         ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
50         virtual ~ChildData() { };
51     };
52 
53     struct ChildProps: public PropHelper
54     {
55         //ChildProps( ChildProps* );
56     };
57 
58 protected:
59     std::list< ChildData* > maChildren;
60 
61 
62     virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0;
63     virtual ChildProps *createChildProps( ChildData* pData ) = 0;
64 
65     ChildData *removeChildData( std::list< ChildData *>&, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
66 
67 public:
68     void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child);
69 
70     // css::awt::XLayoutContainer
71     virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child)
72         throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
73     virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
74         throw (css::uno::RuntimeException);
75 
76     virtual css::uno::Sequence< css::uno::Reference
77                                 < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
78         throw (css::uno::RuntimeException);
79 
80     virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
81         const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
82         throw (css::uno::RuntimeException);
83 };
84 
85 } //  namespace layoutimpl
86 
87 #endif /* LAYOUT_CORE_BOX_BASE HXX */
88