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 INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
20 : #define INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
21 :
22 : #include "frame.hxx"
23 :
24 : class SwAnchoredObject;
25 : class SwCntntFrm;
26 : class SwFlowFrm;
27 : class SwFmtCol;
28 : struct SwCrsrMoveState;
29 : class SwFrmFmt;
30 : class SwBorderAttrs;
31 : class SwFmtFrmSize;
32 : class SwCellFrm;
33 :
34 : class SwLayoutFrm: public SwFrm
35 : {
36 : //Der verkappte SwFrm
37 : friend class SwFlowFrm;
38 : friend class SwFrm;
39 :
40 : //Hebt die Lower waehrend eines Spaltenumbaus auf.
41 : friend SwFrm* SaveCntnt( SwLayoutFrm *, SwFrm * );
42 : friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow );
43 :
44 : #ifdef DBG_UTIL
45 : //removes empty SwSectionFrms from a chain
46 : friend SwFrm* SwClearDummies( SwFrm* pFrm );
47 : #endif
48 :
49 : void CopySubtree( const SwLayoutFrm *pDest );
50 : protected:
51 : void Destroy(); // for ~SwRootFrm
52 :
53 : virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
54 : virtual void MakeAll() SAL_OVERRIDE;
55 :
56 : SwFrm *pLower;
57 : std::vector<SwAnchoredObject*> aVertPosOrientFrmsFor;
58 :
59 : virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) SAL_OVERRIDE;
60 : virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) SAL_OVERRIDE;
61 :
62 : long CalcRel( const SwFmtFrmSize &rSz, sal_Bool bWidth ) const;
63 :
64 : public:
65 : // --> #i28701#
66 : TYPEINFO_OVERRIDE();
67 :
68 : virtual 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 : //Painted die Column-Trennlinien fuer die innenliegenden Columns.
81 : void PaintColLines( const SwRect &, const SwFmtCol &,
82 : const SwPageFrm * ) const;
83 :
84 : virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const SAL_OVERRIDE;
85 :
86 : virtual bool GetCrsrOfst( SwPosition *, Point&,
87 : SwCrsrMoveState* = 0, bool bTestBackground = false ) const SAL_OVERRIDE;
88 :
89 : virtual void Cut() SAL_OVERRIDE;
90 : virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
91 :
92 : //sucht den dichtesten Cntnt zum SPoint, wird bei Seiten, Flys und Cells
93 : //benutzt wenn GetCrsrOfst versagt hat.
94 : const SwCntntFrm* GetCntntPos( Point &rPoint, const sal_Bool bDontLeave,
95 : const sal_Bool bBodyOnly = sal_False,
96 : const sal_Bool bCalc = sal_False,
97 : const SwCrsrMoveState *pCMS = 0,
98 : const sal_Bool bDefaultExpand = sal_True ) const;
99 :
100 : SwLayoutFrm( SwFrmFmt*, SwFrm* );
101 : virtual ~SwLayoutFrm();
102 :
103 : virtual void Paint( SwRect const&,
104 : SwPrintData const*const pPrintData = NULL ) const SAL_OVERRIDE;
105 0 : const SwFrm *Lower() const { return pLower; }
106 0 : SwFrm *Lower() { return pLower; }
107 : const SwCntntFrm *ContainsCntnt() const;
108 : inline SwCntntFrm *ContainsCntnt();
109 : const SwCellFrm *FirstCell() const;
110 : inline SwCellFrm *FirstCell();
111 : // Method <ContainsAny()> doesn't investigate content of footnotes by default.
112 : // But under certain circumstances this investigation is intended.
113 : // Thus, introduce new optional parameter <_bInvestigateFtnForSections>.
114 : // It's default is <false>, still indicating that content of footnotes isn't
115 : // investigated for sections.
116 : const SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false ) const;
117 : inline SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false );
118 : sal_Bool IsAnLower( const SwFrm * ) const;
119 :
120 : virtual const SwFrmFmt *GetFmt() const;
121 : virtual SwFrmFmt *GetFmt();
122 : void SetFrmFmt( SwFrmFmt* );
123 :
124 : //Verschieben der Ftns aller Lower - ab dem StartCntnt.
125 : //sal_True wenn mindestens eine Ftn verschoben wurde.
126 : //Ruft das Update der Seitennummer wenn bFtnNums gesetzt ist.
127 : sal_Bool MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
128 : SwFtnBossFrm *pNewBoss, const sal_Bool bFtnNums );
129 :
130 : // --> #i28701# - change purpose of method and its name
131 : // --> #i44016# - add parameter <_bUnlockPosOfObjs> to
132 : // force an unlockposition call for the lower objects.
133 : void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false );
134 :
135 : //Invalidiert diejenigen innenliegenden Frames, deren Breite und/oder
136 : //Hoehe Prozentual berechnet werden. Auch Rahmen, die an this oder an
137 : //innenliegenden verankert sind werden ggf. invalidiert.
138 : void InvaPercentLowers( SwTwips nDiff = 0 );
139 :
140 : //Gerufen von Format fuer Rahmen und Bereichen mit Spalten.
141 : void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder,
142 : const SwTwips nMinHeight );
143 :
144 : // InnerHeight returns the height of the content and may be bigger or
145 : // less than the PrtArea-Height of the layoutframe himself
146 : SwTwips InnerHeight() const;
147 :
148 : /** method to check relative position of layout frame to
149 : a given layout frame.
150 :
151 : refactoring of pseudo-local method <lcl_Apres(..)> in
152 : <txtftn.cxx> for #104840#.
153 :
154 : @param _aCheckRefLayFrm
155 : constant reference of an instance of class <SwLayoutFrm> which
156 : is used as the reference for the relative position check.
157 :
158 : @return true, if <this> is positioned before the layout frame <p>
159 : */
160 : bool IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const;
161 :
162 : const SwFrm* GetLastLower() const;
163 : inline SwFrm* GetLastLower();
164 :
165 : virtual void PaintBreak() const;
166 :
167 0 : void SetVertPosOrientFrmFor(SwAnchoredObject *pObj)
168 : {
169 0 : aVertPosOrientFrmsFor.push_back(pObj);
170 0 : }
171 :
172 0 : void ClearVertPosOrientFrmFor(SwAnchoredObject *pObj)
173 : {
174 : aVertPosOrientFrmsFor.erase(
175 : std::remove(aVertPosOrientFrmsFor.begin(),
176 0 : aVertPosOrientFrmsFor.end(), pObj), aVertPosOrientFrmsFor.end());
177 0 : }
178 : };
179 :
180 : //Um doppelte Implementierung zu sparen wird hier ein bischen gecasted
181 0 : inline SwCntntFrm* SwLayoutFrm::ContainsCntnt()
182 : {
183 0 : return (SwCntntFrm*)(((const SwLayoutFrm*)this)->ContainsCntnt());
184 : }
185 :
186 0 : inline SwCellFrm* SwLayoutFrm::FirstCell()
187 : {
188 0 : return (SwCellFrm*)(((const SwLayoutFrm*)this)->FirstCell());
189 : }
190 :
191 0 : inline SwFrm* SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections )
192 : {
193 0 : return (SwFrm*)(((const SwLayoutFrm*)this)->ContainsAny( _bInvestigateFtnForSections ));
194 : }
195 :
196 : // Diese SwFrm-inlines sind hier, damit frame.hxx nicht layfrm.hxx includen muss
197 0 : inline bool SwFrm::IsColBodyFrm() const
198 : {
199 0 : return mnType == FRMC_BODY && GetUpper()->IsColumnFrm();
200 : }
201 :
202 0 : inline bool SwFrm::IsPageBodyFrm() const
203 : {
204 0 : return mnType == FRMC_BODY && GetUpper()->IsPageFrm();
205 : }
206 :
207 0 : inline SwFrm* SwLayoutFrm::GetLastLower()
208 : {
209 0 : return const_cast<SwFrm*>(static_cast<const SwLayoutFrm*>(this)->GetLastLower());
210 : }
211 :
212 : #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
213 :
214 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|