1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _ITRATR_HXX 28 #define _ITRATR_HXX 29 #include <atrhndl.hxx> 30 31 #include "txttypes.hxx" 32 #include "swfont.hxx" 33 #include "porlay.hxx" 34 35 #define _SVSTDARR_XUB_STRLEN 36 #define _SVSTDARR_USHORTS 37 #include <svl/svstdarr.hxx> 38 39 class OutputDevice; 40 class SwFont; 41 class SwpHints; 42 class SwTxtAttr; 43 class SwAttrSet; 44 class SwTxtNode; 45 class SwRedlineItr; 46 class ViewShell; 47 class SwTxtFrm; 48 49 /************************************************************************* 50 * class SwAttrIter 51 *************************************************************************/ 52 53 class SwAttrIter 54 { 55 friend class SwFontSave; 56 protected: 57 58 SwAttrHandler aAttrHandler; 59 ViewShell *pShell; 60 SwFont *pFnt; 61 SwpHints *pHints; 62 const SwAttrSet* pAttrSet; // das Char-Attribut-Set 63 SwScriptInfo* pScriptInfo; 64 65 private: 66 OutputDevice *pLastOut; 67 MSHORT nChgCnt; 68 SwRedlineItr *pRedln; 69 xub_StrLen nStartIndex, nEndIndex, nPos; 70 sal_uInt8 nPropFont; 71 void SeekFwd( const xub_StrLen nPos ); 72 inline void SetFnt( SwFont* pNew ) { pFnt = pNew; } 73 const void* aMagicNo[ SW_SCRIPTS ]; 74 MSHORT aFntIdx[ SW_SCRIPTS ]; 75 const SwTxtNode* m_pTxtNode; 76 77 protected: 78 void Chg( SwTxtAttr *pHt ); 79 void Rst( SwTxtAttr *pHt ); 80 void CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, SwTxtFrm* pFrm = 0 ); 81 inline SwAttrIter(SwTxtNode* pTxtNode) 82 : pShell(0), pFnt(0), pLastOut(0), nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode) {} 83 84 public: 85 // Konstruktor, Destruktor 86 inline SwAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf ) 87 : pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode) 88 { CtorInitAttrIter( rTxtNode, rScrInf ); } 89 90 virtual ~SwAttrIter(); 91 92 inline SwRedlineItr *GetRedln() { return pRedln; } 93 // Liefert im Parameter die Position des naechsten Wechsels vor oder an 94 // der uebergebenen Characterposition zurueck. Liefert sal_False, wenn vor 95 // oder an dieser Position kein Wechsel mehr erfolgt, sal_True sonst. 96 xub_StrLen GetNextAttr( ) const; 97 // Macht die an der Characterposition i gueltigen Attribute im 98 // logischen Font wirksam. 99 sal_Bool Seek( const xub_StrLen nPos ); 100 // Bastelt den Font an der gew. Position via Seek und fragt ihn, 101 // ob er ein Symbolfont ist. 102 sal_Bool IsSymbol( const xub_StrLen nPos ); 103 104 // Fuehrt ChgPhysFnt aus, wenn Seek() sal_True zurueckliefert. 105 sal_Bool SeekAndChgAttrIter( const xub_StrLen nPos, OutputDevice* pOut ); 106 sal_Bool SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont = sal_False ); 107 108 // Gibt es ueberhaupt Attributwechsel ? 109 inline sal_Bool HasHints() const { return 0 != pHints; } 110 111 // liefert fuer eine Position das Attribut 112 SwTxtAttr *GetAttr( const xub_StrLen nPos ) const; 113 114 inline const SwAttrSet* GetAttrSet() const { return pAttrSet; } 115 116 inline const SwpHints *GetHints() const { return pHints; } 117 118 inline SwFont *GetFnt() { return pFnt; } 119 inline const SwFont *GetFnt() const { return pFnt; } 120 121 inline sal_uInt8 GetPropFont() const { return nPropFont; } 122 inline void SetPropFont( const sal_uInt8 nNew ) { nPropFont = nNew; } 123 124 inline SwAttrHandler& GetAttrHandler() { return aAttrHandler; } 125 126 #if OSL_DEBUG_LEVEL > 1 127 void Dump( SvStream &rOS ) const; 128 #endif 129 }; 130 131 #endif 132