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