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