1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*efeef26fSAndrew Rist * distributed with this work for additional information
6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10*efeef26fSAndrew Rist *
11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*efeef26fSAndrew Rist *
13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17*efeef26fSAndrew Rist * specific language governing permissions and limitations
18*efeef26fSAndrew Rist * under the License.
19*efeef26fSAndrew Rist *
20*efeef26fSAndrew Rist *************************************************************/
21*efeef26fSAndrew Rist
22*efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp>
28cdf0e10cSrcweir #include <hintids.hxx>
29cdf0e10cSrcweir #include <vcl/sound.hxx>
30cdf0e10cSrcweir #include <tools/shl.hxx> // SW_MOD
31cdf0e10cSrcweir #include <editeng/pgrditem.hxx>
32cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
33cdf0e10cSrcweir #include <pagedesc.hxx> // SwPageDesc
34cdf0e10cSrcweir #include <tgrditem.hxx>
35cdf0e10cSrcweir #include <paratr.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include <fmtline.hxx>
38cdf0e10cSrcweir #include <lineinfo.hxx>
39cdf0e10cSrcweir #include <charfmt.hxx>
40cdf0e10cSrcweir #include "rootfrm.hxx"
41cdf0e10cSrcweir #include <pagefrm.hxx>
42cdf0e10cSrcweir #include <viewsh.hxx> // ViewShell
43cdf0e10cSrcweir #include <viewimp.hxx> // SwViewImp
44cdf0e10cSrcweir #include <viewopt.hxx> // SwViewOption
45cdf0e10cSrcweir #include <frmtool.hxx> // DrawGraphic
46cdf0e10cSrcweir #include <txtcfg.hxx>
47cdf0e10cSrcweir #include <txtfrm.hxx> // SwTxtFrm
48cdf0e10cSrcweir #include <itrpaint.hxx> // SwTxtPainter
49cdf0e10cSrcweir #include <txtpaint.hxx> // SwSaveClip
50cdf0e10cSrcweir #include <txtcache.hxx> // SwTxtLineAccess
51cdf0e10cSrcweir #include <flyfrm.hxx> // SwFlyFrm
52cdf0e10cSrcweir #include <redlnitr.hxx> // SwRedlineItr
53cdf0e10cSrcweir #include <swmodule.hxx> // SW_MOD
54cdf0e10cSrcweir #include <tabfrm.hxx> // SwTabFrm (Redlining)
55cdf0e10cSrcweir #include <SwGrammarMarkUp.hxx>
56cdf0e10cSrcweir
57cdf0e10cSrcweir // --> FME 2004-06-08 #i12836# enhanced pdf export
58cdf0e10cSrcweir #include <EnhancedPDFExportHelper.hxx>
59cdf0e10cSrcweir // <--
60cdf0e10cSrcweir
61cdf0e10cSrcweir #include <IDocumentStylePoolAccess.hxx>
62cdf0e10cSrcweir #include <IDocumentLineNumberAccess.hxx>
63cdf0e10cSrcweir
64cdf0e10cSrcweir // --> OD 2006-06-27 #b6440955#
65cdf0e10cSrcweir // variable moved to class <numfunc:GetDefBulletConfig>
66cdf0e10cSrcweir //extern const sal_Char __FAR_DATA sBulletFntName[];
67cdf0e10cSrcweir namespace numfunc
68cdf0e10cSrcweir {
69cdf0e10cSrcweir extern const String& GetDefBulletFontname();
70cdf0e10cSrcweir extern bool IsDefBulletFontUserDefined();
71cdf0e10cSrcweir }
72cdf0e10cSrcweir // <--
73cdf0e10cSrcweir
74cdf0e10cSrcweir
75cdf0e10cSrcweir #define REDLINE_DISTANCE 567/4
76cdf0e10cSrcweir #define REDLINE_MINDIST 567/10
77cdf0e10cSrcweir
78cdf0e10cSrcweir using namespace ::com::sun::star;
79cdf0e10cSrcweir
80cdf0e10cSrcweir ////////////////////////////////////////////////////////////
81cdf0e10cSrcweir
82cdf0e10cSrcweir sal_Bool bInitFont = sal_True;
83cdf0e10cSrcweir
84cdf0e10cSrcweir class SwExtraPainter
85cdf0e10cSrcweir {
86cdf0e10cSrcweir SwSaveClip aClip;
87cdf0e10cSrcweir SwRect aRect;
88cdf0e10cSrcweir const SwTxtFrm* pTxtFrm;
89cdf0e10cSrcweir ViewShell *pSh;
90cdf0e10cSrcweir SwFont* pFnt;
91cdf0e10cSrcweir const SwLineNumberInfo &rLineInf;
92cdf0e10cSrcweir SwTwips nX;
93cdf0e10cSrcweir SwTwips nRedX;
94cdf0e10cSrcweir sal_uLong nLineNr;
95cdf0e10cSrcweir MSHORT nDivider;
96cdf0e10cSrcweir sal_Bool bGoLeft;
97cdf0e10cSrcweir sal_Bool bLineNum;
IsClipChg()98cdf0e10cSrcweir inline sal_Bool IsClipChg() { return aClip.IsChg(); }
99cdf0e10cSrcweir public:
100cdf0e10cSrcweir SwExtraPainter( const SwTxtFrm *pFrm, ViewShell *pVwSh,
101cdf0e10cSrcweir const SwLineNumberInfo &rLnInf, const SwRect &rRct,
102cdf0e10cSrcweir sal_Int16 eHor, sal_Bool bLnNm );
~SwExtraPainter()103cdf0e10cSrcweir ~SwExtraPainter() { delete pFnt; }
GetFont() const104cdf0e10cSrcweir inline SwFont* GetFont() const { return pFnt; }
IncLineNr()105cdf0e10cSrcweir inline void IncLineNr() { ++nLineNr; }
HasNumber()106cdf0e10cSrcweir inline sal_Bool HasNumber() { return !( nLineNr % rLineInf.GetCountBy() ); }
HasDivider()107cdf0e10cSrcweir inline sal_Bool HasDivider() { if( !nDivider ) return sal_False;
108cdf0e10cSrcweir return !(nLineNr % rLineInf.GetDividerCountBy()); }
109cdf0e10cSrcweir
110cdf0e10cSrcweir void PaintExtra( SwTwips nY, long nAsc, long nMax, sal_Bool bRed );
111cdf0e10cSrcweir void PaintRedline( SwTwips nY, long nMax );
112cdf0e10cSrcweir };
113cdf0e10cSrcweir
114cdf0e10cSrcweir
SwExtraPainter(const SwTxtFrm * pFrm,ViewShell * pVwSh,const SwLineNumberInfo & rLnInf,const SwRect & rRct,sal_Int16 eHor,sal_Bool bLnNm)115cdf0e10cSrcweir SwExtraPainter::SwExtraPainter( const SwTxtFrm *pFrm, ViewShell *pVwSh,
116cdf0e10cSrcweir const SwLineNumberInfo &rLnInf, const SwRect &rRct,
117cdf0e10cSrcweir sal_Int16 eHor, sal_Bool bLnNm )
118cdf0e10cSrcweir : aClip( pVwSh->GetWin() || pFrm->IsUndersized() ? pVwSh->GetOut() : 0 ),
119cdf0e10cSrcweir aRect( rRct ), pTxtFrm( pFrm ), pSh( pVwSh ), pFnt( 0 ), rLineInf( rLnInf ),
120cdf0e10cSrcweir nLineNr( 1L ), bLineNum( bLnNm )
121cdf0e10cSrcweir {
122cdf0e10cSrcweir if( pFrm->IsUndersized() )
123cdf0e10cSrcweir {
124cdf0e10cSrcweir SwTwips nBottom = pFrm->Frm().Bottom();
125cdf0e10cSrcweir if( aRect.Bottom() > nBottom )
126cdf0e10cSrcweir aRect.Bottom( nBottom );
127cdf0e10cSrcweir }
128cdf0e10cSrcweir MSHORT nVirtPageNum = 0;
129cdf0e10cSrcweir if( bLineNum )
130cdf0e10cSrcweir { /* initialisiert die Member, die bei Zeilennumerierung notwendig sind:
131cdf0e10cSrcweir
132cdf0e10cSrcweir nDivider, wie oft ist ein Teilerstring gewuenscht, 0 == nie;
133cdf0e10cSrcweir nX, X-Position der Zeilennummern;
134cdf0e10cSrcweir pFnt, der Font der Zeilennummern;
135cdf0e10cSrcweir nLineNr, die erste Zeilennummer;
136cdf0e10cSrcweir bLineNum wird ggf.wieder auf sal_False gesetzt, wenn die Numerierung sich
137cdf0e10cSrcweir komplett ausserhalb des Paint-Rechtecks aufhaelt. */
138cdf0e10cSrcweir nDivider = rLineInf.GetDivider().Len() ? rLineInf.GetDividerCountBy() : 0;
139cdf0e10cSrcweir nX = pFrm->Frm().Left();
140cdf0e10cSrcweir SwCharFmt* pFmt = rLineInf.GetCharFmt( const_cast<IDocumentStylePoolAccess&>(*pFrm->GetNode()->getIDocumentStylePoolAccess()) );
141cdf0e10cSrcweir ASSERT( pFmt, "PaintExtraData without CharFmt" );
142cdf0e10cSrcweir pFnt = new SwFont( &pFmt->GetAttrSet(), pFrm->GetTxtNode()->getIDocumentSettingAccess() );
143cdf0e10cSrcweir pFnt->Invalidate();
144cdf0e10cSrcweir pFnt->ChgPhysFnt( pSh, *pSh->GetOut() );
145cdf0e10cSrcweir pFnt->SetVertical( 0, pFrm->IsVertical() );
146cdf0e10cSrcweir nLineNr += pFrm->GetAllLines() - pFrm->GetThisLines();
147cdf0e10cSrcweir LineNumberPosition ePos = rLineInf.GetPos();
148cdf0e10cSrcweir if( ePos != LINENUMBER_POS_LEFT && ePos != LINENUMBER_POS_RIGHT )
149cdf0e10cSrcweir {
150cdf0e10cSrcweir if( pFrm->FindPageFrm()->OnRightPage() )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir nVirtPageNum = 1;
153cdf0e10cSrcweir ePos = ePos == LINENUMBER_POS_INSIDE ?
154cdf0e10cSrcweir LINENUMBER_POS_LEFT : LINENUMBER_POS_RIGHT;
155cdf0e10cSrcweir }
156cdf0e10cSrcweir else
157cdf0e10cSrcweir {
158cdf0e10cSrcweir nVirtPageNum = 2;
159cdf0e10cSrcweir ePos = ePos == LINENUMBER_POS_OUTSIDE ?
160cdf0e10cSrcweir LINENUMBER_POS_LEFT : LINENUMBER_POS_RIGHT;
161cdf0e10cSrcweir }
162cdf0e10cSrcweir }
163cdf0e10cSrcweir if( LINENUMBER_POS_LEFT == ePos )
164cdf0e10cSrcweir {
165cdf0e10cSrcweir bGoLeft = sal_True;
166cdf0e10cSrcweir nX -= rLineInf.GetPosFromLeft();
167cdf0e10cSrcweir if( nX < aRect.Left() )
168cdf0e10cSrcweir bLineNum = sal_False;
169cdf0e10cSrcweir }
170cdf0e10cSrcweir else
171cdf0e10cSrcweir {
172cdf0e10cSrcweir bGoLeft = sal_False;
173cdf0e10cSrcweir nX += pFrm->Frm().Width() + rLineInf.GetPosFromLeft();
174cdf0e10cSrcweir if( nX > aRect.Right() )
175cdf0e10cSrcweir bLineNum = sal_False;
176cdf0e10cSrcweir }
177cdf0e10cSrcweir }
178cdf0e10cSrcweir if( eHor != text::HoriOrientation::NONE )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir if( text::HoriOrientation::INSIDE == eHor || text::HoriOrientation::OUTSIDE == eHor )
181cdf0e10cSrcweir {
182cdf0e10cSrcweir if( !nVirtPageNum )
183cdf0e10cSrcweir nVirtPageNum = pFrm->FindPageFrm()->OnRightPage() ? 1 : 2;
184cdf0e10cSrcweir if( nVirtPageNum % 2 )
185cdf0e10cSrcweir eHor = eHor == text::HoriOrientation::INSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
186cdf0e10cSrcweir else
187cdf0e10cSrcweir eHor = eHor == text::HoriOrientation::OUTSIDE ? text::HoriOrientation::LEFT : text::HoriOrientation::RIGHT;
188cdf0e10cSrcweir }
189cdf0e10cSrcweir const SwFrm* pTmpFrm = pFrm->FindTabFrm();
190cdf0e10cSrcweir if( !pTmpFrm )
191cdf0e10cSrcweir pTmpFrm = pFrm;
192cdf0e10cSrcweir nRedX = text::HoriOrientation::LEFT == eHor ? pTmpFrm->Frm().Left() - REDLINE_DISTANCE :
193cdf0e10cSrcweir pTmpFrm->Frm().Right() + REDLINE_DISTANCE;
194cdf0e10cSrcweir }
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir /*************************************************************************
198cdf0e10cSrcweir * SwExtraPainter::PaintExtra()
199cdf0e10cSrcweir **************************************************************************/
200cdf0e10cSrcweir
PaintExtra(SwTwips nY,long nAsc,long nMax,sal_Bool bRed)201cdf0e10cSrcweir void SwExtraPainter::PaintExtra( SwTwips nY, long nAsc, long nMax, sal_Bool bRed )
202cdf0e10cSrcweir {
203cdf0e10cSrcweir //Zeilennummer ist staerker als der Teiler
204cdf0e10cSrcweir const XubString aTmp( HasNumber() ? rLineInf.GetNumType().GetNumStr( nLineNr )
205cdf0e10cSrcweir : rLineInf.GetDivider() );
206cdf0e10cSrcweir
207cdf0e10cSrcweir // get script type of line numbering:
208cdf0e10cSrcweir pFnt->SetActual( SwScriptInfo::WhichFont( 0, &aTmp, 0 ) );
209cdf0e10cSrcweir
210cdf0e10cSrcweir SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, aTmp.Len() );
211cdf0e10cSrcweir aDrawInf.SetSpace( 0 );
212cdf0e10cSrcweir aDrawInf.SetWrong( NULL );
213cdf0e10cSrcweir aDrawInf.SetGrammarCheck( NULL );
214cdf0e10cSrcweir aDrawInf.SetSmartTags( NULL ); // SMARTTAGS
215cdf0e10cSrcweir aDrawInf.SetLeft( 0 );
216cdf0e10cSrcweir aDrawInf.SetRight( LONG_MAX );
217cdf0e10cSrcweir aDrawInf.SetFrm( pTxtFrm );
218cdf0e10cSrcweir aDrawInf.SetFont( pFnt );
219cdf0e10cSrcweir aDrawInf.SetSnapToGrid( sal_False );
220cdf0e10cSrcweir aDrawInf.SetIgnoreFrmRTL( sal_True );
221cdf0e10cSrcweir
222cdf0e10cSrcweir sal_Bool bTooBig = pFnt->GetSize( pFnt->GetActual() ).Height() > nMax &&
223cdf0e10cSrcweir pFnt->GetHeight( pSh, *pSh->GetOut() ) > nMax;
224cdf0e10cSrcweir SwFont* pTmpFnt;
225cdf0e10cSrcweir if( bTooBig )
226cdf0e10cSrcweir {
227cdf0e10cSrcweir pTmpFnt = new SwFont( *GetFont() );
228cdf0e10cSrcweir if( nMax >= 20 )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir nMax *= 17;
231cdf0e10cSrcweir nMax /= 20;
232cdf0e10cSrcweir }
233cdf0e10cSrcweir pTmpFnt->SetSize( Size( 0, nMax ), pTmpFnt->GetActual() );
234cdf0e10cSrcweir }
235cdf0e10cSrcweir else
236cdf0e10cSrcweir pTmpFnt = GetFont();
237cdf0e10cSrcweir Point aTmpPos( nX, nY );
238cdf0e10cSrcweir aTmpPos.Y() += nAsc;
239cdf0e10cSrcweir sal_Bool bPaint = sal_True;
240cdf0e10cSrcweir if( !IsClipChg() )
241cdf0e10cSrcweir {
242cdf0e10cSrcweir Size aSize = pTmpFnt->_GetTxtSize( aDrawInf );
243cdf0e10cSrcweir if( bGoLeft )
244cdf0e10cSrcweir aTmpPos.X() -= aSize.Width();
245cdf0e10cSrcweir // calculate rectangle containing the line number
246cdf0e10cSrcweir SwRect aRct( Point( aTmpPos.X(),
247cdf0e10cSrcweir aTmpPos.Y() - pTmpFnt->GetAscent( pSh, *pSh->GetOut() )
248cdf0e10cSrcweir ), aSize );
249cdf0e10cSrcweir if( !aRect.IsInside( aRct ) )
250cdf0e10cSrcweir {
251cdf0e10cSrcweir if( aRct.Intersection( aRect ).IsEmpty() )
252cdf0e10cSrcweir bPaint = sal_False;
253cdf0e10cSrcweir else
254cdf0e10cSrcweir aClip.ChgClip( aRect, pTxtFrm );
255cdf0e10cSrcweir }
256cdf0e10cSrcweir }
257cdf0e10cSrcweir else if( bGoLeft )
258cdf0e10cSrcweir aTmpPos.X() -= pTmpFnt->_GetTxtSize( aDrawInf ).Width();
259cdf0e10cSrcweir aDrawInf.SetPos( aTmpPos );
260cdf0e10cSrcweir if( bPaint )
261cdf0e10cSrcweir pTmpFnt->_DrawText( aDrawInf );
262cdf0e10cSrcweir
263cdf0e10cSrcweir if( bTooBig )
264cdf0e10cSrcweir delete pTmpFnt;
265cdf0e10cSrcweir if( bRed )
266cdf0e10cSrcweir {
267cdf0e10cSrcweir long nDiff = bGoLeft ? nRedX - nX : nX - nRedX;
268cdf0e10cSrcweir if( nDiff > REDLINE_MINDIST )
269cdf0e10cSrcweir PaintRedline( nY, nMax );
270cdf0e10cSrcweir }
271cdf0e10cSrcweir }
272cdf0e10cSrcweir
PaintRedline(SwTwips nY,long nMax)273cdf0e10cSrcweir void SwExtraPainter::PaintRedline( SwTwips nY, long nMax )
274cdf0e10cSrcweir {
275cdf0e10cSrcweir Point aStart( nRedX, nY );
276cdf0e10cSrcweir Point aEnd( nRedX, nY + nMax );
277cdf0e10cSrcweir
278cdf0e10cSrcweir if( !IsClipChg() )
279cdf0e10cSrcweir {
280cdf0e10cSrcweir SwRect aRct( aStart, aEnd );
281cdf0e10cSrcweir if( !aRect.IsInside( aRct ) )
282cdf0e10cSrcweir {
283cdf0e10cSrcweir if( aRct.Intersection( aRect ).IsEmpty() )
284cdf0e10cSrcweir return;
285cdf0e10cSrcweir aClip.ChgClip( aRect, pTxtFrm );
286cdf0e10cSrcweir }
287cdf0e10cSrcweir }
288cdf0e10cSrcweir const Color aOldCol( pSh->GetOut()->GetLineColor() );
289cdf0e10cSrcweir pSh->GetOut()->SetLineColor( SW_MOD()->GetRedlineMarkColor() );
290cdf0e10cSrcweir
291cdf0e10cSrcweir if ( pTxtFrm->IsVertical() )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir pTxtFrm->SwitchHorizontalToVertical( aStart );
294cdf0e10cSrcweir pTxtFrm->SwitchHorizontalToVertical( aEnd );
295cdf0e10cSrcweir }
296cdf0e10cSrcweir
297cdf0e10cSrcweir pSh->GetOut()->DrawLine( aStart, aEnd );
298cdf0e10cSrcweir pSh->GetOut()->SetLineColor( aOldCol );
299cdf0e10cSrcweir }
300cdf0e10cSrcweir
PaintExtraData(const SwRect & rRect) const301cdf0e10cSrcweir void SwTxtFrm::PaintExtraData( const SwRect &rRect ) const
302cdf0e10cSrcweir {
303cdf0e10cSrcweir if( Frm().Top() > rRect.Bottom() || Frm().Bottom() < rRect.Top() )
304cdf0e10cSrcweir return;
305cdf0e10cSrcweir
306cdf0e10cSrcweir const SwTxtNode& rTxtNode = *GetTxtNode();
307cdf0e10cSrcweir const IDocumentRedlineAccess* pIDRA = rTxtNode.getIDocumentRedlineAccess();
308cdf0e10cSrcweir const SwLineNumberInfo &rLineInf = rTxtNode.getIDocumentLineNumberAccess()->GetLineNumberInfo();
309cdf0e10cSrcweir const SwFmtLineNumber &rLineNum = GetAttrSet()->GetLineNumber();
310cdf0e10cSrcweir sal_Bool bLineNum = !IsInTab() && rLineInf.IsPaintLineNumbers() &&
311cdf0e10cSrcweir ( !IsInFly() || rLineInf.IsCountInFlys() ) && rLineNum.IsCount();
312cdf0e10cSrcweir sal_Int16 eHor = (sal_Int16)SW_MOD()->GetRedlineMarkPos();
313cdf0e10cSrcweir if( eHor != text::HoriOrientation::NONE && !IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) )
314cdf0e10cSrcweir eHor = text::HoriOrientation::NONE;
315cdf0e10cSrcweir sal_Bool bRedLine = eHor != text::HoriOrientation::NONE;
316cdf0e10cSrcweir if ( bLineNum || bRedLine )
317cdf0e10cSrcweir {
318cdf0e10cSrcweir if( IsLocked() || IsHiddenNow() || !Prt().Height() )
319cdf0e10cSrcweir return;
320cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
321cdf0e10cSrcweir
322cdf0e10cSrcweir SWAP_IF_NOT_SWAPPED( this )
323cdf0e10cSrcweir SwRect rOldRect( rRect );
324cdf0e10cSrcweir
325cdf0e10cSrcweir if ( IsVertical() )
326cdf0e10cSrcweir SwitchVerticalToHorizontal( (SwRect&)rRect );
327cdf0e10cSrcweir
328cdf0e10cSrcweir SwLayoutModeModifier aLayoutModeModifier( *pSh->GetOut() );
329cdf0e10cSrcweir aLayoutModeModifier.Modify( sal_False );
330cdf0e10cSrcweir
331cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
332cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pSh->GetOut() );
333cdf0e10cSrcweir // <--
334cdf0e10cSrcweir
335cdf0e10cSrcweir SwExtraPainter aExtra( this, pSh, rLineInf, rRect, eHor, bLineNum );
336cdf0e10cSrcweir
337cdf0e10cSrcweir if( HasPara() )
338cdf0e10cSrcweir {
339cdf0e10cSrcweir SwTxtFrmLocker aLock((SwTxtFrm*)this);
340cdf0e10cSrcweir
341cdf0e10cSrcweir SwTxtLineAccess aAccess( (SwTxtFrm*)this );
342cdf0e10cSrcweir aAccess.GetPara();
343cdf0e10cSrcweir
344cdf0e10cSrcweir SwTxtPaintInfo aInf( (SwTxtFrm*)this, rRect );
345cdf0e10cSrcweir
346cdf0e10cSrcweir aLayoutModeModifier.Modify( sal_False );
347cdf0e10cSrcweir
348cdf0e10cSrcweir SwTxtPainter aLine( (SwTxtFrm*)this, &aInf );
349cdf0e10cSrcweir sal_Bool bNoDummy = !aLine.GetNext(); // Nur eine Leerzeile!
350cdf0e10cSrcweir
351cdf0e10cSrcweir while( aLine.Y() + aLine.GetLineHeight() <= rRect.Top() )
352cdf0e10cSrcweir {
353cdf0e10cSrcweir if( !aLine.GetCurr()->IsDummy() &&
354cdf0e10cSrcweir ( rLineInf.IsCountBlankLines() ||
355cdf0e10cSrcweir aLine.GetCurr()->HasCntnt() ) )
356cdf0e10cSrcweir aExtra.IncLineNr();
357cdf0e10cSrcweir if( !aLine.Next() )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir (SwRect&)rRect = rOldRect;
360cdf0e10cSrcweir UNDO_SWAP( this )
361cdf0e10cSrcweir return;
362cdf0e10cSrcweir }
363cdf0e10cSrcweir }
364cdf0e10cSrcweir
365cdf0e10cSrcweir long nBottom = rRect.Bottom();
366cdf0e10cSrcweir
367cdf0e10cSrcweir sal_Bool bNoPrtLine = 0 == GetMinPrtLine();
368cdf0e10cSrcweir if( !bNoPrtLine )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir while ( aLine.Y() < GetMinPrtLine() )
371cdf0e10cSrcweir {
372cdf0e10cSrcweir if( ( rLineInf.IsCountBlankLines() || aLine.GetCurr()->HasCntnt() )
373cdf0e10cSrcweir && !aLine.GetCurr()->IsDummy() )
374cdf0e10cSrcweir aExtra.IncLineNr();
375cdf0e10cSrcweir if( !aLine.Next() )
376cdf0e10cSrcweir break;
377cdf0e10cSrcweir }
378cdf0e10cSrcweir bNoPrtLine = aLine.Y() >= GetMinPrtLine();
379cdf0e10cSrcweir }
380cdf0e10cSrcweir if( bNoPrtLine )
381cdf0e10cSrcweir {
382cdf0e10cSrcweir do
383cdf0e10cSrcweir {
384cdf0e10cSrcweir if( bNoDummy || !aLine.GetCurr()->IsDummy() )
385cdf0e10cSrcweir {
386cdf0e10cSrcweir sal_Bool bRed = bRedLine && aLine.GetCurr()->HasRedline();
387cdf0e10cSrcweir if( rLineInf.IsCountBlankLines() || aLine.GetCurr()->HasCntnt() )
388cdf0e10cSrcweir {
389cdf0e10cSrcweir if( bLineNum &&
390cdf0e10cSrcweir ( aExtra.HasNumber() || aExtra.HasDivider() ) )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir KSHORT nTmpHeight, nTmpAscent;
393cdf0e10cSrcweir aLine.CalcAscentAndHeight( nTmpAscent, nTmpHeight );
394cdf0e10cSrcweir aExtra.PaintExtra( aLine.Y(), nTmpAscent,
395cdf0e10cSrcweir nTmpHeight, bRed );
396cdf0e10cSrcweir bRed = sal_False;
397cdf0e10cSrcweir }
398cdf0e10cSrcweir aExtra.IncLineNr();
399cdf0e10cSrcweir }
400cdf0e10cSrcweir if( bRed )
401cdf0e10cSrcweir aExtra.PaintRedline( aLine.Y(), aLine.GetLineHeight() );
402cdf0e10cSrcweir }
403cdf0e10cSrcweir } while( aLine.Next() && aLine.Y() <= nBottom );
404cdf0e10cSrcweir }
405cdf0e10cSrcweir }
406cdf0e10cSrcweir else
407cdf0e10cSrcweir {
408cdf0e10cSrcweir bRedLine &= ( MSHRT_MAX!= pIDRA->GetRedlinePos(rTxtNode, USHRT_MAX) );
409cdf0e10cSrcweir
410cdf0e10cSrcweir if( bLineNum && rLineInf.IsCountBlankLines() &&
411cdf0e10cSrcweir ( aExtra.HasNumber() || aExtra.HasDivider() ) )
412cdf0e10cSrcweir {
413cdf0e10cSrcweir aExtra.PaintExtra( Frm().Top()+Prt().Top(), aExtra.GetFont()
414cdf0e10cSrcweir ->GetAscent( pSh, *pSh->GetOut() ), Prt().Height(), bRedLine );
415cdf0e10cSrcweir }
416cdf0e10cSrcweir else if( bRedLine )
417cdf0e10cSrcweir aExtra.PaintRedline( Frm().Top()+Prt().Top(), Prt().Height() );
418cdf0e10cSrcweir }
419cdf0e10cSrcweir
420cdf0e10cSrcweir (SwRect&)rRect = rOldRect;
421cdf0e10cSrcweir UNDO_SWAP( this )
422cdf0e10cSrcweir }
423cdf0e10cSrcweir }
424cdf0e10cSrcweir
425cdf0e10cSrcweir /*************************************************************************
426cdf0e10cSrcweir * SwTxtFrm::Paint()
427cdf0e10cSrcweir *************************************************************************/
428cdf0e10cSrcweir
Paint()429cdf0e10cSrcweir SwRect SwTxtFrm::Paint()
430cdf0e10cSrcweir {
431cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
432cdf0e10cSrcweir const SwTwips nDbgY = Frm().Top();
433cdf0e10cSrcweir (void)nDbgY;
434cdf0e10cSrcweir #endif
435cdf0e10cSrcweir
436cdf0e10cSrcweir // finger layout
437cdf0e10cSrcweir ASSERT( GetValidPosFlag(), "+SwTxtFrm::Paint: no Calc()" );
438cdf0e10cSrcweir
439cdf0e10cSrcweir SwRect aRet( Prt() );
440cdf0e10cSrcweir if ( IsEmpty() || !HasPara() )
441cdf0e10cSrcweir aRet += Frm().Pos();
442cdf0e10cSrcweir else
443cdf0e10cSrcweir {
444cdf0e10cSrcweir // AMA: Wir liefern jetzt mal das richtige Repaintrechteck zurueck,
445cdf0e10cSrcweir // d.h. als linken Rand den berechneten PaintOfst!
446cdf0e10cSrcweir SwRepaint *pRepaint = GetPara()->GetRepaint();
447cdf0e10cSrcweir long l;
448cdf0e10cSrcweir //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
449cdf0e10cSrcweir if ( IsVertLR() ) // mba: the following line was added, but we don't need it for the existing directions; kept for IsVertLR(), but should be checked
450cdf0e10cSrcweir pRepaint->Chg( ( GetUpper()->Frm() ).Pos() + ( GetUpper()->Prt() ).Pos(), ( GetUpper()->Prt() ).SSize() );
451cdf0e10cSrcweir
452cdf0e10cSrcweir if( pRepaint->GetOfst() )
453cdf0e10cSrcweir pRepaint->Left( pRepaint->GetOfst() );
454cdf0e10cSrcweir
455cdf0e10cSrcweir l = pRepaint->GetRightOfst();
456cdf0e10cSrcweir if( l && ( pRepaint->GetOfst() || l > pRepaint->Right() ) )
457cdf0e10cSrcweir pRepaint->Right( l );
458cdf0e10cSrcweir pRepaint->SetOfst( 0 );
459cdf0e10cSrcweir aRet = *pRepaint;
460cdf0e10cSrcweir
461cdf0e10cSrcweir if ( IsRightToLeft() )
462cdf0e10cSrcweir SwitchLTRtoRTL( aRet );
463cdf0e10cSrcweir
464cdf0e10cSrcweir if ( IsVertical() )
465cdf0e10cSrcweir SwitchHorizontalToVertical( aRet );
466cdf0e10cSrcweir }
467cdf0e10cSrcweir ResetRepaint();
468cdf0e10cSrcweir
469cdf0e10cSrcweir return aRet;
470cdf0e10cSrcweir }
471cdf0e10cSrcweir
472cdf0e10cSrcweir /*************************************************************************
473cdf0e10cSrcweir * SwTxtFrm::Paint()
474cdf0e10cSrcweir *************************************************************************/
475cdf0e10cSrcweir
PaintEmpty(const SwRect & rRect,sal_Bool bCheck) const476cdf0e10cSrcweir sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const
477cdf0e10cSrcweir {
478cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
479cdf0e10cSrcweir if( pSh && ( pSh->GetViewOptions()->IsParagraph() || bInitFont ) )
480cdf0e10cSrcweir {
481cdf0e10cSrcweir bInitFont = sal_False;
482cdf0e10cSrcweir SwTxtFly aTxtFly( this );
483cdf0e10cSrcweir aTxtFly.SetTopRule();
484cdf0e10cSrcweir SwRect aRect;
485cdf0e10cSrcweir if( bCheck && aTxtFly.IsOn() && aTxtFly.IsAnyObj( aRect ) )
486cdf0e10cSrcweir return sal_False;
487cdf0e10cSrcweir else if( pSh->GetWin() )
488cdf0e10cSrcweir {
489cdf0e10cSrcweir SwFont *pFnt;
490cdf0e10cSrcweir const SwTxtNode& rTxtNode = *GetTxtNode();
491cdf0e10cSrcweir if ( rTxtNode.HasSwAttrSet() )
492cdf0e10cSrcweir {
493cdf0e10cSrcweir const SwAttrSet *pAttrSet = &( rTxtNode.GetSwAttrSet() );
494cdf0e10cSrcweir pFnt = new SwFont( pAttrSet, rTxtNode.getIDocumentSettingAccess() );
495cdf0e10cSrcweir }
496cdf0e10cSrcweir else
497cdf0e10cSrcweir {
498cdf0e10cSrcweir SwFontAccess aFontAccess( &rTxtNode.GetAnyFmtColl(), pSh );
499cdf0e10cSrcweir pFnt = new SwFont( *aFontAccess.Get()->GetFont() );
500cdf0e10cSrcweir }
501cdf0e10cSrcweir
502cdf0e10cSrcweir const IDocumentRedlineAccess* pIDRA = rTxtNode.getIDocumentRedlineAccess();
503cdf0e10cSrcweir if( IDocumentRedlineAccess::IsShowChanges( pIDRA->GetRedlineMode() ) )
504cdf0e10cSrcweir {
505cdf0e10cSrcweir MSHORT nRedlPos = pIDRA->GetRedlinePos( rTxtNode, USHRT_MAX );
506cdf0e10cSrcweir if( MSHRT_MAX != nRedlPos )
507cdf0e10cSrcweir {
508cdf0e10cSrcweir SwAttrHandler aAttrHandler;
509cdf0e10cSrcweir aAttrHandler.Init( rTxtNode.GetSwAttrSet(),
510cdf0e10cSrcweir *rTxtNode.getIDocumentSettingAccess(), NULL );
511cdf0e10cSrcweir SwRedlineItr aRedln( rTxtNode, *pFnt, aAttrHandler, nRedlPos, sal_True );
512cdf0e10cSrcweir }
513cdf0e10cSrcweir }
514cdf0e10cSrcweir
515cdf0e10cSrcweir if( pSh->GetViewOptions()->IsParagraph() && Prt().Height() )
516cdf0e10cSrcweir {
517cdf0e10cSrcweir if( RTL_TEXTENCODING_SYMBOL == pFnt->GetCharSet( SW_LATIN ) &&
518cdf0e10cSrcweir pFnt->GetName( SW_LATIN ) != numfunc::GetDefBulletFontname() )
519cdf0e10cSrcweir {
520cdf0e10cSrcweir pFnt->SetFamily( FAMILY_DONTKNOW, SW_LATIN );
521cdf0e10cSrcweir pFnt->SetName( numfunc::GetDefBulletFontname(), SW_LATIN );
522cdf0e10cSrcweir pFnt->SetStyleName( aEmptyStr, SW_LATIN );
523cdf0e10cSrcweir pFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, SW_LATIN );
524cdf0e10cSrcweir }
525cdf0e10cSrcweir pFnt->SetVertical( 0, IsVertical() );
526cdf0e10cSrcweir SwFrmSwapper aSwapper( this, sal_True );
527cdf0e10cSrcweir SwLayoutModeModifier aLayoutModeModifier( *pSh->GetOut() );
528cdf0e10cSrcweir aLayoutModeModifier.Modify( IsRightToLeft() );
529cdf0e10cSrcweir
530cdf0e10cSrcweir pFnt->Invalidate();
531cdf0e10cSrcweir pFnt->ChgPhysFnt( pSh, *pSh->GetOut() );
532cdf0e10cSrcweir Point aPos = Frm().Pos() + Prt().Pos();
533cdf0e10cSrcweir
534cdf0e10cSrcweir const SvxLRSpaceItem &rSpace =
535cdf0e10cSrcweir GetTxtNode()->GetSwAttrSet().GetLRSpace();
536cdf0e10cSrcweir
537cdf0e10cSrcweir if ( rSpace.GetTxtFirstLineOfst() > 0 )
538cdf0e10cSrcweir aPos.X() += rSpace.GetTxtFirstLineOfst();
539cdf0e10cSrcweir
540cdf0e10cSrcweir SwSaveClip *pClip;
541cdf0e10cSrcweir if( IsUndersized() )
542cdf0e10cSrcweir {
543cdf0e10cSrcweir pClip = new SwSaveClip( pSh->GetOut() );
544cdf0e10cSrcweir pClip->ChgClip( rRect );
545cdf0e10cSrcweir }
546cdf0e10cSrcweir else
547cdf0e10cSrcweir pClip = NULL;
548cdf0e10cSrcweir
549cdf0e10cSrcweir aPos.Y() += pFnt->GetAscent( pSh, *pSh->GetOut() );
550cdf0e10cSrcweir
551cdf0e10cSrcweir if ( GetTxtNode()->GetSwAttrSet().GetParaGrid().GetValue() &&
552cdf0e10cSrcweir IsInDocBody() )
553cdf0e10cSrcweir {
554cdf0e10cSrcweir GETGRID( FindPageFrm() )
555cdf0e10cSrcweir if ( pGrid )
556cdf0e10cSrcweir {
557cdf0e10cSrcweir // center character in grid line
558cdf0e10cSrcweir aPos.Y() += ( pGrid->GetBaseHeight() -
559cdf0e10cSrcweir pFnt->GetHeight( pSh, *pSh->GetOut() ) ) / 2;
560cdf0e10cSrcweir
561cdf0e10cSrcweir if ( ! pGrid->GetRubyTextBelow() )
562cdf0e10cSrcweir aPos.Y() += pGrid->GetRubyHeight();
563cdf0e10cSrcweir }
564cdf0e10cSrcweir }
565cdf0e10cSrcweir
566cdf0e10cSrcweir const XubString aTmp( CH_PAR );
567cdf0e10cSrcweir SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, 1 );
568cdf0e10cSrcweir aDrawInf.SetLeft( rRect.Left() );
569cdf0e10cSrcweir aDrawInf.SetRight( rRect.Right() );
570cdf0e10cSrcweir aDrawInf.SetPos( aPos );
571cdf0e10cSrcweir aDrawInf.SetSpace( 0 );
572cdf0e10cSrcweir aDrawInf.SetKanaComp( 0 );
573cdf0e10cSrcweir aDrawInf.SetWrong( NULL );
574cdf0e10cSrcweir aDrawInf.SetGrammarCheck( NULL );
575cdf0e10cSrcweir aDrawInf.SetSmartTags( NULL ); // SMARTTAGS
576cdf0e10cSrcweir aDrawInf.SetFrm( this );
577cdf0e10cSrcweir aDrawInf.SetFont( pFnt );
578cdf0e10cSrcweir aDrawInf.SetSnapToGrid( sal_False );
579cdf0e10cSrcweir
580cdf0e10cSrcweir pFnt->_DrawText( aDrawInf );
581cdf0e10cSrcweir delete pClip;
582cdf0e10cSrcweir }
583cdf0e10cSrcweir delete pFnt;
584cdf0e10cSrcweir return sal_True;
585cdf0e10cSrcweir }
586cdf0e10cSrcweir }
587cdf0e10cSrcweir else
588cdf0e10cSrcweir return sal_True;
589cdf0e10cSrcweir return sal_False;
590cdf0e10cSrcweir }
591cdf0e10cSrcweir
592cdf0e10cSrcweir /*************************************************************************
593cdf0e10cSrcweir * SwTxtFrm::Paint()
594cdf0e10cSrcweir *************************************************************************/
595cdf0e10cSrcweir
Paint(SwRect const & rRect,SwPrintData const * const) const596cdf0e10cSrcweir void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
597cdf0e10cSrcweir {
598cdf0e10cSrcweir ResetRepaint();
599cdf0e10cSrcweir
600cdf0e10cSrcweir // --> FME 2004-06-24 #i16816# tagged pdf support
601cdf0e10cSrcweir ViewShell *pSh = getRootFrm()->GetCurrShell();
602cdf0e10cSrcweir
603cdf0e10cSrcweir Num_Info aNumInfo( *this );
604cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelperNumbering( &aNumInfo, 0, 0, *pSh->GetOut() );
605cdf0e10cSrcweir
606cdf0e10cSrcweir Frm_Info aFrmInfo( *this );
607cdf0e10cSrcweir SwTaggedPDFHelper aTaggedPDFHelperParagraph( 0, &aFrmInfo, 0, *pSh->GetOut() );
608cdf0e10cSrcweir // <--
609cdf0e10cSrcweir
610cdf0e10cSrcweir DBG_LOOP_RESET;
611cdf0e10cSrcweir if( !IsEmpty() || !PaintEmpty( rRect, sal_True ) )
612cdf0e10cSrcweir {
613cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
614cdf0e10cSrcweir const SwTwips nDbgY = Frm().Top();
615cdf0e10cSrcweir (void)nDbgY;
616cdf0e10cSrcweir #endif
617cdf0e10cSrcweir
618cdf0e10cSrcweir #ifdef DBGTXT
619cdf0e10cSrcweir if( IsDbg( this ) )
620cdf0e10cSrcweir DBTXTFRM << "Paint()" << endl;
621cdf0e10cSrcweir #endif
622cdf0e10cSrcweir if( IsLocked() || IsHiddenNow() || ! Prt().HasArea() )
623cdf0e10cSrcweir return;
624cdf0e10cSrcweir
625cdf0e10cSrcweir //Kann gut sein, dass mir der IdleCollector mir die gecachten
626cdf0e10cSrcweir //Informationen entzogen hat.
627cdf0e10cSrcweir if( !HasPara() )
628cdf0e10cSrcweir {
629cdf0e10cSrcweir ASSERT( GetValidPosFlag(), "+SwTxtFrm::Paint: no Calc()" );
630cdf0e10cSrcweir
631cdf0e10cSrcweir // --> FME 2004-10-29 #i29062# pass info that we are currently
632cdf0e10cSrcweir // painting.
633cdf0e10cSrcweir ((SwTxtFrm*)this)->GetFormatted( true );
634cdf0e10cSrcweir // <--
635cdf0e10cSrcweir if( IsEmpty() )
636cdf0e10cSrcweir {
637cdf0e10cSrcweir PaintEmpty( rRect, sal_False );
638cdf0e10cSrcweir return;
639cdf0e10cSrcweir }
640cdf0e10cSrcweir if( !HasPara() )
641cdf0e10cSrcweir {
642cdf0e10cSrcweir ASSERT( !this, "+SwTxtFrm::Paint: missing format information" );
643cdf0e10cSrcweir return;
644cdf0e10cSrcweir }
645cdf0e10cSrcweir }
646cdf0e10cSrcweir
647cdf0e10cSrcweir // Waehrend wir painten, wollen wir nicht gestoert werden.
648cdf0e10cSrcweir // Aber erst hinter dem Format() !
649cdf0e10cSrcweir SwTxtFrmLocker aLock((SwTxtFrm*)this);
650cdf0e10cSrcweir
651cdf0e10cSrcweir //Hier wird ggf. nur der Teil des TxtFrm ausgegeben, der sich veraendert
652cdf0e10cSrcweir //hat und der in dem Bereich liegt, dessen Ausgabe angefordert wurde.
653cdf0e10cSrcweir //Man kann jetzt auf die Idee kommen, dass der Bereich rRect ausgegeben
654cdf0e10cSrcweir //werden _muss_ obwohl rRepaint gesetzt ist; in der Tat kann dieses
655cdf0e10cSrcweir //Problem nicht formal vermieden werden. Gluecklicherweise koennen
656cdf0e10cSrcweir //wir davon ausgehen, dass rRepaint immer dann leer ist, wenn der Frm
657cdf0e10cSrcweir //komplett gepainted werden muss.
658cdf0e10cSrcweir SwTxtLineAccess aAccess( (SwTxtFrm*)this );
659cdf0e10cSrcweir SwParaPortion *pPara = aAccess.GetPara();
660cdf0e10cSrcweir
661cdf0e10cSrcweir SwRepaint &rRepaint = *(pPara->GetRepaint());
662cdf0e10cSrcweir
663cdf0e10cSrcweir // Das Recycling muss abgeschaltet werden, wenn wir uns im
664cdf0e10cSrcweir // FlyCntFrm befinden, weil ein DrawRect fuer die Retusche der
665cdf0e10cSrcweir // Zeile aufgerufen wird.
666cdf0e10cSrcweir if( rRepaint.GetOfst() )
667cdf0e10cSrcweir {
668cdf0e10cSrcweir const SwFlyFrm *pFly = FindFlyFrm();
669cdf0e10cSrcweir if( pFly && pFly->IsFlyInCntFrm() )
670cdf0e10cSrcweir rRepaint.SetOfst( 0 );
671cdf0e10cSrcweir }
672cdf0e10cSrcweir
673cdf0e10cSrcweir // Hier holen wir uns den String fuer die Ausgabe, besonders
674cdf0e10cSrcweir // die Laenge ist immer wieder interessant.
675cdf0e10cSrcweir
676cdf0e10cSrcweir // Rectangle
677cdf0e10cSrcweir ASSERT( ! IsSwapped(), "A frame is swapped before Paint" );
678cdf0e10cSrcweir SwRect aOldRect( rRect );
679cdf0e10cSrcweir
680cdf0e10cSrcweir SWAP_IF_NOT_SWAPPED( this )
681cdf0e10cSrcweir
682cdf0e10cSrcweir if ( IsVertical() )
683cdf0e10cSrcweir SwitchVerticalToHorizontal( (SwRect&)rRect );
684cdf0e10cSrcweir
685cdf0e10cSrcweir if ( IsRightToLeft() )
686cdf0e10cSrcweir SwitchRTLtoLTR( (SwRect&)rRect );
687cdf0e10cSrcweir
688cdf0e10cSrcweir SwTxtPaintInfo aInf( (SwTxtFrm*)this, rRect );
689cdf0e10cSrcweir aInf.SetWrongList( ( (SwTxtNode*)GetTxtNode() )->GetWrong() );
690cdf0e10cSrcweir aInf.SetGrammarCheckList( ( (SwTxtNode*)GetTxtNode() )->GetGrammarCheck() );
691cdf0e10cSrcweir aInf.SetSmartTags( ( (SwTxtNode*)GetTxtNode() )->GetSmartTags() ); // SMARTTAGS
692cdf0e10cSrcweir aInf.GetTxtFly()->SetTopRule();
693cdf0e10cSrcweir
694cdf0e10cSrcweir SwTxtPainter aLine( (SwTxtFrm*)this, &aInf );
695cdf0e10cSrcweir // Eine Optimierung, die sich lohnt: wenn kein freifliegender Frame
696cdf0e10cSrcweir // in unsere Zeile ragt, schaltet sich der SwTxtFly einfach ab:
697cdf0e10cSrcweir aInf.GetTxtFly()->Relax();
698cdf0e10cSrcweir
699cdf0e10cSrcweir OutputDevice* pOut = aInf.GetOut();
700cdf0e10cSrcweir const sal_Bool bOnWin = pSh->GetWin() != 0;
701cdf0e10cSrcweir
702cdf0e10cSrcweir SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : 0 );
703cdf0e10cSrcweir
704cdf0e10cSrcweir // Ausgabeschleife: Fuer jede Zeile ... (die noch zu sehen ist) ...
705cdf0e10cSrcweir // rRect muss angepasst werden (Top+1, Bottom-1), weil der Iterator
706cdf0e10cSrcweir // die Zeilen nahtlos aneinanderfuegt.
707cdf0e10cSrcweir aLine.TwipsToLine( rRect.Top() + 1 );
708cdf0e10cSrcweir long nBottom = rRect.Bottom();
709cdf0e10cSrcweir
710cdf0e10cSrcweir sal_Bool bNoPrtLine = 0 == GetMinPrtLine();
711cdf0e10cSrcweir if( !bNoPrtLine )
712cdf0e10cSrcweir {
713cdf0e10cSrcweir while ( aLine.Y() < GetMinPrtLine() && aLine.Next() )
714cdf0e10cSrcweir ;
715cdf0e10cSrcweir bNoPrtLine = aLine.Y() >= GetMinPrtLine();
716cdf0e10cSrcweir }
717cdf0e10cSrcweir if( bNoPrtLine )
718cdf0e10cSrcweir {
719cdf0e10cSrcweir do
720cdf0e10cSrcweir {
721cdf0e10cSrcweir //DBG_LOOP; shadows declaration above.
722cdf0e10cSrcweir //resolved into:
723cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
724cdf0e10cSrcweir #ifdef DBG_UTIL
725cdf0e10cSrcweir DbgLoop aDbgLoop2( (const void*) this );
726cdf0e10cSrcweir #endif
727cdf0e10cSrcweir #endif
728cdf0e10cSrcweir aLine.DrawTextLine( rRect, aClip, IsUndersized() );
729cdf0e10cSrcweir
730cdf0e10cSrcweir } while( aLine.Next() && aLine.Y() <= nBottom );
731cdf0e10cSrcweir }
732cdf0e10cSrcweir
733cdf0e10cSrcweir // Einmal reicht:
734cdf0e10cSrcweir if( aLine.IsPaintDrop() )
735cdf0e10cSrcweir aLine.PaintDropPortion();
736cdf0e10cSrcweir
737cdf0e10cSrcweir if( rRepaint.HasArea() )
738cdf0e10cSrcweir rRepaint.Clear();
739cdf0e10cSrcweir
740cdf0e10cSrcweir UNDO_SWAP( this )
741cdf0e10cSrcweir (SwRect&)rRect = aOldRect;
742cdf0e10cSrcweir
743cdf0e10cSrcweir ASSERT( ! IsSwapped(), "A frame is swapped after Paint" );
744cdf0e10cSrcweir }
745cdf0e10cSrcweir }
746cdf0e10cSrcweir
747