Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #define _SVX_PARAITEM_HXX
31 : : #define _SVX_TEXTITEM_HXX
32 : :
33 : : #include <com/sun/star/accessibility/XAccessible.hpp>
34 : :
35 : : #include <sfx2/viewfrm.hxx>
36 : : #include <sfx2/progress.hxx>
37 : : #include <svx/srchdlg.hxx>
38 : : #include <svx/svdobj.hxx>
39 : : #include <sfx2/viewsh.hxx>
40 : : #include <swwait.hxx>
41 : : #include <swmodule.hxx>
42 : : #include <fesh.hxx>
43 : : #include <doc.hxx>
44 : : #include <rootfrm.hxx>
45 : : #include <pagefrm.hxx>
46 : : #include <cntfrm.hxx>
47 : : #include <viewimp.hxx>
48 : : #include <frmtool.hxx>
49 : : #include <viewopt.hxx>
50 : : #include <dview.hxx>
51 : : #include <swregion.hxx>
52 : : #include <hints.hxx>
53 : : #include <fmtfsize.hxx>
54 : : #include <docufld.hxx>
55 : : #include <txtfrm.hxx>
56 : : #include <layact.hxx>
57 : : #include <mdiexp.hxx>
58 : : #include <fntcache.hxx>
59 : : #include <ptqueue.hxx>
60 : : #include <tabfrm.hxx>
61 : : #include <docsh.hxx>
62 : : #include <pagedesc.hxx>
63 : : #include <ndole.hxx>
64 : : #include <ndindex.hxx>
65 : : #include <accmap.hxx>
66 : : #include <svtools/colorcfg.hxx>
67 : : #include <svtools/accessibilityoptions.hxx>
68 : : #include <accessibilityoptions.hxx>
69 : : #include <statstr.hrc>
70 : : #include <comcore.hrc>
71 : : #include <pagepreviewlayout.hxx>
72 : : #include <sortedobjs.hxx>
73 : : #include <anchoredobject.hxx>
74 : :
75 : : #include "../../ui/inc/view.hxx"
76 : : #include <PostItMgr.hxx>
77 : : #include <vcl/virdev.hxx>
78 : :
79 : : #include <vcl/svapp.hxx>
80 : :
81 : : #include <svx/sdrpaintwindow.hxx>
82 : :
83 : : sal_Bool ViewShell::bLstAct = sal_False;
84 : : ShellResource *ViewShell::pShellRes = 0;
85 : : Window *ViewShell::pCareWindow = 0;
86 : : BitmapEx* ViewShell::pErrorBmp = NULL;
87 : : BitmapEx* ViewShell::pReplaceBmp = NULL;
88 : :
89 : : sal_Bool bInSizeNotify = sal_False;
90 : :
91 : : DBG_NAME(LayoutIdle)
92 : :
93 [ - + ]: 302044 : TYPEINIT0(ViewShell);
94 : :
95 : : using namespace ::com::sun::star;
96 : :
97 : 0 : void ViewShell::ToggleHeaderFooterEdit()
98 : : {
99 : 0 : bHeaderFooterEdit = !bHeaderFooterEdit;
100 [ # # ]: 0 : if ( !bHeaderFooterEdit )
101 : : {
102 : 0 : SetShowHeaderFooterSeparator( Header, false );
103 : 0 : SetShowHeaderFooterSeparator( Footer, false );
104 : : }
105 : :
106 : : // Avoid corner case
107 [ # # # # ]: 0 : if ( !IsShowHeaderFooterSeparator( Header ) &&
[ # # ]
108 : 0 : !IsShowHeaderFooterSeparator( Footer ) )
109 : : {
110 : 0 : bHeaderFooterEdit = false;
111 : : }
112 : :
113 : : // Repaint everything
114 : 0 : GetWin()->Invalidate();
115 : 0 : }
116 : :
117 : : //////////////////////////////////////////////////////////////////////////////
118 : : // #i72754# 2nd set of Pre/PostPaints
119 : : // This time it uses the lock counter (mPrePostPaintRegions empty/non-empty) to allow only one activation
120 : : // and deactivation and mpPrePostOutDev to remember the OutDev from the BeginDrawLayers
121 : : // call. That way, all places where paint take place can be handled the same way, even
122 : : // when calling other paint methods. This is the case at the places where SW paints
123 : : // buffered into VDevs to avoid flicker. Tis is in general problematic and should be
124 : : // solved once using the BufferedOutput functionality of the DrawView.
125 : :
126 : 11393 : void ViewShell::PrePaint()
127 : : {
128 : : // forward PrePaint event from VCL Window to DrawingLayer
129 [ + - ]: 11393 : if(HasDrawView())
130 : : {
131 : 11393 : Imp()->GetDrawView()->PrePaint();
132 : : }
133 : 11393 : }
134 : :
135 : 29218 : void ViewShell::DLPrePaint2(const Region& rRegion)
136 : : {
137 [ + + ]: 29218 : if(mPrePostPaintRegions.empty())
138 : : {
139 : 12432 : mPrePostPaintRegions.push( rRegion );
140 : : // #i75172# ensure DrawView to use DrawingLayer bufferings
141 [ - + ]: 12432 : if ( !HasDrawView() )
142 : 0 : MakeDrawView();
143 : :
144 : : // Prefer window; if tot available, get pOut (e.g. printer)
145 [ + + ]: 12432 : mpPrePostOutDev = (GetWin() ? GetWin() : GetOut());
146 : :
147 : : // #i74769# use SdrPaintWindow now direct
148 : 12432 : mpTargetPaintWindow = Imp()->GetDrawView()->BeginDrawLayers(mpPrePostOutDev, rRegion);
149 : : OSL_ENSURE(mpTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
150 : :
151 : : // #i74769# if prerender, save OutDev and redirect to PreRenderDevice
152 [ + + ]: 12432 : if(mpTargetPaintWindow->GetPreRenderDevice())
153 : : {
154 : 12413 : mpBufferedOut = pOut;
155 : 12413 : pOut = &(mpTargetPaintWindow->GetTargetOutputDevice());
156 : : }
157 : :
158 : : // remember original paint MapMode for wrapped FlyFrame paints
159 : 12432 : maPrePostMapMode = pOut->GetMapMode();
160 : : }
161 : : else
162 : : {
163 : : // region needs to be updated to the given one
164 [ + + ]: 16786 : if( mPrePostPaintRegions.top() != rRegion )
165 : 16502 : Imp()->GetDrawView()->UpdateDrawLayersRegion(mpPrePostOutDev, rRegion);
166 : 16786 : mPrePostPaintRegions.push( rRegion );
167 : : }
168 : 29218 : }
169 : :
170 : 29218 : void ViewShell::DLPostPaint2(bool bPaintFormLayer)
171 : : {
172 : : OSL_ENSURE(!mPrePostPaintRegions.empty(), "ViewShell::DLPostPaint2: Pre/PostPaint encapsulation broken (!)");
173 : :
174 [ + + ]: 29218 : if( mPrePostPaintRegions.size() > 1 )
175 : : {
176 [ + - ][ + - ]: 16786 : Region current = mPrePostPaintRegions.top();
177 [ + - ]: 16786 : mPrePostPaintRegions.pop();
178 [ + - ][ + - ]: 16786 : if( current != mPrePostPaintRegions.top())
[ + + ]
179 [ + - ][ + - ]: 16502 : Imp()->GetDrawView()->UpdateDrawLayersRegion(mpPrePostOutDev, mPrePostPaintRegions.top());
180 [ + - ]: 29218 : return;
181 : : }
182 : 12432 : mPrePostPaintRegions.pop(); // clear
183 [ + - ]: 12432 : if(0 != mpTargetPaintWindow)
184 : : {
185 : : // #i74769# restore buffered OutDev
186 [ + + ]: 12432 : if(mpTargetPaintWindow->GetPreRenderDevice())
187 : : {
188 : 12413 : pOut = mpBufferedOut;
189 : : }
190 : :
191 : : // #i74769# use SdrPaintWindow now direct
192 : 12432 : Imp()->GetDrawView()->EndDrawLayers(*mpTargetPaintWindow, bPaintFormLayer);
193 : 12432 : mpTargetPaintWindow = 0;
194 : : }
195 : : }
196 : :
197 : : //////////////////////////////////////////////////////////////////////////////
198 : :
199 : :
200 : 35760 : void ViewShell::ImplEndAction( const sal_Bool bIdleEnd )
201 : : {
202 : : // Nothing to do for the printer?
203 [ + - ][ - + ]: 35760 : if ( !GetWin() || IsPreView() )
[ - + ]
204 : : {
205 : 0 : bPaintWorks = sal_True;
206 [ # # ]: 0 : UISizeNotify();
207 : 35760 : return;
208 : : }
209 : :
210 : 35760 : bInEndAction = sal_True;
211 : : //Laeuft hiermit das EndAction der Letzten Shell im Ring?
212 : :
213 : 35760 : ViewShell::bLstAct = sal_True;
214 : 35760 : ViewShell *pSh = (ViewShell*)this->GetNext();
215 [ - + ]: 35760 : while ( pSh != this )
216 : : {
217 [ # # ]: 0 : if ( pSh->ActionPend() )
218 : : {
219 : 0 : ViewShell::bLstAct = sal_False;
220 : 0 : pSh = this;
221 : : }
222 : : else
223 : 0 : pSh = (ViewShell*)pSh->GetNext();
224 : : }
225 : :
226 [ + - ]: 35760 : const bool bIsShellForCheckViewLayout = ( this == GetLayout()->GetCurrShell() );
227 : :
228 [ + - ]: 35760 : SET_CURR_SHELL( this );
229 [ + - ][ + + ]: 35760 : if ( Imp()->HasDrawView() && !Imp()->GetDrawView()->areMarkHandlesHidden() )
[ + + ]
230 [ + - ]: 32806 : Imp()->StartAction();
231 : :
232 [ - + ][ # # ]: 35760 : if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() )
[ - + ]
233 [ # # ]: 0 : Imp()->DelRegion();
234 : :
235 [ + - ]: 35760 : const sal_Bool bExtraData = ::IsExtraData( GetDoc() );
236 : :
237 [ + + ]: 35760 : if ( !bIdleEnd )
238 : : {
239 [ + - ][ + - ]: 34458 : SwLayAction aAction( GetLayout(), Imp() );
240 : 34458 : aAction.SetComplete( sal_False );
241 [ + + ]: 34458 : if ( nLockPaint )
242 : 2954 : aAction.SetPaint( sal_False );
243 : 34458 : aAction.SetInputType( VCL_INPUT_KEYBOARD );
244 [ + - ][ + - ]: 34458 : aAction.Action();
245 : : }
246 : :
247 [ + - ]: 35760 : if ( bIsShellForCheckViewLayout )
248 [ + - ][ + - ]: 35760 : GetLayout()->CheckViewLayout( GetViewOptions(), &aVisArea );
249 : :
250 : : //Wenn wir selbst keine Paints erzeugen, so warten wir auf das Paint
251 : : //vom System. Dann ist das Clipping korrekt gesetzt; Beispiel: verschieben
252 : : //eines DrawObjektes.
253 [ + + ][ + + ]: 65084 : if ( Imp()->GetRegion() ||
[ + + ][ + + ]
254 [ + - ]: 29324 : aInvalidRect.HasArea() ||
255 : : bExtraData )
256 : : {
257 [ + + ]: 6829 : if ( !nLockPaint )
258 : : {
259 [ + - ]: 6827 : SolarMutexGuard aGuard;
260 : :
261 [ + - ]: 6827 : sal_Bool bPaintsFromSystem = aInvalidRect.HasArea();
262 [ + - ]: 6827 : GetWin()->Update();
263 [ + - ][ + + ]: 6827 : if ( aInvalidRect.HasArea() )
264 : : {
265 [ + + ]: 1695 : if ( bPaintsFromSystem )
266 [ + - ]: 426 : Imp()->AddPaintRect( aInvalidRect );
267 : :
268 : 1695 : ResetInvalidRect();
269 : 1695 : bPaintsFromSystem = sal_True;
270 : : }
271 : 6827 : bPaintWorks = sal_True;
272 : :
273 : 6827 : SwRegionRects *pRegion = Imp()->GetRegion();
274 : :
275 : : //JP 27.11.97: wer die Selection hided, muss sie aber auch
276 : : // wieder Showen. Sonst gibt es Paintfehler!
277 : : // z.B.: addional Mode, Seite vertikal hab zu sehen, in der
278 : : // Mitte eine Selektion und mit einem anderen Cursor an linken
279 : : // rechten Rand springen. Ohne ShowCrsr verschwindet die
280 : : // Selektion
281 [ + - ][ + - ]: 6827 : sal_Bool bShowCrsr = pRegion && IsA( TYPE(SwCrsrShell) );
[ + - ][ + + ]
282 [ + + ]: 6827 : if( bShowCrsr )
283 [ + - ]: 6823 : ((SwCrsrShell*)this)->HideCrsrs();
284 : :
285 [ + + ]: 6827 : if ( pRegion )
286 : : {
287 [ + - ]: 6823 : SwRootFrm* pCurrentLayout = GetLayout();
288 : :
289 : 6823 : Imp()->pRegion = NULL;
290 : :
291 : : //Erst Invert dann Compress, niemals andersherum!
292 [ + - ]: 6823 : pRegion->Invert();
293 : :
294 [ + - ]: 6823 : pRegion->Compress();
295 : :
296 : 6823 : VirtualDevice *pVout = 0;
297 [ + + ]: 14334 : while ( !pRegion->empty() )
298 : : {
299 [ + - ]: 7511 : SwRect aRect( pRegion->back() );
300 [ + - ]: 7511 : pRegion->pop_back();
301 : :
302 : 7511 : sal_Bool bPaint = sal_True;
303 [ + + ]: 7511 : if ( IsEndActionByVirDev() )
304 : : {
305 : : //virtuelles device erzeugen und einstellen.
306 [ + + ]: 5 : if ( !pVout )
307 [ + - ][ + - ]: 4 : pVout = new VirtualDevice( *GetOut() );
308 [ + - ]: 5 : MapMode aMapMode( GetOut()->GetMapMode() );
309 [ + - ]: 5 : pVout->SetMapMode( aMapMode );
310 : :
311 : 5 : sal_Bool bSizeOK = sal_True;
312 : :
313 [ + - ]: 5 : Rectangle aTmp1( aRect.SVRect() );
314 [ + - ]: 5 : aTmp1 = GetOut()->LogicToPixel( aTmp1 );
315 [ + - ]: 5 : Rectangle aTmp2( GetOut()->PixelToLogic( aTmp1 ) );
316 [ + + ]: 5 : if ( aTmp2.Left() > aRect.Left() )
317 : 1 : aTmp1.Left() = Max( 0L, aTmp1.Left() - 1L );
318 [ + + ]: 5 : if ( aTmp2.Top() > aRect.Top() )
319 : 4 : aTmp1.Top() = Max( 0L, aTmp1.Top() - 1L );
320 : 5 : aTmp1.Right() += 1;
321 : 5 : aTmp1.Bottom() += 1;
322 [ + - ]: 5 : aTmp1 = GetOut()->PixelToLogic( aTmp1 );
323 [ + - ]: 5 : aRect = SwRect( aTmp1 );
324 : :
325 [ + - ]: 5 : const Size aTmp( pVout->GetOutputSize() );
326 [ - + # # ]: 5 : if ( aTmp.Height() < aRect.Height() ||
[ + - ]
327 : 0 : aTmp.Width() < aRect.Width() )
328 : : {
329 [ + - ]: 5 : bSizeOK = pVout->SetOutputSize( aRect.SSize() );
330 : : }
331 [ + - ]: 5 : if ( bSizeOK )
332 : : {
333 : 5 : bPaint = sal_False;
334 : :
335 : : // --> OD 2007-07-26 #i79947#
336 : : // #i72754# start Pre/PostPaint encapsulation before pOut is changed to the buffering VDev
337 [ + - ][ + - ]: 5 : const Region aRepaintRegion(aRect.SVRect());
338 [ + - ]: 5 : DLPrePaint2(aRepaintRegion);
339 : : // <--
340 : :
341 : 5 : OutputDevice *pOld = GetOut();
342 [ + - ]: 5 : pVout->SetLineColor( pOld->GetLineColor() );
343 [ + - ]: 5 : pVout->SetFillColor( pOld->GetFillColor() );
344 : 5 : Point aOrigin( aRect.Pos() );
345 : 5 : aOrigin.X() = -aOrigin.X(); aOrigin.Y() = -aOrigin.Y();
346 [ + - ]: 5 : aMapMode.SetOrigin( aOrigin );
347 [ + - ]: 5 : pVout->SetMapMode( aMapMode );
348 : :
349 : 5 : pOut = pVout;
350 [ + - ]: 5 : if ( bPaintsFromSystem )
351 [ + - ]: 5 : PaintDesktop( aRect );
352 [ + - ]: 5 : pCurrentLayout->Paint( aRect );
353 : 5 : pOld->DrawOutDev( aRect.Pos(), aRect.SSize(),
354 [ + - ]: 10 : aRect.Pos(), aRect.SSize(), *pVout );
355 : 5 : pOut = pOld;
356 : :
357 : : // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted
358 [ + - ][ + - ]: 5 : DLPostPaint2(true);
359 [ + - ]: 5 : }
360 : : }
361 [ + + ]: 7511 : if ( bPaint )
362 : : {
363 : : // #i75172# begin DrawingLayer paint
364 : : // need to do begin/end DrawingLayer preparation for each single rectangle of the
365 : : // repaint region. I already tried to prepare only once for the whole Region. This
366 : : // seems to work (and does technically) but fails with transparent objects. Since the
367 : : // region given to BeginDarwLayers() defines the clip region for DrawingLayer paint,
368 : : // transparent objects in the single rectangles will indeed be painted multiple times.
369 [ + - ][ + - ]: 7506 : DLPrePaint2(Region(aRect.SVRect()));
[ + - ][ + - ]
370 : :
371 [ + + ]: 7506 : if ( bPaintsFromSystem )
372 [ + - ]: 2146 : PaintDesktop( aRect );
373 [ + - ]: 7506 : pCurrentLayout->Paint( aRect );
374 : :
375 : : // #i75172# end DrawingLayer paint
376 [ + - ]: 7506 : DLPostPaint2(true);
377 : : }
378 : :
379 : : // #i107365#
380 : : // Direct paint has been performed. Thus, take care of
381 : : // transparent child windows.
382 [ + - ]: 7511 : if ( GetWin() )
383 : : {
384 : 7511 : Window& rWindow = *(GetWin());
385 [ + - ][ + - ]: 7511 : if (rWindow.IsChildTransparentModeEnabled())
386 : : {
387 [ + - ]: 7511 : Window* pCandidate = rWindow.GetWindow( WINDOW_FIRSTCHILD );
388 [ + + ]: 7511 : if (pCandidate)
389 : : {
390 [ + - ][ + - ]: 447 : const Rectangle aRectanglePixel(rWindow.LogicToPixel(aRect.SVRect()));
391 : :
392 [ + + ]: 8127 : while (pCandidate)
393 : : {
394 [ + - ][ + + ]: 616 : if ( pCandidate->IsPaintTransparent() )
395 : : {
396 : : const Rectangle aCandidatePosSizePixel(
397 : 155 : pCandidate->GetPosPixel(),
398 [ + - ][ + - ]: 155 : pCandidate->GetSizePixel());
[ + - ]
399 : :
400 [ + - ][ + + ]: 155 : if ( aCandidatePosSizePixel.IsOver(aRectanglePixel) )
401 : : {
402 [ + - ]: 144 : pCandidate->Invalidate( INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN );
403 [ + - ]: 155 : pCandidate->Update();
404 : : }
405 : : }
406 : :
407 [ + - ]: 616 : pCandidate = pCandidate->GetWindow( WINDOW_NEXT );
408 : : }
409 : : }
410 : : }
411 : : }
412 : : }
413 : :
414 [ + + ][ + - ]: 6823 : delete pVout;
415 [ + - ]: 6823 : delete pRegion;
416 [ + - ]: 6823 : Imp()->DelRegion();
417 : : }
418 [ + + ]: 6827 : if( bShowCrsr )
419 [ + - ][ + - ]: 6827 : ((SwCrsrShell*)this)->ShowCrsrs( sal_True );
420 : : }
421 : : else
422 : : {
423 [ + - ]: 2 : Imp()->DelRegion();
424 : 2 : bPaintWorks = sal_True;
425 : : }
426 : : }
427 : : else
428 : 28931 : bPaintWorks = sal_True;
429 : :
430 : 35760 : bInEndAction = sal_False;
431 : 35760 : ViewShell::bLstAct = sal_False;
432 [ + - ]: 35760 : Imp()->EndAction();
433 : :
434 : :
435 : : //Damit sich die automatischen Scrollbars auch richtig anordnen k?nnen
436 : : //muessen wir die Aktion hier kuenstlich beenden (EndAction loesst ein
437 : : //Notify aus, und das muss Start-/EndAction rufen um die Scrollbars
438 : : //klarzubekommen.
439 : 35760 : --nStartAction;
440 [ + - ]: 35760 : UISizeNotify();
441 : 35760 : ++nStartAction;
442 : :
443 [ + + ]: 35760 : if( Imp()->IsAccessible() )
444 [ + - ][ + - ]: 35760 : Imp()->FireAccessibleEvents();
445 : : }
446 : :
447 : :
448 : 35760 : void ViewShell::ImplStartAction()
449 : : {
450 : 35760 : bPaintWorks = sal_False;
451 : 35760 : Imp()->StartAction();
452 : 35760 : }
453 : :
454 : :
455 : 3001 : void ViewShell::ImplLockPaint()
456 : : {
457 [ + - ][ + - ]: 3001 : if ( GetWin() && GetWin()->IsVisible() )
[ + - ]
458 : 3001 : GetWin()->EnablePaint( sal_False ); //Auch die Controls abklemmen.
459 : 3001 : Imp()->LockPaint();
460 : 3001 : }
461 : :
462 : :
463 : 3001 : void ViewShell::ImplUnlockPaint( sal_Bool bVirDev )
464 : : {
465 [ + - ]: 3001 : SET_CURR_SHELL( this );
466 [ + - ][ + - ]: 3001 : if ( GetWin() && GetWin()->IsVisible() )
[ + - ][ + - ]
467 : : {
468 [ + + ][ + + ]: 3001 : if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() )
[ + - ][ + - ]
[ + + ]
469 : : {
470 : : //Refresh mit virtuellem Device um das Flackern zu verhindern.
471 [ + - ][ + - ]: 60 : VirtualDevice *pVout = new VirtualDevice( *pOut );
472 [ + - ]: 60 : pVout->SetMapMode( pOut->GetMapMode() );
473 : 60 : Size aSize( VisArea().SSize() );
474 : 60 : aSize.Width() += 20;
475 : 60 : aSize.Height()+= 20;
476 [ + - ][ + - ]: 60 : if( pVout->SetOutputSize( aSize ) )
477 : : {
478 [ + - ]: 60 : GetWin()->EnablePaint( sal_True );
479 [ + - ]: 60 : GetWin()->Validate();
480 : :
481 [ + - ]: 60 : Imp()->UnlockPaint();
482 [ + - ]: 60 : pVout->SetLineColor( pOut->GetLineColor() );
483 [ + - ]: 60 : pVout->SetFillColor( pOut->GetFillColor() );
484 : :
485 : : // #i72754# start Pre/PostPaint encapsulation before pOut is changed to the buffering VDev
486 [ + - ][ + - ]: 60 : const Region aRepaintRegion(VisArea().SVRect());
487 [ + - ]: 60 : DLPrePaint2(aRepaintRegion);
488 : :
489 : 60 : OutputDevice *pOld = pOut;
490 : 60 : pOut = pVout;
491 [ + - ][ + - ]: 60 : Paint( VisArea().SVRect() );
492 : 60 : pOut = pOld;
493 : 60 : pOut->DrawOutDev( VisArea().Pos(), aSize,
494 [ + - ]: 120 : VisArea().Pos(), aSize, *pVout );
495 : :
496 : : // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted
497 [ + - ][ + - ]: 60 : DLPostPaint2(true);
498 : : }
499 : : else
500 : : {
501 [ # # ]: 0 : Imp()->UnlockPaint();
502 [ # # ]: 0 : GetWin()->EnablePaint( sal_True );
503 [ # # ]: 0 : GetWin()->Invalidate( INVALIDATE_CHILDREN );
504 : : }
505 [ + - ][ + - ]: 60 : delete pVout;
506 : : }
507 : : else
508 : : {
509 [ + - ]: 2941 : Imp()->UnlockPaint();
510 [ + - ]: 2941 : GetWin()->EnablePaint( sal_True );
511 [ + - ]: 2941 : GetWin()->Invalidate( INVALIDATE_CHILDREN );
512 : : }
513 : : }
514 : : else
515 [ # # ][ + - ]: 3001 : Imp()->UnlockPaint();
516 : 3001 : }
517 : :
518 : :
519 : 25476 : sal_Bool ViewShell::AddPaintRect( const SwRect & rRect )
520 : : {
521 : 25476 : sal_Bool bRet = sal_False;
522 : 25476 : ViewShell *pSh = this;
523 [ - + ]: 25476 : do
524 : : {
525 [ + - ]: 25476 : if( pSh->Imp() )
526 : : {
527 [ - + ][ # # ]: 25476 : if ( pSh->IsPreView() && pSh->GetWin() )
[ - + ]
528 : 0 : ::RepaintPagePreview( pSh, rRect );
529 : : else
530 : 25476 : bRet |= pSh->Imp()->AddPaintRect( rRect );
531 : : }
532 : 25476 : pSh = (ViewShell*)pSh->GetNext();
533 : : } while ( pSh != this );
534 : 25476 : return bRet;
535 : : }
536 : :
537 : :
538 : 4635 : void ViewShell::InvalidateWindows( const SwRect &rRect )
539 : : {
540 [ + + ]: 4635 : if ( !Imp()->IsCalcLayoutProgress() )
541 : : {
542 : 4487 : ViewShell *pSh = this;
543 [ - + ]: 4487 : do
544 : : {
545 [ + - ]: 4487 : if ( pSh->GetWin() )
546 : : {
547 [ - + ]: 4487 : if ( pSh->IsPreView() )
548 : 0 : ::RepaintPagePreview( pSh, rRect );
549 [ + + ]: 4487 : else if ( pSh->VisArea().IsOver( rRect ) )
550 [ + - ]: 3203 : pSh->GetWin()->Invalidate( rRect.SVRect() );
551 : : }
552 : 4487 : pSh = (ViewShell*)pSh->GetNext();
553 : :
554 : : } while ( pSh != this );
555 : : }
556 : 4635 : }
557 : :
558 : :
559 : 33662 : void ViewShell::MakeVisible( const SwRect &rRect )
560 : : {
561 [ + + ][ + + ]: 33662 : if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin(*this) )
[ - + ][ + + ]
562 : : {
563 [ + + ]: 4445 : if ( !IsViewLocked() )
564 : : {
565 [ + - ]: 763 : if( pWin )
566 : : {
567 : 763 : const SwFrm* pRoot = GetLayout();
568 : 763 : int nLoopCnt = 3;
569 : : long nOldH;
570 [ # # ][ - + ]: 763 : do{
[ - + ]
571 : 763 : nOldH = pRoot->Frm().Height();
572 : 763 : StartAction();
573 : 763 : ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX );
574 : 763 : EndAction();
575 : 763 : } while( nOldH != pRoot->Frm().Height() && nLoopCnt-- ); //swmod 071108//swmod 071225
576 : : }
577 : : #if OSL_DEBUG_LEVEL > 0
578 : : else
579 : : {
580 : : //MA: 04. Nov. 94, braucht doch keiner oder??
581 : : OSL_ENSURE( !this, "MakeVisible fuer Drucker wird doch gebraucht?" );
582 : : }
583 : :
584 : : #endif
585 : : }
586 : : }
587 : 33662 : }
588 : :
589 : :
590 : 29866 : Window* ViewShell::CareChildWin(ViewShell& rVSh)
591 : : {
592 [ + - ]: 29866 : if(rVSh.pSfxViewShell)
593 : : {
594 : 29866 : const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
595 : 29866 : SfxViewFrame* pVFrame = rVSh.pSfxViewShell->GetViewFrame();
596 : 29866 : const SfxChildWindow* pChWin = pVFrame->GetChildWindow( nId );
597 [ - + ]: 29866 : Window *pWin = pChWin ? pChWin->GetWindow() : NULL;
598 [ - + ][ # # ]: 29866 : if ( pWin && pWin->IsVisible() )
[ - + ]
599 : 0 : return pWin;
600 : : }
601 : 29866 : return NULL;
602 : : }
603 : :
604 : :
605 : 0 : Point ViewShell::GetPagePos( sal_uInt16 nPageNum ) const
606 : : {
607 : 0 : return GetLayout()->GetPagePos( nPageNum );
608 : : }
609 : :
610 : :
611 : 6687 : sal_uInt16 ViewShell::GetNumPages()
612 : : {
613 : : //Es kann sein, das noch kein Layout existiert weil die Methode vom
614 : : //Root-Ctor gerufen wird.
615 [ + - ]: 6687 : return GetLayout() ? GetLayout()->GetPageNum() : 0;
616 : : }
617 : :
618 : 0 : sal_Bool ViewShell::IsDummyPage( sal_uInt16 nPageNum ) const
619 : : {
620 [ # # ]: 0 : return GetLayout() ? GetLayout()->IsDummyPage( nPageNum ) : 0;
621 : : }
622 : :
623 : : /**
624 : : * Forces update of each field.
625 : : * It notifies all fields with pNewHt. If that is 0 (default), the field
626 : : * type is sent (???).
627 : : * @param[in] bCloseDB Passed in to GetDoc()->UpdateFlds. [TODO] Purpose???
628 : : */
629 : 0 : void ViewShell::UpdateFlds(sal_Bool bCloseDB)
630 : : {
631 [ # # ]: 0 : SET_CURR_SHELL( this );
632 : :
633 [ # # ][ # # ]: 0 : sal_Bool bCrsr = ISA(SwCrsrShell);
634 [ # # ]: 0 : if ( bCrsr )
635 [ # # ]: 0 : ((SwCrsrShell*)this)->StartAction();
636 : : else
637 [ # # ]: 0 : StartAction();
638 : :
639 [ # # ]: 0 : GetDoc()->UpdateFlds(0, bCloseDB);
640 : :
641 [ # # ]: 0 : if ( bCrsr )
642 [ # # ]: 0 : ((SwCrsrShell*)this)->EndAction();
643 : : else
644 [ # # ][ # # ]: 0 : EndAction();
645 : 0 : }
646 : :
647 : : /** update all charts for which any table exists */
648 : 0 : void ViewShell::UpdateAllCharts()
649 : : {
650 [ # # ]: 0 : SET_CURR_SHELL( this );
651 : : // Start-/EndAction handled in the SwDoc-Method!
652 [ # # ][ # # ]: 0 : GetDoc()->UpdateAllCharts();
653 : 0 : }
654 : :
655 : 0 : sal_Bool ViewShell::HasCharts() const
656 : : {
657 : 0 : sal_Bool bRet = sal_False;
658 : : const SwStartNode *pStNd;
659 [ # # ]: 0 : SwNodeIndex aIdx( *GetDoc()->GetNodes().GetEndOfAutotext().
660 [ # # ]: 0 : StartOfSectionNode(), 1 );
661 [ # # ]: 0 : while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
662 : : {
663 [ # # ]: 0 : aIdx++;
664 : 0 : const SwOLENode *pNd = aIdx.GetNode().GetOLENode();
665 [ # # ][ # # ]: 0 : if( pNd && pNd->GetChartTblName().Len() )
[ # # ]
666 : : {
667 : 0 : bRet = sal_True;
668 : 0 : break;
669 : : }
670 : : }
671 [ # # ]: 0 : return bRet;
672 : : }
673 : :
674 : :
675 : 4490 : void ViewShell::LayoutIdle()
676 : : {
677 : : #ifdef TCOVER
678 : : //fuer TCV-Version: Ende der Startphase des Programmes
679 : : TCovCall::Idle();
680 : : #endif
681 [ + - ][ + - : 13470 : if( !pOpt->IsIdle() || !GetWin() ||
+ - - + ]
[ + - ]
682 : 8980 : ( Imp()->HasDrawView() && Imp()->GetDrawView()->IsDragObj() ) )
683 : : return;
684 : :
685 : : //Kein Idle wenn gerade gedruckt wird.
686 : 4490 : ViewShell *pSh = this;
687 [ - + ]: 4490 : do
688 [ + - ]: 4490 : { if ( !pSh->GetWin() )
689 : : return;
690 : 4490 : pSh = (ViewShell*)pSh->GetNext();
691 : :
692 : : } while ( pSh != this );
693 : :
694 [ + - ]: 4490 : SET_CURR_SHELL( this );
695 : :
696 : : #ifdef DBG_UTIL
697 : : // Wenn Test5 gedrueckt ist, wird der IdleFormatierer abgeknipst.
698 : : if( pOpt->IsTest5() )
699 : : return;
700 : : #endif
701 : :
702 : : {
703 : : DBG_PROFSTART( LayoutIdle );
704 : :
705 : : //Cache vorbereiten und restaurieren, damit er nicht versaut wird.
706 : 4490 : SwSaveSetLRUOfst aSave( *SwTxtFrm::GetTxtCache(),
707 [ + - ]: 8980 : SwTxtFrm::GetTxtCache()->GetCurMax() - 50 );
708 : : // #125243# there are lots of stacktraces indicating that Imp() returns NULL
709 : : // this ViewShell seems to be invalid - but it's not clear why
710 : : // this return is only a workaround!
711 : : OSL_ENSURE(Imp(), "ViewShell already deleted?");
712 [ - + ]: 4490 : if(!Imp())
713 : : return;
714 [ + - ][ + - ]: 4490 : SwLayIdle aIdle( GetLayout(), Imp() );
715 [ + - ][ + - ]: 4490 : DBG_PROFSTOP( LayoutIdle );
716 [ + - ][ + - ]: 4490 : }
717 : : }
718 : :
719 : :
720 : 0 : void lcl_InvalidateAllCntnt( ViewShell& rSh, sal_uInt8 nInv )
721 : : {
722 : 0 : sal_Bool bCrsr = rSh.ISA(SwCrsrShell);
723 [ # # ]: 0 : if ( bCrsr )
724 : 0 : ((SwCrsrShell&)rSh).StartAction();
725 : : else
726 : 0 : rSh.StartAction();
727 : 0 : rSh.GetLayout()->InvalidateAllCntnt( nInv );
728 [ # # ]: 0 : if ( bCrsr )
729 : 0 : ((SwCrsrShell&)rSh).EndAction();
730 : : else
731 : 0 : rSh.EndAction();
732 : :
733 : 0 : rSh.GetDoc()->SetModified();
734 : 0 : }
735 : :
736 : : /** local method to invalidate/re-calculate positions of floating screen
737 : : * objects (Writer fly frame and drawing objects), which are anchored
738 : : * to paragraph or to character. #i11860#
739 : : */
740 : 0 : void lcl_InvalidateAllObjPos( ViewShell &_rSh )
741 : : {
742 : 0 : const bool bIsCrsrShell = _rSh.ISA(SwCrsrShell);
743 [ # # ]: 0 : if ( bIsCrsrShell )
744 : 0 : static_cast<SwCrsrShell&>(_rSh).StartAction();
745 : : else
746 : 0 : _rSh.StartAction();
747 : :
748 : 0 : _rSh.GetLayout()->InvalidateAllObjPos();
749 : :
750 [ # # ]: 0 : if ( bIsCrsrShell )
751 : 0 : static_cast<SwCrsrShell&>(_rSh).EndAction();
752 : : else
753 : 0 : _rSh.EndAction();
754 : :
755 : 0 : _rSh.GetDoc()->SetModified();
756 : 0 : }
757 : :
758 : 0 : void ViewShell::SetParaSpaceMax( bool bNew )
759 : : {
760 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
761 [ # # ]: 0 : if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) != bNew )
762 : : {
763 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
764 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::PARA_SPACE_MAX, bNew );
765 : 0 : const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION;
766 [ # # ][ # # ]: 0 : lcl_InvalidateAllCntnt( *this, nInv );
767 : : }
768 : 0 : }
769 : :
770 : 0 : void ViewShell::SetParaSpaceMaxAtPages( bool bNew )
771 : : {
772 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
773 [ # # ]: 0 : if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) != bNew )
774 : : {
775 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
776 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES, bNew );
777 : 0 : const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION;
778 [ # # ][ # # ]: 0 : lcl_InvalidateAllCntnt( *this, nInv );
779 : : }
780 : 0 : }
781 : :
782 : 0 : void ViewShell::SetTabCompat( bool bNew )
783 : : {
784 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
785 [ # # ]: 0 : if( pIDSA->get(IDocumentSettingAccess::TAB_COMPAT) != bNew )
786 : : {
787 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
788 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::TAB_COMPAT, bNew );
789 : 0 : const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
790 [ # # ][ # # ]: 0 : lcl_InvalidateAllCntnt( *this, nInv );
791 : : }
792 : 0 : }
793 : :
794 : 0 : void ViewShell::SetAddExtLeading( bool bNew )
795 : : {
796 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
797 [ # # ]: 0 : if ( pIDSA->get(IDocumentSettingAccess::ADD_EXT_LEADING) != bNew )
798 : : {
799 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
800 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::ADD_EXT_LEADING, bNew );
801 [ # # ][ # # ]: 0 : SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel();
802 [ # # ]: 0 : if ( pTmpDrawModel )
803 [ # # ]: 0 : pTmpDrawModel->SetAddExtLeading( bNew );
804 : 0 : const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
805 [ # # ][ # # ]: 0 : lcl_InvalidateAllCntnt( *this, nInv );
806 : : }
807 : 0 : }
808 : :
809 : 0 : void ViewShell::SetUseVirDev( bool bNewVirtual )
810 : : {
811 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
812 [ # # ]: 0 : if ( pIDSA->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) != bNewVirtual )
813 : : {
814 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
815 : : // this sets the flag at the document and calls PrtDataChanged
816 [ # # ]: 0 : IDocumentDeviceAccess* pIDDA = getIDocumentDeviceAccess();
817 [ # # ][ # # ]: 0 : pIDDA->setReferenceDeviceType( bNewVirtual, true );
818 : : }
819 : 0 : }
820 : :
821 : : /** Sets if paragraph and table spacing is added at bottom of table cells.
822 : : * #106629#
823 : : * @param[in] (bool) setting of the new value
824 : : */
825 : 0 : void ViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells )
826 : : {
827 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
828 [ # # ]: 0 : if ( pIDSA->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells )
829 : : {
830 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
831 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells );
832 : 0 : const sal_uInt8 nInv = INV_PRTAREA;
833 [ # # ][ # # ]: 0 : lcl_InvalidateAllCntnt( *this, nInv );
834 : : }
835 : 0 : }
836 : :
837 : : /**
838 : : * Sets if former formatting of text lines with proportional line spacing should used.
839 : : * #i11859#
840 : : * @param[in] (bool) setting of the new value
841 : : */
842 : 0 : void ViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing )
843 : : {
844 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
845 [ # # ]: 0 : if ( pIDSA->get(IDocumentSettingAccess::OLD_LINE_SPACING) != _bUseFormerLineSpacing )
846 : : {
847 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
848 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::OLD_LINE_SPACING, _bUseFormerLineSpacing );
849 : 0 : const sal_uInt8 nInv = INV_PRTAREA;
850 [ # # ][ # # ]: 0 : lcl_InvalidateAllCntnt( *this, nInv );
851 : : }
852 : 0 : }
853 : :
854 : :
855 : : /**
856 : : * Sets IDocumentSettingAccess if former object positioning should be used.
857 : : * #i11860#
858 : : * @param[in] (bool) setting the new value
859 : : */
860 : 0 : void ViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos )
861 : : {
862 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
863 [ # # ]: 0 : if ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos )
864 : : {
865 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
866 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::USE_FORMER_OBJECT_POS, _bUseFormerObjPos );
867 [ # # ][ # # ]: 0 : lcl_InvalidateAllObjPos( *this );
868 : : }
869 : 0 : }
870 : :
871 : :
872 : : // #i28701#
873 : 0 : void ViewShell::SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos )
874 : : {
875 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
876 [ # # ]: 0 : if ( pIDSA->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos )
877 : : {
878 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
879 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos );
880 [ # # ][ # # ]: 0 : lcl_InvalidateAllObjPos( *this );
881 : : }
882 : 0 : }
883 : :
884 : :
885 : 0 : void ViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping )
886 : : {
887 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
888 [ # # ]: 0 : if ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping )
889 : : {
890 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
891 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping );
892 : 0 : const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
893 [ # # ][ # # ]: 0 : lcl_InvalidateAllCntnt( *this, nInv );
894 : : }
895 : 0 : }
896 : :
897 : :
898 : : // #i45491#
899 : 0 : void ViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWithManualBreak )
900 : : {
901 : 0 : IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess();
902 [ # # ]: 0 : if ( pIDSA->get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak )
903 : : {
904 [ # # ]: 0 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
905 [ # # ]: 0 : pIDSA->set(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak );
906 : 0 : const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
907 [ # # ][ # # ]: 0 : lcl_InvalidateAllCntnt( *this, nInv );
908 : : }
909 : 0 : }
910 : :
911 : :
912 : 26 : void ViewShell::Reformat()
913 : : {
914 [ + - ]: 26 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
915 : :
916 : : // Wir gehen auf Nummer sicher:
917 : : // Wir muessen die alten Fontinformationen wegschmeissen,
918 : : // wenn die Druckeraufloesung oder der Zoomfaktor sich aendert.
919 : : // Init() und Reformat() sind die sichersten Stellen.
920 : : #ifdef FNTMET
921 : : aFntMetList.Flush();
922 : : #else
923 [ + - ]: 26 : pFntCache->Flush( );
924 : : #endif
925 : :
926 [ + - ][ + - ]: 26 : if( GetLayout()->IsCallbackActionEnabled() )
927 : : {
928 : :
929 [ + - ]: 26 : StartAction();
930 [ + - ][ + - ]: 26 : GetLayout()->InvalidateAllCntnt( INV_SIZE | INV_POS | INV_PRTAREA );
931 [ + - ]: 26 : EndAction();
932 [ + - ]: 26 : }
933 : 26 : }
934 : :
935 : 0 : void ViewShell::ChgNumberDigits()
936 : : {
937 : 0 : SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel();
938 [ # # ]: 0 : if ( pTmpDrawModel )
939 : 0 : pTmpDrawModel->ReformatAllTextObjects();
940 : 0 : Reformat();
941 : 0 : }
942 : :
943 : :
944 : 148 : void ViewShell::CalcLayout()
945 : : {
946 [ + - ]: 148 : SET_CURR_SHELL( this );
947 [ + - ]: 148 : SwWait aWait( *GetDoc()->GetDocShell(), sal_True );
948 : :
949 : : //Cache vorbereiten und restaurieren, damit er nicht versaut wird.
950 : 148 : SwSaveSetLRUOfst aSaveLRU( *SwTxtFrm::GetTxtCache(),
951 [ + - ]: 296 : SwTxtFrm::GetTxtCache()->GetCurMax() - 50 );
952 : :
953 : : //Progress einschalten wenn noch keiner Lauft.
954 [ + - ]: 148 : const sal_Bool bEndProgress = SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) == 0;
955 [ + - ]: 148 : if ( bEndProgress )
956 : : {
957 [ + - ]: 148 : sal_uInt16 nEndPage = GetLayout()->GetPageNum();
958 : 148 : nEndPage += nEndPage * 10 / 100;
959 [ + - ]: 148 : ::StartProgress( STR_STATSTR_REFORMAT, 0, nEndPage, GetDoc()->GetDocShell() );
960 : : }
961 : :
962 [ + - ][ + - ]: 148 : SwLayAction aAction( GetLayout(), Imp() );
963 : 148 : aAction.SetPaint( sal_False );
964 [ + - ]: 148 : aAction.SetStatBar( sal_True );
965 : 148 : aAction.SetCalcLayout( sal_True );
966 : 148 : aAction.SetReschedule( sal_True );
967 [ + - ]: 148 : GetDoc()->LockExpFlds();
968 [ + - ]: 148 : aAction.Action();
969 [ + - ]: 148 : GetDoc()->UnlockExpFlds();
970 : :
971 : : //Das SetNewFldLst() am Doc wurde unterbunden und muss nachgeholt
972 : : //werden (siehe flowfrm.cxx, txtfld.cxx)
973 [ - + ]: 148 : if ( aAction.IsExpFlds() )
974 : : {
975 [ # # ]: 0 : aAction.Reset();
976 : 0 : aAction.SetPaint( sal_False );
977 [ # # ]: 0 : aAction.SetStatBar( sal_True );
978 : 0 : aAction.SetReschedule( sal_True );
979 : :
980 [ # # ]: 0 : SwDocPosUpdate aMsgHnt( 0 );
981 [ # # ]: 0 : GetDoc()->UpdatePageFlds( &aMsgHnt );
982 [ # # ]: 0 : GetDoc()->UpdateExpFlds(NULL, true);
983 : :
984 [ # # ][ # # ]: 0 : aAction.Action();
985 : : }
986 : :
987 [ + - ][ + - ]: 148 : if ( VisArea().HasArea() )
988 [ + - ]: 148 : InvalidateWindows( VisArea() );
989 [ + - ]: 148 : if ( bEndProgress )
990 [ + - ][ + - ]: 148 : ::EndProgress( GetDoc()->GetDocShell() );
[ + - ][ + - ]
991 : 148 : }
992 : :
993 : :
994 : 5645 : void ViewShell::SetFirstVisPageInvalid()
995 : : {
996 : 5645 : ViewShell *pSh = this;
997 [ - + ]: 5645 : do
998 : : {
999 [ + - ]: 5645 : if ( pSh->Imp() )
1000 : 5645 : pSh->Imp()->SetFirstVisPageInvalid();
1001 : 5645 : pSh = (ViewShell*)pSh->GetNext();
1002 : :
1003 : : } while ( pSh != this );
1004 : 5645 : }
1005 : :
1006 : :
1007 : 2883 : void ViewShell::SizeChgNotify()
1008 : : {
1009 [ + + ]: 2883 : if ( !pWin )
1010 : 19 : bDocSizeChgd = sal_True;
1011 [ + + ][ + - ]: 2864 : else if( ActionPend() || Imp()->IsCalcLayoutProgress() || bPaintInProgress )
[ - + ][ + + ]
1012 : : {
1013 : 156 : bDocSizeChgd = sal_True;
1014 : :
1015 [ + - ][ + - ]: 156 : if ( !Imp()->IsCalcLayoutProgress() && ISA( SwCrsrShell ) )
[ + - ]
1016 : : {
1017 : 156 : const SwFrm *pCnt = ((SwCrsrShell*)this)->GetCurrFrm( sal_False );
1018 : : const SwPageFrm *pPage;
1019 [ + - ][ + - ]: 156 : if ( pCnt && 0 != (pPage = pCnt->FindPageFrm()) )
[ + - ]
1020 : : {
1021 [ + - ]: 156 : sal_uInt16 nVirtNum = pPage->GetVirtPageNum();
1022 : 156 : const SvxNumberType& rNum = pPage->GetPageDesc()->GetNumType();
1023 [ + - ]: 156 : String sDisplay = rNum.GetNumStr( nVirtNum );
1024 [ + - ][ + - ]: 156 : PageNumNotify( this, pCnt->GetPhyPageNum(), nVirtNum, sDisplay );
[ + - ][ + - ]
1025 : : }
1026 : : }
1027 : : }
1028 : : else
1029 : : {
1030 : 2708 : bDocSizeChgd = sal_False;
1031 [ + - ]: 2708 : ::SizeNotify( this, GetDocSize() );
1032 : : }
1033 : 2883 : }
1034 : :
1035 : :
1036 : 2591 : void ViewShell::VisPortChgd( const SwRect &rRect)
1037 : : {
1038 : : OSL_ENSURE( GetWin(), "VisPortChgd ohne Window." );
1039 : :
1040 [ + - ]: 2591 : if ( rRect == VisArea() )
1041 : : return;
1042 : :
1043 : : #if OSL_DEBUG_LEVEL > 1
1044 : : if ( bInEndAction )
1045 : : {
1046 : : //Da Rescheduled doch schon wieder irgendwo einer?
1047 : : OSL_ENSURE( !this, "Scroll waehrend einer EndAction." );
1048 : : }
1049 : : #endif
1050 : :
1051 : : //Ersteinmal die alte sichtbare Seite holen, dann braucht nacher nicht
1052 : : //lange gesucht werden.
1053 [ + - ]: 2591 : const SwFrm *pOldPage = Imp()->GetFirstVisPage();
1054 : :
1055 : 2591 : const SwRect aPrevArea( VisArea() );
1056 : 2591 : const sal_Bool bFull = aPrevArea.IsEmpty();
1057 : 2591 : aVisArea = rRect;
1058 [ + - ]: 2591 : SetFirstVisPageInvalid();
1059 : :
1060 : : //Wenn noch eine PaintRegion herumsteht und sich die VisArea geaendert hat,
1061 : : //so ist die PaintRegion spaetestens jetzt obsolete. Die PaintRegion kann
1062 : : //vom RootFrm::Paint erzeugt worden sein.
1063 [ + - - + : 5182 : if ( !bInEndAction &&
# # ][ - + ]
1064 : 2591 : Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea() )
1065 [ # # ]: 0 : Imp()->DelRegion();
1066 : :
1067 [ + - ]: 2591 : SET_CURR_SHELL( this );
1068 : :
1069 : 2591 : bool bScrolled = false;
1070 : :
1071 [ + - ]: 2591 : SwPostItMgr* pPostItMgr = GetPostItMgr();
1072 : :
1073 [ + + ]: 2591 : if ( bFull )
1074 [ + - ]: 1295 : GetWin()->Invalidate();
1075 : : else
1076 : : {
1077 : : // Betrag ausrechnen, um den gescrolled werden muss.
1078 : 1296 : const long nXDiff = aPrevArea.Left() - VisArea().Left();
1079 : 1296 : const long nYDiff = aPrevArea.Top() - VisArea().Top();
1080 : :
1081 [ + + + - : 3818 : if( !nXDiff && !GetViewOptions()->getBrowseMode() &&
+ - ][ + + ]
[ + + ]
1082 : 2522 : (!Imp()->HasDrawView() || !Imp()->GetDrawView()->IsGridVisible() ) )
1083 : : {
1084 : : //Falls moeglich die Wiese nicht mit Scrollen.
1085 : : //Also linke und rechte Kante des Scrollbereiches auf die
1086 : : //Seiten begrenzen.
1087 [ + - ]: 1261 : const SwPageFrm *pPage = (SwPageFrm*)GetLayout()->Lower(); //swmod 071108//swmod 071225
1088 [ - + ]: 1261 : if ( pPage->Frm().Top() > pOldPage->Frm().Top() )
1089 : 0 : pPage = (SwPageFrm*)pOldPage;
1090 : 1261 : SwRect aBoth( VisArea() );
1091 [ + - ]: 1261 : aBoth.Union( aPrevArea );
1092 : 1261 : const SwTwips nBottom = aBoth.Bottom();
1093 : 1261 : SwTwips nMinLeft = LONG_MAX;
1094 : 1261 : SwTwips nMaxRight= 0;
1095 : :
1096 : 1261 : const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
1097 : :
1098 [ + + ][ + + ]: 2794 : while ( pPage && pPage->Frm().Top() <= nBottom )
[ + + ]
1099 : : {
1100 [ + - ]: 1533 : SwRect aPageRect( pPage->GetBoundRect() );
1101 [ - + ]: 1533 : if ( bBookMode )
1102 : : {
1103 [ # # ]: 0 : const SwPageFrm& rFormatPage = static_cast<const SwPageFrm*>(pPage)->GetFormatPage();
1104 [ # # ]: 0 : aPageRect.SSize() = rFormatPage.GetBoundRect().SSize();
1105 : : }
1106 : :
1107 : : // OD 12.02.2003 #i9719#, #105645# - consider new border
1108 : : // and shadow width
1109 [ + - ][ + + ]: 1533 : if ( aPageRect.IsOver( aBoth ) )
1110 : : {
1111 : 1353 : SwTwips nPageLeft = 0;
1112 : 1353 : SwTwips nPageRight = 0;
1113 [ + - ]: 1353 : const sw::sidebarwindows::SidebarPosition aSidebarPos = pPage->SidebarPosition();
1114 : :
1115 [ + - ]: 1353 : if( aSidebarPos != sw::sidebarwindows::SIDEBAR_NONE )
1116 : : {
1117 : 1353 : nPageLeft = aPageRect.Left();
1118 : 1353 : nPageRight = aPageRect.Right();
1119 : : }
1120 : :
1121 [ + + ]: 1353 : if( nPageLeft < nMinLeft )
1122 : 1261 : nMinLeft = nPageLeft;
1123 [ + + ]: 1353 : if( nPageRight > nMaxRight )
1124 : 1279 : nMaxRight = nPageRight;
1125 : : //Zus. auf die Zeichenobjekte abgleichen.
1126 : : //Einen Ofst beruecksichtigen, weil die Objekte u.U.
1127 : : //selektiert sind und die Henkel dann hinausstehen.
1128 [ + + ]: 1353 : if ( pPage->GetSortedObjs() )
1129 : : {
1130 : : const long nOfst = GetOut()->PixelToLogic(
1131 [ + - ][ + - ]: 123 : Size(Imp()->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width();
1132 [ + + ]: 684 : for ( sal_uInt16 i = 0;
1133 [ + - ]: 342 : i < pPage->GetSortedObjs()->Count(); ++i )
1134 : : {
1135 [ + - ]: 219 : SwAnchoredObject* pObj = (*pPage->GetSortedObjs())[i];
1136 : : // ignore objects that are not actually placed on the page
1137 [ + - ][ + - ]: 219 : if (pObj->IsFormatPossible())
1138 : : {
1139 [ + - ][ + - ]: 219 : const Rectangle &rBound = pObj->GetObjRect().SVRect();
1140 : : // OD 03.03.2003 #107927# - use correct datatype
1141 : 219 : const SwTwips nL = Max( 0L, rBound.Left() - nOfst );
1142 [ - + ]: 219 : if ( nL < nMinLeft )
1143 : 0 : nMinLeft = nL;
1144 [ + + ]: 219 : if( rBound.Right() + nOfst > nMaxRight )
1145 : 6 : nMaxRight = rBound.Right() + nOfst;
1146 : : }
1147 : : }
1148 : : }
1149 : : }
1150 : 1533 : pPage = (SwPageFrm*)pPage->GetNext();
1151 : : }
1152 [ + - ]: 1261 : Rectangle aRect( aPrevArea.SVRect() );
1153 : 1261 : aRect.Left() = nMinLeft;
1154 : 1261 : aRect.Right() = nMaxRight;
1155 [ + + ][ + + ]: 1261 : if( VisArea().IsOver( aPrevArea ) && !nLockPaint )
[ + + ][ + - ]
1156 : : {
1157 : 357 : bScrolled = true;
1158 : 357 : aVisArea.Pos() = aPrevArea.Pos();
1159 [ + - ][ + - ]: 357 : if ( SmoothScroll( nXDiff, nYDiff, &aRect ) )
1160 : : return;
1161 : 357 : aVisArea.Pos() = rRect.Pos();
1162 : : }
1163 : : else
1164 [ + - ]: 1261 : GetWin()->Invalidate( aRect );
1165 : : }
1166 [ + + ]: 35 : else if ( !nLockPaint ) //Wird im UnLock erledigt
1167 : : {
1168 [ + - ][ + + ]: 11 : if( VisArea().IsOver( aPrevArea ) )
1169 : : {
1170 : 5 : bScrolled = true;
1171 : 5 : aVisArea.Pos() = aPrevArea.Pos();
1172 [ - + ][ + - ]: 5 : if ( SmoothScroll( nXDiff, nYDiff, 0 ) )
1173 : : return;
1174 : 5 : aVisArea.Pos() = rRect.Pos();
1175 : : }
1176 : : else
1177 [ + - ]: 6 : GetWin()->Invalidate();
1178 : : }
1179 : : }
1180 : :
1181 : 2591 : Point aPt( VisArea().Pos() );
1182 : 2591 : aPt.X() = -aPt.X(); aPt.Y() = -aPt.Y();
1183 [ + - ]: 2591 : MapMode aMapMode( GetWin()->GetMapMode() );
1184 [ + - ]: 2591 : aMapMode.SetOrigin( aPt );
1185 [ + - ]: 2591 : GetWin()->SetMapMode( aMapMode );
1186 [ + - ][ + - ]: 2591 : if ( HasDrawView() )
1187 : : {
1188 [ + - ]: 2591 : Imp()->GetDrawView()->VisAreaChanged( GetWin() );
1189 [ + - ]: 2591 : Imp()->GetDrawView()->SetActualWin( GetWin() );
1190 : : }
1191 [ + - ]: 2591 : GetWin()->Update();
1192 : :
1193 : : // --> OD 2010-02-11 #i88070#
1194 [ + - ]: 2591 : if ( pPostItMgr )
1195 : : {
1196 [ + - ]: 2591 : pPostItMgr->Rescale();
1197 [ + - ]: 2591 : pPostItMgr->CalcRects();
1198 [ + - ]: 2591 : pPostItMgr->LayoutPostIts();
1199 : : }
1200 : : // <--
1201 : :
1202 [ + + ][ + - ]: 2591 : if ( !bScrolled && pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
[ + - ][ + + ]
[ + - ][ + - ]
[ + + ]
1203 [ + - ]: 42 : pPostItMgr->CorrectPositions();
1204 : :
1205 [ + + ]: 2591 : if( Imp()->IsAccessible() )
1206 [ + - ][ + - ]: 2591 : Imp()->UpdateAccessible();
[ + - ][ + - ]
1207 : :
1208 : : }
1209 : :
1210 : :
1211 : 362 : sal_Bool ViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect )
1212 : : {
1213 : 362 : const sal_uLong nColCnt = pOut->GetColorCount();
1214 : 362 : long lMult = 1, lMax = LONG_MAX;
1215 [ - + ]: 362 : if ( nColCnt == 65536 )
1216 : : {
1217 : 0 : lMax = 7000;
1218 : 0 : lMult = 2;
1219 : : }
1220 [ + - ]: 362 : if ( nColCnt == 16777216 )
1221 : : {
1222 : 362 : lMax = 5000;
1223 : 362 : lMult = 6;
1224 : : }
1225 [ # # ]: 0 : else if ( nColCnt == 1 )
1226 : : {
1227 : 0 : lMax = 3000;
1228 : 0 : lMult = 12;
1229 : : }
1230 : :
1231 : : // #i75172# isolated static conditions
1232 [ + + ][ + + ]: 362 : const bool bOnlyYScroll(!lXDiff && Abs(lYDiff) != 0 && Abs(lYDiff) < lMax);
[ + + ]
1233 [ + - ]: 362 : const bool bAllowedWithChildWindows(GetWin()->GetWindowClipRegionPixel(WINDOW_GETCLIPREGION_NOCHILDREN|WINDOW_GETCLIPREGION_NULL).IsNull());
1234 : : // --> OD 2009-08-12 #i98766# - disable smooth scrolling for Mac port builds
1235 : : #ifdef QUARTZ
1236 : : const bool bSmoothScrollAllowed(false);
1237 : : (void) bOnlyYScroll;
1238 : : (void) bAllowedWithChildWindows;
1239 : : #else
1240 [ + - ][ - + ]: 362 : const bool bSmoothScrollAllowed(bOnlyYScroll && bEnableSmooth && GetViewOptions()->IsSmoothScroll() && bAllowedWithChildWindows);
[ # # ][ + + ]
1241 : : #endif
1242 : : // <-
1243 : 362 : const bool bIAmCursorShell(ISA(SwCrsrShell));
1244 : : (void) bIAmCursorShell;
1245 : :
1246 : : // #i75172# with selection on overlay, smooth scroll should be allowed with it
1247 : 362 : const bool bAllowedForSelection(true || (bIAmCursorShell && !((SwCrsrShell*)this)->HasSelection()));
1248 : :
1249 : : // #i75172# with cursors on overlay, smooth scroll should be allowed with it
1250 : 362 : const bool bAllowedForMultipleCursors(true || (bIAmCursorShell && ((SwCrsrShell*)this)->GetCrsrCnt() < 2));
1251 : :
1252 [ - + ]: 362 : if(bSmoothScrollAllowed && bAllowedForSelection && bAllowedForMultipleCursors)
1253 : : {
1254 : 0 : Imp()->bStopSmooth = sal_False;
1255 : :
1256 : 0 : const SwRect aOldVis( VisArea() );
1257 : :
1258 : : //Virtuelles Device erzeugen und einstellen.
1259 [ # # ]: 0 : const Size aPixSz = GetWin()->PixelToLogic(Size(1,1));
1260 [ # # ][ # # ]: 0 : VirtualDevice *pVout = new VirtualDevice( *GetWin() );
1261 [ # # ]: 0 : pVout->SetLineColor( GetWin()->GetLineColor() );
1262 [ # # ]: 0 : pVout->SetFillColor( GetWin()->GetFillColor() );
1263 [ # # ]: 0 : MapMode aMapMode( GetWin()->GetMapMode() );
1264 [ # # ]: 0 : pVout->SetMapMode( aMapMode );
1265 : 0 : Size aSize( aVisArea.Width()+2*aPixSz.Width(), Abs(lYDiff)+(2*aPixSz.Height()) );
1266 [ # # ]: 0 : if ( pRect )
1267 [ # # ]: 0 : aSize.Width() = Min(aSize.Width(), pRect->GetWidth()+2*aPixSz.Width());
1268 [ # # ][ # # ]: 0 : if ( pVout->SetOutputSize( aSize ) )
1269 : : {
1270 : 0 : nLockPaint++;
1271 : :
1272 : : //Ersteinmal alles neue in das VirDev Painten.
1273 : 0 : SwRect aRect( VisArea() );
1274 : 0 : aRect.Height( aSize.Height() );
1275 [ # # ]: 0 : if ( pRect )
1276 : : {
1277 : 0 : aRect.Pos().X() = Max(aRect.Left(),pRect->Left()-aPixSz.Width());
1278 : 0 : aRect.Right( Min(aRect.Right()+2*aPixSz.Width(), pRect->Right()+aPixSz.Width()));
1279 : : }
1280 : : else
1281 : 0 : aRect.SSize().Width() += 2*aPixSz.Width();
1282 : 0 : aRect.Pos().Y() = lYDiff < 0 ? aOldVis.Bottom() - aPixSz.Height()
1283 [ # # ]: 0 : : aRect.Top() - aSize.Height() + aPixSz.Height();
1284 : 0 : aRect.Pos().X() = Max( 0L, aRect.Left()-aPixSz.Width() );
1285 [ # # ][ # # ]: 0 : aRect.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.Pos()));
1286 [ # # ][ # # ]: 0 : aRect.SSize()= GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.SSize()));
1287 : 0 : aVisArea = aRect;
1288 : 0 : const Point aPt( -aRect.Left(), -aRect.Top() );
1289 [ # # ]: 0 : aMapMode.SetOrigin( aPt );
1290 [ # # ]: 0 : pVout->SetMapMode( aMapMode );
1291 : 0 : OutputDevice *pOld = pOut;
1292 : 0 : pOut = pVout;
1293 : :
1294 : : {
1295 : : // #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the
1296 : : // repaint would not be correct since it would use the wrong DrawPage visible region.
1297 : : // This repaint IS about painting something currently outside the visible part (!).
1298 : : // For that purpose, AddWindowToPaintView is used which creates a new SdrPageViewWindow
1299 : : // and all the necessary stuff. It's not cheap, but necessary here. Alone because repaint
1300 : : // target really is NOT the current window.
1301 : : // Also will automatically NOT use PreRendering and overlay (since target is VirtualDevice)
1302 [ # # ][ # # ]: 0 : if(!HasDrawView())
1303 [ # # ]: 0 : MakeDrawView();
1304 [ # # ]: 0 : SdrView* pDrawView = GetDrawView();
1305 [ # # ]: 0 : pDrawView->AddWindowToPaintView(pVout);
1306 : :
1307 : : // clear pWin during DLPrePaint2 to get paint preparation for pOut, but set it again
1308 : : // immediately afterwards. There are many decisions in SW which imply that Printing
1309 : : // is used when pWin == 0 (wrong but widely used).
1310 : 0 : Window* pOldWin = pWin;
1311 : 0 : pWin = 0;
1312 [ # # ][ # # ]: 0 : DLPrePaint2(Region(aRect.SVRect()));
[ # # ][ # # ]
1313 : 0 : pWin = pOldWin;
1314 : :
1315 : : // SW paint stuff
1316 [ # # ]: 0 : PaintDesktop( aRect );
1317 : 0 : ViewShell::bLstAct = sal_True;
1318 [ # # ][ # # ]: 0 : GetLayout()->Paint( aRect );
1319 : 0 : ViewShell::bLstAct = sal_False;
1320 : :
1321 : : // end paint and destroy ObjectContact again
1322 [ # # ]: 0 : DLPostPaint2(true);
1323 [ # # ]: 0 : pDrawView->DeleteWindowFromPaintView(pVout);
1324 : : }
1325 : :
1326 : 0 : pOut = pOld;
1327 : 0 : aVisArea = aOldVis;
1328 : :
1329 : : //Jetzt Stueckchenweise schieben und die neuen Pixel aus dem
1330 : : //VirDev kopieren.
1331 : :
1332 : : // ??????????????????????
1333 : : // or is it better to get the scrollfactor from the User
1334 : : // as option?
1335 : : // ??????????????????????
1336 : 0 : long lMaDelta = aPixSz.Height();
1337 [ # # ]: 0 : if ( Abs(lYDiff) > ( aVisArea.Height() / 3 ) )
1338 : 0 : lMaDelta *= 6;
1339 : : else
1340 : 0 : lMaDelta *= 2;
1341 : :
1342 : 0 : lMaDelta *= lMult;
1343 : :
1344 [ # # ]: 0 : if ( lYDiff < 0 )
1345 : 0 : lMaDelta = -lMaDelta;
1346 : :
1347 : 0 : long lDiff = lYDiff;
1348 [ # # ]: 0 : while ( lDiff )
1349 : : {
1350 : : long lScroll;
1351 [ # # ][ # # ]: 0 : if ( Imp()->bStopSmooth || Abs(lDiff) <= Abs(lMaDelta) )
[ # # ]
1352 : : {
1353 : 0 : lScroll = lDiff;
1354 : 0 : lDiff = 0;
1355 : : }
1356 : : else
1357 : : {
1358 : 0 : lScroll = lMaDelta;
1359 : 0 : lDiff -= lMaDelta;
1360 : : }
1361 : :
1362 : 0 : const SwRect aTmpOldVis = VisArea();
1363 : 0 : aVisArea.Pos().Y() -= lScroll;
1364 [ # # ][ # # ]: 0 : aVisArea.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( VisArea().Pos()));
1365 : 0 : lScroll = aTmpOldVis.Top() - VisArea().Top();
1366 [ # # ]: 0 : if ( pRect )
1367 : : {
1368 [ # # ]: 0 : Rectangle aTmp( aTmpOldVis.SVRect() );
1369 : 0 : aTmp.Left() = pRect->Left();
1370 : 0 : aTmp.Right()= pRect->Right();
1371 [ # # ]: 0 : GetWin()->Scroll( 0, lScroll, aTmp, SCROLL_CHILDREN);
1372 : : }
1373 : : else
1374 [ # # ]: 0 : GetWin()->Scroll( 0, lScroll, SCROLL_CHILDREN );
1375 : :
1376 : 0 : const Point aTmpPt( -VisArea().Left(), -VisArea().Top() );
1377 [ # # ]: 0 : MapMode aTmpMapMode( GetWin()->GetMapMode() );
1378 [ # # ]: 0 : aTmpMapMode.SetOrigin( aTmpPt );
1379 [ # # ]: 0 : GetWin()->SetMapMode( aTmpMapMode );
1380 : :
1381 [ # # ]: 0 : if ( Imp()->HasDrawView() )
1382 [ # # ]: 0 : Imp()->GetDrawView()->VisAreaChanged( GetWin() );
1383 : :
1384 [ # # ]: 0 : SetFirstVisPageInvalid();
1385 [ # # ]: 0 : if ( !Imp()->bStopSmooth )
1386 : : {
1387 : 0 : const bool bScrollDirectionIsUp(lScroll > 0);
1388 : 0 : Imp()->aSmoothRect = VisArea();
1389 : :
1390 [ # # ]: 0 : if(bScrollDirectionIsUp)
1391 : : {
1392 : 0 : Imp()->aSmoothRect.Bottom( VisArea().Top() + lScroll + aPixSz.Height());
1393 : : }
1394 : : else
1395 : : {
1396 : 0 : Imp()->aSmoothRect.Top( VisArea().Bottom() + lScroll - aPixSz.Height());
1397 : : }
1398 : :
1399 : 0 : Imp()->bSmoothUpdate = sal_True;
1400 [ # # ]: 0 : GetWin()->Update();
1401 : 0 : Imp()->bSmoothUpdate = sal_False;
1402 : :
1403 [ # # ]: 0 : if(!Imp()->bStopSmooth)
1404 : : {
1405 : : // start paint on logic base
1406 [ # # ]: 0 : const Rectangle aTargetLogic(Imp()->aSmoothRect.SVRect());
1407 [ # # ][ # # ]: 0 : DLPrePaint2(Region(aTargetLogic));
[ # # ]
1408 : :
1409 : : // get target rectangle in discrete pixels
1410 : 0 : OutputDevice& rTargetDevice = mpTargetPaintWindow->GetTargetOutputDevice();
1411 [ # # ]: 0 : const Rectangle aTargetPixel(rTargetDevice.LogicToPixel(aTargetLogic));
1412 : :
1413 : : // get source top-left in discrete pixels
1414 [ # # ]: 0 : const Point aSourceTopLeft(pVout->LogicToPixel(aTargetLogic.TopLeft()));
1415 : :
1416 : : // switch off MapModes
1417 : 0 : const bool bMapModeWasEnabledDest(rTargetDevice.IsMapModeEnabled());
1418 : 0 : const bool bMapModeWasEnabledSource(pVout->IsMapModeEnabled());
1419 [ # # ]: 0 : rTargetDevice.EnableMapMode(false);
1420 [ # # ]: 0 : pVout->EnableMapMode(false);
1421 : :
1422 : : rTargetDevice.DrawOutDev(
1423 : : aTargetPixel.TopLeft(), aTargetPixel.GetSize(), // dest
1424 : : aSourceTopLeft, aTargetPixel.GetSize(), // source
1425 [ # # ][ # # ]: 0 : *pVout);
[ # # ]
1426 : :
1427 : : // restore MapModes
1428 [ # # ]: 0 : rTargetDevice.EnableMapMode(bMapModeWasEnabledDest);
1429 [ # # ]: 0 : pVout->EnableMapMode(bMapModeWasEnabledSource);
1430 : :
1431 : : // end paint on logoc base
1432 [ # # ]: 0 : DLPostPaint2(true);
1433 : : }
1434 : : else
1435 : 0 : --nLockPaint;
1436 : : }
1437 [ # # ]: 0 : }
1438 [ # # ][ # # ]: 0 : delete pVout;
1439 [ # # ]: 0 : GetWin()->Update();
1440 [ # # ]: 0 : if ( !Imp()->bStopSmooth )
1441 : 0 : --nLockPaint;
1442 [ # # ]: 0 : SetFirstVisPageInvalid();
1443 : 0 : return sal_True;
1444 : : }
1445 [ # # ][ # # ]: 0 : delete pVout;
[ # # ][ # # ]
1446 : : }
1447 : :
1448 : 362 : aVisArea.Pos().X() -= lXDiff;
1449 : 362 : aVisArea.Pos().Y() -= lYDiff;
1450 [ + + ]: 362 : if ( pRect )
1451 : 357 : GetWin()->Scroll( lXDiff, lYDiff, *pRect, SCROLL_CHILDREN);
1452 : : else
1453 : 5 : GetWin()->Scroll( lXDiff, lYDiff, SCROLL_CHILDREN);
1454 : 362 : return sal_False;
1455 : : }
1456 : :
1457 : :
1458 : 7042 : void ViewShell::PaintDesktop( const SwRect &rRect )
1459 : : {
1460 [ - + ][ # # ]: 7042 : if ( !GetWin() && !GetOut()->GetConnectMetaFile() )
[ + - ]
1461 : 7042 : return; //Fuer den Drucker tun wir hier nix
1462 : :
1463 : : //Sonderfaelle abfangen, damit es nicht gar so ueberraschend aussieht.
1464 : : //Kann z.B. waehrend des Idle'ns zwischenzeitlich auftreten.
1465 : : //Die Rechtecke neben den Seiten muessen wir leider auf jedenfall Painten,
1466 : : //den diese werden spaeter beim VisPortChgd ausgespart.
1467 : 7042 : sal_Bool bBorderOnly = sal_False;
1468 [ + - ]: 7042 : const SwRootFrm *pRoot = GetLayout();//swmod 080305
1469 [ + + ]: 7042 : if ( rRect.Top() > pRoot->Frm().Bottom() )
1470 : : {
1471 : 6 : const SwFrm *pPg = pRoot->Lower();
1472 [ + - ][ + + ]: 16 : while ( pPg && pPg->GetNext() )
[ + + ]
1473 : 10 : pPg = pPg->GetNext();
1474 [ + - ][ + - ]: 6 : if ( !pPg || !pPg->Frm().IsOver( VisArea() ) )
[ + - ][ + - ]
1475 : 6 : bBorderOnly = sal_True;
1476 : : }
1477 : :
1478 : 7042 : const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
1479 : :
1480 [ + - ]: 7042 : SwRegionRects aRegion( rRect );
1481 : :
1482 : : //mod #i6193: remove sidebar area to avoid flickering
1483 [ + - ]: 7042 : const SwPostItMgr* pPostItMgr = GetPostItMgr();
1484 [ + - ][ + - ]: 7045 : const SwTwips nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ?
1485 [ + - ][ + - ]: 3 : pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() :
1486 [ + - ][ + + ]: 14090 : 0;
[ + - ]
1487 : :
1488 [ + + ]: 7042 : if ( bBorderOnly )
1489 : : {
1490 : 6 : const SwFrm *pPage =pRoot->Lower(); //swmod 071108//swmod 071225
1491 : 6 : SwRect aLeft( rRect ), aRight( rRect );
1492 [ + + ]: 22 : while ( pPage )
1493 : : {
1494 : 16 : long nTmp = pPage->Frm().Left();
1495 [ + + ]: 16 : if ( nTmp < aLeft.Right() )
1496 : 6 : aLeft.Right( nTmp );
1497 : 16 : nTmp = pPage->Frm().Right();
1498 [ + + ]: 16 : if ( nTmp > aRight.Left() )
1499 : : {
1500 : 6 : aRight.Left( nTmp + nSidebarWidth );
1501 : : }
1502 : 16 : pPage = pPage->GetNext();
1503 : : }
1504 : 6 : aRegion.clear();
1505 [ + - ][ + - ]: 6 : if ( aLeft.HasArea() )
1506 [ + - ]: 6 : aRegion.push_back( aLeft );
1507 [ + - ][ + - ]: 6 : if ( aRight.HasArea() )
1508 [ + - ]: 6 : aRegion.push_back( aRight );
1509 : : }
1510 : : else
1511 : : {
1512 [ + - ]: 7036 : const SwFrm *pPage = Imp()->GetFirstVisPage();
1513 : 7036 : const SwTwips nBottom = rRect.Bottom();
1514 : : //const SwTwips nRight = rRect.Right();
1515 [ + + ]: 21100 : while ( pPage && !aRegion.empty() &&
[ + + + + ]
[ + + ]
1516 : 7172 : (pPage->Frm().Top() <= nBottom) ) // PAGES01 && (pPage->Frm().Left() <= nRight))
1517 : : {
1518 : 6892 : SwRect aPageRect( pPage->Frm() );
1519 [ - + ]: 6892 : if ( bBookMode )
1520 : : {
1521 [ # # ]: 0 : const SwPageFrm& rFormatPage = static_cast<const SwPageFrm*>(pPage)->GetFormatPage();
1522 : 0 : aPageRect.SSize() = rFormatPage.Frm().SSize();
1523 : : }
1524 : :
1525 : : const bool bSidebarRight =
1526 [ + - ]: 6892 : static_cast<const SwPageFrm*>(pPage)->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
1527 [ + - ]: 6892 : aPageRect.Pos().X() -= bSidebarRight ? 0 : nSidebarWidth;
1528 : 6892 : aPageRect.SSize().Width() += nSidebarWidth;
1529 : :
1530 [ + + ][ + - ]: 6892 : if ( aPageRect.IsOver( rRect ) )
1531 [ + - ]: 6861 : aRegion -= aPageRect;
1532 : :
1533 : 6892 : pPage = pPage->GetNext();
1534 : : }
1535 : : }
1536 [ + + ]: 7042 : if ( !aRegion.empty() )
1537 [ + - ]: 7042 : _PaintDesktop( aRegion );
1538 : : }
1539 : :
1540 : :
1541 : : // PaintDesktop gesplittet, dieser Teil wird auch von PreViewPage benutzt
1542 : 2510 : void ViewShell::_PaintDesktop( const SwRegionRects &rRegion )
1543 : : {
1544 : : // OD 2004-04-23 #116347#
1545 : 2510 : GetOut()->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
1546 : 2510 : GetOut()->SetLineColor();
1547 : :
1548 [ + + ]: 6996 : for ( sal_uInt16 i = 0; i < rRegion.size(); ++i )
1549 : : {
1550 [ + - ]: 4486 : const Rectangle aRectangle(rRegion[i].SVRect());
1551 : :
1552 : : // #i93170#
1553 : : // Here we have a real Problem. On the one hand we have the buffering for paint
1554 : : // and overlay which needs an embracing pair of DLPrePaint2/DLPostPaint2 calls,
1555 : : // on the other hand the MapMode is not set correctly when this code is executed.
1556 : : // This is done in the users of this method, for each SWpage before painting it.
1557 : : // Since the MapMode is not correct here, the call to DLPostPaint2 will paint
1558 : : // existing FormControls due to the current MapMode.
1559 : : //
1560 : : // There are basically three solutions for this:
1561 : : //
1562 : : // (1) Set the MapMode correct, move the background painting to the users of
1563 : : // this code
1564 : : //
1565 : : // (2) Do no DLPrePaint2/DLPostPaint2 here; no SdrObjects are allowed to lie in
1566 : : // the desktop region. Disadvantage: the desktop will not be part of the
1567 : : // buffers, e.g. overlay. Thus, as soon as overlay will be used over the
1568 : : // desktop, it will not work.
1569 : : //
1570 : : // (3) expand DLPostPaint2 with a flag to signal if FormControl paints shall
1571 : : // be done or not
1572 : : //
1573 : : // Currently, (3) will be the best possible solution. It will keep overlay and
1574 : : // buffering intact and work without MapMode for single pages. In the medium
1575 : : // to long run, (1) will need to be used and the bool bPaintFormLayer needs
1576 : : // to be removed again
1577 : :
1578 : : // #i68597# inform Drawinglayer about display change
1579 [ + - ][ + - ]: 4486 : DLPrePaint2(Region(aRectangle));
[ + - ]
1580 : :
1581 : : // #i75172# needed to move line/Fill color setters into loop since DLPrePaint2
1582 : : // may exchange GetOut(), that's it's purpose. This happens e.g. at print preview.
1583 [ + - ][ + - ]: 4486 : GetOut()->SetFillColor( SwViewOption::GetAppBackgroundColor());
1584 [ + - ]: 4486 : GetOut()->SetLineColor();
1585 [ + - ]: 4486 : GetOut()->DrawRect(aRectangle);
1586 : :
1587 [ + - ]: 4486 : DLPostPaint2(false);
1588 : : }
1589 : :
1590 : 2510 : GetOut()->Pop();
1591 : 2510 : }
1592 : :
1593 : :
1594 : 4941 : sal_Bool ViewShell::CheckInvalidForPaint( const SwRect &rRect )
1595 : : {
1596 [ - + ]: 4941 : if ( !GetWin() )
1597 : 0 : return sal_False;
1598 : :
1599 : 4941 : const SwPageFrm *pPage = Imp()->GetFirstVisPage();
1600 : 4941 : const SwTwips nBottom = VisArea().Bottom();
1601 : 4941 : const SwTwips nRight = VisArea().Right();
1602 : 4941 : sal_Bool bRet = sal_False;
1603 [ + + ][ + + ]: 14863 : while ( !bRet && pPage && !((pPage->Frm().Top() > nBottom) ||
[ + + ][ + + ]
1604 [ + - ]: 4961 : (pPage->Frm().Left() > nRight)))
1605 : : {
1606 [ + + ][ + + ]: 4961 : if ( pPage->IsInvalid() || pPage->IsInvalidFly() )
[ + + ]
1607 : 81 : bRet = sal_True;
1608 : 4961 : pPage = (SwPageFrm*)pPage->GetNext();
1609 : : }
1610 : :
1611 [ + + ]: 4941 : if ( bRet )
1612 : : {
1613 : : //Start/EndAction wuerden hier leider nix helfen, weil das Paint vom
1614 : : //GUI 'reinkam und somit ein Clipping gesetzt ist gegen das wir nicht
1615 : : //nicht ankommen.
1616 : : //Ergo: Alles selbst machen (siehe ImplEndAction())
1617 [ - + ][ # # ]: 81 : if ( Imp()->GetRegion() && Imp()->GetRegion()->GetOrigin() != VisArea())
[ - + ]
1618 [ # # ]: 0 : Imp()->DelRegion();
1619 : :
1620 [ + - ][ + - ]: 81 : SwLayAction aAction( GetLayout(), Imp() );
1621 : 81 : aAction.SetComplete( sal_False );
1622 : : // We increment the action counter to avoid a recursive call of actions
1623 : : // e.g. from a SwFEShell::RequestObjectResize(..) in bug 95829.
1624 : : // A recursive call of actions is no good idea because the inner action
1625 : : // can't format frames which are locked by the outer action. This may
1626 : : // cause and endless loop.
1627 : 81 : ++nStartAction;
1628 [ + - ]: 81 : aAction.Action();
1629 : 81 : --nStartAction;
1630 : :
1631 : 81 : SwRegionRects *pRegion = Imp()->GetRegion();
1632 [ - + ][ - + ]: 81 : if ( pRegion && aAction.IsBrowseActionStop() )
[ + + ]
1633 : : {
1634 : : //Nur dann interessant, wenn sich im sichtbaren Bereich etwas
1635 : : //veraendert hat.
1636 : 0 : sal_Bool bStop = sal_True;
1637 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < pRegion->size(); ++i )
1638 : : {
1639 : 0 : const SwRect &rTmp = (*pRegion)[i];
1640 [ # # ][ # # ]: 0 : if ( sal_False == (bStop = rTmp.IsOver( VisArea() )) )
1641 : 0 : break;
1642 : : }
1643 [ # # ]: 0 : if ( bStop )
1644 : : {
1645 [ # # ]: 0 : Imp()->DelRegion();
1646 : 0 : pRegion = 0;
1647 : : }
1648 : : }
1649 : :
1650 [ + + ]: 81 : if ( pRegion )
1651 : : {
1652 : : //Erst Invert dann Compress, niemals andersherum!
1653 [ + - ]: 51 : pRegion->Invert();
1654 [ + - ]: 51 : pRegion->Compress();
1655 : 51 : bRet = sal_False;
1656 [ + - ]: 51 : if ( !pRegion->empty() )
1657 : : {
1658 [ + - ]: 51 : SwRegionRects aRegion( rRect );
1659 [ + + ]: 126 : for ( sal_uInt16 i = 0; i < pRegion->size(); ++i )
1660 : 75 : { const SwRect &rTmp = (*pRegion)[i];
1661 [ + + ][ + - ]: 75 : if ( !rRect.IsInside( rTmp ) )
1662 : : {
1663 [ + - ]: 68 : InvalidateWindows( rTmp );
1664 [ + - ][ + - ]: 68 : if ( rTmp.IsOver( VisArea() ) )
1665 [ + - ]: 68 : { aRegion -= rTmp;
1666 : 68 : bRet = sal_True;
1667 : : }
1668 : : }
1669 : : }
1670 [ + + ]: 51 : if ( bRet )
1671 : : {
1672 [ + + ]: 129 : for ( sal_uInt16 i = 0; i < aRegion.size(); ++i )
1673 [ + - ][ + - ]: 79 : GetWin()->Invalidate( aRegion[i].SVRect() );
1674 : :
1675 [ + - ]: 50 : if ( rRect != VisArea() )
1676 : : {
1677 : : //rRect == VisArea ist der spezialfall fuer neu bzw.
1678 : : //Shift-Ctrl-R, dafuer sollte es nicht notwendig sein
1679 : : //das Rechteck nocheinmal in Dokumentkoordinaten v
1680 : : //vorzuhalten.
1681 [ + + ]: 50 : if ( aInvalidRect.IsEmpty() )
1682 : 37 : aInvalidRect = rRect;
1683 : : else
1684 [ + - ]: 13 : aInvalidRect.Union( rRect );
1685 : : }
1686 : 51 : }
1687 : : }
1688 : : else
1689 : 0 : bRet = sal_False;
1690 [ + - ]: 51 : Imp()->DelRegion();
1691 : : }
1692 : : else
1693 [ + - ]: 81 : bRet = sal_False;
1694 : : }
1695 : 4941 : return bRet;
1696 : : }
1697 : :
1698 : :
1699 : 6681 : void ViewShell::Paint(const Rectangle &rRect)
1700 : : {
1701 [ - + ]: 6681 : if ( nLockPaint )
1702 : : {
1703 [ # # ]: 0 : if ( Imp()->bSmoothUpdate )
1704 : : {
1705 [ # # ]: 0 : SwRect aTmp( rRect );
1706 [ # # ][ # # ]: 0 : if ( !Imp()->aSmoothRect.IsInside( aTmp ) )
1707 : 0 : Imp()->bStopSmooth = sal_True;
1708 : : else
1709 : : {
1710 : 0 : Imp()->aSmoothRect = aTmp;
1711 : : return;
1712 : : }
1713 : : }
1714 : : else
1715 : 0 : return;
1716 : : }
1717 : :
1718 [ - + ]: 6681 : if ( SwRootFrm::IsInPaint() )
1719 : : {
1720 : : //Waehrend der Ausgabe einer Seite beim Druckvorgang wird das
1721 : : //Paint gepuffert.
1722 [ # # ]: 0 : SwPaintQueue::Add( this, SwRect( rRect ) );
1723 : 0 : return;
1724 : : }
1725 : :
1726 : : // mit !nStartAction versuche ich mal mich gegen
1727 : : //fehlerhaften Code an anderen Stellen zu wehren. Hoffentlich fuehrt das
1728 : : //nicht zu Problemen!?
1729 [ + + ][ + + ]: 6681 : if ( bPaintWorks && !nStartAction )
1730 : : {
1731 [ + - ][ + - ]: 4941 : if( GetWin() && GetWin()->IsVisible() )
[ + - ]
1732 : : {
1733 [ + - ]: 4941 : SwRect aRect( rRect );
1734 [ - + ]: 4941 : if ( bPaintInProgress ) //Schutz gegen doppelte Paints!
1735 : : {
1736 [ # # ]: 0 : GetWin()->Invalidate( rRect );
1737 : : return;
1738 : : }
1739 : :
1740 : 4941 : bPaintInProgress = sal_True;
1741 [ + - ]: 4941 : SET_CURR_SHELL( this );
1742 : 4941 : SwRootFrm::SetNoVirDev( sal_True );
1743 : :
1744 : : //Wir wollen nicht staendig hin und her Clippen, wir verlassen
1745 : : //uns darauf, das sich alle auf das Rechteck beschraeken und
1746 : : //brauchen das Clipping hier nur einmalig einkalkulieren. Das
1747 : : //ClipRect wird hier einmal entfernt und nicht Restauriert, denn
1748 : : //von aussen braucht es sowieso keiner mehr.
1749 : : //Nicht wenn wir ein MetaFile aufzeichnen.
1750 [ - + ][ - + ]: 4941 : if( !GetOut()->GetConnectMetaFile() && GetOut()->IsClipRegion())
[ + - ]
1751 [ # # ]: 0 : GetOut()->SetClipRegion();
1752 : :
1753 [ - + ]: 4941 : if ( IsPreView() )
1754 : : {
1755 : : //Falls sinnvoll gleich das alte InvalidRect verarbeiten bzw.
1756 : : //vernichten.
1757 [ # # ][ # # ]: 0 : if ( aRect.IsInside( aInvalidRect ) )
1758 : 0 : ResetInvalidRect();
1759 : 0 : ViewShell::bLstAct = sal_True;
1760 [ # # ][ # # ]: 0 : GetLayout()->Paint( aRect );
1761 : 0 : ViewShell::bLstAct = sal_False;
1762 : : }
1763 : : else
1764 : : {
1765 : : //SwSaveHdl *pSaveHdl = 0;
1766 : : //if ( Imp()->HasDrawView() )
1767 : : // pSaveHdl = new SwSaveHdl( Imp() );
1768 : :
1769 : : //Wenn eine der sichtbaren Seiten noch irgendetwas zum Repaint
1770 : : //angemeldet hat, so muessen Repaints ausgeloest werden.
1771 [ + - ][ + + ]: 4941 : if ( !CheckInvalidForPaint( aRect ) )
1772 : : {
1773 : : // --> OD 2009-08-12 #i101192#
1774 : : // start Pre/PostPaint encapsulation to avoid screen blinking
1775 [ + - ][ + - ]: 4891 : const Region aRepaintRegion(aRect.SVRect());
1776 [ + - ]: 4891 : DLPrePaint2(aRepaintRegion);
1777 : :
1778 : : // <--
1779 [ + - ]: 4891 : PaintDesktop( aRect );
1780 : :
1781 : : //Falls sinnvoll gleich das alte InvalidRect verarbeiten bzw.
1782 : : //vernichten.
1783 [ + - ][ + + ]: 4891 : if ( aRect.IsInside( aInvalidRect ) )
1784 : 1482 : ResetInvalidRect();
1785 : 4891 : ViewShell::bLstAct = sal_True;
1786 [ + - ][ + - ]: 4891 : GetLayout()->Paint( aRect );
1787 : 4891 : ViewShell::bLstAct = sal_False;
1788 : : // --> OD 2009-08-12 #i101192#
1789 : : // end Pre/PostPaint encapsulation
1790 [ + - ][ + - ]: 4891 : DLPostPaint2(true);
1791 : : // <--
1792 : : }
1793 : : //delete pSaveHdl;
1794 : : }
1795 : 4941 : SwRootFrm::SetNoVirDev( sal_False );
1796 : 4941 : bPaintInProgress = sal_False;
1797 [ + - ][ + - ]: 4941 : UISizeNotify();
1798 : 4941 : }
1799 : : }
1800 : : else
1801 : : {
1802 [ + + ]: 1740 : if ( aInvalidRect.IsEmpty() )
1803 : 1676 : aInvalidRect = SwRect( rRect );
1804 : : else
1805 [ + - ]: 64 : aInvalidRect.Union( SwRect( rRect ) );
1806 : :
1807 [ + + ][ + - ]: 1740 : if ( bInEndAction && GetWin() )
[ + + ]
1808 : : {
1809 [ + - ]: 1315 : Region aRegion( GetWin()->GetPaintRegion() );
1810 [ + - ]: 1315 : RegionHandle hHdl( aRegion.BeginEnumRects() );
1811 [ + - ]: 1315 : Rectangle aRect;
1812 [ + - ][ + + ]: 2938 : while ( aRegion.GetNextEnumRect( hHdl, aRect ) )
1813 [ + - ][ + - ]: 1623 : Imp()->AddPaintRect( aRect );
1814 [ + - ][ + - ]: 1315 : aRegion.EndEnumRects( hHdl );
1815 : : }
1816 [ + + + - ]: 436 : else if ( SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) &&
[ + + ]
1817 : 11 : GetOut() == GetWin() )
1818 : : {
1819 : : // #i68597#
1820 [ + - ]: 11 : const Region aDLRegion(rRect);
1821 [ + - ]: 11 : DLPrePaint2(aDLRegion);
1822 : :
1823 [ + - ]: 11 : pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
1824 [ + - ][ + - ]: 11 : pOut->SetFillColor( Imp()->GetRetoucheColor() );
1825 [ + - ]: 11 : pOut->SetLineColor();
1826 [ + - ]: 11 : pOut->DrawRect( rRect );
1827 [ + - ]: 11 : pOut->Pop();
1828 : : // #i68597#
1829 [ + - ][ + - ]: 6681 : DLPostPaint2(true);
1830 : : }
1831 : : }
1832 : : }
1833 : :
1834 : :
1835 : 1318 : void ViewShell::SetBrowseBorder( const Size& rNew )
1836 : : {
1837 [ + - ]: 1318 : if( rNew != aBrowseBorder )
1838 : : {
1839 : 1318 : aBrowseBorder = rNew;
1840 [ - + ]: 1318 : if ( aVisArea.HasArea() )
1841 : 0 : CheckBrowseView( sal_False );
1842 : : }
1843 : 1318 : }
1844 : :
1845 : 402 : const Size& ViewShell::GetBrowseBorder() const
1846 : : {
1847 : 402 : return aBrowseBorder;
1848 : : }
1849 : :
1850 : 372 : sal_Int32 ViewShell::GetBrowseWidth() const
1851 : : {
1852 : 372 : const SwPostItMgr* pPostItMgr = GetPostItMgr();
1853 [ - + ][ # # ]: 372 : if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
[ - + ][ + + ]
1854 : : {
1855 : 0 : Size aBorder( aBrowseBorder );
1856 : 0 : aBorder.Width() += aBrowseBorder.Width();
1857 [ # # ][ # # ]: 0 : aBorder.Width() += pPostItMgr->GetSidebarWidth(true) + pPostItMgr->GetSidebarBorderWidth(true);
1858 [ # # ]: 0 : return aVisArea.Width() - GetOut()->PixelToLogic(aBorder).Width();
1859 : : }
1860 : : else
1861 : 372 : return aVisArea.Width() - 2 * GetOut()->PixelToLogic(aBrowseBorder).Width();
1862 : : }
1863 : :
1864 : :
1865 : 2142 : void ViewShell::CheckBrowseView( sal_Bool bBrowseChgd )
1866 : : {
1867 [ + + ][ + + ]: 2142 : if ( !bBrowseChgd && !GetViewOptions()->getBrowseMode() )
[ + + ]
1868 : : return;
1869 : :
1870 [ + - ]: 28 : SET_CURR_SHELL( this );
1871 : :
1872 : : OSL_ENSURE( GetLayout(), "Layout not ready" );
1873 : :
1874 : : // Wenn das Layout noch nicht einmal eine Hoehe hat,
1875 : : // ist sowieso nichts formatiert.
1876 : : // Dann eruebrigt sich die Invalidierung
1877 : : // Falsch, z.B. beim Anlegen einer neuen View wird der Inhalt eingef?gt
1878 : : // und formatiert (trotz einer leeren VisArea). Hier muessen deshalb
1879 : : // die Seiten zur Formatierung angeregt werden.
1880 [ + - ][ - + ]: 28 : if( !GetLayout()->Frm().Height() )
1881 : : {
1882 [ # # ]: 0 : SwFrm* pPage = GetLayout()->Lower();
1883 [ # # ]: 0 : while( pPage )
1884 : : {
1885 [ # # ]: 0 : pPage->_InvalidateSize();
1886 : 0 : pPage = pPage->GetNext();
1887 : : }
1888 : : return;
1889 : : }
1890 : :
1891 [ + - ]: 28 : LockPaint();
1892 [ + - ]: 28 : StartAction();
1893 : :
1894 [ + - ]: 28 : SwPageFrm *pPg = (SwPageFrm*)GetLayout()->Lower();
1895 [ - + ]: 28 : do
1896 [ + - ]: 28 : { pPg->InvalidateSize();
1897 [ + - ]: 28 : pPg->_InvalidatePrt();
1898 [ + - ]: 28 : pPg->InvaPercentLowers();
1899 [ + + ]: 28 : if ( bBrowseChgd )
1900 : : {
1901 [ + - ]: 4 : pPg->PrepareHeader();
1902 [ + - ]: 4 : pPg->PrepareFooter();
1903 : : }
1904 : 28 : pPg = (SwPageFrm*)pPg->GetNext();
1905 : : } while ( pPg );
1906 : :
1907 : : // Wenn sich die Groessenverhaeltnise im BrowseModus aendern,
1908 : : // muss die Position und PrtArea der Cntnt- und Tab-Frames invalidiert werden.
1909 : 28 : sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_POS;
1910 : : // Beim BrowseModus-Wechsel benoetigen die CntntFrms
1911 : : // wg. der Drucker/Bildschirmformatierung eine Size-Invalidierung
1912 [ + + ]: 28 : if( bBrowseChgd )
1913 : 4 : nInv |= INV_SIZE | INV_DIRECTION;
1914 : :
1915 [ + - ][ + - ]: 28 : GetLayout()->InvalidateAllCntnt( nInv );
1916 : :
1917 [ + - ][ + - ]: 28 : SwFrm::CheckPageDescs( (SwPageFrm*)GetLayout()->Lower() );
1918 : :
1919 [ + - ]: 28 : EndAction();
1920 [ + - ][ + - ]: 2142 : UnlockPaint();
[ + - ]
1921 : : }
1922 : :
1923 : :
1924 : 1316647 : SwRootFrm *ViewShell::GetLayout() const
1925 : : {
1926 : 1316647 : return pLayout.get(); //swmod 080116
1927 : : }
1928 : : /***********************************************************************/
1929 : :
1930 : 985519 : OutputDevice& ViewShell::GetRefDev() const
1931 : : {
1932 : 985519 : OutputDevice* pTmpOut = 0;
1933 [ + + + + : 1970134 : if ( GetWin() &&
+ - ][ + + ]
1934 : 984118 : GetViewOptions()->getBrowseMode() &&
1935 : 497 : !GetViewOptions()->IsPrtFormat() )
1936 : 497 : pTmpOut = GetWin();
1937 [ - + ]: 985022 : else if ( 0 != mpTmpRef )
1938 : 0 : pTmpOut = mpTmpRef;
1939 : : else
1940 : 985022 : pTmpOut = GetDoc()->getReferenceDevice( true );
1941 : :
1942 : 985519 : return *pTmpOut;
1943 : : }
1944 : :
1945 : 24 : const SwNodes& ViewShell::GetNodes() const
1946 : : {
1947 : 24 : return pDoc->GetNodes();
1948 : : }
1949 : :
1950 : :
1951 : 591 : void ViewShell::DrawSelChanged()
1952 : : {
1953 : 591 : }
1954 : :
1955 : :
1956 : 88552 : Size ViewShell::GetDocSize() const
1957 : : {
1958 : 88552 : Size aSz;
1959 : 88552 : const SwRootFrm* pRoot = GetLayout();
1960 [ + - ]: 88552 : if( pRoot )
1961 : 88552 : aSz = pRoot->Frm().SSize();
1962 : :
1963 : 88552 : return aSz;
1964 : : }
1965 : :
1966 : :
1967 : 3261 : SfxItemPool& ViewShell::GetAttrPool()
1968 : : {
1969 : 3261 : return GetDoc()->GetAttrPool();
1970 : : }
1971 : :
1972 : :
1973 : 222 : void ViewShell::ApplyViewOptions( const SwViewOption &rOpt )
1974 : : {
1975 : :
1976 : 222 : ViewShell *pSh = this;
1977 [ - + ]: 222 : do
1978 : 222 : { pSh->StartAction();
1979 : 222 : pSh = (ViewShell*)pSh->GetNext();
1980 : : } while ( pSh != this );
1981 : :
1982 : 222 : ImplApplyViewOptions( rOpt );
1983 : :
1984 : : // With one layout per view it is not longer necessary
1985 : : // to sync these "layout related" view options
1986 : : // But as long as we have to disable "multiple layout"
1987 : 222 : pSh = (ViewShell*)this->GetNext();
1988 [ - + ]: 222 : while ( pSh != this )
1989 : : {
1990 [ # # ]: 0 : SwViewOption aOpt( *pSh->GetViewOptions() );
1991 : 0 : aOpt.SetFldName( rOpt.IsFldName() );
1992 : 0 : aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
1993 : 0 : aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
1994 : 0 : aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
1995 : 0 : aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
1996 : 0 : aOpt.SetViewLayoutColumns( rOpt.GetViewLayoutColumns() );
1997 : 0 : aOpt.SetPostIts(rOpt.IsPostIts());
1998 [ # # ][ # # ]: 0 : if ( !(aOpt == *pSh->GetViewOptions()) )
1999 [ # # ]: 0 : pSh->ImplApplyViewOptions( aOpt );
2000 : 0 : pSh = (ViewShell*)pSh->GetNext();
2001 [ # # ]: 0 : }
2002 : : // End of disabled multiple window
2003 : :
2004 : 222 : pSh = this;
2005 [ - + ]: 222 : do
2006 : 222 : { pSh->EndAction();
2007 : 222 : pSh = (ViewShell*)pSh->GetNext();
2008 : : } while ( pSh != this );
2009 : :
2010 : 222 : }
2011 : :
2012 : 222 : void ViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
2013 : : {
2014 [ + - ][ + - ]: 222 : if (*pOpt == rOpt)
2015 : : return;
2016 : :
2017 : 222 : Window *pMyWin = GetWin();
2018 [ + - ]: 222 : if( !pMyWin )
2019 : : {
2020 : : OSL_ENSURE( pMyWin, "ViewShell::ApplyViewOptions: no window" );
2021 : : return;
2022 : : }
2023 : :
2024 [ + - ]: 222 : SET_CURR_SHELL( this );
2025 : :
2026 : 222 : sal_Bool bReformat = sal_False;
2027 : :
2028 [ + + ]: 222 : if( pOpt->IsShowHiddenField() != rOpt.IsShowHiddenField() )
2029 : : {
2030 [ + - ]: 6 : ((SwHiddenTxtFieldType*)pDoc->GetSysFldType( RES_HIDDENTXTFLD ))->
2031 [ + - ]: 12 : SetHiddenFlag( !rOpt.IsShowHiddenField() );
2032 : 6 : bReformat = sal_True;
2033 : : }
2034 [ + + ]: 222 : if ( pOpt->IsShowHiddenPara() != rOpt.IsShowHiddenPara() )
2035 : : {
2036 : 6 : SwHiddenParaFieldType* pFldType = (SwHiddenParaFieldType*)GetDoc()->
2037 [ + - ]: 6 : GetSysFldType(RES_HIDDENPARAFLD);
2038 [ + - ][ - + ]: 6 : if( pFldType && pFldType->GetDepends() )
[ - + ]
2039 : : {
2040 [ # # ]: 0 : SwMsgPoolItem aHnt( RES_HIDDENPARA_PRINT );
2041 [ # # ][ # # ]: 0 : pFldType->ModifyNotification( &aHnt, 0);
2042 : : }
2043 : 6 : bReformat = sal_True;
2044 : : }
2045 [ + + ][ + + ]: 222 : if ( !bReformat && pOpt->IsShowHiddenChar() != rOpt.IsShowHiddenChar() )
[ + + ]
2046 : : {
2047 [ + - ]: 4 : bReformat = GetDoc()->ContainsHiddenChars();
2048 : : }
2049 : :
2050 : : // bReformat wird sal_True, wenn ...
2051 : : // - Feldnamen anzeigen oder nicht ...
2052 : : // ( - SwEndPortion muessen _nicht_ mehr generiert werden. )
2053 : : // - Das Window ist natuerlich was ganz anderes als der Drucker...
2054 [ + + ][ + + ]: 222 : bReformat = bReformat || pOpt->IsFldName() != rOpt.IsFldName();
2055 : :
2056 : : // Der Mapmode wird veraendert, Minima/Maxima werden von der UI beachtet
2057 [ + + ][ + - ]: 222 : if( pOpt->GetZoom() != rOpt.GetZoom() && !IsPreView() )
[ + + ]
2058 : : {
2059 [ + - ]: 104 : MapMode aMode( pMyWin->GetMapMode() );
2060 [ + - ]: 104 : Fraction aNewFactor( rOpt.GetZoom(), 100 );
2061 [ + - ]: 104 : aMode.SetScaleX( aNewFactor );
2062 [ + - ]: 104 : aMode.SetScaleY( aNewFactor );
2063 [ + - ]: 104 : pMyWin->SetMapMode( aMode );
2064 : : // Wenn kein ReferenzDevice (Drucker) zum Formatieren benutzt wird,
2065 : : // sondern der Bildschirm, muss bei Zoomfaktoraenderung neu formatiert
2066 : : // werden.
2067 [ + + ]: 104 : if( pOpt->getBrowseMode() )
2068 [ + - ]: 104 : bReformat = sal_True;
2069 : : }
2070 : :
2071 : 222 : bool bBrowseModeChanged = false;
2072 [ + + ]: 222 : if( pOpt->getBrowseMode() != rOpt.getBrowseMode() )
2073 : : {
2074 : 2 : bBrowseModeChanged = true;
2075 : 2 : bReformat = sal_True;
2076 : : }
2077 [ + + ][ - + ]: 220 : else if( pOpt->getBrowseMode() && pOpt->IsPrtFormat() != rOpt.IsPrtFormat() )
[ - + ]
2078 : 0 : bReformat = sal_True;
2079 : :
2080 [ + - ][ - + ]: 222 : if ( HasDrawView() || rOpt.IsGridVisible() )
[ # # ][ + - ]
2081 : : {
2082 [ + - ][ - + ]: 222 : if ( !HasDrawView() )
2083 [ # # ]: 0 : MakeDrawView();
2084 : :
2085 : 222 : SwDrawView *pDView = Imp()->GetDrawView();
2086 [ - + ]: 222 : if ( pDView->IsDragStripes() != rOpt.IsCrossHair() )
2087 [ # # ]: 0 : pDView->SetDragStripes( rOpt.IsCrossHair() );
2088 : :
2089 [ + + ]: 222 : if ( pDView->IsGridSnap() != rOpt.IsSnap() )
2090 : 4 : pDView->SetGridSnap( rOpt.IsSnap() );
2091 : :
2092 [ + + ]: 222 : if ( pDView->IsGridVisible() != rOpt.IsGridVisible() )
2093 [ + - ]: 4 : pDView->SetGridVisible( rOpt.IsGridVisible() );
2094 : :
2095 : 222 : const Size &rSz = rOpt.GetSnapSize();
2096 : 222 : pDView->SetGridCoarse( rSz );
2097 : :
2098 : : const Size aFSize
2099 : 444 : ( rSz.Width() ? rSz.Width() / (rOpt.GetDivisionX()+1) : 0,
2100 [ + - ][ + - ]: 666 : rSz.Height()? rSz.Height()/ (rOpt.GetDivisionY()+1) : 0);
2101 [ + - ]: 222 : pDView->SetGridFine( aFSize );
2102 [ + - ]: 222 : Fraction aSnGrWdtX(rSz.Width(), rOpt.GetDivisionX() + 1);
2103 [ + - ]: 222 : Fraction aSnGrWdtY(rSz.Height(), rOpt.GetDivisionY() + 1);
2104 [ + - ]: 222 : pDView->SetSnapGridWidth( aSnGrWdtX, aSnGrWdtY );
2105 : :
2106 : : // set handle size to 9 pixels, always
2107 [ + - ]: 222 : pDView->SetMarkHdlSizePixel(9);
2108 : : }
2109 : :
2110 : 222 : sal_Bool bOnlineSpellChgd = pOpt->IsOnlineSpell() != rOpt.IsOnlineSpell();
2111 : :
2112 [ + - ]: 222 : *pOpt = rOpt; // Erst jetzt werden die Options uebernommen.
2113 : 222 : pOpt->SetUIOptions(rOpt);
2114 : :
2115 [ + - ][ + - ]: 222 : pDoc->set(IDocumentSettingAccess::HTML_MODE, 0 != ::GetHtmlMode(pDoc->GetDocShell()));
2116 : :
2117 [ + + ]: 222 : if( bBrowseModeChanged )
2118 : : {
2119 : : // #i44963# Good occasion to check if page sizes in
2120 : : // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import)
2121 [ + - ]: 2 : pDoc->CheckDefaultPageFmt();
2122 [ + - ]: 2 : CheckBrowseView( sal_True );
2123 : : }
2124 : :
2125 [ + - ]: 222 : pMyWin->Invalidate();
2126 [ + + ]: 222 : if ( bReformat )
2127 : : {
2128 : : // Es hilft alles nichts, wir muessen an alle CntntFrms ein
2129 : : // Prepare verschicken, wir formatieren neu:
2130 [ + - ]: 26 : StartAction();
2131 [ + - ]: 26 : Reformat();
2132 [ + - ]: 26 : EndAction();
2133 : : }
2134 : :
2135 [ - + ]: 222 : if( bOnlineSpellChgd )
2136 : : {
2137 : 0 : ViewShell *pSh = (ViewShell*)this->GetNext();
2138 : 0 : sal_Bool bOnlineSpl = rOpt.IsOnlineSpell();
2139 [ # # ]: 0 : while( pSh != this )
2140 : 0 : { pSh->pOpt->SetOnlineSpell( bOnlineSpl );
2141 : 0 : Window *pTmpWin = pSh->GetWin();
2142 [ # # ]: 0 : if( pTmpWin )
2143 [ # # ]: 0 : pTmpWin->Invalidate();
2144 : 0 : pSh = (ViewShell*)pSh->GetNext();
2145 : : }
2146 [ + - ]: 222 : }
2147 : :
2148 : : }
2149 : :
2150 : :
2151 : 1536 : void ViewShell::SetUIOptions( const SwViewOption &rOpt )
2152 : : {
2153 : 1536 : pOpt->SetUIOptions(rOpt);
2154 : : //the API-Flag of the view options is set but never reset
2155 : : //it is required to set scroll bars in readonly documents
2156 [ + + ]: 1536 : if(rOpt.IsStarOneSetting())
2157 : 218 : pOpt->SetStarOneSetting(sal_True);
2158 : :
2159 : 1536 : pOpt->SetSymbolFont(rOpt.GetSymbolFont());
2160 : 1536 : }
2161 : :
2162 : :
2163 : 0 : void ViewShell::SetReadonlyOption(sal_Bool bSet)
2164 : : {
2165 : : //JP 01.02.99: bei ReadOnly Flag richtig abfragen und ggfs. neu
2166 : : // formatieren; Bug 61335
2167 : :
2168 : : // Schalten wir gerade von Readonly auf Bearbeiten um?
2169 [ # # ]: 0 : if( bSet != pOpt->IsReadonly() )
2170 : : {
2171 : : // damit die Flags richtig erfragt werden koennen.
2172 : 0 : pOpt->SetReadonly( sal_False );
2173 : :
2174 : 0 : sal_Bool bReformat = pOpt->IsFldName();
2175 : :
2176 : 0 : pOpt->SetReadonly( bSet );
2177 : :
2178 [ # # ]: 0 : if( bReformat )
2179 : : {
2180 : 0 : StartAction();
2181 : 0 : Reformat();
2182 [ # # ]: 0 : if ( GetWin() )
2183 : 0 : GetWin()->Invalidate();
2184 : 0 : EndAction();
2185 : : }
2186 [ # # ]: 0 : else if ( GetWin() )
2187 : 0 : GetWin()->Invalidate();
2188 [ # # ]: 0 : if( Imp()->IsAccessible() )
2189 : 0 : Imp()->InvalidateAccessibleEditableState( sal_False );
2190 : : }
2191 : 0 : }
2192 : :
2193 : :
2194 : 0 : void ViewShell::SetPDFExportOption(sal_Bool bSet)
2195 : : {
2196 [ # # ]: 0 : if( bSet != pOpt->IsPDFExport() )
2197 : : {
2198 [ # # ][ # # ]: 0 : if( bSet && pOpt->getBrowseMode() )
[ # # ]
2199 : 0 : pOpt->SetPrtFormat( sal_True );
2200 : 0 : pOpt->SetPDFExport(bSet);
2201 : : }
2202 : 0 : }
2203 : :
2204 : :
2205 : 0 : void ViewShell::SetReadonlySelectionOption(sal_Bool bSet)
2206 : : {
2207 [ # # ]: 0 : if( bSet != pOpt->IsSelectionInReadonly() )
2208 : : {
2209 : 0 : pOpt->SetSelectionInReadonly(bSet);
2210 : : }
2211 : 0 : }
2212 : :
2213 : :
2214 : 19 : void ViewShell::SetPrtFormatOption( sal_Bool bSet )
2215 : : {
2216 : 19 : pOpt->SetPrtFormat( bSet );
2217 : 19 : }
2218 : :
2219 : :
2220 : 45131 : void ViewShell::UISizeNotify()
2221 : : {
2222 [ + + ]: 45131 : if ( bDocSizeChgd )
2223 : : {
2224 : 142 : bDocSizeChgd = sal_False;
2225 : 142 : sal_Bool bOld = bInSizeNotify;
2226 : 142 : bInSizeNotify = sal_True;
2227 [ + - ]: 142 : ::SizeNotify( this, GetDocSize() );
2228 : 142 : bInSizeNotify = bOld;
2229 : : }
2230 : 45131 : }
2231 : :
2232 : :
2233 : 618 : void ViewShell::SetRestoreActions(sal_uInt16 nSet)
2234 : : {
2235 : : OSL_ENSURE(!GetRestoreActions()||!nSet, "multiple restore of the Actions ?");
2236 : 618 : Imp()->SetRestoreActions(nSet);
2237 : 618 : }
2238 : 309 : sal_uInt16 ViewShell::GetRestoreActions() const
2239 : : {
2240 : 309 : return Imp()->GetRestoreActions();
2241 : : }
2242 : :
2243 : 1306 : sal_Bool ViewShell::IsNewLayout() const
2244 : : {
2245 : 1306 : return GetLayout()->IsNewLayout();
2246 : : }
2247 : :
2248 : 24 : uno::Reference< ::com::sun::star::accessibility::XAccessible > ViewShell::CreateAccessible()
2249 : : {
2250 : 24 : uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc;
2251 : :
2252 : : // We require a layout and an XModel to be accessible.
2253 : : OSL_ENSURE( pLayout, "no layout, no access" );
2254 : : OSL_ENSURE( GetWin(), "no window, no access" );
2255 : :
2256 [ + - ][ + - ]: 24 : if( pDoc->GetCurrentViewShell() && GetWin() ) //swmod 071108
[ + - ][ + - ]
2257 [ + - ][ + - ]: 24 : xAcc = Imp()->GetAccessibleMap().GetDocumentView();
[ + - ]
2258 : :
2259 : 24 : return xAcc;
2260 : : }
2261 : :
2262 : : uno::Reference< ::com::sun::star::accessibility::XAccessible >
2263 : 0 : ViewShell::CreateAccessiblePreview()
2264 : : {
2265 : : OSL_ENSURE( IsPreView(),
2266 : : "Can't create accessible preview for non-preview ViewShell" );
2267 : :
2268 : : // We require a layout and an XModel to be accessible.
2269 : : OSL_ENSURE( pLayout, "no layout, no access" );
2270 : : OSL_ENSURE( GetWin(), "no window, no access" );
2271 : :
2272 [ # # ][ # # ]: 0 : if ( IsPreView() && GetLayout()&& GetWin() )
[ # # ][ # # ]
2273 : : {
2274 : 0 : return Imp()->GetAccessibleMap().GetDocumentPreview(
2275 : 0 : PagePreviewLayout()->maPrevwPages,
2276 : 0 : GetWin()->GetMapMode().GetScaleX(),
2277 : 0 : GetLayout()->GetPageByPageNum( PagePreviewLayout()->mnSelectedPageNum ),
2278 : 0 : PagePreviewLayout()->maWinSize ); //swmod 080305
2279 : : }
2280 : 0 : return NULL;
2281 : : }
2282 : :
2283 : 2276 : void ViewShell::InvalidateAccessibleFocus()
2284 : : {
2285 [ + + ]: 2276 : if( Imp()->IsAccessible() )
2286 : 24 : Imp()->GetAccessibleMap().InvalidateFocus();
2287 : 2276 : }
2288 : :
2289 : : /*
2290 : : * invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs #i27138#
2291 : : */
2292 : 0 : void ViewShell::InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxtFrm,
2293 : : const SwTxtFrm* _pToTxtFrm )
2294 : : {
2295 [ # # ][ # # ]: 0 : if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
[ # # ]
2296 : : {
2297 : 0 : Imp()->_InvalidateAccessibleParaFlowRelation( _pFromTxtFrm, _pToTxtFrm );
2298 : : }
2299 : 0 : }
2300 : :
2301 : : /*
2302 : : * invalidate text selection for paragraphs #i27301#
2303 : : */
2304 : 35553 : void ViewShell::InvalidateAccessibleParaTextSelection()
2305 : : {
2306 [ + - ][ + + ]: 35553 : if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
[ + + ]
2307 : : {
2308 : 142 : Imp()->_InvalidateAccessibleParaTextSelection();
2309 : : }
2310 : 35553 : }
2311 : :
2312 : : /**
2313 : : * invalidate attributes for paragraphs #i88069#
2314 : : */
2315 : 4530 : void ViewShell::InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm )
2316 : : {
2317 [ + - ][ - + ]: 4530 : if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
[ - + ]
2318 : : {
2319 : 0 : Imp()->_InvalidateAccessibleParaAttrs( rTxtFrm );
2320 : : }
2321 : 4530 : }
2322 : :
2323 : 33 : SwAccessibleMap* ViewShell::GetAccessibleMap()
2324 : : {
2325 [ - + ]: 33 : if ( Imp()->IsAccessible() )
2326 : : {
2327 : 0 : return &(Imp()->GetAccessibleMap());
2328 : : }
2329 : :
2330 : 33 : return 0;
2331 : : }
2332 : :
2333 : :
2334 : 1318 : void ViewShell::ApplyAccessiblityOptions(SvtAccessibilityOptions& rAccessibilityOptions)
2335 : : {
2336 [ - + ][ # # ]: 1318 : if(pOpt->IsPagePreview() && !rAccessibilityOptions.GetIsForPagePreviews())
[ - + ]
2337 : : {
2338 : 0 : pAccOptions->SetAlwaysAutoColor(sal_False);
2339 : 0 : pAccOptions->SetStopAnimatedGraphics(sal_False);
2340 : 0 : pAccOptions->SetStopAnimatedText(sal_False);
2341 : : }
2342 : : else
2343 : : {
2344 : 1318 : pAccOptions->SetAlwaysAutoColor(rAccessibilityOptions.GetIsAutomaticFontColor());
2345 : 1318 : pAccOptions->SetStopAnimatedGraphics(! rAccessibilityOptions.GetIsAllowAnimatedGraphics());
2346 : 1318 : pAccOptions->SetStopAnimatedText(! rAccessibilityOptions.GetIsAllowAnimatedText());
2347 : :
2348 : : // Formular view
2349 : : // Always set this option, not only if document is read-only:
2350 : 1318 : pOpt->SetSelectionInReadonly(rAccessibilityOptions.IsSelectionInReadonly());
2351 : : }
2352 : 1318 : }
2353 : :
2354 : 1686 : ShellResource* ViewShell::GetShellRes()
2355 : : {
2356 : 1686 : return pShellRes;
2357 : : }
2358 : :
2359 : 0 : void ViewShell::SetCareWin( Window* pNew )
2360 : : {
2361 : 0 : pCareWindow = pNew;
2362 : 0 : }
2363 : :
2364 : 19 : sal_uInt16 ViewShell::GetPageCount() const
2365 : : {
2366 [ + - ]: 19 : return GetLayout() ? GetLayout()->GetPageNum() : 1;
2367 : : }
2368 : :
2369 : 0 : const Size ViewShell::GetPageSize( sal_uInt16 nPageNum, bool bSkipEmptyPages ) const
2370 : : {
2371 : 0 : Size aSize;
2372 : 0 : const SwRootFrm* pTmpRoot = GetLayout();
2373 [ # # ][ # # ]: 0 : if( pTmpRoot && nPageNum )
2374 : : {
2375 : : const SwPageFrm* pPage = static_cast<const SwPageFrm*>
2376 : 0 : (pTmpRoot->Lower());
2377 : :
2378 [ # # ][ # # ]: 0 : while( --nPageNum && pPage->GetNext() )
[ # # ]
2379 : 0 : pPage = static_cast<const SwPageFrm*>( pPage->GetNext() );
2380 : :
2381 [ # # ][ # # ]: 0 : if( !bSkipEmptyPages && pPage->IsEmptyPage() && pPage->GetNext() )
[ # # ][ # # ]
2382 : 0 : pPage = static_cast<const SwPageFrm*>( pPage->GetNext() );
2383 : :
2384 : 0 : aSize = pPage->Frm().SSize();
2385 : : }
2386 : 0 : return aSize;
2387 : : }
2388 : :
2389 : :
2390 : : // #i12836# enhanced pdf export
2391 : 0 : sal_Int32 ViewShell::GetPageNumAndSetOffsetForPDF( OutputDevice& rOut, const SwRect& rRect ) const
2392 : : {
2393 : : OSL_ENSURE( GetLayout(), "GetPageNumAndSetOffsetForPDF assumes presence of layout" );
2394 : :
2395 : 0 : sal_Int32 nRet = -1;
2396 : :
2397 : : // #i40059# Position out of bounds:
2398 : 0 : SwRect aRect( rRect );
2399 [ # # ]: 0 : aRect.Pos().X() = Max( aRect.Left(), GetLayout()->Frm().Left() );
2400 : :
2401 [ # # ][ # # ]: 0 : const SwPageFrm* pPage = GetLayout()->GetPageAtPos( aRect.Center() );
[ # # ]
2402 [ # # ]: 0 : if ( pPage )
2403 : : {
2404 : : OSL_ENSURE( pPage, "GetPageNumAndSetOffsetForPDF: No page found" );
2405 : :
2406 : 0 : Point aOffset( pPage->Frm().Pos() );
2407 : 0 : aOffset.X() = -aOffset.X();
2408 : 0 : aOffset.Y() = -aOffset.Y();
2409 : :
2410 [ # # ]: 0 : MapMode aMapMode( rOut.GetMapMode() );
2411 [ # # ]: 0 : aMapMode.SetOrigin( aOffset );
2412 [ # # ]: 0 : rOut.SetMapMode( aMapMode );
2413 : :
2414 [ # # ]: 0 : nRet = pPage->GetPhyPageNum() - 1;
2415 : : }
2416 : :
2417 : 0 : return nRet;
2418 : : }
2419 : :
2420 : :
2421 : : // --> PB 2007-05-30 #146850#
2422 : 57 : const BitmapEx& ViewShell::GetReplacementBitmap( bool bIsErrorState )
2423 : : {
2424 : : BitmapEx** ppRet;
2425 : 57 : sal_uInt16 nResId = 0;
2426 [ + + ]: 57 : if( bIsErrorState )
2427 : : {
2428 : 23 : ppRet = &pErrorBmp;
2429 : 23 : nResId = RID_GRAPHIC_ERRORBMP;
2430 : : }
2431 : : else
2432 : : {
2433 : 34 : ppRet = &pReplaceBmp;
2434 : 34 : nResId = RID_GRAPHIC_REPLACEBMP;
2435 : : }
2436 : :
2437 [ + + ]: 57 : if( !*ppRet )
2438 : : {
2439 [ + - ][ + - ]: 4 : *ppRet = new BitmapEx( SW_RES( nResId ) );
2440 : : }
2441 : 57 : return **ppRet;
2442 : : }
2443 : :
2444 : 0 : void ViewShell::DeleteReplacementBitmaps()
2445 : : {
2446 [ # # ]: 0 : DELETEZ( pErrorBmp );
2447 [ # # ]: 0 : DELETEZ( pReplaceBmp );
2448 : 0 : }
2449 : :
2450 : 62135 : SwPostItMgr* ViewShell::GetPostItMgr()
2451 : : {
2452 [ + - ]: 62135 : SwView* pView = GetDoc()->GetDocShell() ? GetDoc()->GetDocShell()->GetView() : 0;
2453 [ + + ]: 62135 : if ( pView )
2454 : 60713 : return pView->GetPostItMgr();
2455 : :
2456 : 62135 : return 0;
2457 : : }
2458 : :
2459 : : /*
2460 : : * Document Interface Access
2461 : : */
2462 [ + - ]: 609235 : const IDocumentSettingAccess* ViewShell::getIDocumentSettingAccess() const { return pDoc; }
2463 [ + - ]: 5436 : IDocumentSettingAccess* ViewShell::getIDocumentSettingAccess() { return pDoc; }
2464 [ + - ]: 58 : const IDocumentDeviceAccess* ViewShell::getIDocumentDeviceAccess() const { return pDoc; }
2465 [ + - ]: 5276 : IDocumentDeviceAccess* ViewShell::getIDocumentDeviceAccess() { return pDoc; }
2466 : 0 : const IDocumentMarkAccess* ViewShell::getIDocumentMarkAccess() const { return pDoc->getIDocumentMarkAccess(); }
2467 : 0 : IDocumentMarkAccess* ViewShell::getIDocumentMarkAccess() { return pDoc->getIDocumentMarkAccess(); }
2468 [ + - ]: 24756 : const IDocumentDrawModelAccess* ViewShell::getIDocumentDrawModelAccess() const { return pDoc; }
2469 [ + - ]: 17474 : IDocumentDrawModelAccess* ViewShell::getIDocumentDrawModelAccess() { return pDoc; }
2470 [ # # ]: 0 : const IDocumentRedlineAccess* ViewShell::getIDocumentRedlineAccess() const { return pDoc; }
2471 [ # # ]: 0 : IDocumentRedlineAccess* ViewShell::getIDocumentRedlineAccess() { return pDoc; }
2472 [ # # ]: 0 : const IDocumentLayoutAccess* ViewShell::getIDocumentLayoutAccess() const { return pDoc; }
2473 [ + - ]: 38 : IDocumentLayoutAccess* ViewShell::getIDocumentLayoutAccess() { return pDoc; }
2474 [ # # ]: 0 : IDocumentContentOperations* ViewShell::getIDocumentContentOperations() { return pDoc; }
2475 [ # # ]: 0 : IDocumentStylePoolAccess* ViewShell::getIDocumentStylePoolAccess() { return pDoc; }
2476 [ + - ]: 8858 : const IDocumentStatistics* ViewShell::getIDocumentStatistics() const { return pDoc; }
2477 : :
2478 : 0 : IDocumentUndoRedo & ViewShell::GetIDocumentUndoRedo()
2479 : 0 : { return pDoc->GetIDocumentUndoRedo(); }
2480 : 0 : IDocumentUndoRedo const& ViewShell::GetIDocumentUndoRedo() const
2481 : 0 : { return pDoc->GetIDocumentUndoRedo(); }
2482 : :
2483 : : // --> OD 2007-11-14 #i83479#
2484 : 0 : const IDocumentListItems* ViewShell::getIDocumentListItemsAccess() const
2485 : : {
2486 [ # # ]: 0 : return pDoc;
2487 : : }
2488 : 0 : const IDocumentOutlineNodes* ViewShell::getIDocumentOutlineNodesAccess() const
2489 : : {
2490 [ # # ]: 0 : return pDoc;
2491 : : }
2492 : :
2493 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|