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