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 _FRMTOOL_HXX
24cdf0e10cSrcweir #define _FRMTOOL_HXX
25cdf0e10cSrcweir #include "swtypes.hxx"
26cdf0e10cSrcweir #include "layfrm.hxx"
27cdf0e10cSrcweir #include "frmatr.hxx"
28cdf0e10cSrcweir #include "swcache.hxx"
29cdf0e10cSrcweir // --> OD 2008-12-04 #i96772#
30cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
31cdf0e10cSrcweir // <--
32cdf0e10cSrcweir
33cdf0e10cSrcweir class SwPageFrm;
34cdf0e10cSrcweir class SwFlyFrm;
35cdf0e10cSrcweir class SwCntntFrm;
36cdf0e10cSrcweir class SwRootFrm;
37cdf0e10cSrcweir class SwDoc;
38cdf0e10cSrcweir class SwAttrSet;
39cdf0e10cSrcweir class SdrObject;
40cdf0e10cSrcweir class BigInt;
41cdf0e10cSrcweir class SvxBrushItem;
42cdf0e10cSrcweir class SdrMarkList;
43cdf0e10cSrcweir class SwNodeIndex;
44cdf0e10cSrcweir class OutputDevice;
45cdf0e10cSrcweir class SwPageDesc;
46cdf0e10cSrcweir class SwTableBox;
47cdf0e10cSrcweir struct SwFindRowSpanCacheObj;
48cdf0e10cSrcweir
49cdf0e10cSrcweir #if defined(MSC)
50cdf0e10cSrcweir #define MA_FASTCALL __fastcall
51cdf0e10cSrcweir #else
52cdf0e10cSrcweir #define MA_FASTCALL
53cdf0e10cSrcweir #endif
54cdf0e10cSrcweir
55cdf0e10cSrcweir #define WEIT_WECH LONG_MAX - 20000 //Initale Position der Flys.
56cdf0e10cSrcweir #define BROWSE_HEIGHT 56700L * 10L //10 Meter
57cdf0e10cSrcweir //#define BROWSE_HEIGHT 1440L * 45L // 45 inch, maximum size for pdf files
58cdf0e10cSrcweir
59cdf0e10cSrcweir #define GRFNUM_NO 0
60cdf0e10cSrcweir #define GRFNUM_YES 1
61cdf0e10cSrcweir #define GRFNUM_REPLACE 2
62cdf0e10cSrcweir
63cdf0e10cSrcweir //Painten des Hintergrunds. Mit Brush oder Graphic.
64cdf0e10cSrcweir // OD 05.08.2002 #99657# - add 6th parameter to indicate that method should
65cdf0e10cSrcweir // consider background transparency, saved in the color of the brush item
66cdf0e10cSrcweir void MA_FASTCALL DrawGraphic( const SvxBrushItem *, OutputDevice *,
67cdf0e10cSrcweir const SwRect &rOrg, const SwRect &rOut, const sal_uInt8 nGrfNum = GRFNUM_NO,
68cdf0e10cSrcweir const sal_Bool bConsiderBackgroundTransparency = sal_False );
69cdf0e10cSrcweir
70cdf0e10cSrcweir // OD 24.01.2003 #106593# - method to align rectangle
71cdf0e10cSrcweir // Created declaration here to avoid <extern> declarations
72cdf0e10cSrcweir void MA_FASTCALL SwAlignRect( SwRect &rRect, ViewShell *pSh );
73cdf0e10cSrcweir
74cdf0e10cSrcweir // OD 24.01.2003 #106593# - method to align graphic rectangle
75cdf0e10cSrcweir // Created declaration here to avoid <extern> declarations
76cdf0e10cSrcweir void SwAlignGrfRect( SwRect *pGrfRect, const OutputDevice &rOut );
77cdf0e10cSrcweir
78cdf0e10cSrcweir //Fly besorgen, wenn keine List hineingereicht wird, wir die der aktuellen
79cdf0e10cSrcweir //Shell benutzt.
80cdf0e10cSrcweir //Implementierung in feshview.cxx
81cdf0e10cSrcweir SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, ViewShell *pSh );
82cdf0e10cSrcweir
83cdf0e10cSrcweir //Nicht gleich die math.lib anziehen.
84cdf0e10cSrcweir sal_uLong MA_FASTCALL SqRt( BigInt nX );
85cdf0e10cSrcweir
86cdf0e10cSrcweir SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart );
87cdf0e10cSrcweir void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGrow );
88cdf0e10cSrcweir
89cdf0e10cSrcweir //CntntNodes besorgen, CntntFrms erzeugen und in den LayFrm haengen.
90cdf0e10cSrcweir void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, sal_uLong nIndex,
91cdf0e10cSrcweir sal_Bool bPages = sal_False, sal_uLong nEndIndex = 0,
92cdf0e10cSrcweir SwFrm *pPrv = 0 );
93cdf0e10cSrcweir
94cdf0e10cSrcweir //Erzeugen der Frames fuer einen bestimmten Bereich, verwendet _InsertCnt
95cdf0e10cSrcweir void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
96cdf0e10cSrcweir const SwNodeIndex &rEndIdx );
97cdf0e10cSrcweir
98cdf0e10cSrcweir //Um z.B. fuer Tabelleheadlines das Erzeugen der Flys in _InsertCnt zu unterbinden.
99cdf0e10cSrcweir extern sal_Bool bDontCreateObjects;
100cdf0e10cSrcweir
101cdf0e10cSrcweir //Fuer FlyCnts, siehe SwFlyAtCntFrm::MakeAll()
102cdf0e10cSrcweir extern sal_Bool bSetCompletePaintOnInvalidate;
103cdf0e10cSrcweir
104cdf0e10cSrcweir //Fuer Tabelleneinstellung per Tastatur.
105cdf0e10cSrcweir long MA_FASTCALL CalcRowRstHeight( SwLayoutFrm *pRow );
106cdf0e10cSrcweir long MA_FASTCALL CalcHeightWidthFlys( const SwFrm *pFrm ); //MA_FLY_HEIGHT
107cdf0e10cSrcweir
108cdf0e10cSrcweir //Neue Seite einsetzen
109cdf0e10cSrcweir SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
110cdf0e10cSrcweir sal_Bool bOdd, sal_Bool bInsertEmpty, sal_Bool bFtn,
111cdf0e10cSrcweir SwFrm *pSibling );
112cdf0e10cSrcweir
113cdf0e10cSrcweir //Flys bei der Seite anmelden.
114cdf0e10cSrcweir void RegistFlys( SwPageFrm*, const SwLayoutFrm* );
115cdf0e10cSrcweir
116cdf0e10cSrcweir //Benachrichtung des Fly Hintergrundes wenn Notwendig.
117cdf0e10cSrcweir void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld,
118cdf0e10cSrcweir const SwRect* pOldRect = 0 );
119cdf0e10cSrcweir
120cdf0e10cSrcweir void Notify_Background( const SdrObject* pObj,
121cdf0e10cSrcweir SwPageFrm* pPage,
122cdf0e10cSrcweir const SwRect& rRect,
123cdf0e10cSrcweir const PrepareHint eHint,
124cdf0e10cSrcweir const sal_Bool bInva );
125cdf0e10cSrcweir
126cdf0e10cSrcweir const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos );
127cdf0e10cSrcweir
128cdf0e10cSrcweir sal_Bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj );
129cdf0e10cSrcweir
130cdf0e10cSrcweir const SwFrm *FindKontext( const SwFrm *pFrm, sal_uInt16 nAdditionalKontextTyp );
131cdf0e10cSrcweir
132cdf0e10cSrcweir sal_Bool IsFrmInSameKontext( const SwFrm *pInnerFrm, const SwFrm *pFrm );
133cdf0e10cSrcweir
134cdf0e10cSrcweir const SwFrm * MA_FASTCALL FindPage( const SwRect &rRect, const SwFrm *pPage );
135cdf0e10cSrcweir
136cdf0e10cSrcweir // JP 07.05.98: wird von SwCntntNode::GetFrm und von SwFlyFrm::GetFrm
137cdf0e10cSrcweir // gerufen
138cdf0e10cSrcweir SwFrm* GetFrmOfModify( const SwRootFrm* pLayout, SwModify const&, sal_uInt16 const nFrmType, const Point* = 0,
139cdf0e10cSrcweir const SwPosition *pPos = 0,
140cdf0e10cSrcweir const sal_Bool bCalcFrm = sal_False );
141cdf0e10cSrcweir
142cdf0e10cSrcweir //Sollen ExtraDaten (Reline-Strich, Zeilennummern) gepaintet werden?
143cdf0e10cSrcweir sal_Bool IsExtraData( const SwDoc *pDoc );
144cdf0e10cSrcweir
145cdf0e10cSrcweir // OD 14.03.2003 #i11760# - method declaration <CalcCntnt(..)>
146cdf0e10cSrcweir void CalcCntnt( SwLayoutFrm *pLay,
147cdf0e10cSrcweir bool bNoColl = false,
148cdf0e10cSrcweir bool bNoCalcFollow = false );
149cdf0e10cSrcweir
150cdf0e10cSrcweir
151cdf0e10cSrcweir //Die Notify-Klassen merken sich im CTor die aktuellen Groessen und fuehren
152cdf0e10cSrcweir //im DTor ggf. die notwendigen Benachrichtigungen durch.
153cdf0e10cSrcweir
154cdf0e10cSrcweir class SwFrmNotify
155cdf0e10cSrcweir {
156cdf0e10cSrcweir protected:
157cdf0e10cSrcweir SwFrm *pFrm;
158cdf0e10cSrcweir const SwRect aFrm;
159cdf0e10cSrcweir const SwRect aPrt;
160cdf0e10cSrcweir SwTwips mnFlyAnchorOfst;
161cdf0e10cSrcweir SwTwips mnFlyAnchorOfstNoWrap;
162cdf0e10cSrcweir sal_Bool bHadFollow;
163cdf0e10cSrcweir sal_Bool bInvaKeep;
164cdf0e10cSrcweir sal_Bool bValidSize;
165cdf0e10cSrcweir protected:
166cdf0e10cSrcweir // --> OD 2005-07-29 #i49383#
167cdf0e10cSrcweir bool mbFrmDeleted;
168cdf0e10cSrcweir // <--
169cdf0e10cSrcweir
170cdf0e10cSrcweir public:
171cdf0e10cSrcweir SwFrmNotify( SwFrm *pFrm );
172cdf0e10cSrcweir ~SwFrmNotify();
173cdf0e10cSrcweir
Frm() const174cdf0e10cSrcweir const SwRect &Frm() const { return aFrm; }
Prt() const175cdf0e10cSrcweir const SwRect &Prt() const { return aPrt; }
SetInvaKeep()176cdf0e10cSrcweir void SetInvaKeep() { bInvaKeep = sal_True; }
177cdf0e10cSrcweir // --> OD 2005-07-29 #i49383#
FrmDeleted()178cdf0e10cSrcweir void FrmDeleted()
179cdf0e10cSrcweir {
180cdf0e10cSrcweir mbFrmDeleted = true;
181cdf0e10cSrcweir }
182cdf0e10cSrcweir // <--
183cdf0e10cSrcweir };
184cdf0e10cSrcweir
185cdf0e10cSrcweir class SwLayNotify : public SwFrmNotify
186cdf0e10cSrcweir {
187cdf0e10cSrcweir sal_Bool bLowersComplete;
188cdf0e10cSrcweir
GetLay()189cdf0e10cSrcweir SwLayoutFrm *GetLay() { return (SwLayoutFrm*)pFrm; }
190cdf0e10cSrcweir public:
191cdf0e10cSrcweir SwLayNotify( SwLayoutFrm *pLayFrm );
192cdf0e10cSrcweir ~SwLayNotify();
193cdf0e10cSrcweir
SetLowersComplete(sal_Bool b)194cdf0e10cSrcweir void SetLowersComplete( sal_Bool b ) { bLowersComplete = b; }
IsLowersComplete()195cdf0e10cSrcweir sal_Bool IsLowersComplete() { return bLowersComplete; }
196cdf0e10cSrcweir };
197cdf0e10cSrcweir
198cdf0e10cSrcweir class SwFlyNotify : public SwLayNotify
199cdf0e10cSrcweir {
200cdf0e10cSrcweir SwPageFrm *pOldPage;
201cdf0e10cSrcweir const SwRect aFrmAndSpace;
GetFly()202cdf0e10cSrcweir SwFlyFrm *GetFly() { return (SwFlyFrm*)pFrm; }
203cdf0e10cSrcweir public:
204cdf0e10cSrcweir SwFlyNotify( SwFlyFrm *pFlyFrm );
205cdf0e10cSrcweir ~SwFlyNotify();
206cdf0e10cSrcweir
GetOldPage() const207cdf0e10cSrcweir SwPageFrm *GetOldPage() const { return pOldPage; }
208cdf0e10cSrcweir };
209cdf0e10cSrcweir
210cdf0e10cSrcweir class SwCntntNotify : public SwFrmNotify
211cdf0e10cSrcweir {
212cdf0e10cSrcweir private:
213cdf0e10cSrcweir // OD 08.01.2004 #i11859#
214cdf0e10cSrcweir bool mbChkHeightOfLastLine;
215cdf0e10cSrcweir SwTwips mnHeightOfLastLine;
216cdf0e10cSrcweir
217cdf0e10cSrcweir // OD 2004-02-26 #i25029#
218cdf0e10cSrcweir bool mbInvalidatePrevPrtArea;
219cdf0e10cSrcweir bool mbBordersJoinedWithPrev;
220cdf0e10cSrcweir
GetCnt()221cdf0e10cSrcweir SwCntntFrm *GetCnt() { return (SwCntntFrm*)pFrm; }
222cdf0e10cSrcweir
223cdf0e10cSrcweir public:
224cdf0e10cSrcweir SwCntntNotify( SwCntntFrm *pCntFrm );
225cdf0e10cSrcweir ~SwCntntNotify();
226cdf0e10cSrcweir
227cdf0e10cSrcweir // OD 2004-02-26 #i25029#
SetInvalidatePrevPrtArea()228cdf0e10cSrcweir void SetInvalidatePrevPrtArea()
229cdf0e10cSrcweir {
230cdf0e10cSrcweir mbInvalidatePrevPrtArea = true;
231cdf0e10cSrcweir }
232cdf0e10cSrcweir
SetBordersJoinedWithPrev()233cdf0e10cSrcweir void SetBordersJoinedWithPrev()
234cdf0e10cSrcweir {
235cdf0e10cSrcweir mbBordersJoinedWithPrev = true;
236cdf0e10cSrcweir }
237cdf0e10cSrcweir };
238cdf0e10cSrcweir
239cdf0e10cSrcweir //SwBorderAttrs kapselt die Berechnung fuer die Randattribute inclusive
240cdf0e10cSrcweir //Umrandung. Die Attribute und die errechneten Werte werden gecached.
241cdf0e10cSrcweir //Neu: Die gesammte Klasse wird gecached.
242cdf0e10cSrcweir
243cdf0e10cSrcweir //!!!Achtung: Wenn weitere Attribute gecached werden muss unbedingt die
244cdf0e10cSrcweir //Methode Modify::Modify mitgepflegt werden!!!
245cdf0e10cSrcweir
246cdf0e10cSrcweir // OD 23.01.2003 #106895# - delete old method <SwBorderAttrs::CalcRight()> and
247cdf0e10cSrcweir // the stuff that belongs to it.
248cdf0e10cSrcweir class SwBorderAttrs : public SwCacheObj
249cdf0e10cSrcweir {
250cdf0e10cSrcweir const SwAttrSet &rAttrSet;
251cdf0e10cSrcweir const SvxULSpaceItem &rUL;
252cdf0e10cSrcweir // --> OD 2008-12-04 #i96772#
253cdf0e10cSrcweir SvxLRSpaceItem rLR;
254cdf0e10cSrcweir // <--
255cdf0e10cSrcweir const SvxBoxItem &rBox;
256cdf0e10cSrcweir const SvxShadowItem &rShadow;
257cdf0e10cSrcweir const Size aFrmSize; //Die FrmSize
258cdf0e10cSrcweir
259cdf0e10cSrcweir sal_Bool bBorderDist :1; //Ist's ein Frm der auch ohne Linie
260cdf0e10cSrcweir //einen Abstand haben kann?
261cdf0e10cSrcweir
262cdf0e10cSrcweir //Mit den Folgenden Bools werden die gecache'ten Werte fuer UNgueltig
263cdf0e10cSrcweir //erklaert - bis sie einmal berechnet wurden.
264cdf0e10cSrcweir sal_Bool bTopLine :1;
265cdf0e10cSrcweir sal_Bool bBottomLine :1;
266cdf0e10cSrcweir sal_Bool bLeftLine :1;
267cdf0e10cSrcweir sal_Bool bRightLine :1;
268cdf0e10cSrcweir sal_Bool bTop :1;
269cdf0e10cSrcweir sal_Bool bBottom :1;
270cdf0e10cSrcweir sal_Bool bLine :1;
271cdf0e10cSrcweir
272cdf0e10cSrcweir sal_Bool bIsLine :1; //Umrandung an mind. einer Kante?
273cdf0e10cSrcweir
274cdf0e10cSrcweir sal_Bool bCacheGetLine :1; //GetTopLine(), GetBottomLine() cachen?
275cdf0e10cSrcweir sal_Bool bCachedGetTopLine :1; //GetTopLine() gecached?
276cdf0e10cSrcweir sal_Bool bCachedGetBottomLine :1; //GetBottomLine() gecached?
277cdf0e10cSrcweir // OD 21.05.2003 #108789# - booleans indicating, if values <bJoinedWithPrev>
278cdf0e10cSrcweir // and <bJoinedWithNext> are cached and valid.
279cdf0e10cSrcweir // Caching depends on value of <bCacheGetLine>.
280cdf0e10cSrcweir mutable sal_Bool bCachedJoinedWithPrev :1;
281cdf0e10cSrcweir mutable sal_Bool bCachedJoinedWithNext :1;
282cdf0e10cSrcweir // OD 21.05.2003 #108789# - booleans indicating, if borders are joined
283cdf0e10cSrcweir // with previous/next frame.
284cdf0e10cSrcweir sal_Bool bJoinedWithPrev :1;
285cdf0e10cSrcweir sal_Bool bJoinedWithNext :1;
286cdf0e10cSrcweir
287cdf0e10cSrcweir //Die gecache'ten Werte, undefiniert bis sie einmal berechnet wurden.
288cdf0e10cSrcweir sal_uInt16 nTopLine,
289cdf0e10cSrcweir nBottomLine,
290cdf0e10cSrcweir nLeftLine,
291cdf0e10cSrcweir nRightLine,
292cdf0e10cSrcweir nTop,
293cdf0e10cSrcweir nBottom,
294cdf0e10cSrcweir nGetTopLine,
295cdf0e10cSrcweir nGetBottomLine;
296cdf0e10cSrcweir
297cdf0e10cSrcweir //Nur die Lines + Shadow errechnen.
298cdf0e10cSrcweir void _CalcTopLine();
299cdf0e10cSrcweir void _CalcBottomLine();
300cdf0e10cSrcweir void _CalcLeftLine();
301cdf0e10cSrcweir void _CalcRightLine();
302cdf0e10cSrcweir
303cdf0e10cSrcweir //Lines + Shadow + Abstaende
304cdf0e10cSrcweir void _CalcTop();
305cdf0e10cSrcweir void _CalcBottom();
306cdf0e10cSrcweir
307cdf0e10cSrcweir void _IsLine();
308cdf0e10cSrcweir
309cdf0e10cSrcweir // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm>
310cdf0e10cSrcweir // If set, its value is taken for testing, if borders/shadow have to joined
311cdf0e10cSrcweir // with previous frame.
312cdf0e10cSrcweir void _GetTopLine ( const SwFrm& _rFrm,
313cdf0e10cSrcweir const SwFrm* _pPrevFrm = 0L );
314cdf0e10cSrcweir void _GetBottomLine( const SwFrm& _rFrm );
315cdf0e10cSrcweir
316cdf0e10cSrcweir // OD 21.05.2003 #108789# - private methods to calculate cached values
317cdf0e10cSrcweir // <bJoinedWithPrev> and <bJoinedWithNext>.
318cdf0e10cSrcweir // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm>
319cdf0e10cSrcweir // If set, its value is taken for testing, if borders/shadow have to joined
320cdf0e10cSrcweir // with previous frame.
321cdf0e10cSrcweir void _CalcJoinedWithPrev( const SwFrm& _rFrm,
322cdf0e10cSrcweir const SwFrm* _pPrevFrm = 0L );
323cdf0e10cSrcweir void _CalcJoinedWithNext( const SwFrm& _rFrm );
324cdf0e10cSrcweir
325cdf0e10cSrcweir // OD 21.05.2003 #108789# - internal helper method for methods
326cdf0e10cSrcweir // <_CalcJoinedWithPrev> and <_CalcJoinedWithNext>.
327cdf0e10cSrcweir sal_Bool _JoinWithCmp( const SwFrm& _rCallerFrm,
328cdf0e10cSrcweir const SwFrm& _rCmpFrm ) const;
329cdf0e10cSrcweir
330cdf0e10cSrcweir //Rechte und linke Linie sowie LRSpace gleich?
331cdf0e10cSrcweir // OD 21.05.2003 #108789# - change name of 1st parameter - "rAttrs" -> "rCmpAttrs".
332cdf0e10cSrcweir sal_Bool CmpLeftRight( const SwBorderAttrs &rCmpAttrs,
333cdf0e10cSrcweir const SwFrm *pCaller,
334cdf0e10cSrcweir const SwFrm *pCmp ) const;
335cdf0e10cSrcweir
336cdf0e10cSrcweir public:
337cdf0e10cSrcweir DECL_FIXEDMEMPOOL_NEWDEL(SwBorderAttrs)
338cdf0e10cSrcweir
339cdf0e10cSrcweir SwBorderAttrs( const SwModify *pOwner, const SwFrm *pConstructor );
340cdf0e10cSrcweir ~SwBorderAttrs();
341cdf0e10cSrcweir
GetAttrSet() const342cdf0e10cSrcweir inline const SwAttrSet &GetAttrSet() const { return rAttrSet; }
GetULSpace() const343cdf0e10cSrcweir inline const SvxULSpaceItem &GetULSpace() const { return rUL; }
GetLRSpace() const344cdf0e10cSrcweir inline const SvxLRSpaceItem &GetLRSpace() const { return rLR; }
GetBox() const345cdf0e10cSrcweir inline const SvxBoxItem &GetBox() const { return rBox; }
GetShadow() const346cdf0e10cSrcweir inline const SvxShadowItem &GetShadow() const { return rShadow; }
347cdf0e10cSrcweir
348cdf0e10cSrcweir inline sal_uInt16 CalcTopLine() const;
349cdf0e10cSrcweir inline sal_uInt16 CalcBottomLine() const;
350cdf0e10cSrcweir inline sal_uInt16 CalcLeftLine() const;
351cdf0e10cSrcweir inline sal_uInt16 CalcRightLine() const;
352cdf0e10cSrcweir inline sal_uInt16 CalcTop() const;
353cdf0e10cSrcweir inline sal_uInt16 CalcBottom() const;
354cdf0e10cSrcweir long CalcLeft( const SwFrm *pCaller ) const;
355cdf0e10cSrcweir long CalcRight( const SwFrm *pCaller ) const;
356cdf0e10cSrcweir
357cdf0e10cSrcweir inline sal_Bool IsLine() const;
358cdf0e10cSrcweir
GetSize() const359cdf0e10cSrcweir inline const Size &GetSize() const { return aFrmSize; }
360cdf0e10cSrcweir
IsBorderDist() const361cdf0e10cSrcweir inline sal_Bool IsBorderDist() const { return bBorderDist; }
362cdf0e10cSrcweir
363cdf0e10cSrcweir //Sollen obere bzw. untere Umrandung fuer den Frm ausgewertet werden?
364cdf0e10cSrcweir // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm>
365cdf0e10cSrcweir // If set, its value is taken for testing, if borders/shadow have to joined
366cdf0e10cSrcweir // with previous frame.
367cdf0e10cSrcweir inline sal_uInt16 GetTopLine ( const SwFrm& _rFrm,
368cdf0e10cSrcweir const SwFrm* _pPrevFrm = 0L ) const;
369cdf0e10cSrcweir inline sal_uInt16 GetBottomLine( const SwFrm& _rFrm ) const;
370cdf0e10cSrcweir inline void SetGetCacheLine( sal_Bool bNew ) const;
371cdf0e10cSrcweir // OD 21.05.2003 #108789# - accessors for cached values <bJoinedWithPrev>
372cdf0e10cSrcweir // and <bJoinedWithPrev>
373cdf0e10cSrcweir // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm>
374cdf0e10cSrcweir // If set, its value is taken for testing, if borders/shadow have to joined
375cdf0e10cSrcweir // with previous frame.
376cdf0e10cSrcweir sal_Bool JoinedWithPrev( const SwFrm& _rFrm,
377cdf0e10cSrcweir const SwFrm* _pPrevFrm = 0L ) const;
378cdf0e10cSrcweir sal_Bool JoinedWithNext( const SwFrm& _rFrm ) const;
379cdf0e10cSrcweir };
380cdf0e10cSrcweir
381cdf0e10cSrcweir class SwBorderAttrAccess : public SwCacheAccess
382cdf0e10cSrcweir {
383cdf0e10cSrcweir const SwFrm *pConstructor; //opt: Zur weitergabe an SwBorderAttrs
384cdf0e10cSrcweir protected:
385cdf0e10cSrcweir virtual SwCacheObj *NewObj();
386cdf0e10cSrcweir
387cdf0e10cSrcweir public:
388cdf0e10cSrcweir SwBorderAttrAccess( SwCache &rCache, const SwFrm *pOwner );
389cdf0e10cSrcweir
390cdf0e10cSrcweir SwBorderAttrs *Get();
391cdf0e10cSrcweir };
392cdf0e10cSrcweir
393cdf0e10cSrcweir //---------------------------------------------------------------------
394cdf0e10cSrcweir //Iterator fuer die DrawObjecte einer Seite. Die Objecte werden Nach ihrer
395cdf0e10cSrcweir //Z-Order iteriert.
396cdf0e10cSrcweir //Das iterieren ist nicht eben billig, denn fuer alle Operationen muss jeweils
397cdf0e10cSrcweir //ueber das gesamte SortArray iteriert werden.
398cdf0e10cSrcweir class SwOrderIter
399cdf0e10cSrcweir {
400cdf0e10cSrcweir const SwPageFrm *pPage;
401cdf0e10cSrcweir const SdrObject *pCurrent;
402cdf0e10cSrcweir const sal_Bool bFlysOnly;
403cdf0e10cSrcweir public:
404cdf0e10cSrcweir SwOrderIter( const SwPageFrm *pPage, sal_Bool bFlysOnly = sal_True );
405cdf0e10cSrcweir
Current(const SdrObject * pNew)406cdf0e10cSrcweir void Current( const SdrObject *pNew ) { pCurrent = pNew; }
Current() const407cdf0e10cSrcweir const SdrObject *Current() const { return pCurrent; }
operator ()() const408cdf0e10cSrcweir const SdrObject *operator()() const { return pCurrent; }
409cdf0e10cSrcweir const SdrObject *Top();
410cdf0e10cSrcweir const SdrObject *Bottom();
411cdf0e10cSrcweir const SdrObject *Next();
412cdf0e10cSrcweir const SdrObject *Prev();
413cdf0e10cSrcweir };
414cdf0e10cSrcweir
415cdf0e10cSrcweir
416cdf0e10cSrcweir class StackHack
417cdf0e10cSrcweir {
418cdf0e10cSrcweir static sal_uInt8 nCnt;
419cdf0e10cSrcweir static sal_Bool bLocked;
420cdf0e10cSrcweir public:
StackHack()421cdf0e10cSrcweir StackHack()
422cdf0e10cSrcweir {
423cdf0e10cSrcweir if ( ++StackHack::nCnt > 50 )
424cdf0e10cSrcweir StackHack::bLocked = sal_True;
425cdf0e10cSrcweir }
~StackHack()426cdf0e10cSrcweir ~StackHack()
427cdf0e10cSrcweir {
428cdf0e10cSrcweir if ( --StackHack::nCnt < 5 )
429cdf0e10cSrcweir StackHack::bLocked = sal_False;
430cdf0e10cSrcweir }
431cdf0e10cSrcweir
IsLocked()432cdf0e10cSrcweir static sal_Bool IsLocked() { return StackHack::bLocked; }
Count()433cdf0e10cSrcweir static sal_uInt8 Count() { return StackHack::nCnt; }
434cdf0e10cSrcweir };
435cdf0e10cSrcweir
436cdf0e10cSrcweir
437cdf0e10cSrcweir //Sollen obere bzw. untere Umrandung fuer den Frm ausgewertet werden?
438cdf0e10cSrcweir // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm>
439cdf0e10cSrcweir // If set, its value is taken for testing, if borders/shadow have to joined
440cdf0e10cSrcweir // with previous frame.
GetTopLine(const SwFrm & _rFrm,const SwFrm * _pPrevFrm) const441cdf0e10cSrcweir inline sal_uInt16 SwBorderAttrs::GetTopLine ( const SwFrm& _rFrm,
442cdf0e10cSrcweir const SwFrm* _pPrevFrm ) const
443cdf0e10cSrcweir {
444cdf0e10cSrcweir if ( !bCachedGetTopLine || _pPrevFrm )
445cdf0e10cSrcweir {
446cdf0e10cSrcweir const_cast<SwBorderAttrs*>(this)->_GetTopLine( _rFrm, _pPrevFrm );
447cdf0e10cSrcweir }
448cdf0e10cSrcweir return nGetTopLine;
449cdf0e10cSrcweir }
GetBottomLine(const SwFrm & _rFrm) const450cdf0e10cSrcweir inline sal_uInt16 SwBorderAttrs::GetBottomLine( const SwFrm& _rFrm ) const
451cdf0e10cSrcweir {
452cdf0e10cSrcweir if ( !bCachedGetBottomLine )
453cdf0e10cSrcweir const_cast<SwBorderAttrs*>(this)->_GetBottomLine( _rFrm );
454cdf0e10cSrcweir return nGetBottomLine;
455cdf0e10cSrcweir }
SetGetCacheLine(sal_Bool bNew) const456cdf0e10cSrcweir inline void SwBorderAttrs::SetGetCacheLine( sal_Bool bNew ) const
457cdf0e10cSrcweir {
458cdf0e10cSrcweir ((SwBorderAttrs*)this)->bCacheGetLine = bNew;
459cdf0e10cSrcweir ((SwBorderAttrs*)this)->bCachedGetBottomLine =
460cdf0e10cSrcweir ((SwBorderAttrs*)this)->bCachedGetTopLine = sal_False;
461cdf0e10cSrcweir // OD 21.05.2003 #108789# - invalidate cache for values <bJoinedWithPrev>
462cdf0e10cSrcweir // and <bJoinedWithNext>.
463cdf0e10cSrcweir bCachedJoinedWithPrev = sal_False;
464cdf0e10cSrcweir bCachedJoinedWithNext = sal_False;
465cdf0e10cSrcweir }
466cdf0e10cSrcweir
CalcTopLine() const467cdf0e10cSrcweir inline sal_uInt16 SwBorderAttrs::CalcTopLine() const
468cdf0e10cSrcweir {
469cdf0e10cSrcweir if ( bTopLine )
470cdf0e10cSrcweir ((SwBorderAttrs*)this)->_CalcTopLine();
471cdf0e10cSrcweir return nTopLine;
472cdf0e10cSrcweir }
CalcBottomLine() const473cdf0e10cSrcweir inline sal_uInt16 SwBorderAttrs::CalcBottomLine() const
474cdf0e10cSrcweir {
475cdf0e10cSrcweir if ( bBottomLine )
476cdf0e10cSrcweir ((SwBorderAttrs*)this)->_CalcBottomLine();
477cdf0e10cSrcweir return nBottomLine;
478cdf0e10cSrcweir }
CalcLeftLine() const479cdf0e10cSrcweir inline sal_uInt16 SwBorderAttrs::CalcLeftLine() const
480cdf0e10cSrcweir {
481cdf0e10cSrcweir if ( bLeftLine )
482cdf0e10cSrcweir ((SwBorderAttrs*)this)->_CalcLeftLine();
483cdf0e10cSrcweir return nLeftLine;
484cdf0e10cSrcweir }
CalcRightLine() const485cdf0e10cSrcweir inline sal_uInt16 SwBorderAttrs::CalcRightLine() const
486cdf0e10cSrcweir {
487cdf0e10cSrcweir if ( bRightLine )
488cdf0e10cSrcweir ((SwBorderAttrs*)this)->_CalcRightLine();
489cdf0e10cSrcweir return nRightLine;
490cdf0e10cSrcweir }
CalcTop() const491cdf0e10cSrcweir inline sal_uInt16 SwBorderAttrs::CalcTop() const
492cdf0e10cSrcweir {
493cdf0e10cSrcweir if ( bTop )
494cdf0e10cSrcweir ((SwBorderAttrs*)this)->_CalcTop();
495cdf0e10cSrcweir return nTop;
496cdf0e10cSrcweir }
CalcBottom() const497cdf0e10cSrcweir inline sal_uInt16 SwBorderAttrs::CalcBottom() const
498cdf0e10cSrcweir {
499cdf0e10cSrcweir if ( bBottom )
500cdf0e10cSrcweir ((SwBorderAttrs*)this)->_CalcBottom();
501cdf0e10cSrcweir return nBottom;
502cdf0e10cSrcweir }
IsLine() const503cdf0e10cSrcweir inline sal_Bool SwBorderAttrs::IsLine() const
504cdf0e10cSrcweir {
505cdf0e10cSrcweir if ( bLine )
506cdf0e10cSrcweir ((SwBorderAttrs*)this)->_IsLine();
507cdf0e10cSrcweir return bIsLine;
508cdf0e10cSrcweir }
509cdf0e10cSrcweir
510cdf0e10cSrcweir /** method to determine the spacing values of a frame
511cdf0e10cSrcweir
512cdf0e10cSrcweir OD 2004-03-10 #i28701#
513cdf0e10cSrcweir Values only provided for flow frames (table, section or text frames)
514cdf0e10cSrcweir Note: line spacing value is only determined for text frames
515cdf0e10cSrcweir OD 2009-08-28 #i102458#
516cdf0e10cSrcweir Add output parameter <obIsLineSpacingProportional>
517cdf0e10cSrcweir
518cdf0e10cSrcweir @param rFrm
519cdf0e10cSrcweir input parameter - frame, for which the spacing values are determined.
520cdf0e10cSrcweir
521cdf0e10cSrcweir @param onPrevLowerSpacing
522cdf0e10cSrcweir output parameter - lower spacing of the frame in SwTwips
523cdf0e10cSrcweir
524cdf0e10cSrcweir @param onPrevLineSpacing
525cdf0e10cSrcweir output parameter - line spacing of the frame in SwTwips
526cdf0e10cSrcweir
527cdf0e10cSrcweir @param obIsLineSpacingProportional
528cdf0e10cSrcweir
529cdf0e10cSrcweir @author OD
530cdf0e10cSrcweir */
531cdf0e10cSrcweir void GetSpacingValuesOfFrm( const SwFrm& rFrm,
532cdf0e10cSrcweir SwTwips& onLowerSpacing,
533cdf0e10cSrcweir SwTwips& onLineSpacing,
534cdf0e10cSrcweir bool& obIsLineSpacingProportional );
535cdf0e10cSrcweir
536cdf0e10cSrcweir /** method to get the content of the table cell
537cdf0e10cSrcweir
538cdf0e10cSrcweir Content from any nested tables will be omitted.
539cdf0e10cSrcweir Note: line spacing value is only determined for text frames
540cdf0e10cSrcweir
541cdf0e10cSrcweir @param rCell_
542cdf0e10cSrcweir input parameter - the cell which should be searched for content.
543cdf0e10cSrcweir
544cdf0e10cSrcweir return
545cdf0e10cSrcweir pointer to the found content frame or 0
546cdf0e10cSrcweir */
547cdf0e10cSrcweir
548cdf0e10cSrcweir const SwCntntFrm* GetCellCntnt( const SwLayoutFrm& rCell_ );
549cdf0e10cSrcweir
550cdf0e10cSrcweir
551cdf0e10cSrcweir /** helper class to check if a frame has been deleted during an operation
552cdf0e10cSrcweir * !!!WARNING!!! This should only be used as a last and desperate means
553cdf0e10cSrcweir * to make the code robust.
554cdf0e10cSrcweir */
555cdf0e10cSrcweir
556cdf0e10cSrcweir class SwDeletionChecker
557cdf0e10cSrcweir {
558cdf0e10cSrcweir private:
559cdf0e10cSrcweir
560cdf0e10cSrcweir const SwFrm* mpFrm;
561cdf0e10cSrcweir const SwModify* mpRegIn;
562cdf0e10cSrcweir
563cdf0e10cSrcweir public:
564cdf0e10cSrcweir
SwDeletionChecker(const SwFrm * pFrm)565cdf0e10cSrcweir SwDeletionChecker( const SwFrm* pFrm )
566cdf0e10cSrcweir : mpFrm( pFrm ),
567cdf0e10cSrcweir mpRegIn( pFrm ? const_cast<SwFrm*>(pFrm)->GetRegisteredIn() : 0 )
568cdf0e10cSrcweir {
569cdf0e10cSrcweir }
570cdf0e10cSrcweir
571cdf0e10cSrcweir /**
572cdf0e10cSrcweir * return
573cdf0e10cSrcweir * true if mpFrm != 0 and mpFrm is not client of pRegIn
574cdf0e10cSrcweir * false otherwise
575cdf0e10cSrcweir */
576cdf0e10cSrcweir bool HasBeenDeleted();
577cdf0e10cSrcweir };
578cdf0e10cSrcweir
579cdf0e10cSrcweir #endif //_FRMTOOL_HXX
580