merge the formfield patch from ooo-build
[ooovba.git] / sw / source / core / inc / txtfrm.hxx
blobd5a6f6791241640d04248bde5772d9565d086ca7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: txtfrm.hxx,v $
10 * $Revision: 1.56.110.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _TXTFRM_HXX
31 #define _TXTFRM_HXX
32 #include <tools/mempool.hxx>
33 #include <tools/string.hxx>
34 #include "cntfrm.hxx"
36 #define STRSIZE(x) (sizeof(x)-1)
38 class SwCharRange;
39 class SwTxtNode;
40 class SwTxtFormatter;
41 class SwTxtFormatInfo;
42 class SwParaPortion;
43 class WidowsAndOrphans;
44 class SwBodyFrm;
45 class SwTxtFtn;
46 class SwInterHyphInfo; // Hyphenate()
47 class SwCache;
48 class SwBorderAttrs;
49 class SwFrmFmt;
50 class OutputDevice;
51 class SwTestFormat;
52 class SwStripes;
53 struct SwCrsrMoveState;
54 struct SwFillData;
55 class SwPortionHandler;
56 class SwScriptInfo;
57 class SwViewOption;
58 class SwWrongList;
60 #define GRID_ON 0
61 #define GRID_HEIGHT 1
62 #define RUBY_HEIGHT 2
63 #define RUBY_TOP 3
64 #define GRID_CELLS 4
66 class SwTxtFrm: public SwCntntFrm
68 friend class SwTxtIter;
69 friend class SwTestFormat;
70 friend class WidowsAndOrphans;
71 friend class SwTxtFrmLocker; // duerfen Lock()/Unlock()
72 friend sal_Bool lcl_ChangeOffset( SwTxtFrm* pFrm, USHORT nNew );
74 static SwCache *pTxtCache; //Pointer auf den Line-Cache
75 static long nMinPrtLine; //Diese Linie darf beim Drucken nicht
76 //unterschritten werden, Hack fuer Tabellenzellen ueber mehrere Seiten
78 ULONG nAllLines :24;//Anzahl der Zeilen fuer das Paint (inkl. nThisLines)
79 ULONG nThisLines :8; //Anzahl der Zeilen dieses Frames
81 // The x position for flys anchored at this paragraph.
82 // These values are calculated in SwTxtFrm::CalcBaseOfstForFly()
83 SwTwips mnFlyAnchorOfst;
84 // The x position for wrap-through flys anchored at this paragraph.
85 SwTwips mnFlyAnchorOfstNoWrap;
86 SwTwips mnFtnLine;
87 // OD 2004-03-17 #i11860# - re-factoring of #i11859#
88 // member for height of last line (value needed for proportional line spacing)
89 SwTwips mnHeightOfLastLine;
90 // --> OD 2008-01-31 #newlistlevelattrs#
91 // member for the additional first line offset, which is caused by the list
92 // label alignment for list level position and space mode LABEL_ALIGNMENT.
93 // This additional first line offset is used for the text formatting.
94 // It is NOT used for the determination of printing area.
95 SwTwips mnAdditionalFirstLineOffset;
96 // <--
99 xub_StrLen nOfst; //nOfst gibt den Offset im Cntnt (Anzahl Zeichen) an.
101 USHORT nCacheIdx; //Index in den Cache, USHRT_MAX wenn definitiv
102 //kein passendes Objekt im Cache steht.
104 //Teilt den Master ab und erzeugt einen Follow oder passt die
105 //Daten im Follow an.
106 void _AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset,
107 const xub_StrLen nStrEnd, const sal_uInt8 nMode );
108 inline void AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset,
109 const xub_StrLen nStrEnd, const sal_uInt8 nMode );
111 //Iteriert ueber alle Zeilen und stellt das Linespacing
112 //entsprechend dem Attribut ein.
113 void CalcLineSpace();
115 void InitCtor(); // Wird in beiden Ctoren gerufen
117 // Wird nur in Format gerufen:
118 void AdjustFrm( const SwTwips nChgHeight, sal_Bool bHasToFit = sal_False );
120 // wertet in Format() die Preps aus.
121 sal_Bool CalcPreps();
122 void PrepWidows( const USHORT nNeed, sal_Bool bNotify = sal_True );
123 void _InvalidateRange( const SwCharRange &, const long = 0);
124 inline void InvalidateRange( const SwCharRange &, const long = 0);
126 // WidowsAndOrphans, AdjustFrm, AdjustFollow
127 void FormatAdjust( SwTxtFormatter &rLine, WidowsAndOrphans &rFrmBreak,
128 const xub_StrLen nStrLen, const sal_Bool bDummy );
130 sal_Bool bLocked : 1; // im Format?
131 sal_Bool bFormatted : 1; // nach Format auf sal_True
132 sal_Bool bWidow : 1; // sind wir ein Widow
133 sal_Bool bJustWidow : 1; // haben wir soeben Widow angefordert
134 sal_Bool bEmpty : 1; // sind wir ein leerer Absatz
135 sal_Bool bInFtnConnect : 1; // Steht gerade im Connect
136 sal_Bool bFtn : 1; // Hat mindestens eine Fussnote
137 sal_Bool bRepaint : 1; // TxtFrm: Repaint steht zur Abholung bereit
138 sal_Bool bBlinkPor : 1; // enthaelt Blink-Portions
139 sal_Bool bFieldFollow : 1; // beginne mit Feldrest des Masters
140 sal_Bool bHasAnimation : 1; // enthaelt animierte SwGrfNumPortion
141 sal_Bool bIsSwapped : 1; // during text formatting we swap the
142 // width and height for vertical formatting
143 // OD 14.03.2003 #i11760# - flag to control, if follow is formatted in
144 // method <CalcFollow(..)>.
145 // E.g., avoid formatting of follow, if method <SwLayoutFrm::FormatWidthCols(..)>
146 // is running.
147 sal_Bool mbFollowFormatAllowed : 1;
149 void ResetPreps();
150 inline void Lock() { bLocked = sal_True; }
151 inline void Unlock() { bLocked = sal_False; }
152 inline void SetFormatted( const sal_Bool bNew ) { bFormatted = bNew; }
153 inline void SetWidow( const sal_Bool bNew ) { bWidow = bNew; }
154 inline void SetJustWidow( const sal_Bool bNew ) { bJustWidow = bNew; }
155 inline void SetEmpty( const sal_Bool bNew ) { bEmpty = bNew; }
156 inline void SetFieldFollow( const sal_Bool bNew ) { bFieldFollow = bNew; }
158 sal_Bool IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) const;
160 // Wechselt den Frame oder auch nicht (vgl. FlyCnt)
161 sal_Bool _GetCrsrOfst(SwPosition *pPos, const Point &rPoint,
162 const sal_Bool bChgFrm, SwCrsrMoveState* = 0 ) const;
163 void FillCrsrPos( SwFillData &rFill ) const;
165 // formatiert genau eine Zeile ...
166 sal_Bool FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev );
168 // Um Stack einzusparen aufgeteilt ...
169 // _Format ruft _Format mit Parametern
170 void _Format( SwParaPortion *pPara );
171 void _Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
172 const sal_Bool bAdjust = sal_False );
173 void FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf );
175 // formatiert den Follow und sorgt fuer die Entsorgung bei Orphans
176 sal_Bool CalcFollow( const xub_StrLen nTxtOfst );
178 // korrigiert die Stelle ab der formatiert werden muss.
179 xub_StrLen FindBrk(const String &rTxt, const xub_StrLen nStart,
180 const xub_StrLen nEnd) const;
182 // inline-Weiche
183 SwTwips _GetFtnFrmHeight() const;
185 // Aus CalcPreps ausgelagert.
186 sal_Bool CalcPrepFtnAdjust();
188 // Fuer Ftn und WidOrp: Zwangsvalidierung
189 void ValidateFrm();
190 void ValidateBodyFrm();
192 sal_Bool _GetDropRect( SwRect &rRect ) const;
194 void SetPara( SwParaPortion *pNew, sal_Bool bDelete = sal_True );
196 sal_Bool _IsFtnNumFrm() const;
198 // 6995: Formatinformationen auffrischen
199 sal_Bool FormatQuick( bool bForceQuickFormat );
201 // Opt: Leere Absaetze formatieren
202 sal_Bool FormatEmpty();
203 SwTwips EmptyHeight() const;
204 // Opt: Leere Absaetze painten
205 sal_Bool PaintEmpty( const SwRect &, sal_Bool bCheck ) const;
207 void ChgThisLines();//Muss immer gerufen werden, wenn sich die Zeilenazahl
208 //veraendert haben kann.
210 // required for 'new' relative anchor position
211 void CalcBaseOfstForFly();
213 /** method to determine height of last line, needed for proportional line spacing
215 OD 2004-03-17 #i11860#
216 OD 2005-05-20 #i47162# - introduce new optional parameter <_bUseFont>
217 in order to force the usage of the former algorithm to determine the
218 height of the last line, which uses the font.
220 @param _bUseFont
221 optional input parameter - boolean indicating, if the font has to be
222 used to determine the height of the last line. default value: false
224 @author OD
226 void _CalcHeightOfLastLine( const bool _bUseFont = false );
228 // ST2
229 SwWrongList* _SmartTagScan ( ::rtl::OUString aTxtToScan, SwWrongList *pSmartTagList,
230 xub_StrLen nBegin,xub_StrLen nEnd,
231 xub_StrLen nInsertPos, xub_StrLen nActPos,
232 xub_StrLen &nChgStart, xub_StrLen &nChgEnd,
233 xub_StrLen &nInvStart, xub_StrLen &nInvEnd);
235 public:
237 //public, weil der eine oder andere die Methode rufen darf um das
238 //Prepare zu sparen - mit Vorsicht zu geniessen!
239 void Init();
241 // Wird von FormatSpelling( ) gerufen
242 SwRect _AutoSpell( const SwCntntNode*, const SwViewOption&, USHORT );
243 // is called from the FormatSpelling( ) method
244 SwRect SmartTagScan( SwCntntNode* , USHORT );
245 // Wird vom CollectAutoCmplWords gerufen
246 void CollectAutoCmplWrds( SwCntntNode* , USHORT );
248 // Returns the screen position of rPos. The values are relative to the upper
249 // left position of the page frame.
250 // Additional information can be obtained by passing an SwCrsrMoveState object.
251 // Returns sal_False if rPos > number of character is string
252 virtual sal_Bool GetCharRect( SwRect& rRect, const SwPosition& rPos,
253 SwCrsrMoveState* pCMS = 0 ) const;
254 // Eine etwas abgespeckte GetCharRect-Version fuer autopositionierte Rahmen
255 sal_Bool GetAutoPos( SwRect &, const SwPosition& ) const;
257 /** determine top of line for given position in the text frame
259 OD 11.11.2003 #i22341#
260 Assumption: given position exists in the text frame or in a follow of it
261 OD 2004-02-02 - adjustment
262 Top of first paragraph line is the top of the paragraph.
263 OD 2004-03-18 #i11860# - Consider upper space amount considered for
264 previous frame and the page grid.
266 @author OD
268 @param _onTopOfLine
269 output parameter - top of line, if the given position is found in the
270 text frame.
272 @param _rPos
273 input parameter - reference to the position in the text frame
275 @return boolean indicating, if the top of line for the given position
276 has been determined or not.
278 bool GetTopOfLine( SwTwips& _onTopOfLine,
279 const SwPosition& _rPos ) const;
281 virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const;
284 //Liefert in nOffset den Offset des Characters innerhalb des
285 //gesetzten Textbuffers zurueck, welcher der durch aPoint
286 //gegebenen Position innerhalb der SSize des Layout am
287 //naechsten ist. Wenn der SPoint ausserhalb der SSize liegt,
288 //liefert die Funktion sal_False, sal_True sonst.
289 virtual sal_Bool GetCrsrOfst( SwPosition *, Point&,
290 SwCrsrMoveState* = 0) const;
292 // GetKeyCrsrOfst sorgt dafuer, dass der Frame nicht gewechselt wird
293 // (z.B. Wechsel in den zeichengebundenen Frame).
294 inline sal_Bool GetKeyCrsrOfst(SwPosition *pPos, const Point &rPoint ) const
295 { return _GetCrsrOfst( pPos, rPoint, sal_False ); }
297 void PaintExtraData( const SwRect & rRect ) const; //Seitennummer usw.
298 SwRect Paint();
299 virtual void Paint( const SwRect & ) const;
300 virtual void Modify( SfxPoolItem*, SfxPoolItem* );
301 virtual sal_Bool GetInfo( SfxPoolItem & ) const;
303 //Layoutorientiertes Cursortravelling: Linker, rechter Rand,
304 //vorhergehende/naechste Zeile, gleiche horizontale Position.
305 virtual sal_Bool LeftMargin(SwPaM *) const;
306 virtual sal_Bool RightMargin(SwPaM *, sal_Bool bAPI = sal_False) const;
308 virtual sal_Bool UnitUp(SwPaM *, const SwTwips nOffset = 0,
309 sal_Bool bSetInReadOnly = sal_False ) const;
310 virtual sal_Bool UnitDown(SwPaM *, const SwTwips nOffset = 0,
311 sal_Bool bSetInReadOnly = sal_False ) const;
312 sal_Bool _UnitUp(SwPaM *, const SwTwips nOffset = 0,
313 sal_Bool bSetInReadOnly = sal_False ) const;
314 sal_Bool _UnitDown(SwPaM *, const SwTwips nOffset = 0,
315 sal_Bool bSetInReadOnly = sal_False ) const;
317 // Prepares the cursor position for a visual cursor move (BiDi).
318 // The behaviour is different for insert and overwrite cursors
319 void PrepareVisualMove( xub_StrLen& nPos, BYTE& nCrsrLevel,
320 sal_Bool& bRight, sal_Bool bInsertCrsr );
322 // Methoden zur Verwaltung von FolgeFrames
323 SwCntntFrm *SplitFrm( const xub_StrLen nTxtPos );
324 SwCntntFrm *JoinFrm();
325 inline USHORT GetOfst() const { return nOfst; }
326 void _SetOfst( const USHORT nNewOfst );
327 inline void SetOfst ( const USHORT nNewOfst );
328 inline void ManipOfst ( const USHORT nNewOfst ){ nOfst = nNewOfst; }
329 SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos);
330 inline const SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos) const;
331 // OD 07.10.2003 #110978# - return <reference> instead of <pointer>
332 SwTxtFrm& GetFrmAtOfst( const xub_StrLen nOfst );
333 // Wenn es einen Follow gibt und wir selbst keinen Text enthalten:
334 inline sal_Bool IsEmptyMaster() const
335 { return GetFollow() && !GetFollow()->GetOfst(); }
337 // Liefert den zu bearbeitenden Textausschnitt zurueck (inline, s.u.)
338 const String& GetTxt() const;
339 inline SwTxtNode *GetTxtNode()
340 { return (SwTxtNode*)SwCntntFrm::GetNode(); }
341 inline const SwTxtNode *GetTxtNode() const
342 { return (SwTxtNode*)SwCntntFrm::GetNode(); }
344 SwTxtFrm(SwTxtNode * const);
345 virtual ~SwTxtFrm();
347 // SwCntntFrm: der "kurze Dienstweg" fuer die Frames.
348 // Wer den void* falsch casted ist selbst Schuld!
349 // Auf jedenfall muss der void* auf 0 geprueft werden.
350 virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR,
351 const void *pVoid = 0, sal_Bool bNotify = sal_True );
353 // nMaxHeight is the required height
354 // bSplit indicates, that the paragraph has to be split
355 // bTst indicates, that we are currently doing a test formatting
356 virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit, sal_Bool bTst );
358 // Hier das WouldFit-Aequivalent fuer mal kurz probeweise
359 // umgehaengte TextFrames, auch hier liefert
360 // nMaxHeight die benoetigte Hoehe,
361 // und bSplit sagt, obj der Absatz gesplittet werden muss.
362 // Uebergeben wird der potentielle Vorgaenger fuer die Abstandsberechnung
363 sal_Bool TestFormat( const SwFrm* pPrv, SwTwips &nMaxHeight, sal_Bool &bSplit );
365 // Wir formatieren eine Zeile fuer die interaktive Trennung
366 // Return: found
367 sal_Bool Hyphenate( SwInterHyphInfo &rInf );
369 // Probegrow
370 inline SwTwips GrowTst( const SwTwips nGrow );
372 SwParaPortion *GetPara();
373 inline const SwParaPortion *GetPara() const;
374 inline sal_Bool HasPara() const;
375 sal_Bool _HasPara() const;
376 // If there are any hanging punctuation portions in the margin
377 // the offset will be returned.
378 SwTwips HangingMargin() const;
380 // RTTI
381 TYPEINFO();
382 DECL_FIXEDMEMPOOL_NEWDEL(SwTxtFrm)
384 // Locking
385 inline sal_Bool IsLocked() const { return bLocked; }
386 inline sal_Bool IsFormatted() const { return bFormatted; }
388 inline sal_Bool IsWidow() const { return bWidow; }
389 inline sal_Bool IsJustWidow() const { return bJustWidow; }
390 inline sal_Bool IsEmpty() const { return bEmpty; }
391 inline sal_Bool HasFtn() const { return bFtn; }
392 inline sal_Bool IsInFtnConnect()const { return bInFtnConnect;}
393 inline sal_Bool IsFieldFollow() const { return bFieldFollow;}
395 inline void SetRepaint() const;
396 inline void ResetRepaint() const;
397 inline sal_Bool HasRepaint() const { return bRepaint; }
398 inline void SetBlinkPor() const;
399 inline void ResetBlinkPor() const;
400 inline sal_Bool HasBlinkPor() const { return bBlinkPor; }
401 inline void SetAnimation() const
402 { ( (SwTxtFrm*)this )->bHasAnimation = sal_True; }
403 inline sal_Bool HasAnimation() const { return bHasAnimation; }
405 inline sal_Bool IsSwapped() const { return bIsSwapped; }
407 // Hat der Frm eine lokale Fussnote (in diesem Frm bzw. Follow)?
408 #ifdef PRODUCT
409 void CalcFtnFlag();
410 #else
411 void CalcFtnFlag( xub_StrLen nStop = STRING_LEN );//Fuer den Test von SplitFrm
412 #endif
414 // Hidden
415 sal_Bool IsHiddenNow() const; // bHidden && pOut == pPrt
416 void HideHidden(); // Anhaengsel entfernen wenn Hidden
417 void HideFootnotes( xub_StrLen nStart, xub_StrLen nEnd );
419 /** method to hide/show objects
421 OD 2004-01-15 #110582#
422 method hides respectively shows objects, which are anchored at paragraph,
423 at/as a character of the paragraph, corresponding to the paragraph and
424 paragraph portion visibility.
426 @author OD
428 void HideAndShowObjects();
430 // Ftn
431 void RemoveFtn( const xub_StrLen nStart = 0,
432 const xub_StrLen nLen = STRING_LEN );
433 inline SwTwips GetFtnFrmHeight() const;
434 SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn );
435 inline const SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn ) const
436 { return FindFtnRef( pFtn ); }
437 void ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine );
439 // Wenn wir eine Ftn sind, die auf ihre Referenz zu waechst...
440 // public weil von SwCntntFrm::MakeAll benoetigt.
441 SwTwips GetFtnLine( const SwTxtFtn *pFtn ) const;
443 // Liefern den linken und den rechten Rand in
444 // Dokumentkoordinaten (unter Beachtung der Absatzattribute).
445 inline SwTwips GetLeftMargin() const;
446 inline SwTwips GetRightMargin() const;
448 virtual void Format( const SwBorderAttrs *pAttrs = 0 );
449 virtual void CheckDirection( BOOL bVert );
451 // Liefert die Summe der Zeilenhoehen in pLine zurueck.
452 USHORT GetParHeight() const;
454 // Liefert die Resthoehe zurueck
455 inline SwTwips GetRstHeight() const;
457 inline SwTxtFrm *GetFollow();
458 inline const SwTxtFrm *GetFollow() const;
460 // Suche die Seitennummer von ErgoSum und QuoVadis
461 SwTxtFrm *FindQuoVadisFrm();
463 // holt die Formatierug nach, wenn der Idle-Handler zugeschlagen hat.
464 // --> FME 2004-10-29 #i29062# GetFormatted() can trigger a full formatting
465 // of the paragraph, causing other layout frames to become invalid. This
466 // has to be avoided during painting. Therefore we need to pass the
467 // information that we are currently in the paint process.
468 SwTxtFrm* GetFormatted( bool bForceQuickFormat = false );
469 // <--
471 // wird demnaechst uebertragen
472 inline void SetFtn( const sal_Bool bNew ) { bFtn = bNew; }
474 // Beruecksichtigung der Follows
475 inline sal_Bool IsInside( const xub_StrLen nPos ) const;
477 const SwBodyFrm *FindBodyFrm() const;
479 // DropCaps und Selektionen
480 inline sal_Bool GetDropRect( SwRect &rRect ) const
481 { return HasPara() ? _GetDropRect( rRect ) : sal_False; }
483 static SwCache *GetTxtCache() { return pTxtCache; }
484 static void SetTxtCache( SwCache *pNew ) { pTxtCache = pNew; }
486 static long GetMinPrtLine() { return nMinPrtLine; }
487 static void SetMinPrtLine( long nNew ) { nMinPrtLine = nNew; }
489 inline USHORT GetCacheIdx() const { return nCacheIdx; }
490 inline void SetCacheIdx( const USHORT nNew ) { nCacheIdx = nNew; }
492 //Entfert die Line-Informationen aus dem Cache.
493 void ClearPara();
495 // Bin ich ein FtnFrm, der eine Nummer am Absatzanfang hat?
496 inline sal_Bool IsFtnNumFrm() const
497 { return IsInFtn() && !GetIndPrev() && _IsFtnNumFrm(); }
499 // simuliert eine Formatierung, als wenn es keinen rechten Rand und
500 // keine Flys oder andere Hindernisse gaebe und liefert die Breite.
501 SwTwips CalcFitToContent();
503 /** simulate format for a list item paragraph, whose list level attributes
504 are in LABEL_ALIGNMENT mode, in order to determine additional first
505 line offset for the real text formatting due to the value of label
506 adjustment attribute of the list level.
508 OD 2008-01-31 #newlistlevelattrs#
510 @author OD
512 void CalcAdditionalFirstLineOffset();
514 // --> OD 2008-01-31 #newlistlevelattrs#
515 inline SwTwips GetAdditionalFirstLineOffset() const
517 return mnAdditionalFirstLineOffset;
519 // <--
521 // liefert den zusaetzlichen Zeilenabstand fuer den naechsten Absatz
522 // OD 07.01.2004 #i11859# - change return data type;
523 // add default parameter <_bNoPropLineSpacing> to control, if the
524 // value of a proportional line spacing is returned or not
525 long GetLineSpace( const bool _bNoPropLineSpacing = false ) const;
527 // liefert die erste Zeilenhoehe zurueck
528 USHORT FirstLineHeight() const;
530 // Haengt FlyInCntFrm um, wenn nEnd > Index >= nStart ist.
531 void MoveFlyInCnt( SwTxtFrm *pNew, USHORT nStart, USHORT nEnd );
533 // Berechnet die Position von FlyInCntFrms
534 USHORT CalcFlyPos( SwFrmFmt* pSearch );
536 // Ermittelt die Startposition und Schrittweite des Registers
537 sal_Bool FillRegister( SwTwips& rRegStart, USHORT& rRegDiff );
540 USHORT GetLineCount( USHORT nPos ); //Ermittelt die Zeilenanzahl
542 //Fuer die Anzeige der Zeilennummern.
543 ULONG GetAllLines() const { return nAllLines; }
544 ULONG GetThisLines() const { return nThisLines;}
545 void RecalcAllLines();
547 // Stoppt Animationen innerhalb von Numerierungen
548 void StopAnimation( OutputDevice *pOut );
550 void CriticalLines(const OutputDevice& rOut,SwStripes &rStripes,long nOffs);
552 // visit all portions for Accessibility
553 void VisitPortions( SwPortionHandler& rPH ) const;
555 // returns the script info stored at the paraportion
556 const SwScriptInfo* GetScriptInfo() const;
558 // Swaps width and height of the text frame
559 void SwapWidthAndHeight();
560 // Calculates the coordinates of a rectangle when switching from
561 // horizontal to vertical layout.
562 void SwitchHorizontalToVertical( SwRect& rRect ) const;
563 // Calculates the coordinates of a point when switching from
564 // horizontal to vertical layout.
565 void SwitchHorizontalToVertical( Point& rPoint ) const;
566 // Calculates the a limit value when switching from
567 // horizontal to vertical layout.
568 long SwitchHorizontalToVertical( long nLimit ) const;
569 // Calculates the coordinates of a rectangle when switching from
570 // vertical to horizontal layout.
571 void SwitchVerticalToHorizontal( SwRect& rRect ) const;
572 // Calculates the coordinates of a point when switching from
573 // vertical to horizontal layout.
574 void SwitchVerticalToHorizontal( Point& rPoint ) const;
575 // Calculates the a limit value when switching from
576 // vertical to horizontal layout.
577 long SwitchVerticalToHorizontal( long nLimit ) const;
579 // Calculates the coordinates of a rectangle when switching from
580 // LTR to RTL layout
581 void SwitchLTRtoRTL( SwRect& rRect ) const;
582 // Calculates the coordinates of a point when switching from
583 // LTR to RTL layout.
584 void SwitchLTRtoRTL( Point& rPoint ) const;
585 // Calculates the coordinates of a rectangle when switching from
586 // RTL to LTR layout
587 inline void SwitchRTLtoLTR( SwRect& rRect ) const { SwitchLTRtoRTL( rRect ); }
588 // Calculates the coordinates of a point when switching from
589 // RTL to LTR layout.
590 inline void SwitchRTLtoLTR( Point& rPoint ) const { SwitchLTRtoRTL( rPoint ); };
592 // OD 14.03.2003 #i11760# - access to new member <mbNoFollowFormat>
593 inline bool FollowFormatAllowed() const
595 return mbFollowFormatAllowed;
597 inline void AllowFollowFormat()
599 mbFollowFormatAllowed = true;
601 inline void ForbidFollowFormat()
603 mbFollowFormatAllowed = false;
606 SwTwips GetBaseOfstForFly( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const
608 return ( bIgnoreFlysAnchoredAtThisFrame ?
609 mnFlyAnchorOfst :
610 mnFlyAnchorOfstNoWrap );
613 // OD 2004-03-17 #i11860#
614 inline SwTwips GetHeightOfLastLine() const
616 return mnHeightOfLastLine;
620 /*************************************************************************
621 * class SwTxtFrmLocker
622 *************************************************************************/
624 class SwTxtFrmLocker
626 private:
627 SwTxtFrm * const pFrm;
628 public:
629 inline SwTxtFrmLocker( SwTxtFrm *pTxtFrm )
630 : pFrm( pTxtFrm->IsLocked() ? 0 : pTxtFrm )
631 { if( pFrm ) pFrm->Lock(); }
632 inline ~SwTxtFrmLocker() { if( pFrm ) pFrm->Unlock(); }
635 /*************************************************************************
636 * Inline-Implementierung
637 *************************************************************************/
639 inline const SwParaPortion *SwTxtFrm::GetPara() const
641 return ((SwTxtFrm*)this)->GetPara();
644 inline sal_Bool SwTxtFrm::HasPara() const
646 return nCacheIdx != USHRT_MAX ? _HasPara() : sal_False;
649 // 9104: Frm().Height() - Prt().Height(), siehe widorp.cxx und 7455, 6114, 7908
650 inline SwTwips SwTxtFrm::GetRstHeight() const
652 return !GetUpper() ? 0 : ((const SwFrm*)GetUpper())->Frm().Top()
653 + ((const SwFrm*)GetUpper())->Prt().Top()
654 + ((const SwFrm*)GetUpper())->Prt().Height()
655 - Frm().Top() - (Frm().Height() - Prt().Height());
658 inline SwTwips SwTxtFrm::GetLeftMargin() const
660 return Frm().Left() + Prt().Left();
662 inline SwTwips SwTxtFrm::GetRightMargin() const
664 return Frm().Left() + Prt().Left() + Prt().Width();
666 inline SwTwips SwTxtFrm::GrowTst( const SwTwips nGrow )
668 return Grow( nGrow, sal_True );
671 #if OSL_DEBUG_LEVEL > 1
672 // fragt auf WYSIWYG DBG ab
673 extern sal_Bool IsDbg( const SwTxtFrm *pFrm );
674 #define DBTXTFRM aDbstream << "SwTxtFrm[" << GetFrmId() << "]"
675 #endif
677 inline sal_Bool SwTxtFrm::IsInside( const xub_StrLen nPos ) const
679 sal_Bool bRet = sal_True;
680 if( nPos < GetOfst() )
681 bRet = sal_False;
682 else
684 const SwTxtFrm *pFoll = GetFollow();
685 if( pFoll && nPos >= pFoll->GetOfst() )
686 bRet = sal_False;
688 return bRet;
691 inline SwTwips SwTxtFrm::GetFtnFrmHeight() const
693 if( !IsFollow() && IsInFtn() && HasPara() )
694 return _GetFtnFrmHeight();
695 else
696 return 0;
699 inline const SwTxtFrm *SwTxtFrm::GetFollow() const
701 return (const SwTxtFrm*)SwCntntFrm::GetFollow();
703 inline SwTxtFrm *SwTxtFrm::GetFollow()
705 return (SwTxtFrm*)SwCntntFrm::GetFollow();
708 inline const SwTxtFrm *SwTxtFrm::GetFrmAtPos( const SwPosition &rPos) const
710 return ((SwTxtFrm*)this)->GetFrmAtPos( rPos );
713 inline void SwTxtFrm::AdjustFollow( SwTxtFormatter &rLine,
714 const xub_StrLen nOffset, const xub_StrLen nStrEnd, const sal_uInt8 nMode )
716 if ( HasFollow() )
717 _AdjustFollow( rLine, nOffset, nStrEnd, nMode );
720 inline void SwTxtFrm::SetOfst( const xub_StrLen nNewOfst )
722 if ( nOfst != nNewOfst )
723 _SetOfst( nNewOfst );
726 inline void SwTxtFrm::SetRepaint() const
728 ((SwTxtFrm*)this)->bRepaint = sal_True;
730 inline void SwTxtFrm::ResetRepaint() const
732 ((SwTxtFrm*)this)->bRepaint = sal_False;
735 inline void SwTxtFrm::SetBlinkPor() const
737 ((SwTxtFrm*)this)->bBlinkPor = sal_True;
739 inline void SwTxtFrm::ResetBlinkPor() const
741 ((SwTxtFrm*)this)->bBlinkPor = sal_False;
744 #ifdef LINGU_STATISTIK
746 class SwLinguStatistik
748 public:
749 long nWords; // gepruefte Worte
750 long nFlushCnt; // zaehlt die Messungen
752 long nWrong; // als falsch erkannt
753 long nAlter; // Alternativvorschlaege
754 long nSpellTime; // Zeitmessung
755 long nSynonym; // Thesaurus
756 long nNoSynonym; // Thesaurus ratlos
757 long nMeaning; // Thesaurus-Bedeutung
758 long nNoMeaning; // Thesaurus meinungslos
759 long nTheTime; // Zeitmessung
760 long nHyphens; // Trennstellen
761 long nNoHyph; // Worte ohne Trennstellen
762 long nHyphErr; // Fehler beim Trennen
763 long nHyphTime; // Zeitmessung
764 SpellCheck *pSpell;
765 LanguageType eLang;
767 void Flush();
769 inline SwLinguStatistik()
770 { nWords = nWrong = nAlter = nSynonym = nNoSynonym =
771 nHyphens = nNoHyph = nHyphErr = nSpellTime = nTheTime =
772 nHyphTime = nFlushCnt = 0;
773 pSpell = NULL;
774 eLang = LANGUAGE_DONTKNOW; }
775 inline ~SwLinguStatistik(){ Flush(); }
778 // globale Variable, implementiert in txtfrm.cxx
779 extern SwLinguStatistik aSwLinguStat;
781 #define SW_LING(nWhich,nInc) (aSwLinguStat.nWhich) += nInc;
783 #endif
785 #define SWAP_IF_SWAPPED( pFrm )\
786 sal_Bool bUndoSwap = sal_False; \
787 if ( pFrm->IsVertical() && pFrm->IsSwapped() )\
789 bUndoSwap = sal_True; \
790 ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); \
793 #define SWAP_IF_NOT_SWAPPED( pFrm )\
794 sal_Bool bUndoSwap = sal_False; \
795 if ( pFrm->IsVertical() && ! pFrm->IsSwapped() )\
797 bUndoSwap = sal_True; \
798 ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); \
801 #define UNDO_SWAP( pFrm )\
802 if ( bUndoSwap )\
803 ((SwTxtFrm*)pFrm)->SwapWidthAndHeight();
805 // Helper class which can be used instead of the macros if a function
806 // has too many returns
807 class SwFrmSwapper
809 const SwTxtFrm* pFrm;
810 sal_Bool bUndo;
811 public:
812 SwFrmSwapper( const SwTxtFrm* pFrm, sal_Bool bSwapIfNotSwapped );
813 ~SwFrmSwapper();
816 class SwLayoutModeModifier
818 const OutputDevice& rOut;
819 long nOldLayoutMode;
820 public:
821 SwLayoutModeModifier( const OutputDevice& rOutp );
822 ~SwLayoutModeModifier();
823 void Modify( sal_Bool bChgToRTL );
824 void SetAuto();
827 class SwDigitModeModifier
829 const OutputDevice& rOut;
830 LanguageType nOldLanguageType;
831 public:
832 SwDigitModeModifier( const OutputDevice& rOutp, LanguageType eCurLang );
833 ~SwDigitModeModifier();
836 #endif