xref: /aoo41x/main/sw/source/core/text/itrtxt.hxx (revision 1d2dbeb0)
1*1d2dbeb0SAndrew Rist /**************************************************************
2*1d2dbeb0SAndrew Rist  *
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
12cdf0e10cSrcweir  *
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 _ITRTXT_HXX
24cdf0e10cSrcweir #define _ITRTXT_HXX
25cdf0e10cSrcweir #include "swtypes.hxx"
26cdf0e10cSrcweir #include "itratr.hxx"
27cdf0e10cSrcweir #include "inftxt.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir class SwTxtFrm;
30cdf0e10cSrcweir struct SwPosition;
31cdf0e10cSrcweir struct SwCrsrMoveState;
32cdf0e10cSrcweir class SwMarginPortion;
33cdf0e10cSrcweir class SwFlyPortion;
34cdf0e10cSrcweir 
35cdf0e10cSrcweir /*************************************************************************
36cdf0e10cSrcweir  *						class SwTxtIter
37cdf0e10cSrcweir  *************************************************************************/
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class SwTxtIter : public SwAttrIter
40cdf0e10cSrcweir {
41cdf0e10cSrcweir protected:
42cdf0e10cSrcweir 	SwLineInfo aLineInf;
43cdf0e10cSrcweir     SwTxtFrm  *pFrm;
44cdf0e10cSrcweir 	SwTxtInfo *pInf;
45cdf0e10cSrcweir 	SwLineLayout *pCurr;
46cdf0e10cSrcweir 	SwLineLayout *pPrev;
47cdf0e10cSrcweir     SwTwips nFrameStart;
48cdf0e10cSrcweir     SwTwips nY;
49cdf0e10cSrcweir 	SwTwips	nRegStart;			// Anfangsposition (Y) des Registers
50cdf0e10cSrcweir 	xub_StrLen nStart;			// Start im Textstring, Ende = pCurr->GetLen()
51cdf0e10cSrcweir 	KSHORT nRegDiff;			// Zeilenabstand des Registers
52cdf0e10cSrcweir 	MSHORT nLineNr;				// Zeilennummer
53cdf0e10cSrcweir 	sal_Bool bPrev			: 1;
54cdf0e10cSrcweir 	sal_Bool bRegisterOn	: 1;	// Registerhaltigkeit
55cdf0e10cSrcweir 	sal_Bool bOneBlock		: 1;	// Blocksatz: Einzelwoerter austreiben
56cdf0e10cSrcweir 	sal_Bool bLastBlock		: 1;	// Blocksatz: Auch die letzte Zeile
57cdf0e10cSrcweir 	sal_Bool bLastCenter	: 1;	// Blocksatz: Letzte Zeile zentrieren
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	SwLineLayout *_GetPrev();
60cdf0e10cSrcweir 
61cdf0e10cSrcweir 	// Zuruecksetzen in die erste Zeile.
62cdf0e10cSrcweir 	void Init();
63cdf0e10cSrcweir 	void CtorInitTxtIter( SwTxtFrm *pFrm, SwTxtInfo *pInf );
SwTxtIter(SwTxtNode * pTxtNode)64cdf0e10cSrcweir 	inline SwTxtIter(SwTxtNode* pTxtNode) : SwAttrIter(pTxtNode) { }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir public:
SwTxtIter(SwTxtFrm * pTxtFrm,SwTxtInfo * pTxtInf)67cdf0e10cSrcweir     inline SwTxtIter( SwTxtFrm *pTxtFrm, SwTxtInfo *pTxtInf ) : SwAttrIter(pTxtFrm!=NULL?pTxtFrm->GetTxtNode():NULL)
68cdf0e10cSrcweir            { CtorInitTxtIter( pTxtFrm, pTxtInf ); }
GetCurr() const69cdf0e10cSrcweir 	inline const SwLineLayout *GetCurr() const { return pCurr; } // niemals 0!
GetNext() const70cdf0e10cSrcweir 	inline const SwLineLayout *GetNext() const { return pCurr->GetNext(); }
71cdf0e10cSrcweir 		   const SwLineLayout *GetPrev();
GetLength() const72cdf0e10cSrcweir 	inline xub_StrLen GetLength() const { return pCurr->GetLen(); }
GetLineNr() const73cdf0e10cSrcweir 	inline MSHORT GetLineNr() const { return nLineNr; }
GetStart() const74cdf0e10cSrcweir 	inline xub_StrLen GetStart() const { return nStart; }
GetEnd() const75cdf0e10cSrcweir 	inline xub_StrLen GetEnd() const { return GetStart() + GetLength(); }
Y() const76cdf0e10cSrcweir 	inline SwTwips Y() const { return nY; }
77cdf0e10cSrcweir 
RegStart() const78cdf0e10cSrcweir 	inline SwTwips RegStart() const { return nRegStart; }
RegDiff() const79cdf0e10cSrcweir 	inline KSHORT RegDiff() const { return nRegDiff; }
IsRegisterOn() const80cdf0e10cSrcweir 	inline sal_Bool IsRegisterOn() const { return bRegisterOn; }
81cdf0e10cSrcweir 
GetInfo()82cdf0e10cSrcweir 	inline SwTxtInfo &GetInfo() { return *pInf; }
GetInfo() const83cdf0e10cSrcweir 	inline const SwTxtInfo &GetInfo() const { return *pInf; }
84cdf0e10cSrcweir 
Top()85cdf0e10cSrcweir 	inline void Top() { Init(); }
86cdf0e10cSrcweir 	void Bottom();
87cdf0e10cSrcweir 	const SwLineLayout *Next();
88cdf0e10cSrcweir 	const SwLineLayout *Prev();
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	// Ueberspringt die Dummyzeilen der FlyFrms
91cdf0e10cSrcweir 	const SwLineLayout *NextLine();
92cdf0e10cSrcweir 	const SwLineLayout *PrevLine();
93cdf0e10cSrcweir 	const SwLineLayout *GetNextLine() const;
94cdf0e10cSrcweir 	const SwLineLayout *GetPrevLine();
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	void CharToLine( const xub_StrLen );
97cdf0e10cSrcweir 	const SwLineLayout *TwipsToLine(const SwTwips);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	// schneidet ab pCurr alle ab.
100cdf0e10cSrcweir 	void TruncLines( sal_Bool bNoteFollow = sal_False );
101cdf0e10cSrcweir 
GetLineHeight() const102cdf0e10cSrcweir 	inline KSHORT GetLineHeight() const { return pCurr->GetRealHeight(); }
103cdf0e10cSrcweir 	void CalcAscentAndHeight( KSHORT &rAscent, KSHORT &rHeight ) const;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	// 5298, viel Aerger durch die Abfrage auf pCurr == pPara
IsFirstTxtLine() const106cdf0e10cSrcweir 	inline sal_Bool IsFirstTxtLine() const
107cdf0e10cSrcweir 	{ return nStart == GetInfo().GetTxtStart() &&
108cdf0e10cSrcweir 		!( pCurr->IsDummy() && GetNextLine() ); }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	// Als Ersatz fuer das alte IsFirstLine()
IsParaLine() const111cdf0e10cSrcweir 	inline sal_Bool IsParaLine() const
112cdf0e10cSrcweir 		{ return pCurr == pInf->GetParaPortion(); }
113cdf0e10cSrcweir 
GetLineInfo() const114cdf0e10cSrcweir 	const SwLineInfo &GetLineInfo() const { return aLineInf; }
GetFirstPos() const115cdf0e10cSrcweir     inline SwTwips GetFirstPos() const { return nFrameStart; }
116cdf0e10cSrcweir 	inline sal_Bool SeekAndChg( SwTxtSizeInfo &rInf );
117cdf0e10cSrcweir 	inline sal_Bool SeekAndChgBefore( SwTxtSizeInfo &rInf );
118cdf0e10cSrcweir 	inline sal_Bool SeekStartAndChg( SwTxtSizeInfo &rInf, const sal_Bool bPara=sal_False );
119cdf0e10cSrcweir 
GetTxtFrm()120cdf0e10cSrcweir 	inline SwTxtFrm *GetTxtFrm() { return pFrm; }
GetTxtFrm() const121cdf0e10cSrcweir 	inline const SwTxtFrm *GetTxtFrm() const { return pFrm; }
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	// zaehlt aufeinanderfolgende Trennungen, um MaxHyphens einzuhalten
124cdf0e10cSrcweir 	void CntHyphens( sal_uInt8 &nEndCnt, sal_uInt8 &nMidCnt) const;
125cdf0e10cSrcweir };
126cdf0e10cSrcweir 
127cdf0e10cSrcweir /*************************************************************************
128cdf0e10cSrcweir  *                      class SwTxtMargin
129cdf0e10cSrcweir  *************************************************************************/
130cdf0e10cSrcweir 
131cdf0e10cSrcweir class SwTxtMargin : public SwTxtIter
132cdf0e10cSrcweir {
133cdf0e10cSrcweir private:
134cdf0e10cSrcweir 		  SwTwips nLeft;
135cdf0e10cSrcweir 		  SwTwips nRight;
136cdf0e10cSrcweir 		  SwTwips nFirst;
137cdf0e10cSrcweir 		  KSHORT  nDropLeft;
138cdf0e10cSrcweir 		  KSHORT  nDropHeight;
139cdf0e10cSrcweir 		  KSHORT  nDropDescent;
140cdf0e10cSrcweir 		  MSHORT  nDropLines;
141cdf0e10cSrcweir 		  MSHORT  nAdjust;
142cdf0e10cSrcweir           // --> OD 2008-06-30 #i91133#
143cdf0e10cSrcweir           SwTwips mnTabLeft;
144cdf0e10cSrcweir           // <--
145cdf0e10cSrcweir 
146cdf0e10cSrcweir protected:
147cdf0e10cSrcweir 	// fuer FormatQuoVadis
Right(const SwTwips nNew)148cdf0e10cSrcweir 	inline void Right( const SwTwips nNew ) { nRight = nNew; }
149cdf0e10cSrcweir 	// fuer CalcFlyAdjust
SetDropLeft(const KSHORT nNew)150cdf0e10cSrcweir 	inline void SetDropLeft( const KSHORT nNew ) { nDropLeft = nNew; }
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	void CtorInitTxtMargin( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf );
SwTxtMargin(SwTxtNode * pTxtNode)153cdf0e10cSrcweir 	inline SwTxtMargin(SwTxtNode* pTxtNode) : SwTxtIter(pTxtNode) { }
154cdf0e10cSrcweir public:
SwTxtMargin(SwTxtFrm * pTxtFrm,SwTxtSizeInfo * pTxtSizeInf)155cdf0e10cSrcweir     inline SwTxtMargin( SwTxtFrm *pTxtFrm, SwTxtSizeInfo *pTxtSizeInf ) : SwTxtIter(pTxtFrm!=NULL?pTxtFrm->GetTxtNode():NULL)
156cdf0e10cSrcweir            { CtorInitTxtMargin( pTxtFrm, pTxtSizeInf ); }
157cdf0e10cSrcweir 	inline SwTwips GetLeftMargin() const;
158cdf0e10cSrcweir 	inline SwTwips Left() const;
Right() const159cdf0e10cSrcweir 	inline SwTwips Right() const { return nRight; }
FirstLeft() const160cdf0e10cSrcweir 	inline SwTwips FirstLeft() const { return nFirst; }
CurrWidth() const161cdf0e10cSrcweir 	inline SwTwips CurrWidth() const { return pCurr->PrtWidth(); }
162cdf0e10cSrcweir 		   SwTwips GetLineStart() const;
GetLineEnd() const163cdf0e10cSrcweir 	inline SwTwips GetLineEnd() const { return GetLineStart() + CurrWidth(); }
GetTopLeft() const164cdf0e10cSrcweir 	inline Point GetTopLeft() const { return Point( GetLineStart(), Y() ); }
IsOneBlock() const165cdf0e10cSrcweir 	inline sal_Bool IsOneBlock() const { return bOneBlock; }
IsLastBlock() const166cdf0e10cSrcweir 	inline sal_Bool IsLastBlock() const { return bLastBlock; }
IsLastCenter() const167cdf0e10cSrcweir 	inline sal_Bool IsLastCenter() const { return bLastCenter; }
GetAdjust() const168cdf0e10cSrcweir 	inline MSHORT GetAdjust() const { return nAdjust; }
GetLineWidth() const169cdf0e10cSrcweir     inline KSHORT GetLineWidth() const
170cdf0e10cSrcweir 		   { return KSHORT( Right() - GetLeftMargin() + 1 ); }
GetLeftMin() const171cdf0e10cSrcweir 	inline SwTwips GetLeftMin() const { return nFirst < nLeft ? nFirst : nLeft; }
HasNegFirst() const172cdf0e10cSrcweir 	inline sal_Bool HasNegFirst() const { return nFirst < nLeft; }
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     // --> OD 2008-06-30 #i91133#
GetTabLeft() const175cdf0e10cSrcweir     inline SwTwips GetTabLeft() const
176cdf0e10cSrcweir     {
177cdf0e10cSrcweir         return mnTabLeft;
178cdf0e10cSrcweir     }
179cdf0e10cSrcweir     // <--
180cdf0e10cSrcweir 	// DropCaps
GetDropLines() const181cdf0e10cSrcweir 	inline MSHORT GetDropLines() const { return nDropLines; }
SetDropLines(const MSHORT nNew)182cdf0e10cSrcweir 	inline void SetDropLines( const MSHORT nNew ) { nDropLines = nNew; }
GetDropLeft() const183cdf0e10cSrcweir 	inline KSHORT GetDropLeft() const { return nDropLeft; }
GetDropHeight() const184cdf0e10cSrcweir 	inline KSHORT GetDropHeight() const { return nDropHeight; }
SetDropHeight(const KSHORT nNew)185cdf0e10cSrcweir 	inline void SetDropHeight( const KSHORT nNew ) { nDropHeight = nNew; }
GetDropDescent() const186cdf0e10cSrcweir 	inline KSHORT GetDropDescent() const { return nDropDescent; }
SetDropDescent(const KSHORT nNew)187cdf0e10cSrcweir 	inline void SetDropDescent( const KSHORT nNew ) { nDropDescent = nNew; }
188cdf0e10cSrcweir 	void DropInit();
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 	// liefert TxtPos fuer Start und Ende der aktuellen Zeile ohne whitespaces
191cdf0e10cSrcweir 	// In frminf.cxx implementiert.
192cdf0e10cSrcweir 	xub_StrLen GetTxtStart() const;
193cdf0e10cSrcweir 	xub_StrLen GetTxtEnd() const;
194cdf0e10cSrcweir 
GetInfo()195cdf0e10cSrcweir 	inline SwTxtSizeInfo &GetInfo()
196cdf0e10cSrcweir 		{ return (SwTxtSizeInfo&)SwTxtIter::GetInfo(); }
GetInfo() const197cdf0e10cSrcweir 	inline const SwTxtSizeInfo &GetInfo() const
198cdf0e10cSrcweir 		{ return (const SwTxtSizeInfo&)SwTxtIter::GetInfo(); }
199cdf0e10cSrcweir 
200cdf0e10cSrcweir };
201cdf0e10cSrcweir 
202cdf0e10cSrcweir 
203cdf0e10cSrcweir /*************************************************************************
204cdf0e10cSrcweir  *                      class SwTxtAdjuster
205cdf0e10cSrcweir  *************************************************************************/
206cdf0e10cSrcweir 
207cdf0e10cSrcweir class SwTxtAdjuster : public SwTxtMargin
208cdf0e10cSrcweir {
209cdf0e10cSrcweir 	// Gleicht die Portions aus, wenn Adjustment und FlyFrms vorliegen.
210cdf0e10cSrcweir 	void CalcFlyAdjust( SwLineLayout *pCurr );
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 	// ruft SplitGlues und CalcBlockAdjust
213cdf0e10cSrcweir 	void FormatBlock( );
214cdf0e10cSrcweir 
215cdf0e10cSrcweir 	// Erstellt bei kurzen Zeilen die Glue-Kette.
216cdf0e10cSrcweir     SwMarginPortion* CalcRightMargin( SwLineLayout *pCurr, SwTwips nReal = 0 );
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	// Berechnung des Adjustments (FlyPortions)
219cdf0e10cSrcweir 	SwFlyPortion *CalcFlyPortion( const long nRealWidth,
220cdf0e10cSrcweir 								  const SwRect &rCurrRect );
221cdf0e10cSrcweir 
222cdf0e10cSrcweir protected:
SwTxtAdjuster(SwTxtNode * pTxtNode)223cdf0e10cSrcweir 	inline SwTxtAdjuster(SwTxtNode* pTxtNode) : SwTxtMargin(pTxtNode) { }
224cdf0e10cSrcweir 	// spannt beim Blocksatz die Glues auf.
225cdf0e10cSrcweir 	void CalcNewBlock( SwLineLayout *pCurr, const SwLinePortion *pStopAt,
226cdf0e10cSrcweir         SwTwips nReal = 0, bool bSkipKashida = false );
227cdf0e10cSrcweir     SwTwips CalcKanaAdj( SwLineLayout *pCurr );
228cdf0e10cSrcweir public:
SwTxtAdjuster(SwTxtFrm * pTxtFrm,SwTxtSizeInfo * pTxtSizeInf)229cdf0e10cSrcweir     inline SwTxtAdjuster( SwTxtFrm *pTxtFrm, SwTxtSizeInfo *pTxtSizeInf ) : SwTxtMargin(pTxtFrm!=NULL?pTxtFrm->GetTxtNode():NULL)
230cdf0e10cSrcweir            { CtorInitTxtMargin( pTxtFrm, pTxtSizeInf ); }
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	// wird von SwTxtFormatter wegen UpdatePos ueberladen
233cdf0e10cSrcweir 	void CalcAdjLine( SwLineLayout *pCurr );
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	// sorgt fuer das nachtraegliche adjustieren
GetAdjusted() const236cdf0e10cSrcweir 	inline void GetAdjusted() const
237cdf0e10cSrcweir 	{
238cdf0e10cSrcweir 		if( pCurr->IsFormatAdj() )
239cdf0e10cSrcweir 			((SwTxtAdjuster*)this)->CalcAdjLine( pCurr );
240cdf0e10cSrcweir 	}
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 	// DropCaps-Extrawurst
243cdf0e10cSrcweir 	void CalcDropAdjust();
244cdf0e10cSrcweir     void CalcDropRepaint();
245cdf0e10cSrcweir };
246cdf0e10cSrcweir 
247cdf0e10cSrcweir /*************************************************************************
248cdf0e10cSrcweir  *                      class SwTxtCursor
249cdf0e10cSrcweir  *************************************************************************/
250cdf0e10cSrcweir 
251cdf0e10cSrcweir class SwTxtCursor : public SwTxtAdjuster
252cdf0e10cSrcweir {
253cdf0e10cSrcweir 	// A small helper-class to save SwTxtCursor member, manipulate them
254cdf0e10cSrcweir 	// and to restore them
255cdf0e10cSrcweir 	friend class SwTxtCursorSave;
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 	// 1170: Mehrdeutigkeiten
258cdf0e10cSrcweir 	static sal_Bool bRightMargin;
259cdf0e10cSrcweir 	void _GetCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* );
260cdf0e10cSrcweir protected:
261cdf0e10cSrcweir 	void CtorInitTxtCursor( SwTxtFrm *pFrm, SwTxtSizeInfo *pInf );
SwTxtCursor(SwTxtNode * pTxtNode)262cdf0e10cSrcweir 	inline SwTxtCursor(SwTxtNode* pTxtNode) : SwTxtAdjuster(pTxtNode) { }
263cdf0e10cSrcweir public:
SwTxtCursor(SwTxtFrm * pTxtFrm,SwTxtSizeInfo * pTxtSizeInf)264cdf0e10cSrcweir     inline SwTxtCursor( SwTxtFrm *pTxtFrm, SwTxtSizeInfo *pTxtSizeInf ) : SwTxtAdjuster(pTxtFrm!=NULL?pTxtFrm->GetTxtNode():NULL)
265cdf0e10cSrcweir            { CtorInitTxtCursor( pTxtFrm, pTxtSizeInf ); }
266cdf0e10cSrcweir 	sal_Bool GetCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* = 0,
267cdf0e10cSrcweir 		const long nMax = 0 );
268cdf0e10cSrcweir 	sal_Bool GetEndCharRect(SwRect *, const xub_StrLen, SwCrsrMoveState* = 0,
269cdf0e10cSrcweir 		const long nMax = 0 );
270cdf0e10cSrcweir 	xub_StrLen GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
271cdf0e10cSrcweir 				const MSHORT nChgNode, SwCrsrMoveState* = 0 ) const;
272cdf0e10cSrcweir 	// 1170: beruecksichtigt Mehrdeutigkeiten; Implementierung s.u.
273cdf0e10cSrcweir 	const SwLineLayout *CharCrsrToLine( const xub_StrLen nPos );
274cdf0e10cSrcweir 
275cdf0e10cSrcweir     // calculates baseline for portion rPor
276cdf0e10cSrcweir     // bAutoToCentered indicates, if AUTOMATIC mode means CENTERED or BASELINE
277cdf0e10cSrcweir     sal_uInt16 AdjustBaseLine( const SwLineLayout& rLine, const SwLinePortion* pPor,
278cdf0e10cSrcweir                            sal_uInt16 nPorHeight = 0, sal_uInt16 nAscent = 0,
279cdf0e10cSrcweir                            const sal_Bool bAutoToCentered = sal_False ) const;
280cdf0e10cSrcweir 
SetRightMargin(const sal_Bool bNew)281cdf0e10cSrcweir 	static inline void SetRightMargin( const sal_Bool bNew ){ bRightMargin = bNew; }
IsRightMargin()282cdf0e10cSrcweir 	static inline sal_Bool IsRightMargin() { return bRightMargin; }
283cdf0e10cSrcweir };
284cdf0e10cSrcweir 
285cdf0e10cSrcweir /*************************************************************************
286cdf0e10cSrcweir  *                          SwHookOut
287cdf0e10cSrcweir  *
288cdf0e10cSrcweir  * Change current output device to printer, this has to be done before
289cdf0e10cSrcweir  * formatting.
290cdf0e10cSrcweir  *************************************************************************/
291cdf0e10cSrcweir 
292cdf0e10cSrcweir class SwHookOut
293cdf0e10cSrcweir {
294cdf0e10cSrcweir     SwTxtSizeInfo* pInf;
295cdf0e10cSrcweir     OutputDevice* pOut;
296cdf0e10cSrcweir     sal_Bool bOnWin;
297cdf0e10cSrcweir public:
298cdf0e10cSrcweir     SwHookOut( SwTxtSizeInfo& rInfo );
299cdf0e10cSrcweir     ~SwHookOut();
300cdf0e10cSrcweir };
301cdf0e10cSrcweir 
302cdf0e10cSrcweir /*************************************************************************
303cdf0e10cSrcweir  *						Inline-Implementierungen
304cdf0e10cSrcweir  *************************************************************************/
305cdf0e10cSrcweir 
SeekAndChg(SwTxtSizeInfo & rInf)306cdf0e10cSrcweir inline sal_Bool SwTxtIter::SeekAndChg( SwTxtSizeInfo &rInf )
307cdf0e10cSrcweir {
308cdf0e10cSrcweir 	return SeekAndChgAttrIter( rInf.GetIdx(), rInf.GetOut() );
309cdf0e10cSrcweir }
310cdf0e10cSrcweir 
SeekAndChgBefore(SwTxtSizeInfo & rInf)311cdf0e10cSrcweir inline sal_Bool SwTxtIter::SeekAndChgBefore( SwTxtSizeInfo &rInf )
312cdf0e10cSrcweir {
313cdf0e10cSrcweir 	if ( rInf.GetIdx() )
314cdf0e10cSrcweir 		return SeekAndChgAttrIter( rInf.GetIdx()-1, rInf.GetOut() );
315cdf0e10cSrcweir 	else
316cdf0e10cSrcweir 		return SeekAndChgAttrIter( rInf.GetIdx(), rInf.GetOut() );
317cdf0e10cSrcweir }
318cdf0e10cSrcweir 
SeekStartAndChg(SwTxtSizeInfo & rInf,const sal_Bool bPara)319cdf0e10cSrcweir inline sal_Bool SwTxtIter::SeekStartAndChg( SwTxtSizeInfo &rInf, const sal_Bool bPara )
320cdf0e10cSrcweir {
321cdf0e10cSrcweir 	return SeekStartAndChgAttrIter( rInf.GetOut(), bPara );
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
GetLeftMargin() const324cdf0e10cSrcweir inline SwTwips SwTxtMargin::GetLeftMargin() const
325cdf0e10cSrcweir {
326cdf0e10cSrcweir 	return IsFirstTxtLine() ? nFirst : Left();
327cdf0e10cSrcweir }
328cdf0e10cSrcweir 
Left() const329cdf0e10cSrcweir inline SwTwips SwTxtMargin::Left() const
330cdf0e10cSrcweir {
331cdf0e10cSrcweir 	return (nDropLines >= nLineNr && 1 != nLineNr) ? nFirst + nDropLeft : nLeft;
332cdf0e10cSrcweir }
333cdf0e10cSrcweir 
334cdf0e10cSrcweir 
335cdf0e10cSrcweir 
336cdf0e10cSrcweir #endif
337