1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: itratr.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <atrhndl.hxx>
34 #include "txttypes.hxx"
38 #define _SVSTDARR_XUB_STRLEN
39 #define _SVSTDARR_USHORTS
40 #include <svtools/svstdarr.hxx>
52 /*************************************************************************
54 *************************************************************************/
58 friend class SwFontSave
;
61 SwAttrHandler aAttrHandler
;
65 const SwAttrSet
* pAttrSet
; // das Char-Attribut-Set
66 SwScriptInfo
* pScriptInfo
;
69 OutputDevice
*pLastOut
;
72 xub_StrLen nStartIndex
, nEndIndex
, nPos
;
74 void SeekFwd( const xub_StrLen nPos
);
75 inline void SetFnt( SwFont
* pNew
) { pFnt
= pNew
; }
76 const void* aMagicNo
[ SW_SCRIPTS
];
77 MSHORT aFntIdx
[ SW_SCRIPTS
];
78 const SwTxtNode
* m_pTxtNode
;
81 void Chg( SwTxtAttr
*pHt
);
82 void Rst( SwTxtAttr
*pHt
);
83 void CtorInitAttrIter( SwTxtNode
& rTxtNode
, SwScriptInfo
& rScrInf
, SwTxtFrm
* pFrm
= 0 );
84 inline SwAttrIter(SwTxtNode
* pTxtNode
)
85 : pShell(0), pFnt(0), pLastOut(0), nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode
) {}
88 // Konstruktor, Destruktor
89 inline SwAttrIter( SwTxtNode
& rTxtNode
, SwScriptInfo
& rScrInf
)
90 : pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode
)
91 { CtorInitAttrIter( rTxtNode
, rScrInf
); }
93 virtual ~SwAttrIter();
95 inline SwRedlineItr
*GetRedln() { return pRedln
; }
96 // Liefert im Parameter die Position des naechsten Wechsels vor oder an
97 // der uebergebenen Characterposition zurueck. Liefert sal_False, wenn vor
98 // oder an dieser Position kein Wechsel mehr erfolgt, sal_True sonst.
99 xub_StrLen
GetNextAttr( ) const;
100 // Macht die an der Characterposition i gueltigen Attribute im
101 // logischen Font wirksam.
102 sal_Bool
Seek( const xub_StrLen nPos
);
103 // Bastelt den Font an der gew. Position via Seek und fragt ihn,
104 // ob er ein Symbolfont ist.
105 sal_Bool
IsSymbol( const xub_StrLen nPos
);
107 // Fuehrt ChgPhysFnt aus, wenn Seek() sal_True zurueckliefert.
108 sal_Bool
SeekAndChgAttrIter( const xub_StrLen nPos
, OutputDevice
* pOut
);
109 sal_Bool
SeekStartAndChgAttrIter( OutputDevice
* pOut
, const sal_Bool bParaFont
= sal_False
);
111 // Gibt es ueberhaupt Attributwechsel ?
112 inline sal_Bool
HasHints() const { return 0 != pHints
; }
114 // liefert fuer eine Position das Attribut
115 SwTxtAttr
*GetAttr( const xub_StrLen nPos
) const;
117 inline const SwAttrSet
* GetAttrSet() const { return pAttrSet
; }
119 inline const SwpHints
*GetHints() const { return pHints
; }
121 inline SwFont
*GetFnt() { return pFnt
; }
122 inline const SwFont
*GetFnt() const { return pFnt
; }
124 inline BYTE
GetPropFont() const { return nPropFont
; }
125 inline void SetPropFont( const BYTE nNew
) { nPropFont
= nNew
; }
127 inline SwAttrHandler
& GetAttrHandler() { return aAttrHandler
; }
129 #if OSL_DEBUG_LEVEL > 1
130 void Dump( SvStream
&rOS
) const;