LCOV - code coverage report
Current view: top level - sw/source/core/text - itratr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 16 16 100.0 %
Date: 2012-08-25 Functions: 11 11 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           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                 :            : #ifndef _ITRATR_HXX
      29                 :            : #define _ITRATR_HXX
      30                 :            : #include <atrhndl.hxx>
      31                 :            : 
      32                 :            : #include "txttypes.hxx"
      33                 :            : #include "swfont.hxx"
      34                 :            : #include "porlay.hxx"
      35                 :            : 
      36                 :            : 
      37                 :            : class OutputDevice;
      38                 :            : class SwFont;
      39                 :            : class SwpHints;
      40                 :            : class SwTxtAttr;
      41                 :            : class SwAttrSet;
      42                 :            : class SwTxtNode;
      43                 :            : class SwRedlineItr;
      44                 :            : class ViewShell;
      45                 :            : class SwTxtFrm;
      46                 :            : 
      47                 :            : /*************************************************************************
      48                 :            :  *                      class SwAttrIter
      49                 :            :  *************************************************************************/
      50                 :            : 
      51                 :            : class SwAttrIter
      52                 :            : {
      53                 :            :     friend class SwFontSave;
      54                 :            : protected:
      55                 :            : 
      56                 :            :     SwAttrHandler aAttrHandler;
      57                 :            :     ViewShell *pShell;
      58                 :            :     SwFont *pFnt;
      59                 :            :     SwpHints  *pHints;
      60                 :            :     const SwAttrSet* pAttrSet;       // The char attribute set
      61                 :            :     SwScriptInfo* pScriptInfo;
      62                 :            : 
      63                 :            : private:
      64                 :            :     OutputDevice *pLastOut;
      65                 :            :     MSHORT nChgCnt;
      66                 :            :     SwRedlineItr *pRedln;
      67                 :            :     xub_StrLen nStartIndex, nEndIndex, nPos;
      68                 :            :     sal_uInt8 nPropFont;
      69                 :            :     void SeekFwd( const xub_StrLen nPos );
      70                 :         96 :     inline void SetFnt( SwFont* pNew ) { pFnt = pNew; }
      71                 :            :     const void* aMagicNo[ SW_SCRIPTS ];
      72                 :            :     MSHORT aFntIdx[ SW_SCRIPTS ];
      73                 :            :     const SwTxtNode* m_pTxtNode;
      74                 :            : 
      75                 :            : protected:
      76                 :            :     void Chg( SwTxtAttr *pHt );
      77                 :            :     void Rst( SwTxtAttr *pHt );
      78                 :            :     void CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, SwTxtFrm* pFrm = 0 );
      79                 :      94498 :     inline SwAttrIter(SwTxtNode* pTxtNode)
      80                 :      94498 :         : pShell(0), pFnt(0), pHints(0), pAttrSet(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode) {
      81                 :      94498 :             aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = NULL;
      82                 :      94498 :         }
      83                 :            : 
      84                 :            : public:
      85                 :            :     // Constructor, destructor
      86                 :        208 :     inline SwAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf )
      87                 :        208 :         : pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode)
      88         [ +  - ]:        208 :         { CtorInitAttrIter( rTxtNode, rScrInf ); }
      89                 :            : 
      90                 :            :     virtual ~SwAttrIter();
      91                 :            : 
      92                 :     147181 :     inline SwRedlineItr *GetRedln() { return pRedln; }
      93                 :            :     // The parameter returns the position of the next change before or at the
      94                 :            :     // char position.
      95                 :            :     // Returns sal_False, if there's no change before or at the positon,
      96                 :            :     // else sal_True.
      97                 :            :     xub_StrLen GetNextAttr( ) const;
      98                 :            :     // Enables the attributes used at char pos nPos in the logical font
      99                 :            :     sal_Bool Seek( const xub_StrLen nPos );
     100                 :            :     // Creates the font at the specified position via Seek() and checks
     101                 :            :     // if it's a symbol font.
     102                 :            :     sal_Bool IsSymbol( const xub_StrLen nPos );
     103                 :            : 
     104                 :            :     // Executes ChgPhysFnt if Seek() returns sal_True
     105                 :            :     sal_Bool SeekAndChgAttrIter( const xub_StrLen nPos, OutputDevice* pOut );
     106                 :            :     sal_Bool SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont = sal_False );
     107                 :            : 
     108                 :            :     // Do we have an attribute change at all?
     109                 :        295 :     inline sal_Bool HasHints() const { return 0 != pHints; }
     110                 :            : 
     111                 :            :     // Returns the attribute for a position
     112                 :            :     SwTxtAttr *GetAttr( const xub_StrLen nPos ) const;
     113                 :            : 
     114                 :            :     inline const SwAttrSet* GetAttrSet() const { return pAttrSet; }
     115                 :            : 
     116                 :      16025 :     inline const SwpHints *GetHints() const { return pHints; }
     117                 :            : 
     118                 :     163841 :     inline SwFont *GetFnt() { return pFnt; }
     119                 :     204572 :     inline const SwFont *GetFnt() const { return pFnt; }
     120                 :            : 
     121                 :      55505 :     inline sal_uInt8 GetPropFont() const { return nPropFont; }
     122                 :        896 :     inline void SetPropFont( const sal_uInt8 nNew ) { nPropFont = nNew; }
     123                 :            : 
     124                 :        322 :     inline SwAttrHandler& GetAttrHandler() { return aAttrHandler; }
     125                 :            : };
     126                 :            : 
     127                 :            : #endif
     128                 :            : 
     129                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10