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