update dev300-m58
[ooovba.git] / sw / source / core / inc / layfrm.hxx
blob840c1d0719323439eb21985ee9cec9e464e82bd0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: layfrm.hxx,v $
10 * $Revision: 1.18 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _LAYFRM_HXX
31 #define _LAYFRM_HXX
33 #include "frame.hxx"
35 class SwCntntFrm;
36 class SwFlowFrm;
37 class SwFmtCol;
38 struct SwCrsrMoveState;
39 class SwFrmFmt;
40 class SwBorderAttrs;
41 class SwFmtFrmSize;
42 class SwCellFrm;
44 class SwLayoutFrm: public SwFrm
46 //Der verkappte SwFrm
47 friend class SwFlowFrm;
48 friend class SwFrm;
50 //Hebt die Lower waehrend eines Spaltenumbaus auf.
51 friend SwFrm* SaveCntnt( SwLayoutFrm *, SwFrm * );
52 friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow );
54 #if OSL_DEBUG_LEVEL > 1
55 //entfernt leere SwSectionFrms aus einer Kette
56 friend SwFrm* SwClearDummies( SwFrm* pFrm );
57 #endif
59 void CopySubtree( const SwLayoutFrm *pDest );
60 protected:
61 virtual void Format( const SwBorderAttrs *pAttrs = 0 );
62 virtual void MakeAll();
64 SwFrm *pLower;
66 virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE );
67 virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE );
69 long CalcRel( const SwFmtFrmSize &rSz, BOOL bWidth ) const;
71 public:
72 // --> OD 2004-06-29 #i28701#
73 TYPEINFO();
75 void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const;
76 void RefreshLaySubsidiary( const SwPageFrm*, const SwRect& ) const;
77 void RefreshExtraData( const SwRect & ) const;
79 //Proportionale Groessenanpassung der untergeordneten.
80 void ChgLowersProp( const Size& rOldSize );
82 void AdjustColumns( const SwFmtCol *pCol, BOOL bAdjustAttributes );
84 void ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew,
85 const BOOL bChgFtn = FALSE );
88 //Painted die Column-Trennlinien fuer die innenliegenden Columns.
89 void PaintColLines( const SwRect &, const SwFmtCol &,
90 const SwPageFrm * ) const;
92 virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const;
94 virtual BOOL GetCrsrOfst( SwPosition *, Point&,
95 SwCrsrMoveState* = 0 ) const;
97 virtual void Cut();
98 virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
100 //sucht den dichtesten Cntnt zum SPoint, wird bei Seiten, Flys und Cells
101 //benutzt wenn GetCrsrOfst versagt hat.
102 const SwCntntFrm* GetCntntPos( Point &rPoint, const BOOL bDontLeave,
103 const BOOL bBodyOnly = FALSE,
104 const BOOL bCalc = FALSE,
105 const SwCrsrMoveState *pCMS = 0,
106 const BOOL bDefaultExpand = TRUE ) const;
108 SwLayoutFrm( SwFrmFmt* );
109 ~SwLayoutFrm();
111 virtual void Paint( const SwRect& ) const;
112 const SwFrm *Lower() const { return pLower; }
113 SwFrm *Lower() { return pLower; }
114 const SwCntntFrm *ContainsCntnt() const;
115 inline SwCntntFrm *ContainsCntnt();
116 const SwCellFrm *FirstCell() const;
117 inline SwCellFrm *FirstCell();
118 // --> OD 2006-02-01 #130797#
119 // Method <ContainsAny()> doesn't investigate content of footnotes by default.
120 // But under certain circumstances this investigation is intended.
121 // Thus, introduce new optional parameter <_bInvestigateFtnForSections>.
122 // It's default is <false>, still indicating that content of footnotes isn't
123 // investigated for sections.
124 const SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false ) const;
125 inline SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false );
126 // <--
127 BOOL IsAnLower( const SwFrm * ) const;
129 const SwFrmFmt *GetFmt() const { return (const SwFrmFmt*)GetDep(); }
130 SwFrmFmt *GetFmt() { return (SwFrmFmt*)GetDep(); }
131 void SetFrmFmt( SwFrmFmt* );
133 //Verschieben der Ftns aller Lower - ab dem StartCntnt.
134 //TRUE wenn mindestens eine Ftn verschoben wurde.
135 //Ruft das Update der Seitennummer wenn bFtnNums gesetzt ist.
136 BOOL MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
137 SwFtnBossFrm *pNewBoss, const BOOL bFtnNums );
139 // --> OD 2004-07-01 #i28701# - change purpose of method and its name
140 // --> OD 2005-03-11 #i44016# - add parameter <_bUnlockPosOfObjs> to
141 // force an unlockposition call for the lower objects.
142 void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false );
143 // <--
145 //Invalidiert diejenigen innenliegenden Frames, deren Breite und/oder
146 //Hoehe Prozentual berechnet werden. Auch Rahmen, die an this oder an
147 //innenliegenden verankert sind werden ggf. invalidiert.
148 void InvaPercentLowers( SwTwips nDiff = 0 );
150 //Gerufen von Format fuer Rahmen und Bereichen mit Spalten.
151 void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder,
152 const SwTwips nMinHeight );
154 // InnerHeight returns the height of the content and may be bigger or
155 // less than the PrtArea-Height of the layoutframe himself
156 SwTwips InnerHeight() const;
158 /** method to check relative position of layout frame to
159 a given layout frame.
161 OD 08.11.2002 - refactoring of pseudo-local method <lcl_Apres(..)> in
162 <txtftn.cxx> for #104840#.
164 @param _aCheckRefLayFrm
165 constant reference of an instance of class <SwLayoutFrm> which
166 is used as the reference for the relative position check.
168 @author OD
170 @return true, if <this> is positioned before the layout frame <p>
172 bool IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const;
174 const SwFrm* GetLastLower() const;
175 inline SwFrm* GetLastLower();
178 //Um doppelte Implementierung zu sparen wird hier ein bischen gecasted
179 inline SwCntntFrm* SwLayoutFrm::ContainsCntnt()
181 return (SwCntntFrm*)(((const SwLayoutFrm*)this)->ContainsCntnt());
184 inline SwCellFrm* SwLayoutFrm::FirstCell()
186 return (SwCellFrm*)(((const SwLayoutFrm*)this)->FirstCell());
189 // --> OD 2006-02-01 #130797#
190 inline SwFrm* SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections )
192 return (SwFrm*)(((const SwLayoutFrm*)this)->ContainsAny( _bInvestigateFtnForSections ));
194 // <--
196 // Diese SwFrm-inlines sind hier, damit frame.hxx nicht layfrm.hxx includen muss
197 inline BOOL SwFrm::IsColBodyFrm() const
199 return nType == FRMC_BODY && GetUpper()->IsColumnFrm();
202 inline BOOL SwFrm::IsPageBodyFrm() const
204 return nType == FRMC_BODY && GetUpper()->IsPageFrm();
207 inline SwFrm* SwLayoutFrm::GetLastLower()
209 return const_cast<SwFrm*>(static_cast<const SwLayoutFrm*>(this)->GetLastLower());
212 #endif //_LAYFRM_HXX