LCOV - code coverage report
Current view: top level - editeng/source/editeng - editdoc.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 119 138 86.2 %
Date: 2014-11-03 Functions: 108 124 87.1 %
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             : 
      20             : #ifndef INCLUDED_EDITENG_SOURCE_EDITENG_EDITDOC_HXX
      21             : #define INCLUDED_EDITENG_SOURCE_EDITENG_EDITDOC_HXX
      22             : 
      23             : #include <com/sun/star/i18n/XExtendedInputSequenceChecker.hpp>
      24             : 
      25             : #include "editattr.hxx"
      26             : #include "edtspell.hxx"
      27             : #include <editeng/svxfont.hxx>
      28             : #include <svl/itemset.hxx>
      29             : #include <svl/style.hxx>
      30             : #include <svl/itempool.hxx>
      31             : #include <tools/lineend.hxx>
      32             : 
      33             : #include <vector>
      34             : #include <deque>
      35             : 
      36             : #include <boost/ptr_container/ptr_vector.hpp>
      37             : #include <boost/noncopyable.hpp>
      38             : #include <boost/scoped_ptr.hpp>
      39             : 
      40             : class ImpEditEngine;
      41             : class SvxTabStop;
      42             : 
      43             : 
      44             : #define CHARPOSGROW     16
      45             : #define DEFTAB          720
      46             : 
      47             : void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent = true, short nScriptType = 0 );
      48             : sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, short nScriptType );
      49             : bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType );
      50             : 
      51             : EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_Int32 nS, sal_Int32 nE );
      52             : 
      53             : class ContentNode;
      54             : class EditDoc;
      55             : 
      56             : struct EPaM
      57             : {
      58             :     sal_Int32  nPara;
      59             :     sal_Int32  nIndex;
      60             : 
      61         390 :     EPaM() : nPara(0), nIndex(0) {}
      62       27203 :     EPaM( sal_Int32 nP, sal_Int32 nI ) : nPara(nP), nIndex(nI) {}
      63       26813 :     EPaM( const EPaM& r) : nPara(r.nPara), nIndex(r.nIndex) {}
      64         390 :     EPaM& operator = ( const EPaM& r )  { nPara = r.nPara; nIndex = r.nIndex; return *this; }
      65             :     inline bool operator == ( const EPaM& r ) const;
      66             :     inline bool operator < ( const EPaM& r ) const;
      67             : };
      68             : 
      69         130 : inline bool EPaM::operator < ( const EPaM& r ) const
      70             : {
      71         130 :     return ( ( nPara < r.nPara ) ||
      72         130 :              ( ( nPara == r.nPara ) && nIndex < r.nIndex ) ) ? sal_True : sal_False;
      73             : }
      74             : 
      75         130 : inline bool EPaM::operator == ( const EPaM& r ) const
      76             : {
      77         130 :     return ( ( nPara == r.nPara ) && ( nIndex == r.nIndex ) ) ? sal_True : sal_False;
      78             : }
      79             : 
      80             : struct ScriptTypePosInfo
      81             : {
      82             :     short   nScriptType;
      83             :     sal_Int32  nStartPos;
      84             :     sal_Int32  nEndPos;
      85             : 
      86      223429 :     ScriptTypePosInfo( short _Type, sal_Int32 _Start, sal_Int32 _End )
      87             :     : nScriptType(_Type)
      88             :     , nStartPos(_Start)
      89      223429 :     , nEndPos(_End)
      90             :     {
      91      223429 :     }
      92             : };
      93             : 
      94             : typedef std::deque< ScriptTypePosInfo > ScriptTypePosInfos;
      95             : 
      96             : struct WritingDirectionInfo
      97             : {
      98             :     sal_uInt8   nType;
      99             :     sal_Int32  nStartPos;
     100             :     sal_Int32  nEndPos;
     101             : 
     102      216272 :     WritingDirectionInfo( sal_uInt8 _Type, sal_Int32 _Start, sal_Int32 _End )
     103             :     : nType(_Type)
     104             :     , nStartPos(_Start)
     105      216272 :     , nEndPos(_End)
     106             :     {
     107      216272 :     }
     108             : };
     109             : 
     110             : 
     111             : typedef std::deque< WritingDirectionInfo > WritingDirectionInfos;
     112             : 
     113       10643 : class ContentAttribsInfo
     114             : {
     115             : private:
     116             :     typedef boost::ptr_vector<EditCharAttrib> CharAttribsType;
     117             : 
     118             :     SfxItemSet          aPrevParaAttribs;
     119             :     CharAttribsType     aPrevCharAttribs;
     120             : 
     121             : public:
     122             :                         ContentAttribsInfo( const SfxItemSet& rParaAttribs );
     123             : 
     124           0 :     const SfxItemSet&       GetPrevParaAttribs() const  { return aPrevParaAttribs; }
     125           0 :     const CharAttribsType&  GetPrevCharAttribs() const  { return aPrevCharAttribs; }
     126             : 
     127             :     void RemoveAllCharAttribsFromPool(SfxItemPool& rPool) const;
     128             :     void AppendCharAttrib(EditCharAttrib* pNew);
     129             : };
     130             : 
     131             : 
     132             : //  class SvxColorList
     133             : 
     134             : typedef std::vector<Color> SvxColorList;
     135             : 
     136             : 
     137             : //  class ItemList
     138             : 
     139             : 
     140           0 : class ItemList
     141             : {
     142             : private:
     143             :     typedef std::vector<const SfxPoolItem*> DummyItemList;
     144             :     DummyItemList aItemPool;
     145             :     sal_Int32  CurrentItem;
     146             : 
     147             : public:
     148             :     ItemList();
     149             :     const SfxPoolItem*  First();
     150             :     const SfxPoolItem*  Next();
     151           0 :     sal_Int32              Count() { return aItemPool.size(); };
     152             :     void                Insert( const SfxPoolItem* pItem );
     153           0 :     void                Clear() { aItemPool.clear(); };
     154             : };
     155             : 
     156             : 
     157             : // class ContentAttribs
     158             : 
     159             : class ContentAttribs
     160             : {
     161             : private:
     162             :     SfxStyleSheet*  pStyle;
     163             :     SfxItemSet      aAttribSet;
     164             : 
     165             : public:
     166             :                     ContentAttribs( SfxItemPool& rItemPool );
     167             :                     ContentAttribs( const ContentAttribs& );
     168             :                     ~ContentAttribs();  // only for larger Tabs
     169             : 
     170             :     SvxTabStop      FindTabStop( sal_Int32 nCurPos, sal_uInt16 nDefTab );
     171     2591455 :     SfxItemSet&     GetItems()                          { return aAttribSet; }
     172      714336 :     const SfxItemSet& GetItems() const { return aAttribSet; }
     173           0 :     const SfxStyleSheet*  GetStyleSheet() const { return pStyle; }
     174     1455198 :     SfxStyleSheet*  GetStyleSheet() { return pStyle; }
     175             :     void            SetStyleSheet( SfxStyleSheet* pS );
     176             : 
     177             :     const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const;
     178             :     bool HasItem( sal_uInt16 nWhich ) const;
     179             : };
     180             : 
     181             : 
     182             : // class CharAttribList
     183             : 
     184             : class CharAttribList
     185             : {
     186             : public:
     187             :     typedef boost::ptr_vector<EditCharAttrib> AttribsType;
     188             : 
     189             : private:
     190             :     AttribsType     aAttribs;
     191             :     SvxFont         aDefFont;          // faster than ever from the pool!
     192             :     bool            bHasEmptyAttribs;
     193             : 
     194             :                     CharAttribList( const CharAttribList& ) {;}
     195             : 
     196             : public:
     197             :                     CharAttribList();
     198             :                     ~CharAttribList();
     199             : 
     200             :     void            DeleteEmptyAttribs(  SfxItemPool& rItemPool );
     201             :     void            RemoveItemsFromPool( SfxItemPool* pItemPool );
     202             : 
     203             :     const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const;
     204             :     EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos );
     205             :     const EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos ) const;
     206             :     const EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const;
     207             :     EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos );
     208             :     const EditCharAttrib* FindFeature( sal_Int32 nPos ) const;
     209             : 
     210             : 
     211             :     void            ResortAttribs();
     212             :     void            OptimizeRanges( SfxItemPool& rItemPool );
     213             : 
     214             :     sal_Int32 Count() const;
     215             : 
     216             :     void            InsertAttrib( EditCharAttrib* pAttrib );
     217             : 
     218     2206148 :     SvxFont&        GetDefFont()            { return aDefFont; }
     219             : 
     220       18426 :     bool            HasEmptyAttribs() const { return bHasEmptyAttribs; }
     221             :     void SetHasEmptyAttribs(bool b);
     222             :     bool HasBoundingAttrib( sal_Int32 nBound ) const;
     223             :     bool HasAttrib( sal_Int32 nStartPos, sal_Int32 nEndPos ) const;
     224             : 
     225     2091579 :     AttribsType& GetAttribs() { return aAttribs;}
     226      354209 :     const AttribsType& GetAttribs() const { return aAttribs;}
     227             : 
     228             :     void Remove(const EditCharAttrib* p);
     229             :     void Remove(sal_Int32 nPos);
     230             :     void Release(const EditCharAttrib* p);
     231             : 
     232             : #if OSL_DEBUG_LEVEL > 2
     233             :     // Debug:
     234             :     bool DbgCheckAttribs() const;
     235             : #endif
     236             : };
     237             : 
     238             : 
     239             : // class ContentNode
     240             : 
     241             : class ContentNode : boost::noncopyable
     242             : {
     243             : private:
     244             :     OUString maString;
     245             :     ContentAttribs  aContentAttribs;
     246             :     CharAttribList  aCharAttribList;
     247             :     boost::scoped_ptr<WrongList> mpWrongList;
     248             : 
     249             :     void UnExpandPosition( sal_Int32 &rStartPos, bool bBiasStart );
     250             : 
     251             : public:
     252             :                     ContentNode( SfxItemPool& rItemPool );
     253             :                     ContentNode( const OUString& rStr, const ContentAttribs& rContentAttribs );
     254             :                     ~ContentNode();
     255             : 
     256     6797382 :     ContentAttribs& GetContentAttribs()     { return aContentAttribs; }
     257     2497131 :     const ContentAttribs& GetContentAttribs() const { return aContentAttribs; }
     258     5346196 :     CharAttribList& GetCharAttribs()        { return aCharAttribList; }
     259     1394013 :     const CharAttribList& GetCharAttribs() const { return aCharAttribList; }
     260             : 
     261             :     void            ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNewChars, SfxItemPool& rItemPool );
     262             :     void            CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDelChars, SfxItemPool& rItemPool );
     263             :     void            AppendAttribs( ContentNode* pNextNode );
     264             :     void            CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, bool bKeepEndingAttribs );
     265             : 
     266             :     void            SetStyleSheet( SfxStyleSheet* pS, bool bRecalcFont = true );
     267             :     void            SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyle );
     268      836924 :     SfxStyleSheet*  GetStyleSheet() { return aContentAttribs.GetStyleSheet(); }
     269             :     const SfxStyleSheet* GetStyleSheet() const { return aContentAttribs.GetStyleSheet(); }
     270             : 
     271             :     void            CreateDefFont();
     272             : 
     273             :     void EnsureWrongList();
     274             :     WrongList* GetWrongList();
     275             :     const WrongList* GetWrongList() const;
     276             :     void SetWrongList( WrongList* p );
     277             : 
     278             :     void            CreateWrongList();
     279             :     void            DestroyWrongList();
     280             : 
     281             :     bool IsFeature( sal_Int32 nPos ) const;
     282             : 
     283             :     sal_Int32 Len() const;
     284      655035 :     const OUString& GetString() const { return maString;}
     285             : 
     286             :     /// return length including expanded fields
     287             :     sal_uLong GetExpandedLen() const;
     288             :     /// return content including expanded fields
     289             :     OUString  GetExpandedText(sal_Int32 nStartPos = 0, sal_Int32 nEndPos = -1, bool bResolveFields = true) const;
     290             :     /// re-write offsets in the expanded text to string offsets
     291             :     void      UnExpandPositions( sal_Int32 &rStartPos, sal_Int32 &rEndPos );
     292             : 
     293             :     void SetChar(sal_Int32 nPos, sal_Unicode c);
     294             :     void Insert(const OUString& rStr, sal_Int32 nPos);
     295             :     void Append(const OUString& rStr);
     296             :     void Erase(sal_Int32 nPos);
     297             :     void Erase(sal_Int32 nPos, sal_Int32 nCount);
     298             :     OUString Copy(sal_Int32 nPos) const;
     299             :     OUString Copy(sal_Int32 nPos, sal_Int32 nCount) const;
     300             :     sal_Unicode GetChar(sal_Int32 nPos) const;
     301             : };
     302             : 
     303             : 
     304             : // class EditPaM
     305             : 
     306             : class EditPaM
     307             : {
     308             : private:
     309             :     ContentNode* pNode;
     310             :     sal_Int32    nIndex;
     311             : 
     312             : public:
     313             :     EditPaM();
     314             :     EditPaM(const EditPaM& r);
     315             :     EditPaM(ContentNode* p, sal_Int32 n);
     316             : 
     317     2583428 :     const ContentNode* GetNode() const { return pNode;}
     318     4223598 :     ContentNode* GetNode() { return pNode;}
     319             :     void SetNode(ContentNode* p);
     320             : 
     321     4164170 :     sal_Int32  GetIndex() const         { return nIndex; }
     322      460958 :     void       SetIndex( sal_Int32 n )  { nIndex = n; }
     323             : 
     324             :     bool       DbgIsBuggy( EditDoc& rDoc );
     325             : 
     326             :     EditPaM&    operator = ( const EditPaM& rPaM );
     327             :     friend bool operator == ( const EditPaM& r1, const EditPaM& r2 );
     328             :     friend bool operator != ( const EditPaM& r1, const EditPaM& r2 );
     329             :     bool operator !() const { return !pNode && !nIndex; }
     330             : };
     331             : 
     332             : enum class PortionKind
     333             : {
     334             :     TEXT        = 0,
     335             :     TAB         = 1,
     336             :     LINEBREAK   = 2,
     337             :     FIELD       = 3,
     338             :     HYPHENATOR  = 4
     339             : };
     340             : 
     341             : #define DELMODE_SIMPLE          0
     342             : #define DELMODE_RESTOFWORD      1
     343             : #define DELMODE_RESTOFCONTENT   2
     344             : 
     345             : #define CHAR_NORMAL            0x00
     346             : #define CHAR_KANA              0x01
     347             : #define CHAR_PUNCTUATIONLEFT   0x02
     348             : #define CHAR_PUNCTUATIONRIGHT  0x04
     349             : 
     350             : 
     351             : // struct ExtraPortionInfos
     352             : 
     353             : struct ExtraPortionInfo
     354             : {
     355             :     long    nOrgWidth;
     356             :     long    nWidthFullCompression;
     357             : 
     358             :     long    nPortionOffsetX;
     359             : 
     360             :     sal_uInt16  nMaxCompression100thPercent;
     361             : 
     362             :     sal_uInt8    nAsianCompressionTypes;
     363             :     bool    bFirstCharIsRightPunktuation;
     364             :     bool    bCompressed;
     365             : 
     366             :     long*    pOrgDXArray;
     367             :     ::std::vector< sal_Int32 > lineBreaksList;
     368             : 
     369             : 
     370             :             ExtraPortionInfo();
     371             :             ~ExtraPortionInfo();
     372             : 
     373             :     void    SaveOrgDXArray( const long* pDXArray, sal_Int32 nLen );
     374             : };
     375             : 
     376             : 
     377             : 
     378             : // class TextPortion
     379             : 
     380             : class TextPortion
     381             : {
     382             : private:
     383             :     ExtraPortionInfo*   pExtraInfos;
     384             :     sal_Int32           nLen;
     385             :     Size                aOutSz;
     386             :     PortionKind         nKind;
     387             :     sal_uInt8           nRightToLeft;
     388             :     sal_Unicode         nExtraValue;
     389             : 
     390             : 
     391             :                 TextPortion()
     392             :                 : pExtraInfos( NULL )
     393             :                 , nLen( 0 )
     394             :                 , aOutSz()
     395             :                 , nKind( PortionKind::TEXT )
     396             :                 , nRightToLeft( sal_False )
     397             :                 , nExtraValue( 0 )
     398             :                 {
     399             :                 }
     400             : 
     401             : public:
     402      421864 :                 TextPortion( sal_Int32 nL )
     403             :                 : pExtraInfos( NULL )
     404             :                 , nLen( nL )
     405             :                 , aOutSz( -1, -1 )
     406             :                 , nKind( PortionKind::TEXT )
     407             :                 , nRightToLeft( sal_False )
     408      421864 :                 , nExtraValue( 0 )
     409             :                 {
     410      421864 :                 }
     411             : 
     412           0 :                 TextPortion( const TextPortion& r )
     413             :                 : pExtraInfos( NULL )
     414             :                 , nLen( r.nLen )
     415             :                 , aOutSz( r.aOutSz )
     416             :                 , nKind( r.nKind )
     417             :                 , nRightToLeft( r.nRightToLeft )
     418           0 :                 , nExtraValue( r.nExtraValue )
     419             :                 {
     420           0 :                 }
     421             : 
     422             : 
     423     2410480 :     sal_Int32      GetLen() const              { return nLen; }
     424       72707 :     void           SetLen( sal_Int32 nL )         { nLen = nL; }
     425             : 
     426     1268040 :     Size&          GetSize()                   { return aOutSz; }
     427      107280 :     const Size&    GetSize() const             { return aOutSz; }
     428             : 
     429      509123 :     PortionKind&   GetKind()                   { return nKind; }
     430      439522 :     PortionKind    GetKind() const             { return nKind; }
     431             : 
     432      194266 :     void           SetRightToLeft( sal_uInt8 b )    { nRightToLeft = b; }
     433       50602 :     sal_uInt8      GetRightToLeft() const      { return nRightToLeft; }
     434       32414 :     bool           IsRightToLeft() const       { return (nRightToLeft&1); }
     435             : 
     436         185 :     sal_Unicode    GetExtraValue() const       { return nExtraValue; }
     437          22 :     void           SetExtraValue( sal_Unicode n )  { nExtraValue = n; }
     438             : 
     439           0 :     bool           HasValidSize() const        { return aOutSz.Width() != (-1); }
     440             : 
     441       78268 :     ExtraPortionInfo*   GetExtraInfos() const { return pExtraInfos; }
     442           0 :     void                SetExtraInfos( ExtraPortionInfo* p ) { delete pExtraInfos; pExtraInfos = p; }
     443             : };
     444             : 
     445             : 
     446             : // class TextPortionList
     447             : 
     448             : class TextPortionList
     449             : {
     450             :     typedef boost::ptr_vector<TextPortion> PortionsType;
     451             :     PortionsType maPortions;
     452             : 
     453             : public:
     454             :             TextPortionList();
     455             :             ~TextPortionList();
     456             : 
     457             :     void    Reset();
     458             :     sal_Int32 FindPortion(
     459             :         sal_Int32 nCharPos, sal_Int32& rPortionStart, bool bPreferStartingPortion = false) const;
     460             :     sal_Int32 GetStartPos(sal_Int32 nPortion);
     461             :     void DeleteFromPortion(sal_Int32 nDelFrom);
     462             :     sal_Int32 Count() const;
     463             :     const TextPortion* operator[](sal_Int32 nPos) const;
     464             :     TextPortion* operator[](sal_Int32 nPos);
     465             : 
     466             :     void Append(TextPortion* p);
     467             :     void Insert(sal_Int32 nPos, TextPortion* p);
     468             :     void Remove(sal_Int32 nPos);
     469             :     sal_Int32 GetPos(const TextPortion* p) const;
     470             : };
     471             : 
     472             : class ParaPortion;
     473             : 
     474             : 
     475             : // class EditLine
     476             : 
     477             : class EditLine
     478             : {
     479             : public:
     480             :     typedef std::vector<long> CharPosArrayType;
     481             : 
     482             : private:
     483             :     CharPosArrayType aPositions;
     484             :     long            nTxtWidth;
     485             :     sal_uInt16          nStartPosX;
     486             :     sal_Int32          nStart;     // could be replaced by nStartPortion
     487             :     sal_Int32          nEnd;       // could be replaced by nEndPortion
     488             :     sal_Int32          nStartPortion;
     489             :     sal_Int32          nEndPortion;
     490             :     sal_uInt16          nHeight;    //  Total height of the line
     491             :     sal_uInt16          nTxtHeight; // Pure Text height
     492             :     sal_uInt16          nCrsrHeight;    // For contour flow high lines => cursor is large.
     493             :     sal_uInt16          nMaxAscent;
     494             :     bool            bHangingPunctuation:1;
     495             :     bool            bInvalid:1;   // for skillful formatting
     496             : 
     497             : public:
     498             :                     EditLine();
     499             :                     EditLine( const EditLine& );
     500             :                     ~EditLine();
     501             : 
     502           0 :     bool            IsIn( sal_Int32 nIndex ) const
     503           0 :                         { return ( (nIndex >= nStart ) && ( nIndex < nEnd ) ); }
     504             : 
     505         409 :     bool            IsIn( sal_Int32 nIndex, bool bInclEnd ) const
     506         409 :                         { return ( ( nIndex >= nStart ) && ( bInclEnd ? ( nIndex <= nEnd ) : ( nIndex < nEnd ) ) ); }
     507             : 
     508      290044 :     void            SetStart( sal_Int32 n )            { nStart = n; }
     509       53817 :     sal_Int32          GetStart() const                { return nStart; }
     510     1439245 :     sal_Int32&         GetStart()                      { return nStart; }
     511             : 
     512      484083 :     void            SetEnd( sal_Int32 n )              { nEnd = n; }
     513        3446 :     sal_Int32          GetEnd() const                  { return nEnd; }
     514      318464 :     sal_Int32&         GetEnd()                        { return nEnd; }
     515             : 
     516       73445 :     void            SetStartPortion( sal_Int32 n )     { nStartPortion = n; }
     517       52436 :     sal_Int32          GetStartPortion() const         { return nStartPortion; }
     518      490535 :     sal_Int32&         GetStartPortion()               { return nStartPortion; }
     519             : 
     520      267484 :     void            SetEndPortion( sal_Int32 n )       { nEndPortion = n; }
     521       69951 :     sal_Int32          GetEndPortion() const           { return nEndPortion; }
     522      749170 :     sal_Int32&         GetEndPortion()                 { return nEndPortion; }
     523             : 
     524             :     void            SetHeight( sal_uInt16 nH, sal_uInt16 nTxtH = 0, sal_uInt16 nCrsrH = 0 );
     525     1472110 :     sal_uInt16          GetHeight() const               { return nHeight; }
     526        7355 :     sal_uInt16          GetTxtHeight() const            { return nTxtHeight; }
     527             :     sal_uInt16          GetCrsrHeight() const           { return nCrsrHeight; }
     528             : 
     529      194565 :     void            SetTextWidth( long n )          { nTxtWidth = n; }
     530         701 :     long            GetTextWidth() const            { return nTxtWidth; }
     531             : 
     532      415157 :     void            SetMaxAscent( sal_uInt16 n )        { nMaxAscent = n; }
     533       35321 :     sal_uInt16          GetMaxAscent() const            { return nMaxAscent; }
     534             : 
     535       77347 :     void            SetHangingPunctuation( bool b )     { bHangingPunctuation = b; }
     536      193872 :     bool            IsHangingPunctuation() const        { return bHangingPunctuation; }
     537             : 
     538      194434 :     sal_Int32          GetLen() const                  { return nEnd - nStart; }
     539             : 
     540       53684 :     sal_uInt16          GetStartPosX() const            { return nStartPosX; }
     541             :     void            SetStartPosX( long start );
     542             :     Size            CalcTextSize( ParaPortion& rParaPortion );
     543             : 
     544      322222 :     bool            IsInvalid() const               { return bInvalid; }
     545      391162 :     bool            IsValid() const                 { return !bInvalid; }
     546      193872 :     void            SetInvalid()                    { bInvalid = true; }
     547      117210 :     void            SetValid()                      { bInvalid = false; }
     548             : 
     549        1955 :     bool            IsEmpty() const                 { return (nEnd > nStart) ? sal_False : sal_True; }
     550             : 
     551      899348 :     CharPosArrayType& GetCharPosArray() { return aPositions;}
     552       43050 :     const CharPosArrayType& GetCharPosArray() const { return aPositions;}
     553             : 
     554             :     EditLine*       Clone() const;
     555             : 
     556             :     EditLine&   operator = ( const EditLine& rLine );
     557             :     friend bool operator == ( const EditLine& r1,  const EditLine& r2  );
     558             :     friend bool operator != ( const EditLine& r1,  const EditLine& r2  );
     559             : };
     560             : 
     561             : 
     562             : 
     563             : // class LineList
     564             : 
     565             : class EditLineList
     566             : {
     567             :     typedef boost::ptr_vector<EditLine> LinesType;
     568             :     LinesType maLines;
     569             : 
     570             : public:
     571             :             EditLineList();
     572             :             ~EditLineList();
     573             : 
     574             :     void Reset();
     575             :     void DeleteFromLine(sal_Int32 nDelFrom);
     576             :     sal_Int32 FindLine(sal_Int32 nChar, bool bInclEnd);
     577             :     sal_Int32 Count() const;
     578             :     const EditLine* operator[](sal_Int32 nPos) const;
     579             :     EditLine* operator[](sal_Int32 nPos);
     580             : 
     581             :     void Append(EditLine* p);
     582             :     void Insert(sal_Int32 nPos, EditLine* p);
     583             : };
     584             : 
     585             : 
     586             : // class ParaPortion
     587             : 
     588             : class ParaPortion
     589             : {
     590             :     friend class ImpEditEngine; // to adjust the height
     591             : private:
     592             :     EditLineList        aLineList;
     593             :     TextPortionList     aTextPortionList;
     594             :     ContentNode*        pNode;
     595             :     long                nHeight;
     596             : 
     597             :     ScriptTypePosInfos      aScriptInfos;
     598             :     WritingDirectionInfos   aWritingDirectionInfos;
     599             : 
     600             :     sal_Int32              nInvalidPosStart;
     601             :     sal_Int32              nFirstLineOffset;   // For Writer-LineSpacing-Interpretation
     602             :     sal_uInt16             nBulletX;
     603             :     sal_Int32              nInvalidDiff;
     604             : 
     605             :     bool                bInvalid            : 1;
     606             :     bool                bSimple             : 1;    // only linear Tap
     607             :     bool                bVisible            : 1;    // Belongs to the node!
     608             :     bool                bForceRepaint       : 1;
     609             : 
     610             :                         ParaPortion( const ParaPortion& );
     611             : 
     612             : public:
     613             :                         ParaPortion( ContentNode* pNode );
     614             :                         ~ParaPortion();
     615             : 
     616             :     sal_Int32 GetLineNumber( sal_Int32 nIndex ) const;
     617             : 
     618     5049462 :     EditLineList&       GetLines()                  { return aLineList; }
     619       49767 :     const EditLineList& GetLines() const { return aLineList; }
     620             : 
     621      743354 :     bool                IsInvalid() const           { return bInvalid; }
     622      434762 :     bool                IsSimpleInvalid()   const   { return bSimple; }
     623      337044 :     void                SetValid()                  { bInvalid = false; bSimple = true;}
     624             : 
     625      700541 :     bool                MustRepaint() const         { return bForceRepaint; }
     626      292325 :     void                SetMustRepaint( bool bRP )  { bForceRepaint = bRP; }
     627             : 
     628      409632 :     sal_uInt16              GetBulletX() const          { return nBulletX; }
     629      337044 :     void                SetBulletX( sal_uInt16 n )      { nBulletX = n; }
     630             : 
     631             :     void                MarkInvalid( sal_Int32 nStart, sal_Int32 nDiff);
     632             :     void                MarkSelectionInvalid( sal_Int32 nStart, sal_Int32 nEnd );
     633             : 
     634             :     void                SetVisible( bool bVisible );
     635     1106171 :     bool                IsVisible() const { return bVisible; }
     636             : 
     637      363793 :     bool            IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0]->GetLen() == 0; }
     638             : 
     639     1437828 :     long                GetHeight() const           { return ( bVisible ? nHeight : 0 ); }
     640      346407 :     sal_Int32           GetFirstLineOffset() const  { return ( bVisible ? nFirstLineOffset : 0 ); }
     641           0 :     void                ResetHeight()   { nHeight = 0; nFirstLineOffset = 0; }
     642             : 
     643     5483700 :     ContentNode*        GetNode() const             { return pNode; }
     644     3305935 :     TextPortionList&    GetTextPortions()           { return aTextPortionList; }
     645      202861 :     const TextPortionList& GetTextPortions() const { return aTextPortionList; }
     646             : 
     647      120445 :     sal_Int32           GetInvalidPosStart() const  { return nInvalidPosStart; }
     648      120445 :     short               GetInvalidDiff() const      { return nInvalidDiff; }
     649             : 
     650             :     void                CorrectValuesBehindLastFormattedLine( sal_Int32 nLastFormattedLine );
     651             : #if OSL_DEBUG_LEVEL > 2
     652             :     sal_Bool                DbgCheckTextPortions();
     653             : #endif
     654             : };
     655             : 
     656             : 
     657             : // class ParaPortionList
     658             : 
     659             : class ParaPortionList
     660             : {
     661             :     mutable sal_Int32 nLastCache;
     662             :     boost::ptr_vector<ParaPortion> maPortions;
     663             : public:
     664             :                     ParaPortionList();
     665             :                     ~ParaPortionList();
     666             : 
     667             :     void            Reset();
     668             :     long GetYOffset(const ParaPortion* pPPortion) const;
     669             :     sal_Int32 FindParagraph(long nYOffset) const;
     670             : 
     671             :     const ParaPortion* SafeGetObject(sal_Int32 nPos) const;
     672             :     ParaPortion* SafeGetObject(sal_Int32 nPos);
     673             : 
     674             :     sal_Int32 GetPos(const ParaPortion* p) const;
     675             :     ParaPortion* operator[](sal_Int32 nPos);
     676             :     const ParaPortion* operator[](sal_Int32 nPos) const;
     677             : 
     678             :     ParaPortion* Release(sal_Int32 nPos);
     679             :     void Remove(sal_Int32 nPos);
     680             :     void Insert(sal_Int32 nPos, ParaPortion* p);
     681             :     void Append(ParaPortion* p);
     682             :     sal_Int32 Count() const;
     683             : 
     684             : #if OSL_DEBUG_LEVEL > 2
     685             :     // temporary:
     686             :     void            DbgCheck( EditDoc& rDoc );
     687             : #endif
     688             : };
     689             : 
     690             : 
     691             : // class EditSelection
     692             : 
     693      452704 : class EditSelection
     694             : {
     695             : private:
     696             :     EditPaM         aStartPaM;
     697             :     EditPaM         aEndPaM;
     698             : 
     699             : public:
     700             :                     EditSelection();    // No constructor and destructor
     701             :                                         // are automtically excecuted correctly!
     702             :                     EditSelection( const EditPaM& rStartAndAnd );
     703             :                     EditSelection( const EditPaM& rStart, const EditPaM& rEnd );
     704             : 
     705      894858 :     EditPaM&        Min()               { return aStartPaM; }
     706     1384684 :     EditPaM&        Max()               { return aEndPaM; }
     707             : 
     708       20546 :     const EditPaM&  Min() const         { return aStartPaM; }
     709      117985 :     const EditPaM&  Max() const         { return aEndPaM; }
     710             : 
     711      286246 :     bool            HasRange() const    { return aStartPaM != aEndPaM; }
     712             :     bool            IsInvalid() const { return !aStartPaM || !aEndPaM; }
     713             :     bool            DbgIsBuggy( EditDoc& rDoc );
     714             : 
     715             :     void            Adjust( const EditDoc& rNodes );
     716             : 
     717             :     EditSelection&  operator = ( const EditPaM& r );
     718           0 :     bool            operator == ( const EditSelection& r ) const
     719           0 :                     { return ( aStartPaM == r.aStartPaM ) && ( aEndPaM == r.aEndPaM ); }
     720           0 :     bool            operator != ( const EditSelection& r ) const { return !( r == *this ); }
     721             : };
     722             : 
     723             : 
     724             : // class DeletedNodeInfo
     725             : 
     726             : class DeletedNodeInfo
     727             : {
     728             : private:
     729             :     sal_uIntPtr     nInvalidAdressPtr;
     730             :     sal_Int32       nInvalidParagraph;
     731             : 
     732             : public:
     733        3578 :             DeletedNodeInfo( sal_uIntPtr nInvAdr, sal_Int32 nPos )
     734             :             : nInvalidAdressPtr(nInvAdr)
     735        3578 :             , nInvalidParagraph(nPos)
     736             :             {
     737        3578 :             }
     738             : 
     739           0 :     sal_uIntPtr GetInvalidAdress() const { return nInvalidAdressPtr; }
     740           0 :     sal_Int32   GetPosition() const { return nInvalidParagraph; }
     741             : };
     742             : 
     743             : 
     744             : // class EditDoc
     745             : 
     746             : class EditDoc
     747             : {
     748             : private:
     749             :     mutable sal_Int32 nLastCache;
     750             :     boost::ptr_vector<ContentNode> maContents;
     751             : 
     752             :     SfxItemPool*    pItemPool;
     753             :     Link            aModifyHdl;
     754             : 
     755             :     SvxFont         aDefFont;           //faster than ever from the pool!!
     756             :     sal_uInt16          nDefTab;
     757             :     bool            bIsVertical:1;
     758             :     bool            bIsFixedCellHeight:1;
     759             : 
     760             :     bool            bOwnerOfPool:1;
     761             :     bool            bModified:1;
     762             : 
     763             : private:
     764             :     void            ImplDestroyContents();
     765             : 
     766             : public:
     767             :                     EditDoc( SfxItemPool* pItemPool );
     768             :                     ~EditDoc();
     769             : 
     770             :     void ClearSpellErrors();
     771             : 
     772          36 :     bool            IsModified() const      { return bModified; }
     773             :     void            SetModified( bool b );
     774             : 
     775       51673 :     void            SetModifyHdl( const Link& rLink ) { aModifyHdl = rLink; }
     776             :     Link            GetModifyHdl() const { return aModifyHdl; }
     777             : 
     778             :     void            CreateDefFont( bool bUseStyles );
     779       29249 :     const SvxFont&  GetDefFont() { return aDefFont; }
     780             : 
     781       49178 :     void            SetDefTab( sal_uInt16 nTab )    { nDefTab = nTab ? nTab : DEFTAB; }
     782          22 :     sal_uInt16          GetDefTab() const           { return nDefTab; }
     783             : 
     784           8 :     void            SetVertical( bool bVertical )   { bIsVertical = bVertical; }
     785     4054390 :     bool            IsVertical() const              { return bIsVertical; }
     786             : 
     787          68 :     void            SetFixedCellHeight( bool bUseFixedCellHeight )  { bIsFixedCellHeight = bUseFixedCellHeight; }
     788      925525 :     bool            IsFixedCellHeight() const               { return bIsFixedCellHeight; }
     789             : 
     790             :     EditPaM         Clear();
     791             :     EditPaM         RemoveText();
     792             :     EditPaM         RemoveChars( EditPaM aPaM, sal_Int32 nChars );
     793             :     EditPaM         InsertText( EditPaM aPaM, const OUString& rStr );
     794             :     EditPaM         InsertParaBreak( EditPaM aPaM, bool bKeepEndingAttribs );
     795             :     EditPaM         InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem );
     796             :     EditPaM         ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight );
     797             : 
     798             :     OUString        GetText( LineEnd eEnd ) const;
     799             :     sal_uLong       GetTextLen() const;
     800             : 
     801             :     OUString       GetParaAsString( sal_Int32 nNode ) const;
     802             :     OUString       GetParaAsString(const ContentNode* pNode, sal_Int32 nStartPos = 0, sal_Int32 nEndPos = -1, bool bResolveFields = true) const;
     803             : 
     804             :     EditPaM GetStartPaM() const;
     805             :     EditPaM GetEndPaM() const;
     806             : 
     807     1998247 :     SfxItemPool&        GetItemPool()                   { return *pItemPool; }
     808       42490 :     const SfxItemPool&  GetItemPool() const             { return *pItemPool; }
     809             : 
     810             :     void RemoveItemsFromPool(const ContentNode& rNode);
     811             : 
     812             :     void            InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd );
     813             :     void            InsertAttrib( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem );
     814             :     void            InsertAttribInSelection( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem );
     815             :     bool            RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt16 nWhich = 0 );
     816             :     bool            RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich = 0 );
     817             :     void            FindAttribs( ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nEndPos, SfxItemSet& rCurSet );
     818             : 
     819             :     sal_Int32 GetPos(const ContentNode* pNode) const;
     820             :     const ContentNode* GetObject(sal_Int32 nPos) const;
     821             :     ContentNode* GetObject(sal_Int32 nPos);
     822             :     sal_Int32 Count() const;
     823             :     const ContentNode* operator[](sal_Int32 nPos) const;
     824             :     ContentNode* operator[](sal_Int32 nPos);
     825             :     void Insert(sal_Int32 nPos, ContentNode* p);
     826             :     /// deletes
     827             :     void Remove(sal_Int32 nPos);
     828             :     /// does not delete
     829             :     void Release(sal_Int32 nPos);
     830             : 
     831             :     static OUString GetSepStr( LineEnd eEnd );
     832             : };
     833             : 
     834     3449909 : inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, sal_Int32 nAttr)
     835             : {
     836     3449909 :     return (nAttr < (sal_Int32)rAttribs.size()) ? &rAttribs[nAttr] : NULL;
     837             : }
     838             : 
     839             : bool CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart);
     840             : 
     841             : 
     842             : // class EditEngineItemPool
     843             : 
     844             : class EditEngineItemPool : public SfxItemPool
     845             : {
     846             : public:
     847             :                         EditEngineItemPool( bool bPersistenRefCounts );
     848             : protected:
     849             :                         virtual ~EditEngineItemPool();
     850             : public:
     851             : 
     852             :     virtual SvStream&   Store( SvStream& rStream ) const SAL_OVERRIDE;
     853             : };
     854             : 
     855             : #endif // INCLUDED_EDITENG_SOURCE_EDITENG_EDITDOC_HXX
     856             : 
     857             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10