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