xref: /trunk/main/sw/source/core/text/itratr.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*1d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*1d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*1d2dbeb0SAndrew Rist  * distributed with this work for additional information
6*1d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*1d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*1d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
9*1d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*1d2dbeb0SAndrew Rist  *
11*1d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*1d2dbeb0SAndrew Rist  *
13*1d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*1d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
15*1d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
17*1d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
18*1d2dbeb0SAndrew Rist  * under the License.
19*1d2dbeb0SAndrew Rist  *
20*1d2dbeb0SAndrew Rist  *************************************************************/
21*1d2dbeb0SAndrew Rist 
22*1d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _ITRATR_HXX
24cdf0e10cSrcweir #define _ITRATR_HXX
25cdf0e10cSrcweir #include <atrhndl.hxx>
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "txttypes.hxx"
28cdf0e10cSrcweir #include "swfont.hxx"
29cdf0e10cSrcweir #include "porlay.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #define _SVSTDARR_XUB_STRLEN
32cdf0e10cSrcweir #define _SVSTDARR_USHORTS
33cdf0e10cSrcweir #include <svl/svstdarr.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class OutputDevice;
36cdf0e10cSrcweir class SwFont;
37cdf0e10cSrcweir class SwpHints;
38cdf0e10cSrcweir class SwTxtAttr;
39cdf0e10cSrcweir class SwAttrSet;
40cdf0e10cSrcweir class SwTxtNode;
41cdf0e10cSrcweir class SwRedlineItr;
42cdf0e10cSrcweir class ViewShell;
43cdf0e10cSrcweir class SwTxtFrm;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir /*************************************************************************
46cdf0e10cSrcweir  *						class SwAttrIter
47cdf0e10cSrcweir  *************************************************************************/
48cdf0e10cSrcweir 
49cdf0e10cSrcweir class SwAttrIter
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 	friend class SwFontSave;
52cdf0e10cSrcweir protected:
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     SwAttrHandler aAttrHandler;
55cdf0e10cSrcweir     ViewShell *pShell;
56cdf0e10cSrcweir 	SwFont *pFnt;
57cdf0e10cSrcweir 	SwpHints  *pHints;
58cdf0e10cSrcweir 	const SwAttrSet* pAttrSet;		 // das Char-Attribut-Set
59cdf0e10cSrcweir 	SwScriptInfo* pScriptInfo;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir private:
62cdf0e10cSrcweir 	OutputDevice *pLastOut;
63cdf0e10cSrcweir 	MSHORT nChgCnt;
64cdf0e10cSrcweir 	SwRedlineItr *pRedln;
65cdf0e10cSrcweir     xub_StrLen nStartIndex, nEndIndex, nPos;
66cdf0e10cSrcweir 	sal_uInt8 nPropFont;
67cdf0e10cSrcweir 	void SeekFwd( const xub_StrLen nPos );
SetFnt(SwFont * pNew)68cdf0e10cSrcweir 	inline void SetFnt( SwFont* pNew ) { pFnt = pNew; }
69cdf0e10cSrcweir 	const void* aMagicNo[ SW_SCRIPTS ];
70cdf0e10cSrcweir 	MSHORT aFntIdx[ SW_SCRIPTS ];
71cdf0e10cSrcweir 	const SwTxtNode* m_pTxtNode;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir protected:
74cdf0e10cSrcweir 	void Chg( SwTxtAttr *pHt );
75cdf0e10cSrcweir 	void Rst( SwTxtAttr *pHt );
76cdf0e10cSrcweir     void CtorInitAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf, SwTxtFrm* pFrm = 0 );
SwAttrIter(SwTxtNode * pTxtNode)77cdf0e10cSrcweir     inline SwAttrIter(SwTxtNode* pTxtNode)
78cdf0e10cSrcweir 		: pShell(0), pFnt(0), pLastOut(0),	nChgCnt(0), pRedln(0), nPropFont(0), m_pTxtNode(pTxtNode) {}
79cdf0e10cSrcweir 
80cdf0e10cSrcweir public:
81cdf0e10cSrcweir 	// Konstruktor, Destruktor
SwAttrIter(SwTxtNode & rTxtNode,SwScriptInfo & rScrInf)82cdf0e10cSrcweir     inline SwAttrIter( SwTxtNode& rTxtNode, SwScriptInfo& rScrInf )
83cdf0e10cSrcweir 		: pShell(0), pFnt(0), pHints(0), pScriptInfo(0), pLastOut(0), nChgCnt(0), pRedln(0),nPropFont(0), m_pTxtNode(&rTxtNode)
84cdf0e10cSrcweir         { CtorInitAttrIter( rTxtNode, rScrInf ); }
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	virtual ~SwAttrIter();
87cdf0e10cSrcweir 
GetRedln()88cdf0e10cSrcweir 	inline SwRedlineItr *GetRedln() { return pRedln; }
89cdf0e10cSrcweir 	// Liefert im Parameter die Position des naechsten Wechsels vor oder an
90cdf0e10cSrcweir 	// der uebergebenen Characterposition zurueck. Liefert sal_False, wenn vor
91cdf0e10cSrcweir 	// oder an dieser Position kein Wechsel mehr erfolgt, sal_True sonst.
92cdf0e10cSrcweir 	xub_StrLen GetNextAttr( ) const;
93cdf0e10cSrcweir 	// Macht die an der Characterposition i gueltigen Attribute im
94cdf0e10cSrcweir 	// logischen Font wirksam.
95cdf0e10cSrcweir 	sal_Bool Seek( const xub_StrLen nPos );
96cdf0e10cSrcweir 	// Bastelt den Font an der gew. Position via Seek und fragt ihn,
97cdf0e10cSrcweir 	// ob er ein Symbolfont ist.
98cdf0e10cSrcweir 	sal_Bool IsSymbol( const xub_StrLen nPos );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 	// Fuehrt ChgPhysFnt aus, wenn Seek() sal_True zurueckliefert.
101cdf0e10cSrcweir     sal_Bool SeekAndChgAttrIter( const xub_StrLen nPos, OutputDevice* pOut );
102cdf0e10cSrcweir     sal_Bool SeekStartAndChgAttrIter( OutputDevice* pOut, const sal_Bool bParaFont = sal_False );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	// Gibt es ueberhaupt Attributwechsel ?
HasHints() const105cdf0e10cSrcweir 	inline sal_Bool HasHints() const { return 0 != pHints; }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	// liefert fuer eine Position das Attribut
108cdf0e10cSrcweir 	SwTxtAttr *GetAttr( const xub_StrLen nPos ) const;
109cdf0e10cSrcweir 
GetAttrSet() const110cdf0e10cSrcweir 	inline const SwAttrSet* GetAttrSet() const { return pAttrSet; }
111cdf0e10cSrcweir 
GetHints() const112cdf0e10cSrcweir 	inline const SwpHints *GetHints() const { return pHints; }
113cdf0e10cSrcweir 
GetFnt()114cdf0e10cSrcweir 	inline SwFont *GetFnt() { return pFnt; }
GetFnt() const115cdf0e10cSrcweir 	inline const SwFont *GetFnt() const { return pFnt; }
116cdf0e10cSrcweir 
GetPropFont() const117cdf0e10cSrcweir 	inline sal_uInt8 GetPropFont() const { return nPropFont; }
SetPropFont(const sal_uInt8 nNew)118cdf0e10cSrcweir 	inline void SetPropFont( const sal_uInt8 nNew ) { nPropFont = nNew; }
119cdf0e10cSrcweir 
GetAttrHandler()120cdf0e10cSrcweir     inline SwAttrHandler& GetAttrHandler() { return aAttrHandler; }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
123cdf0e10cSrcweir 	void Dump( SvStream &rOS ) const;
124cdf0e10cSrcweir #endif
125cdf0e10cSrcweir };
126cdf0e10cSrcweir 
127cdf0e10cSrcweir #endif
128