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

Generated by: LCOV version 1.10