LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/inc - txtfrm.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 61 100 61.0 %
Date: 2012-12-27 Functions: 40 58 69.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10