Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef SW_LAYFRM_HXX
29 : : #define SW_LAYFRM_HXX
30 : :
31 : : #include "frame.hxx"
32 : :
33 : : class SwCntntFrm;
34 : : class SwFlowFrm;
35 : : class SwFmtCol;
36 : : struct SwCrsrMoveState;
37 : : class SwFrmFmt;
38 : : class SwBorderAttrs;
39 : : class SwFmtFrmSize;
40 : : class SwCellFrm;
41 : :
42 : : class SwLayoutFrm: public SwFrm
43 : : {
44 : : //Der verkappte SwFrm
45 : : friend class SwFlowFrm;
46 : : friend class SwFrm;
47 : :
48 : : //Hebt die Lower waehrend eines Spaltenumbaus auf.
49 : : friend SwFrm* SaveCntnt( SwLayoutFrm *, SwFrm * );
50 : : friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow );
51 : :
52 : : #ifdef DBG_UTIL
53 : : //removes empty SwSectionFrms from a chain
54 : : friend SwFrm* SwClearDummies( SwFrm* pFrm );
55 : : #endif
56 : :
57 : : void CopySubtree( const SwLayoutFrm *pDest );
58 : : protected:
59 : : void Destroy(); // for ~SwRootFrm
60 : :
61 : : virtual void Format( const SwBorderAttrs *pAttrs = 0 );
62 : : virtual void MakeAll();
63 : :
64 : : SwFrm *pLower;
65 : :
66 : : virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
67 : : virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False );
68 : :
69 : : long CalcRel( const SwFmtFrmSize &rSz, sal_Bool bWidth ) const;
70 : :
71 : : public:
72 : : // --> #i28701#
73 : : TYPEINFO();
74 : :
75 : : virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const;
76 : : void RefreshLaySubsidiary( const SwPageFrm*, const SwRect& ) const;
77 : : void RefreshExtraData( const SwRect & ) const;
78 : :
79 : : //Proportionale Groessenanpassung der untergeordneten.
80 : : void ChgLowersProp( const Size& rOldSize );
81 : :
82 : : void AdjustColumns( const SwFmtCol *pCol, sal_Bool bAdjustAttributes );
83 : :
84 : : void ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew,
85 : : const sal_Bool bChgFtn = sal_False );
86 : :
87 : :
88 : : //Painted die Column-Trennlinien fuer die innenliegenden Columns.
89 : : void PaintColLines( const SwRect &, const SwFmtCol &,
90 : : const SwPageFrm * ) const;
91 : :
92 : : virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const;
93 : :
94 : : virtual sal_Bool GetCrsrOfst( SwPosition *, Point&,
95 : : SwCrsrMoveState* = 0 ) const;
96 : :
97 : : virtual void Cut();
98 : : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
99 : :
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 sal_Bool bDontLeave,
103 : : const sal_Bool bBodyOnly = sal_False,
104 : : const sal_Bool bCalc = sal_False,
105 : : const SwCrsrMoveState *pCMS = 0,
106 : : const sal_Bool bDefaultExpand = sal_True ) const;
107 : :
108 : : SwLayoutFrm( SwFrmFmt*, SwFrm* );
109 : : virtual ~SwLayoutFrm();
110 : :
111 : : virtual void Paint( SwRect const&,
112 : : SwPrintData const*const pPrintData = NULL ) const;
113 : 1163167 : const SwFrm *Lower() const { return pLower; }
114 : 470965 : SwFrm *Lower() { return pLower; }
115 : : const SwCntntFrm *ContainsCntnt() const;
116 : : inline SwCntntFrm *ContainsCntnt();
117 : : const SwCellFrm *FirstCell() const;
118 : : inline SwCellFrm *FirstCell();
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 : : sal_Bool IsAnLower( const SwFrm * ) const;
127 : :
128 : : virtual const SwFrmFmt *GetFmt() const;
129 : : virtual SwFrmFmt *GetFmt();
130 : : void SetFrmFmt( SwFrmFmt* );
131 : :
132 : : //Verschieben der Ftns aller Lower - ab dem StartCntnt.
133 : : //sal_True wenn mindestens eine Ftn verschoben wurde.
134 : : //Ruft das Update der Seitennummer wenn bFtnNums gesetzt ist.
135 : : sal_Bool MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
136 : : SwFtnBossFrm *pNewBoss, const sal_Bool bFtnNums );
137 : :
138 : : // --> #i28701# - change purpose of method and its name
139 : : // --> #i44016# - add parameter <_bUnlockPosOfObjs> to
140 : : // force an unlockposition call for the lower objects.
141 : : void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false );
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 : : 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 : : virtual void PaintBreak() const;
176 : : };
177 : :
178 : : //Um doppelte Implementierung zu sparen wird hier ein bischen gecasted
179 : 77505 : inline SwCntntFrm* SwLayoutFrm::ContainsCntnt()
180 : : {
181 : 77505 : return (SwCntntFrm*)(((const SwLayoutFrm*)this)->ContainsCntnt());
182 : : }
183 : :
184 : 42 : inline SwCellFrm* SwLayoutFrm::FirstCell()
185 : : {
186 : 42 : return (SwCellFrm*)(((const SwLayoutFrm*)this)->FirstCell());
187 : : }
188 : :
189 : 1066 : inline SwFrm* SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections )
190 : : {
191 : 1066 : return (SwFrm*)(((const SwLayoutFrm*)this)->ContainsAny( _bInvestigateFtnForSections ));
192 : : }
193 : :
194 : : // Diese SwFrm-inlines sind hier, damit frame.hxx nicht layfrm.hxx includen muss
195 : 5661 : inline sal_Bool SwFrm::IsColBodyFrm() const
196 : : {
197 [ + + ][ + + ]: 5661 : return nType == FRMC_BODY && GetUpper()->IsColumnFrm();
198 : : }
199 : :
200 : 25318 : inline sal_Bool SwFrm::IsPageBodyFrm() const
201 : : {
202 [ + + ][ + + ]: 25318 : return nType == FRMC_BODY && GetUpper()->IsPageFrm();
203 : : }
204 : :
205 : 82 : inline SwFrm* SwLayoutFrm::GetLastLower()
206 : : {
207 : 82 : return const_cast<SwFrm*>(static_cast<const SwLayoutFrm*>(this)->GetLastLower());
208 : : }
209 : :
210 : : #endif // SW_LAYFRM_HXX
211 : :
212 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|