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