LCOV - code coverage report
Current view: top level - editeng/source/editeng - editdoc.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 111 132 84.1 %
Date: 2014-04-11 Functions: 100 118 84.7 %
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             : sal_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         144 :     EPaM() : nPara(0), nIndex(0) {}
      62       19044 :     EPaM( sal_Int32 nP, sal_Int32 nI ) : nPara(nP), nIndex(nI) {}
      63       18900 :     EPaM( const EPaM& r) : nPara(r.nPara), nIndex(r.nIndex) {}
      64         144 :     EPaM& operator = ( const EPaM& r )  { nPara = r.nPara; nIndex = r.nIndex; return *this; }
      65             :     inline sal_Bool operator == ( const EPaM& r ) const;
      66             :     inline sal_Bool operator < ( const EPaM& r ) const;
      67             : };
      68             : 
      69          48 : inline sal_Bool EPaM::operator < ( const EPaM& r ) const
      70             : {
      71          96 :     return ( ( nPara < r.nPara ) ||
      72          96 :              ( ( nPara == r.nPara ) && nIndex < r.nIndex ) ) ? sal_True : sal_False;
      73             : }
      74             : 
      75          48 : inline sal_Bool EPaM::operator == ( const EPaM& r ) const
      76             : {
      77          48 :     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      188173 :     ScriptTypePosInfo( short _Type, sal_Int32 _Start, sal_Int32 _End )
      87             :     : nScriptType(_Type)
      88             :     , nStartPos(_Start)
      89      188173 :     , nEndPos(_End)
      90             :     {
      91      188173 :     }
      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      185606 :     WritingDirectionInfo( sal_uInt8 _Type, sal_Int32 _Start, sal_Int32 _End )
     103             :     : nType(_Type)
     104             :     , nStartPos(_Start)
     105      185606 :     , nEndPos(_End)
     106             :     {
     107      185606 :     }
     108             : };
     109             : 
     110             : 
     111             : typedef std::deque< WritingDirectionInfo > WritingDirectionInfos;
     112             : 
     113        4818 : 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             : 
     135             : class SvxColorList
     136             : {
     137             : private:
     138             :     typedef std::vector<SvxColorItem*> DummyColorList;
     139             :     DummyColorList aColorList;
     140             : 
     141             : public:
     142             :             SvxColorList();
     143             :             ~SvxColorList();
     144             : 
     145             :     sal_Int32  GetId( const SvxColorItem& rColor );
     146           0 :     sal_Int32  Count() { return aColorList.size(); };
     147             :     void    Insert( SvxColorItem* pItem, sal_Int32 nIndex );
     148             :     SvxColorItem* GetObject( sal_Int32 nIndex );
     149             : };
     150             : 
     151             : 
     152             : //  class ItemList
     153             : 
     154             : 
     155           0 : class ItemList
     156             : {
     157             : private:
     158             :     typedef std::vector<const SfxPoolItem*> DummyItemList;
     159             :     DummyItemList aItemPool;
     160             :     sal_Int32  CurrentItem;
     161             : 
     162             : public:
     163             :     ItemList();
     164             :     const SfxPoolItem*  First();
     165             :     const SfxPoolItem*  Next();
     166           0 :     sal_Int32              Count() { return aItemPool.size(); };
     167             :     void                Insert( const SfxPoolItem* pItem );
     168           0 :     void                Clear() { aItemPool.clear(); };
     169             : };
     170             : 
     171             : 
     172             : // class ContentAttribs
     173             : 
     174             : class ContentAttribs
     175             : {
     176             : private:
     177             :     SfxStyleSheet*  pStyle;
     178             :     SfxItemSet      aAttribSet;
     179             : 
     180             : public:
     181             :                     ContentAttribs( SfxItemPool& rItemPool );
     182             :                     ContentAttribs( const ContentAttribs& );
     183             :                     ~ContentAttribs();  // only for larger Tabs
     184             : 
     185             :     SvxTabStop      FindTabStop( sal_Int32 nCurPos, sal_uInt16 nDefTab );
     186     2062405 :     SfxItemSet&     GetItems()                          { return aAttribSet; }
     187      630762 :     const SfxItemSet& GetItems() const { return aAttribSet; }
     188           0 :     const SfxStyleSheet*  GetStyleSheet() const { return pStyle; }
     189      964355 :     SfxStyleSheet*  GetStyleSheet() { return pStyle; }
     190             :     void            SetStyleSheet( SfxStyleSheet* pS );
     191             : 
     192             :     const SfxPoolItem& GetItem( sal_uInt16 nWhich ) const;
     193             :     bool HasItem( sal_uInt16 nWhich ) const;
     194             : };
     195             : 
     196             : 
     197             : // class CharAttribList
     198             : 
     199             : class CharAttribList
     200             : {
     201             : public:
     202             :     typedef boost::ptr_vector<EditCharAttrib> AttribsType;
     203             : 
     204             : private:
     205             :     AttribsType     aAttribs;
     206             :     SvxFont         aDefFont;          // faster than ever from the pool!
     207             :     bool            bHasEmptyAttribs;
     208             : 
     209             :                     CharAttribList( const CharAttribList& ) {;}
     210             : 
     211             : public:
     212             :                     CharAttribList();
     213             :                     ~CharAttribList();
     214             : 
     215             :     void            DeleteEmptyAttribs(  SfxItemPool& rItemPool );
     216             :     void            RemoveItemsFromPool( SfxItemPool* pItemPool );
     217             : 
     218             :     const EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const;
     219             :     EditCharAttrib* FindAttrib( sal_uInt16 nWhich, sal_Int32 nPos );
     220             :     const EditCharAttrib* FindNextAttrib( sal_uInt16 nWhich, sal_Int32 nFromPos ) const;
     221             :     const EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos ) const;
     222             :     EditCharAttrib* FindEmptyAttrib( sal_uInt16 nWhich, sal_Int32 nPos );
     223             :     const EditCharAttrib* FindFeature( sal_Int32 nPos ) const;
     224             : 
     225             : 
     226             :     void            ResortAttribs();
     227             :     void            OptimizeRanges( SfxItemPool& rItemPool );
     228             : 
     229             :     sal_Int32 Count() const;
     230             : 
     231             :     void            InsertAttrib( EditCharAttrib* pAttrib );
     232             : 
     233     1769584 :     SvxFont&        GetDefFont()            { return aDefFont; }
     234             : 
     235        5464 :     bool            HasEmptyAttribs() const { return bHasEmptyAttribs; }
     236             :     void SetHasEmptyAttribs(bool b);
     237             :     bool HasBoundingAttrib( sal_Int32 nBound ) const;
     238             :     bool HasAttrib( sal_Int32 nStartPos, sal_Int32 nEndPos ) const;
     239             : 
     240             :     AttribsType& GetAttribs();
     241             :     const AttribsType& GetAttribs() const;
     242             : 
     243             :     void Remove(const EditCharAttrib* p);
     244             :     void Remove(sal_Int32 nPos);
     245             :     void Release(const EditCharAttrib* p);
     246             : 
     247             : #if OSL_DEBUG_LEVEL > 2
     248             :     // Debug:
     249             :     bool DbgCheckAttribs() const;
     250             : #endif
     251             : };
     252             : 
     253             : 
     254             : // class ContentNode
     255             : 
     256             : class ContentNode : boost::noncopyable
     257             : {
     258             : private:
     259             :     OUString maString;
     260             :     ContentAttribs  aContentAttribs;
     261             :     CharAttribList  aCharAttribList;
     262             :     boost::scoped_ptr<WrongList> mpWrongList;
     263             : 
     264             : public:
     265             :                     ContentNode( SfxItemPool& rItemPool );
     266             :                     ContentNode( const OUString& rStr, const ContentAttribs& rContentAttribs );
     267             :                     ~ContentNode();
     268             : 
     269     5977313 :     ContentAttribs& GetContentAttribs()     { return aContentAttribs; }
     270     2330853 :     const ContentAttribs& GetContentAttribs() const { return aContentAttribs; }
     271     3778612 :     CharAttribList& GetCharAttribs()        { return aCharAttribList; }
     272      864050 :     const CharAttribList& GetCharAttribs() const { return aCharAttribList; }
     273             : 
     274             :     void            ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNewChars, SfxItemPool& rItemPool );
     275             :     void            CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDelChars, SfxItemPool& rItemPool );
     276             :     void            AppendAttribs( ContentNode* pNextNode );
     277             :     void            CopyAndCutAttribs( ContentNode* pPrevNode, SfxItemPool& rPool, sal_Bool bKeepEndingAttribs );
     278             : 
     279             :     void            SetStyleSheet( SfxStyleSheet* pS, sal_Bool bRecalcFont = sal_True );
     280             :     void            SetStyleSheet( SfxStyleSheet* pS, const SvxFont& rFontFromStyle );
     281      530137 :     SfxStyleSheet*  GetStyleSheet() { return aContentAttribs.GetStyleSheet(); }
     282             :     const SfxStyleSheet* GetStyleSheet() const { return aContentAttribs.GetStyleSheet(); }
     283             : 
     284             :     void            CreateDefFont();
     285             : 
     286             :     void EnsureWrongList();
     287             :     WrongList* GetWrongList();
     288             :     const WrongList* GetWrongList() const;
     289             :     void SetWrongList( WrongList* p );
     290             : 
     291             :     void            CreateWrongList();
     292             :     void            DestroyWrongList();
     293             : 
     294             :     bool IsFeature( sal_Int32 nPos ) const;
     295             : 
     296             :     sal_Int32 Len() const;
     297             :     const OUString& GetString() const;
     298             : 
     299             :     void SetChar(sal_Int32 nPos, sal_Unicode c);
     300             :     void Insert(const OUString& rStr, sal_Int32 nPos);
     301             :     void Append(const OUString& rStr);
     302             :     void Erase(sal_Int32 nPos);
     303             :     void Erase(sal_Int32 nPos, sal_Int32 nCount);
     304             :     OUString Copy(sal_Int32 nPos) const;
     305             :     OUString Copy(sal_Int32 nPos, sal_Int32 nCount) const;
     306             :     sal_Unicode GetChar(sal_Int32 nPos) const;
     307             : };
     308             : 
     309             : 
     310             : // class EditPaM
     311             : 
     312             : class EditPaM
     313             : {
     314             : private:
     315             :     ContentNode* pNode;
     316             :     sal_Int32    nIndex;
     317             : 
     318             : public:
     319             :     EditPaM();
     320             :     EditPaM(const EditPaM& r);
     321             :     EditPaM(ContentNode* p, sal_Int32 n);
     322             : 
     323             :     const ContentNode* GetNode() const;
     324             :     ContentNode* GetNode();
     325             :     void SetNode(ContentNode* p);
     326             : 
     327     3033018 :     sal_Int32  GetIndex() const         { return nIndex; }
     328      298395 :     void       SetIndex( sal_Int32 n )  { nIndex = n; }
     329             : 
     330             :     bool       DbgIsBuggy( EditDoc& rDoc );
     331             : 
     332             :     EditPaM&    operator = ( const EditPaM& rPaM );
     333             :     friend bool operator == ( const EditPaM& r1, const EditPaM& r2 );
     334             :     friend bool operator != ( const EditPaM& r1, const EditPaM& r2 );
     335             :     bool operator !() const { return !pNode && !nIndex; }
     336             : };
     337             : 
     338             : #define PORTIONKIND_TEXT        0
     339             : #define PORTIONKIND_TAB         1
     340             : #define PORTIONKIND_LINEBREAK   2
     341             : #define PORTIONKIND_FIELD       3
     342             : #define PORTIONKIND_HYPHENATOR  4
     343             : 
     344             : #define DELMODE_SIMPLE          0
     345             : #define DELMODE_RESTOFWORD      1
     346             : #define DELMODE_RESTOFCONTENT   2
     347             : 
     348             : #define CHAR_NORMAL            0x00
     349             : #define CHAR_KANA              0x01
     350             : #define CHAR_PUNCTUATIONLEFT   0x02
     351             : #define CHAR_PUNCTUATIONRIGHT  0x04
     352             : 
     353             : 
     354             : // struct ExtraPortionInfos
     355             : 
     356             : struct ExtraPortionInfo
     357             : {
     358             :     long    nOrgWidth;
     359             :     long    nWidthFullCompression;
     360             : 
     361             :     long    nPortionOffsetX;
     362             : 
     363             :     sal_uInt16  nMaxCompression100thPercent;
     364             : 
     365             :     sal_uInt8    nAsianCompressionTypes;
     366             :     sal_Bool    bFirstCharIsRightPunktuation;
     367             :     sal_Bool    bCompressed;
     368             : 
     369             :     sal_Int32*    pOrgDXArray;
     370             :     ::std::vector< sal_Int32 > lineBreaksList;
     371             : 
     372             : 
     373             :             ExtraPortionInfo();
     374             :             ~ExtraPortionInfo();
     375             : 
     376             :     void    SaveOrgDXArray( const sal_Int32* pDXArray, sal_Int32 nLen );
     377             : };
     378             : 
     379             : 
     380             : 
     381             : // class TextPortion
     382             : 
     383             : class TextPortion
     384             : {
     385             : private:
     386             :     ExtraPortionInfo*   pExtraInfos;
     387             :     sal_Int32              nLen;
     388             :     Size                aOutSz;
     389             :     sal_uInt8               nKind;
     390             :     sal_uInt8                nRightToLeft;
     391             :     sal_Unicode         nExtraValue;
     392             : 
     393             : 
     394             :                 TextPortion()
     395             :                 : pExtraInfos( NULL )
     396             :                 , nLen( 0 )
     397             :                 , aOutSz()
     398             :                 , nKind( PORTIONKIND_TEXT )
     399             :                 , nRightToLeft( sal_False )
     400             :                 , nExtraValue( 0 )
     401             :                 {
     402             :                 }
     403             : 
     404             : public:
     405      405670 :                 TextPortion( sal_Int32 nL )
     406             :                 : pExtraInfos( NULL )
     407             :                 , nLen( nL )
     408             :                 , aOutSz( -1, -1 )
     409             :                 , nKind( PORTIONKIND_TEXT )
     410             :                 , nRightToLeft( sal_False )
     411      405670 :                 , nExtraValue( 0 )
     412             :                 {
     413      405670 :                 }
     414             : 
     415           0 :                 TextPortion( const TextPortion& r )
     416             :                 : pExtraInfos( NULL )
     417             :                 , nLen( r.nLen )
     418             :                 , aOutSz( r.aOutSz )
     419             :                 , nKind( r.nKind )
     420             :                 , nRightToLeft( r.nRightToLeft )
     421           0 :                 , nExtraValue( r.nExtraValue )
     422             :                 {
     423           0 :                 }
     424             : 
     425             : 
     426     2051953 :     sal_Int32      GetLen() const              { return nLen; }
     427       54483 :     void        SetLen( sal_Int32 nL )         { nLen = nL; }
     428             : 
     429     1151619 :     Size&       GetSize()                   { return aOutSz; }
     430      116861 :     const Size& GetSize() const             { return aOutSz; }
     431             : 
     432      428834 :     sal_uInt8&      GetKind()                   { return nKind; }
     433      373950 :     sal_uInt8       GetKind() const             { return nKind; }
     434             : 
     435      173709 :     void        SetRightToLeft( sal_uInt8 b )    { nRightToLeft = b; }
     436       30946 :     sal_uInt8        GetRightToLeft() const      { return nRightToLeft; }
     437       19536 :     sal_Bool        IsRightToLeft() const       { return (nRightToLeft&1); }
     438             : 
     439           0 :     sal_Unicode GetExtraValue() const       { return nExtraValue; }
     440           9 :     void        SetExtraValue( sal_Unicode n )  { nExtraValue = n; }
     441             : 
     442           0 :     sal_Bool        HasValidSize() const        { return aOutSz.Width() != (-1); }
     443             : 
     444       57273 :     ExtraPortionInfo*   GetExtraInfos() const { return pExtraInfos; }
     445           0 :     void                SetExtraInfos( ExtraPortionInfo* p ) { delete pExtraInfos; pExtraInfos = p; }
     446             : };
     447             : 
     448             : 
     449             : // class TextPortionList
     450             : 
     451             : class TextPortionList
     452             : {
     453             :     typedef boost::ptr_vector<TextPortion> PortionsType;
     454             :     PortionsType maPortions;
     455             : 
     456             : public:
     457             :             TextPortionList();
     458             :             ~TextPortionList();
     459             : 
     460             :     void    Reset();
     461             :     sal_Int32 FindPortion(
     462             :         sal_Int32 nCharPos, sal_Int32& rPortionStart, bool bPreferStartingPortion = false) const;
     463             :     sal_Int32 GetStartPos(sal_Int32 nPortion);
     464             :     void DeleteFromPortion(sal_Int32 nDelFrom);
     465             :     sal_Int32 Count() const;
     466             :     const TextPortion* operator[](sal_Int32 nPos) const;
     467             :     TextPortion* operator[](sal_Int32 nPos);
     468             : 
     469             :     void Append(TextPortion* p);
     470             :     void Insert(sal_Int32 nPos, TextPortion* p);
     471             :     void Remove(sal_Int32 nPos);
     472             :     sal_Int32 GetPos(const TextPortion* p) const;
     473             : };
     474             : 
     475             : class ParaPortion;
     476             : 
     477             : 
     478             : // class EditLine
     479             : 
     480             : class EditLine
     481             : {
     482             : public:
     483             :     typedef std::vector<sal_Int32> CharPosArrayType;
     484             : 
     485             : private:
     486             :     CharPosArrayType aPositions;
     487             :     long            nTxtWidth;
     488             :     sal_uInt16          nStartPosX;
     489             :     sal_Int32          nStart;     // could be replaced by nStartPortion
     490             :     sal_Int32          nEnd;       // could be replaced by nEndPortion
     491             :     sal_Int32          nStartPortion;
     492             :     sal_Int32          nEndPortion;
     493             :     sal_uInt16          nHeight;    //  Total height of the line
     494             :     sal_uInt16          nTxtHeight; // Pure Text height
     495             :     sal_uInt16          nCrsrHeight;    // For contour flow high lines => cursor is large.
     496             :     sal_uInt16          nMaxAscent;
     497             :     bool            bHangingPunctuation:1;
     498             :     bool            bInvalid:1;   // for skillful formatting
     499             : 
     500             : public:
     501             :                     EditLine();
     502             :                     EditLine( const EditLine& );
     503             :                     ~EditLine();
     504             : 
     505           0 :     sal_Bool            IsIn( sal_Int32 nIndex ) const
     506           0 :                         { return ( (nIndex >= nStart ) && ( nIndex < nEnd ) ); }
     507             : 
     508         153 :     sal_Bool            IsIn( sal_Int32 nIndex, sal_Bool bInclEnd ) const
     509         153 :                         { return ( ( nIndex >= nStart ) && ( bInclEnd ? ( nIndex <= nEnd ) : ( nIndex < nEnd ) ) ); }
     510             : 
     511      282262 :     void            SetStart( sal_Int32 n )            { nStart = n; }
     512       33314 :     sal_Int32          GetStart() const                { return nStart; }
     513     1247485 :     sal_Int32&         GetStart()                      { return nStart; }
     514             : 
     515      456969 :     void            SetEnd( sal_Int32 n )              { nEnd = n; }
     516        1655 :     sal_Int32          GetEnd() const                  { return nEnd; }
     517      296923 :     sal_Int32&         GetEnd()                        { return nEnd; }
     518             : 
     519       54692 :     void            SetStartPortion( sal_Int32 n )     { nStartPortion = n; }
     520       32737 :     sal_Int32          GetStartPortion() const         { return nStartPortion; }
     521      459096 :     sal_Int32&         GetStartPortion()               { return nStartPortion; }
     522             : 
     523      229399 :     void            SetEndPortion( sal_Int32 n )       { nEndPortion = n; }
     524       44559 :     sal_Int32          GetEndPortion() const           { return nEndPortion; }
     525      726772 :     sal_Int32&         GetEndPortion()                 { return nEndPortion; }
     526             : 
     527             :     void            SetHeight( sal_uInt16 nH, sal_uInt16 nTxtH = 0, sal_uInt16 nCrsrH = 0 );
     528     1454642 :     sal_uInt16          GetHeight() const               { return nHeight; }
     529        3010 :     sal_uInt16          GetTxtHeight() const            { return nTxtHeight; }
     530             :     sal_uInt16          GetCrsrHeight() const           { return nCrsrHeight; }
     531             : 
     532      174987 :     void            SetTextWidth( long n )          { nTxtWidth = n; }
     533         331 :     long            GetTextWidth() const            { return nTxtWidth; }
     534             : 
     535      407357 :     void            SetMaxAscent( sal_uInt16 n )        { nMaxAscent = n; }
     536       26320 :     sal_uInt16          GetMaxAscent() const            { return nMaxAscent; }
     537             : 
     538       59381 :     void            SetHangingPunctuation( bool b )     { bHangingPunctuation = b; }
     539      174660 :     bool            IsHangingPunctuation() const        { return bHangingPunctuation; }
     540             : 
     541      174884 :     sal_Int32          GetLen() const                  { return nEnd - nStart; }
     542             : 
     543       33062 :     sal_uInt16          GetStartPosX() const            { return nStartPosX; }
     544             :     void            SetStartPosX( long start );
     545             :     Size            CalcTextSize( ParaPortion& rParaPortion );
     546             : 
     547      340416 :     bool            IsInvalid() const               { return bInvalid; }
     548      392249 :     bool            IsValid() const                 { return !bInvalid; }
     549      174660 :     void            SetInvalid()                    { bInvalid = true; }
     550      118155 :     void            SetValid()                      { bInvalid = false; }
     551             : 
     552        1479 :     sal_Bool            IsEmpty() const                 { return (nEnd > nStart) ? sal_False : sal_True; }
     553             : 
     554             :     CharPosArrayType& GetCharPosArray();
     555             :     const CharPosArrayType& GetCharPosArray() const;
     556             : 
     557             :     EditLine*       Clone() const;
     558             : 
     559             :     EditLine&   operator = ( const EditLine& rLine );
     560             :     friend sal_Bool operator == ( const EditLine& r1,  const EditLine& r2  );
     561             :     friend sal_Bool operator != ( const EditLine& r1,  const EditLine& r2  );
     562             : };
     563             : 
     564             : 
     565             : 
     566             : // class LineList
     567             : 
     568             : class EditLineList
     569             : {
     570             :     typedef boost::ptr_vector<EditLine> LinesType;
     571             :     LinesType maLines;
     572             : 
     573             : public:
     574             :             EditLineList();
     575             :             ~EditLineList();
     576             : 
     577             :     void Reset();
     578             :     void DeleteFromLine(sal_Int32 nDelFrom);
     579             :     sal_Int32 FindLine(sal_Int32 nChar, bool bInclEnd);
     580             :     sal_Int32 Count() const;
     581             :     const EditLine* operator[](sal_Int32 nPos) const;
     582             :     EditLine* operator[](sal_Int32 nPos);
     583             : 
     584             :     void Append(EditLine* p);
     585             :     void Insert(sal_Int32 nPos, EditLine* p);
     586             : };
     587             : 
     588             : 
     589             : // class ParaPortion
     590             : 
     591             : class ParaPortion
     592             : {
     593             :     friend class ImpEditEngine; // to adjust the height
     594             : private:
     595             :     EditLineList        aLineList;
     596             :     TextPortionList     aTextPortionList;
     597             :     ContentNode*        pNode;
     598             :     long                nHeight;
     599             : 
     600             :     ScriptTypePosInfos      aScriptInfos;
     601             :     WritingDirectionInfos   aWritingDirectionInfos;
     602             : 
     603             :     sal_Int32              nInvalidPosStart;
     604             :     sal_Int32              nFirstLineOffset;   // For Writer-LineSpacing-Interpretation
     605             :     sal_uInt16             nBulletX;
     606             :     sal_Int32              nInvalidDiff;
     607             : 
     608             :     sal_Bool                bInvalid            : 1;
     609             :     sal_Bool                bSimple             : 1;    // only linear Tap
     610             :     sal_Bool                bVisible            : 1;    // Belongs to the node!
     611             :     sal_Bool                bForceRepaint       : 1;
     612             : 
     613             :                         ParaPortion( const ParaPortion& );
     614             : 
     615             : public:
     616             :                         ParaPortion( ContentNode* pNode );
     617             :                         ~ParaPortion();
     618             : 
     619             :     sal_Int32 GetLineNumber( sal_Int32 nIndex ) const;
     620             : 
     621     5199843 :     EditLineList&       GetLines()                  { return aLineList; }
     622       30786 :     const EditLineList& GetLines() const { return aLineList; }
     623             : 
     624      732482 :     sal_Bool                IsInvalid() const           { return bInvalid; }
     625      414612 :     sal_Bool                IsSimpleInvalid()   const   { return bSimple; }
     626      347546 :     void                SetValid()                  { bInvalid = sal_False; bSimple = sal_True;}
     627             : 
     628      710434 :     sal_Bool                MustRepaint() const         { return bForceRepaint; }
     629      267345 :     void                SetMustRepaint( sal_Bool bRP )  { bForceRepaint = bRP; }
     630             : 
     631      444308 :     sal_uInt16              GetBulletX() const          { return nBulletX; }
     632      347546 :     void                SetBulletX( sal_uInt16 n )      { nBulletX = n; }
     633             : 
     634             :     void                MarkInvalid( sal_Int32 nStart, sal_Int32 nDiff);
     635             :     void                MarkSelectionInvalid( sal_Int32 nStart, sal_Int32 nEnd );
     636             : 
     637             :     void                SetVisible( sal_Bool bVisible );
     638     1157389 :     bool                IsVisible() const { return bVisible; }
     639             : 
     640      363314 :     sal_Bool            IsEmpty() { return GetTextPortions().Count() == 1 && GetTextPortions()[0]->GetLen() == 0; }
     641             : 
     642     1442322 :     long                GetHeight() const           { return ( bVisible ? nHeight : 0 ); }
     643      355437 :     sal_Int32           GetFirstLineOffset() const  { return ( bVisible ? nFirstLineOffset : 0 ); }
     644           0 :     void                ResetHeight()   { nHeight = 0; nFirstLineOffset = 0; }
     645             : 
     646     5511693 :     ContentNode*        GetNode() const             { return pNode; }
     647     3074219 :     TextPortionList&    GetTextPortions()           { return aTextPortionList; }
     648      118797 :     const TextPortionList& GetTextPortions() const { return aTextPortionList; }
     649             : 
     650      119976 :     sal_Int32           GetInvalidPosStart() const  { return nInvalidPosStart; }
     651      119976 :     short               GetInvalidDiff() const      { return nInvalidDiff; }
     652             : 
     653             :     void                CorrectValuesBehindLastFormattedLine( sal_Int32 nLastFormattedLine );
     654             : #if OSL_DEBUG_LEVEL > 2
     655             :     sal_Bool                DbgCheckTextPortions();
     656             : #endif
     657             : };
     658             : 
     659             : 
     660             : // class ParaPortionList
     661             : 
     662             : class ParaPortionList
     663             : {
     664             :     mutable sal_Int32 nLastCache;
     665             :     boost::ptr_vector<ParaPortion> maPortions;
     666             : public:
     667             :                     ParaPortionList();
     668             :                     ~ParaPortionList();
     669             : 
     670             :     void            Reset();
     671             :     long GetYOffset(const ParaPortion* pPPortion) const;
     672             :     sal_Int32 FindParagraph(long nYOffset) const;
     673             : 
     674             :     const ParaPortion* SafeGetObject(sal_Int32 nPos) const;
     675             :     ParaPortion* SafeGetObject(sal_Int32 nPos);
     676             : 
     677             :     sal_Int32 GetPos(const ParaPortion* p) const;
     678             :     ParaPortion* operator[](sal_Int32 nPos);
     679             :     const ParaPortion* operator[](sal_Int32 nPos) const;
     680             : 
     681             :     ParaPortion* Release(sal_Int32 nPos);
     682             :     void Remove(sal_Int32 nPos);
     683             :     void Insert(sal_Int32 nPos, ParaPortion* p);
     684             :     void Append(ParaPortion* p);
     685             :     sal_Int32 Count() const;
     686             : 
     687             : #if OSL_DEBUG_LEVEL > 2
     688             :     // temporary:
     689             :     void            DbgCheck( EditDoc& rDoc );
     690             : #endif
     691             : };
     692             : 
     693             : 
     694             : // class EditSelection
     695             : 
     696      265765 : class EditSelection
     697             : {
     698             : private:
     699             :     EditPaM         aStartPaM;
     700             :     EditPaM         aEndPaM;
     701             : 
     702             : public:
     703             :                     EditSelection();    // No constructor and destructor
     704             :                                         // are automtically excecuted correctly!
     705             :                     EditSelection( const EditPaM& rStartAndAnd );
     706             :                     EditSelection( const EditPaM& rStart, const EditPaM& rEnd );
     707             : 
     708      505005 :     EditPaM&        Min()               { return aStartPaM; }
     709      915139 :     EditPaM&        Max()               { return aEndPaM; }
     710             : 
     711        9011 :     const EditPaM&  Min() const         { return aStartPaM; }
     712       62727 :     const EditPaM&  Max() const         { return aEndPaM; }
     713             : 
     714      219718 :     bool            HasRange() const    { return aStartPaM != aEndPaM; }
     715             :     bool            IsInvalid() const { return !aStartPaM || !aEndPaM; }
     716             :     bool            DbgIsBuggy( EditDoc& rDoc );
     717             : 
     718             :     void            Adjust( const EditDoc& rNodes );
     719             : 
     720             :     EditSelection&  operator = ( const EditPaM& r );
     721           0 :     bool            operator == ( const EditSelection& r ) const
     722           0 :                     { return ( aStartPaM == r.aStartPaM ) && ( aEndPaM == r.aEndPaM ); }
     723           0 :     bool            operator != ( const EditSelection& r ) const { return !( r == *this ); }
     724             : };
     725             : 
     726             : 
     727             : // class DeletedNodeInfo
     728             : 
     729             : class DeletedNodeInfo
     730             : {
     731             : private:
     732             :     sal_uIntPtr     nInvalidAdressPtr;
     733             :     sal_Int32       nInvalidParagraph;
     734             : 
     735             : public:
     736        1106 :             DeletedNodeInfo( sal_uIntPtr nInvAdr, sal_Int32 nPos )
     737             :             : nInvalidAdressPtr(nInvAdr)
     738        1106 :             , nInvalidParagraph(nPos)
     739             :             {
     740        1106 :             }
     741             : 
     742           0 :     sal_uIntPtr GetInvalidAdress() const { return nInvalidAdressPtr; }
     743           0 :     sal_Int32   GetPosition() const { return nInvalidParagraph; }
     744             : };
     745             : 
     746             : 
     747             : // class EditDoc
     748             : 
     749             : class EditDoc
     750             : {
     751             : private:
     752             :     mutable sal_Int32 nLastCache;
     753             :     boost::ptr_vector<ContentNode> maContents;
     754             : 
     755             :     SfxItemPool*    pItemPool;
     756             :     Link            aModifyHdl;
     757             : 
     758             :     SvxFont         aDefFont;           //faster than ever from the pool!!
     759             :     sal_uInt16          nDefTab;
     760             :     bool            bIsVertical:1;
     761             :     bool            bIsFixedCellHeight:1;
     762             : 
     763             :     bool            bOwnerOfPool:1;
     764             :     bool            bModified:1;
     765             : 
     766             : private:
     767             :     void            ImplDestroyContents();
     768             : 
     769             : public:
     770             :                     EditDoc( SfxItemPool* pItemPool );
     771             :                     ~EditDoc();
     772             : 
     773             :     void ClearSpellErrors();
     774             : 
     775          25 :     bool            IsModified() const      { return bModified; }
     776             :     void            SetModified( bool b );
     777             : 
     778       25815 :     void            SetModifyHdl( const Link& rLink ) { aModifyHdl = rLink; }
     779             :     Link            GetModifyHdl() const { return aModifyHdl; }
     780             : 
     781             :     void            CreateDefFont( sal_Bool bUseStyles );
     782       13624 :     const SvxFont&  GetDefFont() { return aDefFont; }
     783             : 
     784       24313 :     void            SetDefTab( sal_uInt16 nTab )    { nDefTab = nTab ? nTab : DEFTAB; }
     785           9 :     sal_uInt16          GetDefTab() const           { return nDefTab; }
     786             : 
     787           4 :     void            SetVertical( bool bVertical )   { bIsVertical = bVertical; }
     788     3826608 :     bool            IsVertical() const              { return bIsVertical; }
     789             : 
     790          20 :     void            SetFixedCellHeight( bool bUseFixedCellHeight )  { bIsFixedCellHeight = bUseFixedCellHeight; }
     791      926479 :     bool            IsFixedCellHeight() const               { return bIsFixedCellHeight; }
     792             : 
     793             :     EditPaM         Clear();
     794             :     EditPaM         RemoveText();
     795             :     EditPaM         RemoveChars( EditPaM aPaM, sal_Int32 nChars );
     796             :     EditPaM         InsertText( EditPaM aPaM, const OUString& rStr );
     797             :     EditPaM         InsertParaBreak( EditPaM aPaM, sal_Bool bKeepEndingAttribs );
     798             :     EditPaM         InsertFeature( EditPaM aPaM, const SfxPoolItem& rItem );
     799             :     EditPaM         ConnectParagraphs( ContentNode* pLeft, ContentNode* pRight );
     800             : 
     801             :     OUString        GetText( LineEnd eEnd ) const;
     802             :     sal_uLong       GetTextLen() const;
     803             : 
     804             :     OUString       GetParaAsString( sal_Int32 nNode ) const;
     805             :     OUString       GetParaAsString(const ContentNode* pNode, sal_Int32 nStartPos = 0, sal_Int32 nEndPos = -1, bool bResolveFields = true) const;
     806             : 
     807             :     EditPaM GetStartPaM() const;
     808             :     EditPaM GetEndPaM() const;
     809             : 
     810     1357398 :     SfxItemPool&        GetItemPool()                   { return *pItemPool; }
     811       14363 :     const SfxItemPool&  GetItemPool() const             { return *pItemPool; }
     812             : 
     813             :     void RemoveItemsFromPool(const ContentNode& rNode);
     814             : 
     815             :     void            InsertAttrib( const SfxPoolItem& rItem, ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd );
     816             :     void            InsertAttrib( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem );
     817             :     void            InsertAttribInSelection( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, const SfxPoolItem& rPoolItem );
     818             :     sal_Bool            RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, sal_uInt16 nWhich = 0 );
     819             :     sal_Bool            RemoveAttribs( ContentNode* pNode, sal_Int32 nStart, sal_Int32 nEnd, EditCharAttrib*& rpStarting, EditCharAttrib*& rpEnding, sal_uInt16 nWhich = 0 );
     820             :     void            FindAttribs( ContentNode* pNode, sal_Int32 nStartPos, sal_Int32 nEndPos, SfxItemSet& rCurSet );
     821             : 
     822             :     sal_Int32 GetPos(const ContentNode* pNode) const;
     823             :     const ContentNode* GetObject(sal_Int32 nPos) const;
     824             :     ContentNode* GetObject(sal_Int32 nPos);
     825             :     sal_Int32 Count() const;
     826             :     const ContentNode* operator[](sal_Int32 nPos) const;
     827             :     ContentNode* operator[](sal_Int32 nPos);
     828             :     void Insert(sal_Int32 nPos, ContentNode* p);
     829             :     /// deletes
     830             :     void Remove(sal_Int32 nPos);
     831             :     /// does not delete
     832             :     void Release(sal_Int32 nPos);
     833             : 
     834             :     static OUString GetSepStr( LineEnd eEnd );
     835             : };
     836             : 
     837     1951490 : inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, sal_Int32 nAttr)
     838             : {
     839     1951490 :     return (nAttr < (sal_Int32)rAttribs.size()) ? &rAttribs[nAttr] : NULL;
     840             : }
     841             : 
     842             : bool CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart);
     843             : 
     844             : 
     845             : // class EditEngineItemPool
     846             : 
     847             : class EditEngineItemPool : public SfxItemPool
     848             : {
     849             : public:
     850             :                         EditEngineItemPool( sal_Bool bPersistenRefCounts );
     851             : protected:
     852             :                         virtual ~EditEngineItemPool();
     853             : public:
     854             : 
     855             :     virtual SvStream&   Store( SvStream& rStream ) const SAL_OVERRIDE;
     856             : };
     857             : 
     858             : #endif // INCLUDED_EDITENG_SOURCE_EDITENG_EDITDOC_HXX
     859             : 
     860             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10