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_TABLE_HXX 29 #define LAYOUT_CORE_TABLE_HXX 30 31 #include <layout/core/box-base.hxx> 32 33 namespace layoutimpl 34 { 35 36 class Table : public Box_Base 37 { 38 public: 39 // Children properties 40 struct ChildData : public Box_Base::ChildData 41 { 42 sal_Bool mbExpand[ 2 ]; 43 sal_Int32 mnColSpan; 44 sal_Int32 mnRowSpan; 45 int mnLeftCol; 46 int mnRightCol; 47 int mnTopRow; 48 int mnBottomRow; 49 50 ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); 51 bool isVisible(); 52 }; 53 54 struct ChildProps : public Box_Base::ChildProps 55 { 56 ChildProps( ChildData *pData ); 57 }; 58 59 protected: 60 61 // a group of children; either a column or a row 62 struct GroupData 63 { 64 sal_Bool mbExpand; 65 int mnSize; // request size (width or height) 66 GroupData() : mbExpand( false ), mnSize( 0 ) {} 67 }; 68 69 // Table properties 70 sal_Int32 mnColsLen; 71 std::vector< GroupData > maCols; 72 std::vector< GroupData > maRows; 73 int mnColExpandables, mnRowExpandables; 74 75 ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ); 76 ChildProps *createChildProps( Box_Base::ChildData* pData ); 77 78 public: 79 Table(); 80 81 // css::awt::XLayoutContainer 82 virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child ) 83 throw (css::uno::RuntimeException, css::awt::MaxChildrenException); 84 85 virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) 86 throw (css::uno::RuntimeException); 87 88 virtual css::awt::Size SAL_CALL getMinimumSize() 89 throw(css::uno::RuntimeException); 90 91 // unimplemented: 92 virtual sal_Bool SAL_CALL hasHeightForWidth() 93 throw(css::uno::RuntimeException) 94 { return false; } 95 virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ ) 96 throw(css::uno::RuntimeException) 97 { return maRequisition.Height; } 98 }; 99 100 } // namespace layoutimpl 101 102 #endif /* LAYOUT_CORE_TABLE_HXX */ 103