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 /* A few simple binary containers */ 29 30 #ifndef LAYOUT_CORE_BIN_HXX 31 #define LAYOUT_CORE_BIN_HXX 32 33 #include <layout/core/container.hxx> 34 35 namespace layoutimpl 36 { 37 38 class Bin : public Container 39 { 40 protected: 41 // Child 42 css::awt::Size maChildRequisition; 43 css::uno::Reference< css::awt::XLayoutConstrains > mxChild; 44 45 public: 46 Bin(); 47 virtual ~Bin() {} 48 49 // css::awt::XLayoutContainer 50 virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) 51 throw (css::uno::RuntimeException, css::awt::MaxChildrenException); 52 virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) 53 throw (css::uno::RuntimeException); 54 55 virtual css::uno::Sequence< css::uno::Reference 56 < css::awt::XLayoutConstrains > > SAL_CALL getChildren() 57 throw (css::uno::RuntimeException); 58 59 virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) 60 throw (css::uno::RuntimeException); 61 62 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties( 63 const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) 64 throw (css::uno::RuntimeException); 65 66 virtual sal_Bool SAL_CALL hasHeightForWidth() 67 throw(css::uno::RuntimeException); 68 virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth ) 69 throw(css::uno::RuntimeException); 70 71 // css::awt::XLayoutConstrains 72 virtual css::awt::Size SAL_CALL getMinimumSize() 73 throw(css::uno::RuntimeException); 74 }; 75 76 // Align gives control over child position on the allocated space. 77 class Align : public Bin 78 { 79 friend class AlignChildProps; 80 protected: 81 // properties 82 float fHorAlign, fVerAlign; 83 float fHorFill, fVerFill; 84 85 public: 86 Align(); 87 88 bool emptyVisible (); 89 90 // css::awt::XLayoutContainer 91 virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) 92 throw (css::uno::RuntimeException); 93 }; 94 95 // Makes child request its or a specified size, whatever is larger. 96 class MinSize : public Bin 97 { 98 protected: 99 // properties 100 long mnMinWidth, mnMinHeight; 101 102 public: 103 MinSize(); 104 105 bool emptyVisible (); 106 // css::awt::XLayoutContainer 107 virtual css::awt::Size SAL_CALL getMinimumSize() 108 throw(css::uno::RuntimeException); 109 }; 110 111 } // namespace layoutimpl 112 113 #endif /* LAYOUT_CORE_BIN_HXX */ 114