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_TXTFRM_HXX
29 : : #define SW_TXTFRM_HXX
30 : :
31 : : #include <tools/mempool.hxx>
32 : : #include <tools/string.hxx>
33 : : #include "cntfrm.hxx"
34 : : #include "ndtxt.hxx"
35 : :
36 : : class SwCharRange;
37 : : class SwTxtNode;
38 : : class SwTxtFormatter;
39 : : class SwTxtFormatInfo;
40 : : class SwParaPortion;
41 : : class WidowsAndOrphans;
42 : : class SwBodyFrm;
43 : : class SwTxtFtn;
44 : : class SwInterHyphInfo; // Hyphenate()
45 : : class SwCache;
46 : : class SwBorderAttrs;
47 : : class SwFrmFmt;
48 : : class OutputDevice;
49 : : class SwTestFormat;
50 : : struct SwCrsrMoveState;
51 : : struct SwFillData;
52 : : class SwPortionHandler;
53 : : class SwScriptInfo;
54 : : class SwViewOption;
55 : : class SwWrongList;
56 : :
57 : : /// Represents the visualization of a paragraph.
58 : : class SwTxtFrm: public SwCntntFrm
59 : : {
60 : : friend class SwTxtIter;
61 : : friend class SwTestFormat;
62 : : friend class WidowsAndOrphans;
63 : : friend class SwTxtFrmLocker; // duerfen Lock()/Unlock()
64 : : friend sal_Bool lcl_ChangeOffset( SwTxtFrm* pFrm, sal_uInt16 nNew );
65 : :
66 : : static SwCache *pTxtCache; //Pointer auf den Line-Cache
67 : : static long nMinPrtLine; //Diese Linie darf beim Drucken nicht
68 : : //unterschritten werden, Hack fuer Tabellenzellen ueber mehrere Seiten
69 : :
70 : : sal_uLong nAllLines :24;//Anzahl der Zeilen fuer das Paint (inkl. nThisLines)
71 : : sal_uLong nThisLines :8; //Anzahl der Zeilen dieses Frames
72 : :
73 : : // The x position for flys anchored at this paragraph.
74 : : // These values are calculated in SwTxtFrm::CalcBaseOfstForFly()
75 : : SwTwips mnFlyAnchorOfst;
76 : : // The x position for wrap-through flys anchored at this paragraph.
77 : : SwTwips mnFlyAnchorOfstNoWrap;
78 : : SwTwips mnFtnLine;
79 : : // OD 2004-03-17 #i11860# - re-factoring of #i11859#
80 : : // member for height of last line (value needed for proportional line spacing)
81 : : SwTwips mnHeightOfLastLine;
82 : : // member for the additional first line offset, which is caused by the list
83 : : // label alignment for list level position and space mode LABEL_ALIGNMENT.
84 : : // This additional first line offset is used for the text formatting.
85 : : // It is NOT used for the determination of printing area.
86 : : SwTwips mnAdditionalFirstLineOffset;
87 : :
88 : :
89 : : xub_StrLen nOfst; //nOfst gibt den Offset im Cntnt (Anzahl Zeichen) an.
90 : :
91 : : sal_uInt16 nCacheIdx; //Index in den Cache, USHRT_MAX wenn definitiv
92 : : //kein passendes Objekt im Cache steht.
93 : :
94 : : //Teilt den Master ab und erzeugt einen Follow oder passt die
95 : : //Daten im Follow an.
96 : : void _AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset,
97 : : const xub_StrLen nStrEnd, const sal_uInt8 nMode );
98 : : inline void AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset,
99 : : const xub_StrLen nStrEnd, const sal_uInt8 nMode );
100 : :
101 : : //Iteriert ueber alle Zeilen und stellt das Linespacing
102 : : //entsprechend dem Attribut ein.
103 : : void CalcLineSpace();
104 : :
105 : : // Wird nur in Format gerufen:
106 : : void AdjustFrm( const SwTwips nChgHeight, sal_Bool bHasToFit = sal_False );
107 : :
108 : : // wertet in Format() die Preps aus.
109 : : sal_Bool CalcPreps();
110 : : void PrepWidows( const sal_uInt16 nNeed, sal_Bool bNotify = sal_True );
111 : : void _InvalidateRange( const SwCharRange &, const long = 0);
112 : : inline void InvalidateRange( const SwCharRange &, const long = 0);
113 : :
114 : : // WidowsAndOrphans, AdjustFrm, AdjustFollow
115 : : void FormatAdjust( SwTxtFormatter &rLine, WidowsAndOrphans &rFrmBreak,
116 : : const xub_StrLen nStrLen, const sal_Bool bDummy );
117 : :
118 : : sal_Bool bLocked : 1; // im Format?
119 : : sal_Bool bFormatted : 1; // nach Format auf sal_True
120 : : sal_Bool bWidow : 1; // sind wir ein Widow
121 : : sal_Bool bJustWidow : 1; // haben wir soeben Widow angefordert
122 : : sal_Bool bEmpty : 1; // sind wir ein leerer Absatz
123 : : sal_Bool bInFtnConnect : 1; // Steht gerade im Connect
124 : : sal_Bool bFtn : 1; // Hat mindestens eine Fussnote
125 : : sal_Bool bRepaint : 1; // TxtFrm: Repaint steht zur Abholung bereit
126 : : sal_Bool bBlinkPor : 1; // enthaelt Blink-Portions
127 : : sal_Bool bFieldFollow : 1; // beginne mit Feldrest des Masters
128 : : sal_Bool bHasAnimation : 1; // enthaelt animierte SwGrfNumPortion
129 : : sal_Bool bIsSwapped : 1; // during text formatting we swap the
130 : : // width and height for vertical formatting
131 : : // OD 14.03.2003 #i11760# - flag to control, if follow is formatted in
132 : : // method <CalcFollow(..)>.
133 : : // E.g., avoid formatting of follow, if method <SwLayoutFrm::FormatWidthCols(..)>
134 : : // is running.
135 : : sal_Bool mbFollowFormatAllowed : 1;
136 : :
137 : : void ResetPreps();
138 : 29066 : inline void Lock() { bLocked = sal_True; }
139 : 29066 : inline void Unlock() { bLocked = sal_False; }
140 : : inline void SetFormatted( const sal_Bool bNew ) { bFormatted = bNew; }
141 : 11806 : inline void SetWidow( const sal_Bool bNew ) { bWidow = bNew; }
142 : 0 : inline void SetJustWidow( const sal_Bool bNew ) { bJustWidow = bNew; }
143 : 18115 : inline void SetEmpty( const sal_Bool bNew ) { bEmpty = bNew; }
144 : 624 : inline void SetFieldFollow( const sal_Bool bNew ) { bFieldFollow = bNew; }
145 : :
146 : : sal_Bool IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) const;
147 : :
148 : : // Wechselt den Frame oder auch nicht (vgl. FlyCnt)
149 : : sal_Bool _GetCrsrOfst(SwPosition *pPos, const Point &rPoint,
150 : : const sal_Bool bChgFrm, SwCrsrMoveState* = 0 ) const;
151 : : void FillCrsrPos( SwFillData &rFill ) const;
152 : :
153 : : // formatiert genau eine Zeile ...
154 : : sal_Bool FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev );
155 : :
156 : : // Um Stack einzusparen aufgeteilt ...
157 : : // _Format ruft _Format mit Parametern
158 : : void _Format( SwParaPortion *pPara );
159 : : void _Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
160 : : const sal_Bool bAdjust = sal_False );
161 : : void FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf );
162 : :
163 : : // formatiert den Follow und sorgt fuer die Entsorgung bei Orphans
164 : : sal_Bool CalcFollow( const xub_StrLen nTxtOfst );
165 : :
166 : : // korrigiert die Stelle ab der formatiert werden muss.
167 : : xub_StrLen FindBrk(const String &rTxt, const xub_StrLen nStart,
168 : : const xub_StrLen nEnd) const;
169 : :
170 : : // inline-Weiche
171 : : SwTwips _GetFtnFrmHeight() const;
172 : :
173 : : // Aus CalcPreps ausgelagert.
174 : : sal_Bool CalcPrepFtnAdjust();
175 : :
176 : : // Fuer Ftn und WidOrp: Zwangsvalidierung
177 : : void ValidateFrm();
178 : : void ValidateBodyFrm();
179 : :
180 : : sal_Bool _GetDropRect( SwRect &rRect ) const;
181 : :
182 : : void SetPara( SwParaPortion *pNew, sal_Bool bDelete = sal_True );
183 : :
184 : : sal_Bool _IsFtnNumFrm() const;
185 : :
186 : : // 6995: Formatinformationen auffrischen
187 : : sal_Bool FormatQuick( bool bForceQuickFormat );
188 : :
189 : : // Opt: Leere Absaetze formatieren
190 : : sal_Bool FormatEmpty();
191 : : SwTwips EmptyHeight() const;
192 : : // Opt: Leere Absaetze painten
193 : : sal_Bool PaintEmpty( const SwRect &, sal_Bool bCheck ) const;
194 : :
195 : : void ChgThisLines();//Muss immer gerufen werden, wenn sich die Zeilenazahl
196 : : //veraendert haben kann.
197 : :
198 : : // required for 'new' relative anchor position
199 : : void CalcBaseOfstForFly();
200 : :
201 : : /** method to determine height of last line, needed for proportional line spacing
202 : :
203 : : OD 2004-03-17 #i11860#
204 : : OD 2005-05-20 #i47162# - introduce new optional parameter <_bUseFont>
205 : : in order to force the usage of the former algorithm to determine the
206 : : height of the last line, which uses the font.
207 : :
208 : : @param _bUseFont
209 : : optional input parameter - boolean indicating, if the font has to be
210 : : used to determine the height of the last line. default value: false
211 : :
212 : : @author OD
213 : : */
214 : : void _CalcHeightOfLastLine( const bool _bUseFont = false );
215 : :
216 : : // ST2
217 : : SwWrongList* _SmartTagScan ( ::rtl::OUString aTxtToScan, SwWrongList *pSmartTagList,
218 : : xub_StrLen nBegin,xub_StrLen nEnd,
219 : : xub_StrLen nInsertPos, xub_StrLen nActPos,
220 : : xub_StrLen &nChgStart, xub_StrLen &nChgEnd,
221 : : xub_StrLen &nInvStart, xub_StrLen &nInvEnd);
222 : : protected:
223 : : virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
224 : :
225 : : public:
226 : :
227 : : //public, weil der eine oder andere die Methode rufen darf um das
228 : : //Prepare zu sparen - mit Vorsicht zu geniessen!
229 : : void Init();
230 : :
231 : : // Wird von FormatSpelling( ) gerufen
232 : : SwRect _AutoSpell( const SwCntntNode*, const SwViewOption&, sal_uInt16 );
233 : : // is called from the FormatSpelling( ) method
234 : : SwRect SmartTagScan( SwCntntNode* , sal_uInt16 );
235 : : // Wird vom CollectAutoCmplWords gerufen
236 : : void CollectAutoCmplWrds( SwCntntNode* , sal_uInt16 );
237 : :
238 : : // Returns the screen position of rPos. The values are relative to the upper
239 : : // left position of the page frame.
240 : : // Additional information can be obtained by passing an SwCrsrMoveState object.
241 : : // Returns sal_False if rPos > number of character is string
242 : : virtual sal_Bool GetCharRect( SwRect& rRect, const SwPosition& rPos,
243 : : SwCrsrMoveState* pCMS = 0 ) const;
244 : : // Eine etwas abgespeckte GetCharRect-Version fuer autopositionierte Rahmen
245 : : sal_Bool GetAutoPos( SwRect &, const SwPosition& ) const;
246 : :
247 : : /** determine top of line for given position in the text frame
248 : :
249 : : OD 11.11.2003 #i22341#
250 : : Assumption: given position exists in the text frame or in a follow of it
251 : : OD 2004-02-02 - adjustment
252 : : Top of first paragraph line is the top of the paragraph.
253 : : OD 2004-03-18 #i11860# - Consider upper space amount considered for
254 : : previous frame and the page grid.
255 : :
256 : : @author OD
257 : :
258 : : @param _onTopOfLine
259 : : output parameter - top of line, if the given position is found in the
260 : : text frame.
261 : :
262 : : @param _rPos
263 : : input parameter - reference to the position in the text frame
264 : :
265 : : @return boolean indicating, if the top of line for the given position
266 : : has been determined or not.
267 : : */
268 : : bool GetTopOfLine( SwTwips& _onTopOfLine,
269 : : const SwPosition& _rPos ) const;
270 : :
271 : : virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const;
272 : :
273 : :
274 : : //Liefert in nOffset den Offset des Characters innerhalb des
275 : : //gesetzten Textbuffers zurueck, welcher der durch aPoint
276 : : //gegebenen Position innerhalb der SSize des Layout am
277 : : //naechsten ist. Wenn der SPoint ausserhalb der SSize liegt,
278 : : //liefert die Funktion sal_False, sal_True sonst.
279 : : virtual sal_Bool GetCrsrOfst( SwPosition *, Point&,
280 : : SwCrsrMoveState* = 0) const;
281 : :
282 : : // GetKeyCrsrOfst sorgt dafuer, dass der Frame nicht gewechselt wird
283 : : // (z.B. Wechsel in den zeichengebundenen Frame).
284 : 0 : inline sal_Bool GetKeyCrsrOfst(SwPosition *pPos, const Point &rPoint ) const
285 : 0 : { return _GetCrsrOfst( pPos, rPoint, sal_False ); }
286 : :
287 : : void PaintExtraData( const SwRect & rRect ) const; //Seitennummer usw.
288 : : SwRect Paint();
289 : : virtual void Paint( SwRect const&,
290 : : SwPrintData const*const pPrintData = NULL ) const;
291 : : virtual sal_Bool GetInfo( SfxPoolItem & ) const;
292 : :
293 : : //Layoutorientiertes Cursortravelling: Linker, rechter Rand,
294 : : //vorhergehende/naechste Zeile, gleiche horizontale Position.
295 : : virtual sal_Bool LeftMargin(SwPaM *) const;
296 : : virtual sal_Bool RightMargin(SwPaM *, sal_Bool bAPI = sal_False) const;
297 : :
298 : : virtual sal_Bool UnitUp(SwPaM *, const SwTwips nOffset = 0,
299 : : sal_Bool bSetInReadOnly = sal_False ) const;
300 : : virtual sal_Bool UnitDown(SwPaM *, const SwTwips nOffset = 0,
301 : : sal_Bool bSetInReadOnly = sal_False ) const;
302 : : sal_Bool _UnitUp(SwPaM *, const SwTwips nOffset = 0,
303 : : sal_Bool bSetInReadOnly = sal_False ) const;
304 : : sal_Bool _UnitDown(SwPaM *, const SwTwips nOffset = 0,
305 : : sal_Bool bSetInReadOnly = sal_False ) const;
306 : :
307 : : // Prepares the cursor position for a visual cursor move (BiDi).
308 : : // The behaviour is different for insert and overwrite cursors
309 : : void PrepareVisualMove( xub_StrLen& nPos, sal_uInt8& nCrsrLevel,
310 : : sal_Bool& bRight, sal_Bool bInsertCrsr );
311 : :
312 : : // Methoden zur Verwaltung von FolgeFrames
313 : : SwCntntFrm *SplitFrm( const xub_StrLen nTxtPos );
314 : : SwCntntFrm *JoinFrm();
315 : 329426 : inline sal_uInt16 GetOfst() const { return nOfst; }
316 : : void _SetOfst( const sal_uInt16 nNewOfst );
317 : : inline void SetOfst ( const sal_uInt16 nNewOfst );
318 : 1828 : inline void ManipOfst ( const sal_uInt16 nNewOfst ){ nOfst = nNewOfst; }
319 : : SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos);
320 : : inline const SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos) const;
321 : : // OD 07.10.2003 #110978# - return <reference> instead of <pointer>
322 : : SwTxtFrm& GetFrmAtOfst( const xub_StrLen nOfst );
323 : : // Wenn es einen Follow gibt und wir selbst keinen Text enthalten:
324 : 15307 : inline sal_Bool IsEmptyMaster() const
325 [ + + ][ - + ]: 15307 : { return GetFollow() && !GetFollow()->GetOfst(); }
326 : :
327 : : // Liefert den zu bearbeitenden Textausschnitt zurueck (inline, s.u.)
328 : : const String& GetTxt() const;
329 : 1448339 : inline SwTxtNode *GetTxtNode()
330 : 1448339 : { return static_cast< SwTxtNode* >( SwCntntFrm::GetNode()); }
331 : 728316 : inline const SwTxtNode *GetTxtNode() const
332 : 728316 : { return static_cast< const SwTxtNode* >( SwCntntFrm::GetNode()); }
333 : :
334 : : SwTxtFrm(SwTxtNode * const, SwFrm* );
335 : : virtual ~SwTxtFrm();
336 : :
337 : : // SwCntntFrm: der "kurze Dienstweg" fuer die Frames.
338 : : // Wer den void* falsch casted ist selbst Schuld!
339 : : // Auf jedenfall muss der void* auf 0 geprueft werden.
340 : : virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
341 : : const void *pVoid = 0, sal_Bool bNotify = sal_True );
342 : :
343 : : // nMaxHeight is the required height
344 : : // bSplit indicates, that the paragraph has to be split
345 : : // bTst indicates, that we are currently doing a test formatting
346 : : virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit, sal_Bool bTst );
347 : :
348 : : // Hier das WouldFit-Aequivalent fuer mal kurz probeweise
349 : : // umgehaengte TextFrames, auch hier liefert
350 : : // nMaxHeight die benoetigte Hoehe,
351 : : // und bSplit sagt, obj der Absatz gesplittet werden muss.
352 : : // Uebergeben wird der potentielle Vorgaenger fuer die Abstandsberechnung
353 : : sal_Bool TestFormat( const SwFrm* pPrv, SwTwips &nMaxHeight, sal_Bool &bSplit );
354 : :
355 : : // Wir formatieren eine Zeile fuer die interaktive Trennung
356 : : // Return: found
357 : : sal_Bool Hyphenate( SwInterHyphInfo &rInf );
358 : :
359 : : // Probegrow
360 : : inline SwTwips GrowTst( const SwTwips nGrow );
361 : :
362 : : SwParaPortion *GetPara();
363 : : inline const SwParaPortion *GetPara() const;
364 : : inline sal_Bool HasPara() const;
365 : : sal_Bool _HasPara() const;
366 : : // If there are any hanging punctuation portions in the margin
367 : : // the offset will be returned.
368 : : SwTwips HangingMargin() const;
369 : :
370 : : // RTTI
371 : : TYPEINFO();
372 [ + - ][ + - ]: 10400 : DECL_FIXEDMEMPOOL_NEWDEL(SwTxtFrm)
373 : :
374 : : // Locking
375 : 206397 : inline sal_Bool IsLocked() const { return bLocked; }
376 : : inline sal_Bool IsFormatted() const { return bFormatted; }
377 : :
378 : 14203 : inline sal_Bool IsWidow() const { return bWidow; }
379 : 0 : inline sal_Bool IsJustWidow() const { return bJustWidow; }
380 : 163771 : inline sal_Bool IsEmpty() const { return bEmpty; }
381 : 25117 : inline sal_Bool HasFtn() const { return bFtn; }
382 : 424 : inline sal_Bool IsInFtnConnect()const { return bInFtnConnect;}
383 : 1907 : inline sal_Bool IsFieldFollow() const { return bFieldFollow;}
384 : :
385 : : inline void SetRepaint() const;
386 : : inline void ResetRepaint() const;
387 : 7327 : inline sal_Bool HasRepaint() const { return bRepaint; }
388 : : inline void SetBlinkPor() const;
389 : : inline void ResetBlinkPor() const;
390 : 4723 : inline sal_Bool HasBlinkPor() const { return bBlinkPor; }
391 : 0 : inline void SetAnimation() const
392 : 0 : { ( (SwTxtFrm*)this )->bHasAnimation = sal_True; }
393 : 132 : inline sal_Bool HasAnimation() const { return bHasAnimation; }
394 : :
395 : 32 : inline sal_Bool IsSwapped() const { return bIsSwapped; }
396 : :
397 : : // Hat der Frm eine lokale Fussnote (in diesem Frm bzw. Follow)?
398 : : #ifdef DBG_UTIL
399 : : void CalcFtnFlag( xub_StrLen nStop = STRING_LEN );//For testing SplitFrm
400 : : #else
401 : : void CalcFtnFlag();
402 : : #endif
403 : :
404 : : // Hidden
405 : : sal_Bool IsHiddenNow() const; // bHidden && pOut == pPrt
406 : : void HideHidden(); // Anhaengsel entfernen wenn Hidden
407 : : void HideFootnotes( xub_StrLen nStart, xub_StrLen nEnd );
408 : :
409 : : /** method to hide/show objects
410 : :
411 : : OD 2004-01-15 #110582#
412 : : method hides respectively shows objects, which are anchored at paragraph,
413 : : at/as a character of the paragraph, corresponding to the paragraph and
414 : : paragraph portion visibility.
415 : :
416 : : @author OD
417 : : */
418 : : void HideAndShowObjects();
419 : :
420 : : // Ftn
421 : : void RemoveFtn( const xub_StrLen nStart = 0,
422 : : const xub_StrLen nLen = STRING_LEN );
423 : : inline SwTwips GetFtnFrmHeight() const;
424 : : SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn );
425 : : inline const SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn ) const
426 : : { return FindFtnRef( pFtn ); }
427 : : void ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine );
428 : :
429 : : // Wenn wir eine Ftn sind, die auf ihre Referenz zu waechst...
430 : : // public weil von SwCntntFrm::MakeAll benoetigt.
431 : : SwTwips GetFtnLine( const SwTxtFtn *pFtn ) const;
432 : :
433 : : // Liefern den linken und den rechten Rand in
434 : : // Dokumentkoordinaten (unter Beachtung der Absatzattribute).
435 : : inline SwTwips GetLeftMargin() const;
436 : : inline SwTwips GetRightMargin() const;
437 : :
438 : : virtual void Format( const SwBorderAttrs *pAttrs = 0 );
439 : : virtual void CheckDirection( sal_Bool bVert );
440 : :
441 : : // Liefert die Summe der Zeilenhoehen in pLine zurueck.
442 : : sal_uInt16 GetParHeight() const;
443 : :
444 : : // Liefert die Resthoehe zurueck
445 : : inline SwTwips GetRstHeight() const;
446 : :
447 : : inline SwTxtFrm *GetFollow();
448 : : inline const SwTxtFrm *GetFollow() const;
449 : :
450 : : // Suche die Seitennummer von ErgoSum und QuoVadis
451 : : SwTxtFrm *FindQuoVadisFrm();
452 : :
453 : : // holt die Formatierug nach, wenn der Idle-Handler zugeschlagen hat.
454 : : // #i29062# GetFormatted() can trigger a full formatting
455 : : // of the paragraph, causing other layout frames to become invalid. This
456 : : // has to be avoided during painting. Therefore we need to pass the
457 : : // information that we are currently in the paint process.
458 : : SwTxtFrm* GetFormatted( bool bForceQuickFormat = false );
459 : :
460 : : // wird demnaechst uebertragen
461 : 187 : inline void SetFtn( const sal_Bool bNew ) { bFtn = bNew; }
462 : :
463 : : // Beruecksichtigung der Follows
464 : : inline sal_Bool IsInside( const xub_StrLen nPos ) const;
465 : :
466 : : const SwBodyFrm *FindBodyFrm() const;
467 : :
468 : : // DropCaps und Selektionen
469 : 485 : inline sal_Bool GetDropRect( SwRect &rRect ) const
470 [ + + ]: 485 : { return HasPara() ? _GetDropRect( rRect ) : sal_False; }
471 : :
472 : 650210 : static SwCache *GetTxtCache() { return pTxtCache; }
473 : 73 : static void SetTxtCache( SwCache *pNew ) { pTxtCache = pNew; }
474 : :
475 : 13807 : static long GetMinPrtLine() { return nMinPrtLine; }
476 : : static void SetMinPrtLine( long nNew ) { nMinPrtLine = nNew; }
477 : :
478 : 1063136 : inline sal_uInt16 GetCacheIdx() const { return nCacheIdx; }
479 : 8103 : inline void SetCacheIdx( const sal_uInt16 nNew ) { nCacheIdx = nNew; }
480 : :
481 : : //Entfert die Line-Informationen aus dem Cache.
482 : : void ClearPara();
483 : :
484 : : // Bin ich ein FtnFrm, der eine Nummer am Absatzanfang hat?
485 : 11151 : inline sal_Bool IsFtnNumFrm() const
486 [ + + ][ + + ]: 11151 : { return IsInFtn() && !GetIndPrev() && _IsFtnNumFrm(); }
[ + - ]
487 : :
488 : : // simuliert eine Formatierung, als wenn es keinen rechten Rand und
489 : : // keine Flys oder andere Hindernisse gaebe und liefert die Breite.
490 : : SwTwips CalcFitToContent();
491 : :
492 : : /** simulate format for a list item paragraph, whose list level attributes
493 : : are in LABEL_ALIGNMENT mode, in order to determine additional first
494 : : line offset for the real text formatting due to the value of label
495 : : adjustment attribute of the list level.
496 : :
497 : : @author OD
498 : : */
499 : : void CalcAdditionalFirstLineOffset();
500 : :
501 : 71642 : inline SwTwips GetAdditionalFirstLineOffset() const
502 : : {
503 : 71642 : return mnAdditionalFirstLineOffset;
504 : : }
505 : :
506 : : // liefert den zusaetzlichen Zeilenabstand fuer den naechsten Absatz
507 : : // OD 07.01.2004 #i11859# - change return data type;
508 : : // add default parameter <_bNoPropLineSpacing> to control, if the
509 : : // value of a proportional line spacing is returned or not
510 : : long GetLineSpace( const bool _bNoPropLineSpacing = false ) const;
511 : :
512 : : // liefert die erste Zeilenhoehe zurueck
513 : : sal_uInt16 FirstLineHeight() const;
514 : :
515 : : // Haengt FlyInCntFrm um, wenn nEnd > Index >= nStart ist.
516 : : void MoveFlyInCnt( SwTxtFrm *pNew, sal_uInt16 nStart, sal_uInt16 nEnd );
517 : :
518 : : // Berechnet die Position von FlyInCntFrms
519 : : sal_uInt16 CalcFlyPos( SwFrmFmt* pSearch );
520 : :
521 : : // Ermittelt die Startposition und Schrittweite des Registers
522 : : sal_Bool FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff );
523 : :
524 : :
525 : : sal_uInt16 GetLineCount( sal_uInt16 nPos ); //Ermittelt die Zeilenanzahl
526 : :
527 : : //Fuer die Anzeige der Zeilennummern.
528 : 20393 : sal_uLong GetAllLines() const { return nAllLines; }
529 : 5788 : sal_uLong GetThisLines() const { return nThisLines;}
530 : : void RecalcAllLines();
531 : :
532 : : // Stoppt Animationen innerhalb von Numerierungen
533 : : void StopAnimation( OutputDevice *pOut );
534 : :
535 : : // visit all portions for Accessibility
536 : : void VisitPortions( SwPortionHandler& rPH ) const;
537 : :
538 : : // returns the script info stored at the paraportion
539 : : const SwScriptInfo* GetScriptInfo() const;
540 : :
541 : : // Swaps width and height of the text frame
542 : : void SwapWidthAndHeight();
543 : : // Calculates the coordinates of a rectangle when switching from
544 : : // horizontal to vertical layout.
545 : : void SwitchHorizontalToVertical( SwRect& rRect ) const;
546 : : // Calculates the coordinates of a point when switching from
547 : : // horizontal to vertical layout.
548 : : void SwitchHorizontalToVertical( Point& rPoint ) const;
549 : : // Calculates the a limit value when switching from
550 : : // horizontal to vertical layout.
551 : : long SwitchHorizontalToVertical( long nLimit ) const;
552 : : // Calculates the coordinates of a rectangle when switching from
553 : : // vertical to horizontal layout.
554 : : void SwitchVerticalToHorizontal( SwRect& rRect ) const;
555 : : // Calculates the coordinates of a point when switching from
556 : : // vertical to horizontal layout.
557 : : void SwitchVerticalToHorizontal( Point& rPoint ) const;
558 : : // Calculates the a limit value when switching from
559 : : // vertical to horizontal layout.
560 : : long SwitchVerticalToHorizontal( long nLimit ) const;
561 : :
562 : : // Calculates the coordinates of a rectangle when switching from
563 : : // LTR to RTL layout
564 : : void SwitchLTRtoRTL( SwRect& rRect ) const;
565 : : // Calculates the coordinates of a point when switching from
566 : : // LTR to RTL layout.
567 : : void SwitchLTRtoRTL( Point& rPoint ) const;
568 : : // Calculates the coordinates of a rectangle when switching from
569 : : // RTL to LTR layout
570 : 0 : inline void SwitchRTLtoLTR( SwRect& rRect ) const { SwitchLTRtoRTL( rRect ); }
571 : : // Calculates the coordinates of a point when switching from
572 : : // RTL to LTR layout.
573 : 0 : inline void SwitchRTLtoLTR( Point& rPoint ) const { SwitchLTRtoRTL( rPoint ); };
574 : :
575 : : // OD 14.03.2003 #i11760# - access to new member <mbNoFollowFormat>
576 : 624 : inline bool FollowFormatAllowed() const
577 : : {
578 : 624 : return mbFollowFormatAllowed;
579 : : }
580 : 726 : inline void AllowFollowFormat()
581 : : {
582 : 726 : mbFollowFormatAllowed = true;
583 : 726 : }
584 : 0 : inline void ForbidFollowFormat()
585 : : {
586 : 0 : mbFollowFormatAllowed = false;
587 : 0 : }
588 : :
589 : 90533 : SwTwips GetBaseOfstForFly( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const
590 : : {
591 : : return ( bIgnoreFlysAnchoredAtThisFrame ?
592 : : mnFlyAnchorOfst :
593 [ + + ]: 90533 : mnFlyAnchorOfstNoWrap );
594 : : }
595 : :
596 : : // OD 2004-03-17 #i11860#
597 : 1167 : inline SwTwips GetHeightOfLastLine() const
598 : : {
599 : 1167 : return mnHeightOfLastLine;
600 : : }
601 : :
602 : : static void repaintTextFrames( const SwTxtNode& rNode );
603 : :
604 : : virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
605 : : };
606 : :
607 : : /*************************************************************************
608 : : * class SwTxtFrmLocker
609 : : *************************************************************************/
610 : :
611 : : class SwTxtFrmLocker
612 : : {
613 : : private:
614 : : SwTxtFrm * const pFrm;
615 : : public:
616 : 29129 : inline SwTxtFrmLocker( SwTxtFrm *pTxtFrm )
617 [ + + ]: 29129 : : pFrm( pTxtFrm->IsLocked() ? 0 : pTxtFrm )
618 [ + + ]: 29129 : { if( pFrm ) pFrm->Lock(); }
619 [ + + ]: 29129 : inline ~SwTxtFrmLocker() { if( pFrm ) pFrm->Unlock(); }
620 : : };
621 : :
622 : : /*************************************************************************
623 : : * Inline-Implementierung
624 : : *************************************************************************/
625 : :
626 : 108342 : inline const SwParaPortion *SwTxtFrm::GetPara() const
627 : : {
628 : 108342 : return ((SwTxtFrm*)this)->GetPara();
629 : : }
630 : :
631 : 275812 : inline sal_Bool SwTxtFrm::HasPara() const
632 : : {
633 [ + + ]: 275812 : return nCacheIdx != USHRT_MAX ? _HasPara() : sal_False;
634 : : }
635 : :
636 : : // 9104: Frm().Height() - Prt().Height(), siehe widorp.cxx und 7455, 6114, 7908
637 : : inline SwTwips SwTxtFrm::GetRstHeight() const
638 : : {
639 : : return !GetUpper() ? 0 : ((const SwFrm*)GetUpper())->Frm().Top()
640 : : + ((const SwFrm*)GetUpper())->Prt().Top()
641 : : + ((const SwFrm*)GetUpper())->Prt().Height()
642 : : - Frm().Top() - (Frm().Height() - Prt().Height());
643 : : }
644 : :
645 : : inline SwTwips SwTxtFrm::GetLeftMargin() const
646 : : {
647 : : return Frm().Left() + Prt().Left();
648 : : }
649 : : inline SwTwips SwTxtFrm::GetRightMargin() const
650 : : {
651 : : return Frm().Left() + Prt().Left() + Prt().Width();
652 : : }
653 : 2039 : inline SwTwips SwTxtFrm::GrowTst( const SwTwips nGrow )
654 : : {
655 : 2039 : return Grow( nGrow, sal_True );
656 : : }
657 : :
658 : : #ifdef DBG_UTIL
659 : : // query WYSIWYG DBG
660 : : extern sal_Bool IsDbg( const SwTxtFrm *pFrm );
661 : : #endif
662 : :
663 : 2 : inline sal_Bool SwTxtFrm::IsInside( const xub_StrLen nPos ) const
664 : : {
665 : 2 : sal_Bool bRet = sal_True;
666 [ - + ]: 2 : if( nPos < GetOfst() )
667 : 0 : bRet = sal_False;
668 : : else
669 : : {
670 : 2 : const SwTxtFrm *pFoll = GetFollow();
671 [ # # ][ - + ]: 2 : if( pFoll && nPos >= pFoll->GetOfst() )
[ - + ]
672 : 0 : bRet = sal_False;
673 : : }
674 : 2 : return bRet;
675 : : }
676 : :
677 : 231 : inline SwTwips SwTxtFrm::GetFtnFrmHeight() const
678 : : {
679 [ + - ][ + - ]: 231 : if( !IsFollow() && IsInFtn() && HasPara() )
[ + - ][ + - ]
680 : 231 : return _GetFtnFrmHeight();
681 : : else
682 : 231 : return 0;
683 : : }
684 : :
685 : 34618 : inline const SwTxtFrm *SwTxtFrm::GetFollow() const
686 : : {
687 : 34618 : return (const SwTxtFrm*)SwCntntFrm::GetFollow();
688 : : }
689 : 453864 : inline SwTxtFrm *SwTxtFrm::GetFollow()
690 : : {
691 : 453864 : return (SwTxtFrm*)SwCntntFrm::GetFollow();
692 : : }
693 : :
694 : : inline const SwTxtFrm *SwTxtFrm::GetFrmAtPos( const SwPosition &rPos) const
695 : : {
696 : : return ((SwTxtFrm*)this)->GetFrmAtPos( rPos );
697 : : }
698 : :
699 : : inline void SwTxtFrm::AdjustFollow( SwTxtFormatter &rLine,
700 : : const xub_StrLen nOffset, const xub_StrLen nStrEnd, const sal_uInt8 nMode )
701 : : {
702 : : if ( HasFollow() )
703 : : _AdjustFollow( rLine, nOffset, nStrEnd, nMode );
704 : : }
705 : :
706 : 44 : inline void SwTxtFrm::SetOfst( const xub_StrLen nNewOfst )
707 : : {
708 [ + - ]: 44 : if ( nOfst != nNewOfst )
709 : 44 : _SetOfst( nNewOfst );
710 : 44 : }
711 : :
712 : 14115 : inline void SwTxtFrm::SetRepaint() const
713 : : {
714 : 14115 : ((SwTxtFrm*)this)->bRepaint = sal_True;
715 : 14115 : }
716 : 33095 : inline void SwTxtFrm::ResetRepaint() const
717 : : {
718 : 33095 : ((SwTxtFrm*)this)->bRepaint = sal_False;
719 : 33095 : }
720 : :
721 : 224 : inline void SwTxtFrm::SetBlinkPor() const
722 : : {
723 : 224 : ((SwTxtFrm*)this)->bBlinkPor = sal_True;
724 : 224 : }
725 : 1864 : inline void SwTxtFrm::ResetBlinkPor() const
726 : : {
727 : 1864 : ((SwTxtFrm*)this)->bBlinkPor = sal_False;
728 : 1864 : }
729 : :
730 : : #define SWAP_IF_SWAPPED( pFrm )\
731 : : sal_Bool bUndoSwap = sal_False; \
732 : : if ( pFrm->IsVertical() && pFrm->IsSwapped() )\
733 : : { \
734 : : bUndoSwap = sal_True; \
735 : : ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); \
736 : : }
737 : :
738 : : #define SWAP_IF_NOT_SWAPPED( pFrm )\
739 : : sal_Bool bUndoSwap = sal_False; \
740 : : if ( pFrm->IsVertical() && ! pFrm->IsSwapped() )\
741 : : { \
742 : : bUndoSwap = sal_True; \
743 : : ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); \
744 : : }
745 : :
746 : : #define UNDO_SWAP( pFrm )\
747 : : if ( bUndoSwap )\
748 : : ((SwTxtFrm*)pFrm)->SwapWidthAndHeight();
749 : :
750 : : // Helper class which can be used instead of the macros if a function
751 : : // has too many returns
752 : : class SwFrmSwapper
753 : : {
754 : : const SwTxtFrm* pFrm;
755 : : sal_Bool bUndo;
756 : : public:
757 : : SwFrmSwapper( const SwTxtFrm* pFrm, sal_Bool bSwapIfNotSwapped );
758 : : ~SwFrmSwapper();
759 : : };
760 : :
761 : : class SwLayoutModeModifier
762 : : {
763 : : const OutputDevice& rOut;
764 : : long nOldLayoutMode;
765 : : public:
766 : : SwLayoutModeModifier( const OutputDevice& rOutp );
767 : : ~SwLayoutModeModifier();
768 : : void Modify( sal_Bool bChgToRTL );
769 : : void SetAuto();
770 : : };
771 : :
772 : : class SwDigitModeModifier
773 : : {
774 : : const OutputDevice& rOut;
775 : : LanguageType nOldLanguageType;
776 : : public:
777 : : SwDigitModeModifier( const OutputDevice& rOutp, LanguageType eCurLang );
778 : : ~SwDigitModeModifier();
779 : : };
780 : :
781 : : #endif
782 : :
783 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|