LCOV - code coverage report
Current view: top level - editeng/source/editeng - editobj2.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 27 39 69.2 %
Date: 2012-08-25 Functions: 24 36 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 15 46.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _EDITOBJ2_HXX
      30                 :            : #define _EDITOBJ2_HXX
      31                 :            : 
      32                 :            : #include <editeng/editobj.hxx>
      33                 :            : #include <editdoc.hxx>
      34                 :            : 
      35                 :            : #include <unotools/fontcvt.hxx>
      36                 :            : 
      37                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      38                 :            : 
      39                 :            : class XEditAttribute
      40                 :            : {
      41                 :            : private:
      42                 :            :     const SfxPoolItem*  pItem;
      43                 :            :     sal_uInt16              nStart;
      44                 :            :     sal_uInt16              nEnd;
      45                 :            : 
      46                 :            :                         XEditAttribute();
      47                 :            :                         XEditAttribute( const XEditAttribute& rCopyFrom );
      48                 :            : 
      49                 :            : public:
      50                 :            :     XEditAttribute( const SfxPoolItem& rAttr, sal_uInt16 nStart, sal_uInt16 nEnd );
      51                 :            :     ~XEditAttribute();
      52                 :            : 
      53                 :     537095 :     const SfxPoolItem*  GetItem() const             { return pItem; }
      54                 :            : 
      55                 :          0 :     sal_uInt16&             GetStart()                  { return nStart; }
      56                 :      37661 :     sal_uInt16&             GetEnd()                    { return nEnd; }
      57                 :            : 
      58                 :     147290 :     sal_uInt16              GetStart() const            { return nStart; }
      59                 :     216778 :     sal_uInt16              GetEnd() const              { return nEnd; }
      60                 :            : 
      61                 :      62374 :     sal_uInt16              GetLen() const              { return nEnd-nStart; }
      62                 :            : 
      63                 :            :     bool IsFeature() const;
      64                 :            :     void SetItem(const SfxPoolItem& rNew);
      65                 :            : 
      66                 :            :     inline bool operator==( const XEditAttribute& rCompare ) const;
      67                 :            : 
      68                 :      23182 :     bool operator!= (const XEditAttribute& r) const
      69                 :            :     {
      70                 :      23182 :         return !operator==(r);
      71                 :            :     }
      72                 :            : };
      73                 :            : 
      74                 :      23182 : inline bool XEditAttribute::operator==( const XEditAttribute& rCompare ) const
      75                 :            : {
      76                 :            :     return  (nStart == rCompare.nStart) &&
      77                 :            :             (nEnd == rCompare.nEnd) &&
      78                 :            :             ( (pItem == rCompare.pItem) ||
      79                 :      19587 :             ( pItem->Which() != rCompare.pItem->Which()) ||
      80 [ +  - ][ +  - ]:      42769 :             (*pItem == *rCompare.pItem));
           [ +  +  +  + ]
                 [ -  + ]
      81                 :            : }
      82                 :            : 
      83      [ #  #  # ]:          0 : struct XParaPortion
      84                 :            : {
      85                 :            :     long                nHeight;
      86                 :            :     sal_uInt16              nFirstLineOffset;
      87                 :            : 
      88                 :            :     EditLineList        aLines;
      89                 :            :     TextPortionList     aTextPortions;
      90                 :            : };
      91                 :            : 
      92         [ #  # ]:          0 : class XParaPortionList
      93                 :            : {
      94                 :            :     typedef boost::ptr_vector<XParaPortion> ListType;
      95                 :            :     ListType maList;
      96                 :            : 
      97                 :            :     sal_uIntPtr nRefDevPtr;
      98                 :            :     OutDevType  eRefDevType;
      99                 :            :     MapMode     aRefMapMode;
     100                 :            :     sal_uInt16  nStretchX;
     101                 :            :     sal_uInt16  nStretchY;
     102                 :            :     sal_uLong   nPaperWidth;
     103                 :            : 
     104                 :            : public:
     105                 :            :     XParaPortionList(OutputDevice* pRefDev, sal_uLong nPW, sal_uInt16 _nStretchX, sal_uInt16 _nStretchY);
     106                 :            : 
     107                 :            :     void push_back(XParaPortion* p);
     108                 :            :     const XParaPortion& operator[](size_t i) const;
     109                 :            : 
     110                 :          0 :     sal_uIntPtr         GetRefDevPtr() const        { return nRefDevPtr; }
     111                 :          0 :     sal_uLong           GetPaperWidth() const       { return nPaperWidth; }
     112                 :          0 :     OutDevType      GetRefDevType() const       { return eRefDevType; }
     113                 :          0 :     const MapMode&  GetRefMapMode() const       { return aRefMapMode; }
     114                 :          0 :     sal_uInt16  GetStretchX() const         { return nStretchX; }
     115                 :          0 :     sal_uInt16  GetStretchY() const         { return nStretchY; }
     116                 :            : 
     117                 :            : };
     118                 :            : 
     119                 :            : class ContentInfo
     120                 :            : {
     121                 :            :     friend class BinTextObject;
     122                 :            : public:
     123                 :            :     typedef boost::ptr_vector<XEditAttribute> XEditAttributesType;
     124                 :            : 
     125                 :            : private:
     126                 :            :     String              aText;
     127                 :            :     String              aStyle;
     128                 :            : 
     129                 :            :     XEditAttributesType aAttribs;
     130                 :            :     SfxStyleFamily      eFamily;
     131                 :            :     SfxItemSet          aParaAttribs;
     132                 :            :     WrongList*          pWrongs;
     133                 :            : 
     134                 :            :                         ContentInfo( SfxItemPool& rPool );
     135                 :            :                         ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse  );
     136                 :            : 
     137                 :            : public:
     138                 :            :                         ~ContentInfo();
     139                 :            : 
     140                 :            :     const XEditAttributesType& GetAttribs() const { return aAttribs; }
     141                 :     274272 :     XEditAttributesType& GetAttribs() { return aAttribs; }
     142                 :            : 
     143                 :      95840 :     const String&       GetText()           const   { return aText; }
     144                 :      86568 :     const String&       GetStyle()          const   { return aStyle; }
     145                 :      86294 :     const SfxItemSet&   GetParaAttribs()    const   { return aParaAttribs; }
     146                 :      86568 :     SfxStyleFamily      GetFamily()         const   { return eFamily; }
     147                 :            : 
     148                 :     359943 :     String&             GetText()           { return aText; }
     149                 :      44032 :     String&             GetStyle()          { return aStyle; }
     150                 :     353240 :     SfxItemSet&         GetParaAttribs()    { return aParaAttribs; }
     151                 :      27273 :     SfxStyleFamily&     GetFamily()         { return eFamily; }
     152                 :            : 
     153                 :     110630 :     WrongList*          GetWrongList() const            { return pWrongs; }
     154                 :       4942 :     void                SetWrongList( WrongList* p )    { pWrongs = p; }
     155                 :            :     bool operator==( const ContentInfo& rCompare ) const;
     156                 :            :     bool operator!=( const ContentInfo& rCompare ) const;
     157                 :            : 
     158                 :            :     // #i102062#
     159                 :            :     bool isWrongListEqual(const ContentInfo& rCompare) const;
     160                 :            : };
     161                 :            : 
     162                 :            : class BinTextObject : public EditTextObject, public SfxItemPoolUser
     163                 :            : {
     164                 :            :     using EditTextObject::operator==;
     165                 :            :     using EditTextObject::isWrongListEqual;
     166                 :            : 
     167                 :            : public:
     168                 :            :     typedef boost::ptr_vector<ContentInfo> ContentInfosType;
     169                 :            : 
     170                 :            : private:
     171                 :            :     ContentInfosType        aContents;
     172                 :            :     SfxItemPool*            pPool;
     173                 :            :     XParaPortionList*       pPortionInfo;
     174                 :            : 
     175                 :            :     sal_uInt32              nObjSettings;
     176                 :            :     sal_uInt16                  nMetric;
     177                 :            :     sal_uInt16                  nVersion;
     178                 :            :     sal_uInt16                  nUserType;
     179                 :            :     sal_uInt16                  nScriptType;
     180                 :            : 
     181                 :            :     bool                    bOwnerOfPool:1;
     182                 :            :     bool                    bVertical:1;
     183                 :            :     bool                    bStoreUnicodeStrings:1;
     184                 :            : 
     185                 :            : protected:
     186                 :            :     virtual void            StoreData( SvStream& rOStream ) const;
     187                 :            :     virtual void            CreateData( SvStream& rIStream );
     188                 :            :     sal_Bool                    ImpChangeStyleSheets( const String& rOldName, SfxStyleFamily eOldFamily,
     189                 :            :                                         const String& rNewName, SfxStyleFamily eNewFamily );
     190                 :            : 
     191                 :            : public:
     192                 :            :                             BinTextObject( SfxItemPool* pPool );
     193                 :            :                             BinTextObject( const BinTextObject& );
     194                 :            :     virtual                 ~BinTextObject();
     195                 :            : 
     196                 :            :     virtual EditTextObject* Clone() const;
     197                 :            : 
     198                 :            :     sal_uInt16                  GetUserType() const;
     199                 :            :     void                    SetUserType( sal_uInt16 n );
     200                 :            : 
     201                 :            :     sal_uLong                   GetObjectSettings() const;
     202                 :            :     void                    SetObjectSettings( sal_uLong n );
     203                 :            : 
     204                 :            :     bool                    IsVertical() const;
     205                 :            :     void                    SetVertical( bool b );
     206                 :            : 
     207                 :            :     sal_uInt16                  GetScriptType() const;
     208                 :            :     void                    SetScriptType( sal_uInt16 nType );
     209                 :            : 
     210                 :            :     sal_uInt16                  GetVersion() const; // As long as the outliner does not store any record length
     211                 :            : 
     212                 :            :     ContentInfo*            CreateAndInsertContent();
     213                 :            :     XEditAttribute*         CreateAttrib( const SfxPoolItem& rItem, sal_uInt16 nStart, sal_uInt16 nEnd );
     214                 :            :     void                    DestroyAttrib( XEditAttribute* pAttr );
     215                 :            : 
     216                 :            :     ContentInfosType&       GetContents();
     217                 :            :     const ContentInfosType& GetContents() const;
     218                 :      23656 :     SfxItemPool*            GetPool() const         { return pPool; }
     219                 :     132345 :     XParaPortionList*       GetPortionInfo() const  { return pPortionInfo; }
     220                 :          0 :     void                    SetPortionInfo( XParaPortionList* pP )
     221                 :          0 :                                 { pPortionInfo = pP; }
     222                 :            : 
     223                 :            :     virtual size_t GetParagraphCount() const;
     224                 :            :     virtual String GetText(size_t nParagraph) const;
     225                 :            :     virtual void Insert(const EditTextObject& rObj, size_t nPara);
     226                 :            :     virtual EditTextObject* CreateTextObject(size_t nPara, size_t nParas = 1) const;
     227                 :            :     virtual void RemoveParagraph(size_t nPara);
     228                 :            : 
     229                 :            :     virtual sal_Bool            HasPortionInfo() const;
     230                 :            :     virtual void            ClearPortionInfo();
     231                 :            : 
     232                 :            :     virtual sal_Bool            HasOnlineSpellErrors() const;
     233                 :            : 
     234                 :            :     virtual sal_Bool            HasCharAttribs( sal_uInt16 nWhich = 0 ) const;
     235                 :            :     virtual void            GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
     236                 :            : 
     237                 :            :     virtual sal_Bool            RemoveCharAttribs( sal_uInt16 nWhich = 0 );
     238                 :            :     virtual sal_Bool            RemoveParaAttribs( sal_uInt16 nWhich = 0 );
     239                 :            : 
     240                 :            :     virtual void            MergeParaAttribs( const SfxItemSet& rAttribs, sal_uInt16 nStart, sal_uInt16 nEnd );
     241                 :            : 
     242                 :            :     virtual sal_Bool            IsFieldObject() const;
     243                 :            :     virtual const SvxFieldItem* GetField() const;
     244                 :            :     virtual sal_Bool            HasField( TypeId Type = NULL ) const;
     245                 :            : 
     246                 :            :     virtual SfxItemSet GetParaAttribs(size_t nPara) const;
     247                 :            :     virtual void SetParaAttribs(size_t nPara, const SfxItemSet& rAttribs);
     248                 :            : 
     249                 :            :     virtual sal_Bool            HasStyleSheet( const XubString& rName, SfxStyleFamily eFamily ) const;
     250                 :            :     virtual void GetStyleSheet(size_t nPara, String& rName, SfxStyleFamily& eFamily) const;
     251                 :            :     virtual void SetStyleSheet(size_t nPara, const String& rName, const SfxStyleFamily& eFamily);
     252                 :            :     virtual sal_Bool            ChangeStyleSheets(  const XubString& rOldName, SfxStyleFamily eOldFamily,
     253                 :            :                                                 const String& rNewName, SfxStyleFamily eNewFamily );
     254                 :            :     virtual void            ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
     255                 :            : 
     256                 :            :     virtual editeng::FieldUpdater GetFieldUpdater();
     257                 :            : 
     258                 :            :     void                    CreateData300( SvStream& rIStream );
     259                 :            : 
     260                 :     132345 :     sal_Bool                    HasMetric() const           { return nMetric != 0xFFFF; }
     261                 :     132345 :     sal_uInt16                  GetMetric() const           { return nMetric; }
     262                 :      63193 :     void                    SetMetric( sal_uInt16 n )       { nMetric = n; }
     263                 :            : 
     264                 :      63193 :     bool                    IsOwnerOfPool() const       { return bOwnerOfPool; }
     265                 :          0 :     void                    StoreUnicodeStrings( sal_Bool b ) { bStoreUnicodeStrings = b; }
     266                 :            : 
     267                 :            :     bool                    operator==( const BinTextObject& rCompare ) const;
     268                 :            : 
     269                 :            :     // #i102062#
     270                 :            :     bool isWrongListEqual(const BinTextObject& rCompare) const;
     271                 :            : 
     272                 :            :     // from SfxItemPoolUser
     273                 :            :     virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool);
     274                 :            : };
     275                 :            : 
     276                 :            : #endif  // _EDITOBJ2_HXX
     277                 :            : 
     278                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10