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 #ifndef SW_LAYFRM_HXX 28 #define SW_LAYFRM_HXX 29 30 #include "frame.hxx" 31 32 class SwCntntFrm; 33 class SwFlowFrm; 34 class SwFmtCol; 35 struct SwCrsrMoveState; 36 class SwFrmFmt; 37 class SwBorderAttrs; 38 class SwFmtFrmSize; 39 class SwCellFrm; 40 41 class SwLayoutFrm: public SwFrm 42 { 43 //Der verkappte SwFrm 44 friend class SwFlowFrm; 45 friend class SwFrm; 46 47 //Hebt die Lower waehrend eines Spaltenumbaus auf. 48 friend SwFrm* SaveCntnt( SwLayoutFrm *, SwFrm * ); 49 friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow ); 50 51 #if OSL_DEBUG_LEVEL > 1 52 //entfernt leere SwSectionFrms aus einer Kette 53 friend SwFrm* SwClearDummies( SwFrm* pFrm ); 54 #endif 55 56 void CopySubtree( const SwLayoutFrm *pDest ); 57 protected: 58 virtual void Format( const SwBorderAttrs *pAttrs = 0 ); 59 virtual void MakeAll(); 60 61 SwFrm *pLower; 62 63 virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); 64 virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); 65 66 long CalcRel( const SwFmtFrmSize &rSz, sal_Bool bWidth ) const; 67 68 public: 69 // --> OD 2004-06-29 #i28701# 70 TYPEINFO(); 71 72 void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const; 73 void RefreshLaySubsidiary( const SwPageFrm*, const SwRect& ) const; 74 void RefreshExtraData( const SwRect & ) const; 75 76 //Proportionale Groessenanpassung der untergeordneten. 77 void ChgLowersProp( const Size& rOldSize ); 78 79 void AdjustColumns( const SwFmtCol *pCol, sal_Bool bAdjustAttributes ); 80 81 void ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, 82 const sal_Bool bChgFtn = sal_False ); 83 84 85 //Painted die Column-Trennlinien fuer die innenliegenden Columns. 86 void PaintColLines( const SwRect &, const SwFmtCol &, 87 const SwPageFrm * ) const; 88 89 virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const; 90 91 virtual sal_Bool GetCrsrOfst( SwPosition *, Point&, 92 SwCrsrMoveState* = 0 ) const; 93 94 virtual void Cut(); 95 virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); 96 97 //sucht den dichtesten Cntnt zum SPoint, wird bei Seiten, Flys und Cells 98 //benutzt wenn GetCrsrOfst versagt hat. 99 const SwCntntFrm* GetCntntPos( Point &rPoint, const sal_Bool bDontLeave, 100 const sal_Bool bBodyOnly = sal_False, 101 const sal_Bool bCalc = sal_False, 102 const SwCrsrMoveState *pCMS = 0, 103 const sal_Bool bDefaultExpand = sal_True ) const; 104 105 SwLayoutFrm( SwFrmFmt*, SwFrm* ); 106 ~SwLayoutFrm(); 107 108 virtual void Paint( SwRect const&, 109 SwPrintData const*const pPrintData = NULL ) const; 110 const SwFrm *Lower() const { return pLower; } 111 SwFrm *Lower() { return pLower; } 112 const SwCntntFrm *ContainsCntnt() const; 113 inline SwCntntFrm *ContainsCntnt(); 114 const SwCellFrm *FirstCell() const; 115 inline SwCellFrm *FirstCell(); 116 // --> OD 2006-02-01 #130797# 117 // Method <ContainsAny()> doesn't investigate content of footnotes by default. 118 // But under certain circumstances this investigation is intended. 119 // Thus, introduce new optional parameter <_bInvestigateFtnForSections>. 120 // It's default is <false>, still indicating that content of footnotes isn't 121 // investigated for sections. 122 const SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false ) const; 123 inline SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false ); 124 // <-- 125 sal_Bool IsAnLower( const SwFrm * ) const; 126 127 virtual const SwFrmFmt *GetFmt() const; 128 virtual SwFrmFmt *GetFmt(); 129 void SetFrmFmt( SwFrmFmt* ); 130 131 //Verschieben der Ftns aller Lower - ab dem StartCntnt. 132 //sal_True wenn mindestens eine Ftn verschoben wurde. 133 //Ruft das Update der Seitennummer wenn bFtnNums gesetzt ist. 134 sal_Bool MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, 135 SwFtnBossFrm *pNewBoss, const sal_Bool bFtnNums ); 136 137 // --> OD 2004-07-01 #i28701# - change purpose of method and its name 138 // --> OD 2005-03-11 #i44016# - add parameter <_bUnlockPosOfObjs> to 139 // force an unlockposition call for the lower objects. 140 void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false ); 141 // <-- 142 143 //Invalidiert diejenigen innenliegenden Frames, deren Breite und/oder 144 //Hoehe Prozentual berechnet werden. Auch Rahmen, die an this oder an 145 //innenliegenden verankert sind werden ggf. invalidiert. 146 void InvaPercentLowers( SwTwips nDiff = 0 ); 147 148 //Gerufen von Format fuer Rahmen und Bereichen mit Spalten. 149 void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder, 150 const SwTwips nMinHeight ); 151 152 // InnerHeight returns the height of the content and may be bigger or 153 // less than the PrtArea-Height of the layoutframe himself 154 SwTwips InnerHeight() const; 155 156 /** method to check relative position of layout frame to 157 a given layout frame. 158 159 OD 08.11.2002 - refactoring of pseudo-local method <lcl_Apres(..)> in 160 <txtftn.cxx> for #104840#. 161 162 @param _aCheckRefLayFrm 163 constant reference of an instance of class <SwLayoutFrm> which 164 is used as the reference for the relative position check. 165 166 @author OD 167 168 @return true, if <this> is positioned before the layout frame <p> 169 */ 170 bool IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const; 171 172 const SwFrm* GetLastLower() const; 173 inline SwFrm* GetLastLower(); 174 }; 175 176 //Um doppelte Implementierung zu sparen wird hier ein bischen gecasted 177 inline SwCntntFrm* SwLayoutFrm::ContainsCntnt() 178 { 179 return (SwCntntFrm*)(((const SwLayoutFrm*)this)->ContainsCntnt()); 180 } 181 182 inline SwCellFrm* SwLayoutFrm::FirstCell() 183 { 184 return (SwCellFrm*)(((const SwLayoutFrm*)this)->FirstCell()); 185 } 186 187 // --> OD 2006-02-01 #130797# 188 inline SwFrm* SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections ) 189 { 190 return (SwFrm*)(((const SwLayoutFrm*)this)->ContainsAny( _bInvestigateFtnForSections )); 191 } 192 // <-- 193 194 // Diese SwFrm-inlines sind hier, damit frame.hxx nicht layfrm.hxx includen muss 195 inline sal_Bool SwFrm::IsColBodyFrm() const 196 { 197 return nType == FRMC_BODY && GetUpper()->IsColumnFrm(); 198 } 199 200 inline sal_Bool SwFrm::IsPageBodyFrm() const 201 { 202 return nType == FRMC_BODY && GetUpper()->IsPageFrm(); 203 } 204 205 inline SwFrm* SwLayoutFrm::GetLastLower() 206 { 207 return const_cast<SwFrm*>(static_cast<const SwLayoutFrm*>(this)->GetLastLower()); 208 } 209 210 #endif // SW_LAYFRM_HXX 211