LibreOffice Module sw (master)  1
viewsh.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <officecfg/Office/Common.hxx>
21 #include <com/sun/star/accessibility/XAccessible.hpp>
22 #include <sfx2/viewfrm.hxx>
23 #include <sfx2/progress.hxx>
24 #include <svx/srchdlg.hxx>
25 #include <sfx2/viewsh.hxx>
26 #include <sfx2/ipclient.hxx>
27 #include <sal/log.hxx>
28 #include <drawdoc.hxx>
29 #include <swwait.hxx>
30 #include <crsrsh.hxx>
31 #include <doc.hxx>
37 #include <IDocumentState.hxx>
38 #include <rootfrm.hxx>
39 #include <pagefrm.hxx>
40 #include <cntfrm.hxx>
41 #include <viewimp.hxx>
42 #include <frmtool.hxx>
43 #include <viewopt.hxx>
44 #include <dview.hxx>
45 #include <swregion.hxx>
46 #include <hints.hxx>
47 #include <docufld.hxx>
48 #include <txtfrm.hxx>
49 #include <layact.hxx>
50 #include <mdiexp.hxx>
51 #include <fntcache.hxx>
52 #include <ptqueue.hxx>
53 #include <docsh.hxx>
54 #include <pagedesc.hxx>
55 #include <bookmark.hxx>
56 #include <ndole.hxx>
57 #include <ndindex.hxx>
58 #include <accmap.hxx>
59 #include <vcl/bitmapex.hxx>
61 #include <accessibilityoptions.hxx>
62 #include <strings.hrc>
63 #include <bitmaps.hlst>
64 #include <pagepreviewlayout.hxx>
65 #include <sortedobjs.hxx>
66 #include <anchoredobject.hxx>
69 
70 #include <unotxdoc.hxx>
71 #include <view.hxx>
72 #include <PostItMgr.hxx>
73 #include <unotools/configmgr.hxx>
74 #include <vcl/virdev.hxx>
75 #include <vcl/svapp.hxx>
76 #include <svx/sdrpaintwindow.hxx>
77 #include <svx/sdrpagewindow.hxx>
78 #include <svx/svdpagv.hxx>
79 #include <comphelper/lok.hxx>
80 #include <sfx2/lokhelper.hxx>
81 #include <tools/UnitConversion.hxx>
82 
83 #if !HAVE_FEATURE_DESKTOP
84 #include <vcl/sysdata.hxx>
85 #endif
86 
87 #include <frameformats.hxx>
88 #include <fmtcntnt.hxx>
89 
90 bool SwViewShell::sbLstAct = false;
93 
94 static bool bInSizeNotify = false;
95 
96 
97 using namespace ::com::sun::star;
98 
100 
101  //tdf#118621 - Optionally disable floating header/footer menu
102  if ( bShow )
104 
105  if ( eControl == FrameControlType::Header )
106  mbShowHeaderSeparator = bShow;
107  else
108  mbShowFooterSeparator = bShow;
109 }
110 
112 {
114  if ( !mbHeaderFooterEdit )
115  {
118  }
119 
120  // Avoid corner case
121  if ( ( GetViewOptions()->IsUseHeaderFooterMenu() ) &&
124  {
125  mbHeaderFooterEdit = false;
126  }
127 
128  // Repaint everything
129  GetWin()->Invalidate();
130 }
131 
132 void SwViewShell::setOutputToWindow(bool bOutputToWindow)
133 {
134  mbOutputToWindow = bOutputToWindow;
135 }
136 
138 {
139  return mbOutputToWindow;
140 }
141 
143 {
144  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwViewShell"));
145  (void)xmlTextWriterEndElement(pWriter);
146 }
147 
148 static void
150 {
151  // Direct paint has been performed: the background of transparent child
152  // windows has been painted, so need to paint the child windows now.
153  if (rShell.GetWin())
154  {
155  vcl::Window& rWindow = *(rShell.GetWin());
156  const tools::Rectangle aRectanglePixel(rShell.GetOut()->LogicToPixel(rRect.SVRect()));
157  PaintTransparentChildren(rWindow, aRectanglePixel);
158  }
159 }
160 
161 // #i72754# 2nd set of Pre/PostPaints
162 // This time it uses the lock counter (mPrePostPaintRegions empty/non-empty) to allow only one activation
163 // and deactivation and mpPrePostOutDev to remember the OutDev from the BeginDrawLayers
164 // call. That way, all places where paint take place can be handled the same way, even
165 // when calling other paint methods. This is the case at the places where SW paints
166 // buffered into VDevs to avoid flicker. It is in general problematic and should be
167 // solved once using the BufferedOutput functionality of the DrawView.
168 
170 {
171  // forward PrePaint event from VCL Window to DrawingLayer
172  if(HasDrawView())
173  {
174  Imp()->GetDrawView()->PrePaint();
175  }
176 }
177 
179 {
180  if(mPrePostPaintRegions.empty())
181  {
182  mPrePostPaintRegions.push( rRegion );
183  // #i75172# ensure DrawView to use DrawingLayer bufferings
184  if ( !HasDrawView() )
185  MakeDrawView();
186 
187  // Prefer window; if not available, get mpOut (e.g. printer)
188  const bool bWindow = GetWin() && !comphelper::LibreOfficeKit::isActive() && !isOutputToWindow();
189  mpPrePostOutDev = bWindow ? GetWin()->GetOutDev() : GetOut();
190 
191  // #i74769# use SdrPaintWindow now direct
193  OSL_ENSURE(mpTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
194 
195  // #i74769# if prerender, save OutDev and redirect to PreRenderDevice
197  {
200  }
201  else if (isOutputToWindow())
202  // In case mpOut is used without buffering and we're not printing, need to set clipping.
203  mpOut->SetClipRegion(rRegion);
204 
205  // remember original paint MapMode for wrapped FlyFrame paints
207  }
208  else
209  {
210  // region needs to be updated to the given one
211  if( mPrePostPaintRegions.top() != rRegion )
213  mPrePostPaintRegions.push( rRegion );
214  }
215 }
216 
217 void SwViewShell::DLPostPaint2(bool bPaintFormLayer)
218 {
219  OSL_ENSURE(!mPrePostPaintRegions.empty(), "SwViewShell::DLPostPaint2: Pre/PostPaint encapsulation broken (!)");
220 
221  if( mPrePostPaintRegions.size() > 1 )
222  {
223  vcl::Region current = std::move(mPrePostPaintRegions.top());
224  mPrePostPaintRegions.pop();
225  if( current != mPrePostPaintRegions.top())
227  return;
228  }
229  mPrePostPaintRegions.pop(); // clear
230  if(nullptr != mpTargetPaintWindow)
231  {
232  // #i74769# restore buffered OutDev
234  {
236  }
237 
238  // #i74769# use SdrPaintWindow now direct
239  Imp()->GetDrawView()->EndDrawLayers(*mpTargetPaintWindow, bPaintFormLayer);
240  mpTargetPaintWindow = nullptr;
241  }
242 }
243 // end of Pre/PostPaints
244 
245 void SwViewShell::ImplEndAction( const bool bIdleEnd )
246 {
247  // Nothing to do for the printer?
248  if ( !GetWin() || IsPreview() )
249  {
250  mbPaintWorks = true;
251  UISizeNotify();
252  // tdf#101464 print preview may generate events if another view shell
253  // performs layout...
254  if (IsPreview() && Imp()->IsAccessible())
255  {
257  }
258  return;
259  }
260 
261  mbInEndAction = true;
262  //will this put the EndAction of the last shell in the sequence?
263 
264  SwViewShell::sbLstAct = true;
265  for(SwViewShell& rShell : GetRingContainer())
266  {
267  if(&rShell != this && rShell.ActionPend())
268  {
269  SwViewShell::sbLstAct = false;
270  break;
271  }
272  }
273 
274  const bool bIsShellForCheckViewLayout = ( this == GetLayout()->GetCurrShell() );
275 
276  CurrShell aCurr( this );
277  if ( Imp()->HasDrawView() && !Imp()->GetDrawView()->areMarkHandlesHidden() )
278  Imp()->StartAction();
279 
280  if ( Imp()->HasPaintRegion() && Imp()->GetPaintRegion()->GetOrigin() != VisArea() )
281  Imp()->DeletePaintRegion();
282 
283  const bool bExtraData = ::IsExtraData( GetDoc() );
284 
285  if ( !bIdleEnd )
286  {
287  SwLayAction aAction( GetLayout(), Imp() );
288  aAction.SetComplete( false );
289  if ( mnLockPaint )
290  aAction.SetPaint( false );
291  aAction.SetInputType( VclInputFlags::KEYBOARD );
292  aAction.Action(GetWin()->GetOutDev());
293  }
294 
295  if ( bIsShellForCheckViewLayout )
297 
298  //If we don't call Paints, we wait for the Paint of the system.
299  //Then the clipping is set correctly; e.g. shifting of a Draw object
300  if ( Imp()->HasPaintRegion() ||
302  bExtraData )
303  {
304  if ( !mnLockPaint )
305  {
306  SolarMutexGuard aGuard;
307 
308  bool bPaintsFromSystem = maInvalidRect.HasArea();
310  if ( maInvalidRect.HasArea() )
311  {
312  if ( bPaintsFromSystem )
314 
316  bPaintsFromSystem = true;
317  }
318  mbPaintWorks = true;
319 
320  std::unique_ptr<SwRegionRects> pRegion = Imp()->TakePaintRegion();
321 
322  //JP 27.11.97: what hid the selection, must also Show it,
323  // else we get Paint errors!
324  // e.g. additional mode, page half visible vertically, in the
325  // middle a selection and with another cursor jump to left
326  // right border. Without ShowCursor the selection disappears.
327  bool bShowCursor = pRegion && dynamic_cast<const SwCursorShell*>(this) != nullptr;
328  if( bShowCursor )
329  static_cast<SwCursorShell*>(this)->HideCursors();
330 
331  if ( pRegion )
332  {
333  SwRootFrame* pCurrentLayout = GetLayout();
334 
335  pRegion->LimitToOrigin();
336  pRegion->Compress( SwRegionRects::CompressFuzzy );
337 
339  while ( !pRegion->empty() )
340  {
341  SwRect aRect( pRegion->back() );
342  pRegion->pop_back();
343 
344  bool bPaint = true;
345  if ( IsEndActionByVirDev() )
346  {
347  //create virtual device and set.
348  if ( !pVout )
350  MapMode aMapMode( GetOut()->GetMapMode() );
351  pVout->SetMapMode( aMapMode );
352 
353  bool bSizeOK = true;
354 
355  tools::Rectangle aTmp1( aRect.SVRect() );
356  aTmp1 = GetOut()->LogicToPixel( aTmp1 );
357  tools::Rectangle aTmp2( GetOut()->PixelToLogic( aTmp1 ) );
358  if ( aTmp2.Left() > aRect.Left() )
359  aTmp1.SetLeft( std::max( tools::Long(0), aTmp1.Left() - 1 ) );
360  if ( aTmp2.Top() > aRect.Top() )
361  aTmp1.SetTop( std::max<tools::Long>( 0, aTmp1.Top() - 1 ) );
362  aTmp1.AdjustRight(1 );
363  aTmp1.AdjustBottom(1 );
364  aTmp1 = GetOut()->PixelToLogic( aTmp1 );
365  aRect = SwRect( aTmp1 );
366 
367  const Size aTmp( pVout->GetOutputSize() );
368  if ( aTmp.Height() < aRect.Height() ||
369  aTmp.Width() < aRect.Width() )
370  {
371  bSizeOK = pVout->SetOutputSize( aRect.SSize() );
372  }
373  if ( bSizeOK )
374  {
375  bPaint = false;
376 
377  // --> OD 2007-07-26 #i79947#
378  // #i72754# start Pre/PostPaint encapsulation before mpOut is changed to the buffering VDev
379  const vcl::Region aRepaintRegion(aRect.SVRect());
380  DLPrePaint2(aRepaintRegion);
381  // <--
382 
383  OutputDevice *pOld = GetOut();
384  pVout->SetLineColor( pOld->GetLineColor() );
385  pVout->SetFillColor( pOld->GetFillColor() );
386  Point aOrigin( aRect.Pos() );
387  aOrigin.setX( -aOrigin.X() ); aOrigin.setY( -aOrigin.Y() );
388  aMapMode.SetOrigin( aOrigin );
389  pVout->SetMapMode( aMapMode );
390 
391  mpOut = pVout.get();
392  if ( bPaintsFromSystem )
393  PaintDesktop(*mpOut, aRect);
394  pCurrentLayout->PaintSwFrame( *mpOut, aRect );
395  pOld->DrawOutDev( aRect.Pos(), aRect.SSize(),
396  aRect.Pos(), aRect.SSize(), *pVout );
397  mpOut = pOld;
398 
399  // #i72754# end Pre/PostPaint encapsulation when mpOut is back and content is painted
400  DLPostPaint2(true);
401  }
402  }
403  if ( bPaint )
404  {
405  if (GetWin()->SupportsDoubleBuffering())
406  InvalidateWindows(aRect);
407  else
408  {
409  // #i75172# begin DrawingLayer paint
410  // need to do begin/end DrawingLayer preparation for each single rectangle of the
411  // repaint region. I already tried to prepare only once for the whole Region. This
412  // seems to work (and does technically) but fails with transparent objects. Since the
413  // region given to BeginDrawLayers() defines the clip region for DrawingLayer paint,
414  // transparent objects in the single rectangles will indeed be painted multiple times.
416  {
417  DLPrePaint2(vcl::Region(aRect.SVRect()));
418  }
419 
420  if ( bPaintsFromSystem )
421  PaintDesktop(*GetOut(), aRect);
423  pCurrentLayout->PaintSwFrame( *mpOut, aRect );
424  else
425  pCurrentLayout->GetCurrShell()->InvalidateWindows(aRect);
426 
427  // #i75172# end DrawingLayer paint
429  {
430  DLPostPaint2(true);
431  }
432  }
433  }
434 
435  lcl_PaintTransparentFormControls(*this, aRect); // i#107365
436  }
437  }
438  if( bShowCursor )
439  static_cast<SwCursorShell*>(this)->ShowCursors( true );
440  }
441  else
442  {
443  Imp()->DeletePaintRegion();
444  mbPaintWorks = true;
445  }
446  }
447  else
448  mbPaintWorks = true;
449 
450  mbInEndAction = false;
451  SwViewShell::sbLstAct = false;
452  Imp()->EndAction();
453 
454  //We artificially end the action here to enable the automatic scrollbars
455  //to adjust themselves correctly
456  //EndAction sends a Notify, and that must call Start-/EndAction to
457  //adjust the scrollbars correctly
458  --mnStartAction;
459  UISizeNotify();
460  ++mnStartAction;
461 
462  if( Imp()->IsAccessible() )
464 }
465 
467 {
468  mbPaintWorks = false;
469  Imp()->StartAction();
470 }
471 
473 {
474  if ( GetWin() && GetWin()->IsVisible() )
475  GetWin()->EnablePaint( false ); //Also cut off the controls.
476  Imp()->LockPaint();
477 }
478 
479 void SwViewShell::ImplUnlockPaint( bool bVirDev )
480 {
481  CurrShell aCurr( this );
482  if ( GetWin() && GetWin()->IsVisible() )
483  {
484  if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && !comphelper::LibreOfficeKit::isActive())
485  {
486  //Refresh with virtual device to avoid flickering.
488  pVout->SetMapMode( mpOut->GetMapMode() );
489  Size aSize( VisArea().SSize() );
490  aSize.AdjustWidth(20 );
491  aSize.AdjustHeight(20 );
492  if( pVout->SetOutputSize( aSize ) )
493  {
494  GetWin()->EnablePaint( true );
495  GetWin()->Validate();
496 
497  Imp()->UnlockPaint();
498  pVout->SetLineColor( mpOut->GetLineColor() );
499  pVout->SetFillColor( mpOut->GetFillColor() );
500 
501  // #i72754# start Pre/PostPaint encapsulation before mpOut is changed to the buffering VDev
502  const vcl::Region aRepaintRegion(VisArea().SVRect());
503  DLPrePaint2(aRepaintRegion);
504 
505  OutputDevice *pOld = mpOut;
506  mpOut = pVout.get();
507  Paint(*mpOut, VisArea().SVRect());
508  mpOut = pOld;
509  mpOut->DrawOutDev( VisArea().Pos(), aSize,
510  VisArea().Pos(), aSize, *pVout );
511 
512  // #i72754# end Pre/PostPaint encapsulation when mpOut is back and content is painted
513  DLPostPaint2(true);
514 
515  lcl_PaintTransparentFormControls(*this, VisArea()); // fdo#63949
516  }
517  else
518  {
519  Imp()->UnlockPaint();
520  GetWin()->EnablePaint( true );
521  GetWin()->Invalidate( InvalidateFlags::Children );
522  }
523  pVout.disposeAndClear();
524  }
525  else
526  {
527  Imp()->UnlockPaint();
528  GetWin()->EnablePaint( true );
529  GetWin()->Invalidate( InvalidateFlags::Children );
530  }
531  }
532  else
533  Imp()->UnlockPaint();
534 }
535 
536 bool SwViewShell::AddPaintRect( const SwRect & rRect )
537 {
538  bool bRet = false;
539  for(SwViewShell& rSh : GetRingContainer())
540  {
541  if( rSh.Imp() )
542  {
543  if ( rSh.IsPreview() && rSh.GetWin() )
544  ::RepaintPagePreview( &rSh, rRect );
545  else
546  bRet |= rSh.Imp()->AddPaintRect( rRect );
547  }
548  }
549  return bRet;
550 }
551 
553 {
554  if ( Imp()->IsCalcLayoutProgress() )
555  return;
556 
558  {
559  // If we are inside tiled painting, invalidations are ignored.
560  // Ignore them right now to save work, but also to avoid the problem
561  // that this state could be reset before FlushPendingLOKInvalidateTiles()
562  // gets called.
564  return;
565  // First collect all invalidations and perform them only later,
566  // otherwise the number of Invalidate() calls would be at least
567  // O(n^2) if not worse. The problem is that if any change in a document
568  // is made, SwEditShell::EndAllAction() is called, which calls EndAction()
569  // for every view. And every view does it own handling of paint rectangles,
570  // and then calls InvalidateWindows() based on that. On then this code
571  // would call Invalidate() for all views for each rectangle.
572  // So collect the rectangles, avoid duplicates (which there usually will
573  // be many because of the repetitions), FlushPendingLOKInvalidateTiles()
574  // will collect all rectangles from all related views, compress them
575  // and only with those relatively few rectangle it'd call Invalidate()
576  // for all views.
577  Imp()->AddPendingLOKInvalidation(rRect);
578  return;
579  }
580 
581  for(SwViewShell& rSh : GetRingContainer())
582  {
583  if ( rSh.GetWin() )
584  {
585  if ( rSh.IsPreview() )
586  ::RepaintPagePreview( &rSh, rRect );
587  // In case of tiled rendering, invalidation is wanted even if
588  // the rectangle is outside the visual area.
589  else if ( rSh.VisArea().Overlaps( rRect ) || comphelper::LibreOfficeKit::isActive() )
590  rSh.GetWin()->Invalidate( rRect.SVRect() );
591  }
592  }
593 }
594 
596 {
598  SwRegionRects rects;
599  for(SwViewShell& rSh : GetRingContainer())
600  {
601  std::vector<SwRect> tmpRects = rSh.Imp()->TakePendingLOKInvalidations();
602  rects.insert( rects.end(), tmpRects.begin(), tmpRects.end());
603  }
605  if(rects.empty())
606  return;
607  // This is basically the loop from SwViewShell::InvalidateWindows().
608  for(SwViewShell& rSh : GetRingContainer())
609  {
610  if ( rSh.GetWin() )
611  {
612  if ( rSh.IsPreview() )
613  {
614  for( const SwRect& rect : rects )
615  ::RepaintPagePreview( &rSh, rect );
616  }
617  else
618  {
619  for( const SwRect& rect : rects )
620  rSh.GetWin()->Invalidate( rect.SVRect() );
621  }
622  }
623  }
624 }
625 
627 {
628  // when using the tiled rendering, consider the entire document as our
629  // visible area
631 }
632 
633 void SwViewShell::MakeVisible( const SwRect &rRect )
634 {
635  if ( !(!VisArea().Contains( rRect ) || IsScrollMDI( this, rRect ) || GetCareDialog(*this)) )
636  return;
637 
638  if ( IsViewLocked() )
639  return;
640 
641  if( mpWin )
642  {
643  const SwFrame* pRoot = GetLayout();
644  int nLoopCnt = 3;
645  tools::Long nOldH;
646  do{
647  nOldH = pRoot->getFrameArea().Height();
648  StartAction();
649  ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX );
650  EndAction();
651  } while( nOldH != pRoot->getFrameArea().Height() && nLoopCnt-- );
652  }
653 #if OSL_DEBUG_LEVEL > 0
654  else
655  {
656  //MA: 04. Nov. 94, no one needs this, does one?
657  OSL_ENSURE( false, "Is MakeVisible still needed for printers?" );
658  }
659 
660 #endif
661 }
662 
664 {
665  if (!rVSh.mpSfxViewShell)
666  return nullptr;
667 #if HAVE_FEATURE_DESKTOP
668  const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
669  SfxViewFrame* pVFrame = rVSh.mpSfxViewShell->GetViewFrame();
670  SfxChildWindow* pChWin = pVFrame->GetChildWindow( nId );
671  if (!pChWin)
672  return nullptr;
673  weld::DialogController* pController = pChWin->GetController().get();
674  if (!pController)
675  return nullptr;
676  weld::Window* pWin = pController->getDialog();
677  if (pWin && pWin->get_visible())
678  return pWin;
679 #endif
680  return nullptr;
681 }
682 
683 Point SwViewShell::GetPagePos( sal_uInt16 nPageNum ) const
684 {
685  return GetLayout()->GetPagePos( nPageNum );
686 }
687 
688 sal_uInt16 SwViewShell::GetNumPages() const
689 {
690  //It is possible that no layout exists when the method from
691  //root-Ctor is called.
692  return GetLayout() ? GetLayout()->GetPageNum() : 0;
693 }
694 
695 bool SwViewShell::IsDummyPage( sal_uInt16 nPageNum ) const
696 {
697  return GetLayout() && GetLayout()->IsDummyPage( nPageNum );
698 }
699 
706 void SwViewShell::UpdateFields(bool bCloseDB)
707 {
708  CurrShell aCurr( this );
709 
710  auto pCursorShell = dynamic_cast<SwCursorShell*>( this );
711  if ( pCursorShell )
712  pCursorShell->StartAction();
713  else
714  StartAction();
715 
717 
718  if ( pCursorShell )
719  pCursorShell->EndAction();
720  else
721  EndAction();
722 }
723 
725 {
726  SwDoc* pDoc = GetDoc();
727  const SwFrameFormats* const pFormats = pDoc->GetSpzFrameFormats();
728  if (pFormats->empty())
729  {
730  return;
731  }
732 
733  for (size_t i = 0; i < pFormats->size(); ++i)
734  {
735  SwFrameFormat* pFormat = (*pFormats)[i];
736  if (pFormat->Which() != RES_FLYFRMFMT)
737  {
738  continue;
739  }
740 
741  const SwNodeIndex* pNodeIndex = pFormat->GetContent().GetContentIdx();
742  if (!pNodeIndex || !pNodeIndex->GetNodes().IsDocNodes())
743  {
744  continue;
745  }
746 
747  SwNode* pNode = pDoc->GetNodes()[pNodeIndex->GetIndex() + 1];
748  SwOLENode* pOleNode = pNode->GetOLENode();
749  if (!pOleNode)
750  {
751  continue;
752  }
753 
754  SwOLEObj& rOleObj = pOleNode->GetOLEObj();
755  svt::EmbeddedObjectRef& rObject = rOleObj.GetObject();
756  rObject.UpdateReplacement();
757  // Trigger the repaint.
758  pOleNode->SetChanged();
759  }
760 }
761 
764 {
765  CurrShell aCurr( this );
766  // Start-/EndAction handled in the SwDoc-Method!
767  GetDoc()->UpdateAllCharts();
768 }
769 
771 {
772  bool bRet = false;
773  SwNodeIndex aIdx( *GetDoc()->GetNodes().GetEndOfAutotext().
774  StartOfSectionNode(), 1 );
775  while (aIdx.GetNode().GetStartNode())
776  {
777  ++aIdx;
778  const SwOLENode *pNd = aIdx.GetNode().GetOLENode();
779  if( pNd && !pNd->GetChartTableName().isEmpty() )
780  {
781  bRet = true;
782  break;
783  }
784  }
785  return bRet;
786 }
787 
789 {
790  if( !mpOpt->IsIdle() || !GetWin() || HasDrawViewDrag() )
791  return;
792 
793  //No idle when printing is going on.
794  for(const SwViewShell& rSh : GetRingContainer())
795  {
796  if ( !rSh.GetWin() )
797  return;
798  }
799 
800  CurrShell aCurr( this );
801 
802 #ifdef DBG_UTIL
803  // If Test5 has been set, the IdleFormatter is disabled.
804  if( mpOpt->IsTest5() )
805  return;
806 #endif
807 
808  {
809  // Preserve top of the text frame cache.
810  SwSaveSetLRUOfst aSaveLRU;
811  // #125243# there are lots of stacktraces indicating that Imp() returns NULL
812  // this SwViewShell seems to be invalid - but it's not clear why
813  // this return is only a workaround!
814  OSL_ENSURE(Imp(), "SwViewShell already deleted?");
815  if(!Imp())
816  return;
817  SwLayIdle aIdle( GetLayout(), Imp() );
818  }
819 }
820 
822 {
823  auto pCursorShell = dynamic_cast<SwCursorShell*>( &rSh);
824  if ( pCursorShell )
825  pCursorShell->StartAction();
826  else
827  rSh.StartAction();
828  rSh.GetLayout()->InvalidateAllContent( nInv );
829  if ( pCursorShell )
830  pCursorShell->EndAction();
831  else
832  rSh.EndAction();
833 
835 }
836 
842 {
843  auto pCursorShell = dynamic_cast<SwCursorShell*>( &_rSh);
844  if ( pCursorShell )
845  pCursorShell->StartAction();
846  else
847  _rSh.StartAction();
848 
849  _rSh.GetLayout()->InvalidateAllObjPos();
850 
851  if ( pCursorShell )
852  pCursorShell->EndAction();
853  else
854  _rSh.EndAction();
855 
857 }
858 
860 {
862  if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) != bNew )
863  {
864  SwWait aWait( *GetDoc()->GetDocShell(), true );
867  lcl_InvalidateAllContent( *this, nInv );
868  }
869 }
870 
872 {
875  {
876  SwWait aWait( *GetDoc()->GetDocShell(), true );
879  lcl_InvalidateAllContent( *this, nInv );
880  }
881 }
882 
883 void SwViewShell::SetTabCompat( bool bNew )
884 {
886  if( rIDSA.get(DocumentSettingId::TAB_COMPAT) != bNew )
887  {
888  SwWait aWait( *GetDoc()->GetDocShell(), true );
889  rIDSA.set(DocumentSettingId::TAB_COMPAT, bNew );
891  lcl_InvalidateAllContent( *this, nInv );
892  }
893 }
894 
896 {
898  if ( rIDSA.get(DocumentSettingId::ADD_EXT_LEADING) != bNew )
899  {
900  SwWait aWait( *GetDoc()->GetDocShell(), true );
903  if ( pTmpDrawModel )
904  pTmpDrawModel->SetAddExtLeading( bNew );
906  lcl_InvalidateAllContent( *this, nInv );
907  }
908 }
909 
910 void SwViewShell::SetUseVirDev( bool bNewVirtual )
911 {
913  if ( rIDSA.get(DocumentSettingId::USE_VIRTUAL_DEVICE) != bNewVirtual )
914  {
915  SwWait aWait( *GetDoc()->GetDocShell(), true );
916  // this sets the flag at the document and calls PrtDataChanged
918  rIDDA.setReferenceDeviceType( bNewVirtual, true );
919  }
920 }
921 
926 void SwViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells )
927 {
929  if (rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells
930  || rIDSA.get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells)
931  {
932  SwWait aWait( *GetDoc()->GetDocShell(), true );
933  rIDSA.set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells );
934  // note: the dialog can't change the value to indeterminate, so only false/false and true/true
935  rIDSA.set(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells );
937  lcl_InvalidateAllContent( *this, nInv );
938  }
939 }
940 
946 void SwViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing )
947 {
949  if ( rIDSA.get(DocumentSettingId::OLD_LINE_SPACING) != _bUseFormerLineSpacing )
950  {
951  SwWait aWait( *GetDoc()->GetDocShell(), true );
952  rIDSA.set(DocumentSettingId::OLD_LINE_SPACING, _bUseFormerLineSpacing );
954  lcl_InvalidateAllContent( *this, nInv );
955  }
956 }
957 
963 void SwViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos )
964 {
966  if ( rIDSA.get(DocumentSettingId::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos )
967  {
968  SwWait aWait( *GetDoc()->GetDocShell(), true );
969  rIDSA.set(DocumentSettingId::USE_FORMER_OBJECT_POS, _bUseFormerObjPos );
970  lcl_InvalidateAllObjPos( *this );
971  }
972 }
973 
974 // #i28701#
975 void SwViewShell::SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos )
976 {
978  if ( rIDSA.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos )
979  {
980  SwWait aWait( *GetDoc()->GetDocShell(), true );
981  rIDSA.set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos );
982  lcl_InvalidateAllObjPos( *this );
983  }
984 }
985 
986 void SwViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping )
987 {
989  if ( rIDSA.get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping )
990  {
991  SwWait aWait( *GetDoc()->GetDocShell(), true );
992  rIDSA.set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping );
994  lcl_InvalidateAllContent( *this, nInv );
995  }
996 }
997 
998 // #i45491#
999 void SwViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWithManualBreak )
1000 {
1002  if ( rIDSA.get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak )
1003  {
1004  SwWait aWait( *GetDoc()->GetDocShell(), true );
1005  rIDSA.set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak );
1007  lcl_InvalidateAllContent( *this, nInv );
1008  }
1009 }
1010 
1011 void SwViewShell::SetProtectForm( bool _bProtectForm )
1012 {
1014  rIDSA.set(DocumentSettingId::PROTECT_FORM, _bProtectForm );
1015 }
1016 
1017 void SwViewShell::SetMsWordCompTrailingBlanks( bool _bMsWordCompTrailingBlanks )
1018 {
1020  if (rIDSA.get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS) != _bMsWordCompTrailingBlanks)
1021  {
1022  SwWait aWait(*GetDoc()->GetDocShell(), true);
1023  rIDSA.set(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS, _bMsWordCompTrailingBlanks);
1025  lcl_InvalidateAllContent(*this, nInv);
1026  }
1027 }
1028 
1029 void SwViewShell::SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys)
1030 {
1032  rIDSA.set(DocumentSettingId::SUBTRACT_FLYS, bSubtractFlysAnchoredAtFlys);
1033 }
1034 
1035 void SwViewShell::SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara)
1036 {
1038  if (rIDSA.get(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA) == bEmptyDbFieldHidesPara)
1039  return;
1040 
1041  SwWait aWait(*GetDoc()->GetDocShell(), true);
1042  rIDSA.set(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA, bEmptyDbFieldHidesPara);
1043  StartAction();
1045  for (auto const & pFieldType : *GetDoc()->getIDocumentFieldsAccess().GetFieldTypes())
1046  {
1047  if(pFieldType->Which() == SwFieldIds::Database)
1048  pFieldType->UpdateFields();
1049  }
1050  EndAction();
1051 }
1052 
1054 {
1055  SwWait aWait( *GetDoc()->GetDocShell(), true );
1056 
1057  // we go for safe: get rid of the old font information,
1058  // when the printer resolution or zoom factor changes.
1059  // Init() and Reformat() are the safest locations.
1060  pFntCache->Flush( );
1061 
1062  if( GetLayout()->IsCallbackActionEnabled() )
1063  {
1064  StartAction();
1066  EndAction();
1067  }
1068 }
1069 
1071 {
1072  SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess().GetDrawModel();
1073  if ( pTmpDrawModel )
1074  pTmpDrawModel->ReformatAllTextObjects();
1075  Reformat();
1076 }
1077 
1079 {
1080  // extremely likely to be a Bad Idea to call this without StartAction
1081  // (except the Page Preview apparently only has a non-subclassed ViewShell)
1082  assert((typeid(*this) == typeid(SwViewShell)) || mnStartAction);
1083 
1084  CurrShell aCurr( this );
1085  SwWait aWait( *GetDoc()->GetDocShell(), true );
1086 
1087  // Preserve top of the text frame cache.
1088  SwSaveSetLRUOfst aSaveLRU;
1089 
1090  //switch on Progress when none is running yet.
1091  const bool bEndProgress = SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) == nullptr;
1092  if ( bEndProgress )
1093  {
1094  tools::Long nEndPage = GetLayout()->GetPageNum();
1095  nEndPage += nEndPage * 10 / 100;
1096  ::StartProgress( STR_STATSTR_REFORMAT, 0, nEndPage, GetDoc()->GetDocShell() );
1097  }
1098 
1099  SwLayAction aAction( GetLayout(), Imp() );
1100  aAction.SetPaint( false );
1101  aAction.SetStatBar( true );
1102  aAction.SetCalcLayout( true );
1103  aAction.SetReschedule( true );
1105  aAction.Action(GetOut());
1107 
1108  //the SetNewFieldLst() on the Doc was cut off and must be fetched again
1109  //(see flowfrm.cxx, txtfld.cxx)
1110  if ( aAction.IsExpFields() )
1111  {
1112  aAction.Reset();
1113  aAction.SetPaint( false );
1114  aAction.SetStatBar( true );
1115  aAction.SetReschedule( true );
1116 
1117  SwDocPosUpdate aMsgHint( 0 );
1119  GetDoc()->getIDocumentFieldsAccess().UpdateExpFields(nullptr, true);
1120 
1121  aAction.Action(GetOut());
1122  }
1123 
1124  if ( VisArea().HasArea() )
1126  if ( bEndProgress )
1127  ::EndProgress( GetDoc()->GetDocShell() );
1128 }
1129 
1131 {
1132  for(SwViewShell& rSh : GetRingContainer())
1133  {
1134  if ( rSh.Imp() )
1135  rSh.Imp()->SetFirstVisPageInvalid();
1136  }
1137 }
1138 
1140 {
1141  if ( !mpWin )
1142  mbDocSizeChgd = true;
1143  else if( ActionPend() || Imp()->IsCalcLayoutProgress() || mbPaintInProgress )
1144  {
1145  mbDocSizeChgd = true;
1146 
1147  if ( !Imp()->IsCalcLayoutProgress() && dynamic_cast<const SwCursorShell*>( this ) != nullptr )
1148  {
1149  PageNumNotify(this);
1150 
1152  {
1153  Size aDocSize = GetDocSize();
1154  std::stringstream ss;
1155  ss << aDocSize.Width() + 2 * DOCUMENTBORDER << ", " << aDocSize.Height() + 2 * DOCUMENTBORDER;
1156  OString sSize = ss.str().c_str();
1157 
1158  SwXTextDocument* pModel = comphelper::getFromUnoTunnel<SwXTextDocument>(GetSfxViewShell()->GetCurrentDocument());
1160  }
1161  }
1162  }
1163  else
1164  {
1165  mbDocSizeChgd = false;
1166  ::SizeNotify( this, GetDocSize() );
1167  }
1168 }
1169 
1171 {
1172  OSL_ENSURE( GetWin(), "VisPortChgd without Window." );
1173 
1174  if ( rRect == VisArea() )
1175  return;
1176 
1177  // Is someone spuriously rescheduling again?
1178  SAL_WARN_IF(mbInEndAction, "sw.core", "Scrolling during EndAction");
1179 
1180  //First get the old visible page, so we don't have to look
1181  //for it afterwards.
1182  const SwFrame *pOldPage = Imp()->GetFirstVisPage(GetWin()->GetOutDev());
1183 
1184  const SwRect aPrevArea( VisArea() );
1185  const bool bFull = aPrevArea.IsEmpty();
1186  maVisArea = rRect;
1188 
1189  //When there a PaintRegion still exists and the VisArea has changed,
1190  //the PaintRegion is at least by now obsolete. The PaintRegion can
1191  //have been created by RootFrame::PaintSwFrame.
1192  if ( !mbInEndAction &&
1193  Imp()->HasPaintRegion() && Imp()->GetPaintRegion()->GetOrigin() != VisArea() )
1194  Imp()->DeletePaintRegion();
1195 
1196  CurrShell aCurr( this );
1197 
1198  bool bScrolled = false;
1199 
1200  SwPostItMgr* pPostItMgr = GetPostItMgr();
1201 
1202  if ( bFull )
1203  GetWin()->Invalidate();
1204  else
1205  {
1206  //Calculate amount to be scrolled.
1207  const tools::Long nXDiff = aPrevArea.Left() - VisArea().Left();
1208  const tools::Long nYDiff = aPrevArea.Top() - VisArea().Top();
1209 
1210  if( !nXDiff && !GetViewOptions()->getBrowseMode() &&
1211  (!Imp()->HasDrawView() || !Imp()->GetDrawView()->IsGridVisible() ) )
1212  {
1213  // If possible, don't scroll the application background
1214  // (PaintDesktop). Also limit the left and right side of
1215  // the scroll range to the pages.
1216  const SwPageFrame *pPage = static_cast<SwPageFrame*>(GetLayout()->Lower());
1217  if ( pPage->getFrameArea().Top() > pOldPage->getFrameArea().Top() )
1218  pPage = static_cast<const SwPageFrame*>(pOldPage);
1219  SwRect aBoth( VisArea() );
1220  aBoth.Union( aPrevArea );
1221  const SwTwips nBottom = aBoth.Bottom();
1222  SwTwips nMinLeft = SAL_MAX_INT32;
1223  SwTwips nMaxRight= 0;
1224 
1225  const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
1226 
1227  while ( pPage && pPage->getFrameArea().Top() <= nBottom )
1228  {
1229  SwRect aPageRect( pPage->GetBoundRect(GetWin()->GetOutDev()) );
1230  if ( bBookMode )
1231  {
1232  const SwPageFrame& rFormatPage = pPage->GetFormatPage();
1233  aPageRect.SSize( rFormatPage.GetBoundRect(GetWin()->GetOutDev()).SSize() );
1234  }
1235 
1236  // #i9719# - consider new border and shadow width
1237  if ( aPageRect.Overlaps( aBoth ) )
1238  {
1239  SwTwips nPageLeft = 0;
1240  SwTwips nPageRight = 0;
1241  const sw::sidebarwindows::SidebarPosition aSidebarPos = pPage->SidebarPosition();
1242 
1243  if( aSidebarPos != sw::sidebarwindows::SidebarPosition::NONE )
1244  {
1245  nPageLeft = aPageRect.Left();
1246  nPageRight = aPageRect.Right();
1247  }
1248 
1249  if( nPageLeft < nMinLeft )
1250  nMinLeft = nPageLeft;
1251  if( nPageRight > nMaxRight )
1252  nMaxRight = nPageRight;
1253  //match with the draw objects
1254  //take nOfst into account as the objects have been
1255  //selected and have handles attached.
1256  if ( pPage->GetSortedObjs() )
1257  {
1258  const tools::Long nOfst = GetOut()->PixelToLogic(
1259  Size(Imp()->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width();
1260  for (SwAnchoredObject* pObj : *pPage->GetSortedObjs())
1261  {
1262  // ignore objects that are not actually placed on the page
1263  if (pObj->IsFormatPossible())
1264  {
1265  const tools::Rectangle &rBound = pObj->GetObjRect().SVRect();
1266  if (rBound.Left() != FAR_AWAY) {
1267  // OD 03.03.2003 #107927# - use correct datatype
1268  const SwTwips nL = std::max( SwTwips(0), SwTwips(rBound.Left() - nOfst) );
1269  if ( nL < nMinLeft )
1270  nMinLeft = nL;
1271  if( rBound.Right() + nOfst > nMaxRight )
1272  nMaxRight = rBound.Right() + nOfst;
1273  }
1274  }
1275  }
1276  }
1277  }
1278  pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
1279  }
1280  tools::Rectangle aRect( aPrevArea.SVRect() );
1281  aRect.SetLeft( nMinLeft );
1282  aRect.SetRight( nMaxRight );
1283  if( VisArea().Overlaps( aPrevArea ) && !mnLockPaint )
1284  {
1285  bScrolled = true;
1286  maVisArea.Pos() = aPrevArea.Pos();
1287  if ( SmoothScroll( nXDiff, nYDiff, &aRect ) )
1288  return;
1289  maVisArea.Pos() = rRect.Pos();
1290  }
1291  else
1292  GetWin()->Invalidate( aRect );
1293  }
1294  else if ( !mnLockPaint ) //will be released in Unlock
1295  {
1296  if( VisArea().Overlaps( aPrevArea ) )
1297  {
1298  bScrolled = true;
1299  maVisArea.Pos() = aPrevArea.Pos();
1300  if ( SmoothScroll( nXDiff, nYDiff, nullptr ) )
1301  return;
1302  maVisArea.Pos() = rRect.Pos();
1303  }
1304  else
1305  GetWin()->Invalidate();
1306  }
1307  }
1308 
1309  // When tiled rendering, the map mode of the window is disabled, avoid
1310  // enabling it here.
1312  {
1313  Point aPt( VisArea().Pos() );
1314  aPt.setX( -aPt.X() ); aPt.setY( -aPt.Y() );
1315  MapMode aMapMode( GetWin()->GetMapMode() );
1316  aMapMode.SetOrigin( aPt );
1317  GetWin()->SetMapMode( aMapMode );
1318  }
1319 
1320  if ( HasDrawView() )
1321  {
1322  Imp()->GetDrawView()->VisAreaChanged( GetWin()->GetOutDev() );
1323  Imp()->GetDrawView()->SetActualWin( GetWin()->GetOutDev() );
1324  }
1325  GetWin()->PaintImmediately();
1326 
1327  if ( pPostItMgr ) // #i88070#
1328  {
1329  pPostItMgr->Rescale();
1330  pPostItMgr->CalcRects();
1331  pPostItMgr->LayoutPostIts();
1332  }
1333 
1334  if ( !bScrolled && pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1335  pPostItMgr->CorrectPositions();
1336 
1337  if( Imp()->IsAccessible() )
1338  Imp()->UpdateAccessible();
1339 }
1340 
1342 {
1343 #if !defined(MACOSX) && !defined(ANDROID) && !defined(IOS)
1344  // #i98766# - disable smooth scrolling for Mac
1345 
1346  const sal_uLong nBitCnt = mpOut->GetBitCount();
1347  tools::Long lMult = 1, lMax = LONG_MAX;
1348  if ( nBitCnt == 16 )
1349  {
1350  lMax = 7000;
1351  lMult = 2;
1352  }
1353  if ( nBitCnt == 24 )
1354  {
1355  lMax = 5000;
1356  lMult = 6;
1357  }
1358  else if ( nBitCnt == 1 )
1359  {
1360  lMax = 3000;
1361  lMult = 12;
1362  }
1363 
1364  // #i75172# isolated static conditions
1365  const bool bOnlyYScroll(!lXDiff && std::abs(lYDiff) != 0 && std::abs(lYDiff) < lMax);
1366  const bool bAllowedWithChildWindows(GetWin()->GetWindowClipRegionPixel().IsNull());
1367  const bool bSmoothScrollAllowed(bOnlyYScroll && mbEnableSmooth && GetViewOptions()->IsSmoothScroll() && bAllowedWithChildWindows);
1368 
1369  if(bSmoothScrollAllowed)
1370  {
1371  Imp()->m_bStopSmooth = false;
1372 
1373  const SwRect aOldVis( VisArea() );
1374 
1375  //create virtual device and set.
1376  const Size aPixSz = GetWin()->PixelToLogic(Size(1,1));
1377  VclPtrInstance<VirtualDevice> pVout( *GetWin()->GetOutDev() );
1378  pVout->SetLineColor( GetWin()->GetOutDev()->GetLineColor() );
1379  pVout->SetFillColor( GetWin()->GetOutDev()->GetFillColor() );
1380  MapMode aMapMode( GetWin()->GetMapMode() );
1381  pVout->SetMapMode( aMapMode );
1382  Size aSize( maVisArea.Width()+2*aPixSz.Width(), std::abs(lYDiff)+(2*aPixSz.Height()) );
1383  if ( pRect )
1384  aSize.setWidth( std::min(aSize.Width(), pRect->GetWidth()+2*aPixSz.Width()) );
1385  if ( pVout->SetOutputSize( aSize ) )
1386  {
1387  mnLockPaint++;
1388 
1389  //First Paint everything in the virtual device.
1390  SwRect aRect( VisArea() );
1391  aRect.Height( aSize.Height() );
1392  if ( pRect )
1393  {
1394  aRect.Pos().setX( std::max(aRect.Left(),pRect->Left()-aPixSz.Width()) );
1395  aRect.Right( std::min(aRect.Right()+2*aPixSz.Width(), pRect->Right()+aPixSz.Width()));
1396  }
1397  else
1398  aRect.AddWidth(2*aPixSz.Width() );
1399  aRect.Pos().setY( lYDiff < 0 ? aOldVis.Bottom() - aPixSz.Height()
1400  : aRect.Top() - aSize.Height() + aPixSz.Height() );
1401  aRect.Pos().setX( std::max( tools::Long(0), aRect.Left()-aPixSz.Width() ) );
1402  aRect.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.Pos()));
1403  aRect.SSize( GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.SSize())) );
1404  maVisArea = aRect;
1405  const Point aPt( -aRect.Left(), -aRect.Top() );
1406  aMapMode.SetOrigin( aPt );
1407  pVout->SetMapMode( aMapMode );
1408  OutputDevice *pOld = mpOut;
1409  mpOut = pVout.get();
1410 
1411  {
1412  // #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the
1413  // repaint would not be correct since it would use the wrong DrawPage visible region.
1414  // This repaint IS about painting something currently outside the visible part (!).
1415  // For that purpose, AddWindowToPaintView is used which creates a new SdrPageViewWindow
1416  // and all the necessary stuff. It's not cheap, but necessary here. Alone because repaint
1417  // target really is NOT the current window.
1418  // Also will automatically NOT use PreRendering and overlay (since target is VirtualDevice)
1419  if(!HasDrawView())
1420  MakeDrawView();
1421  SdrView* pDrawView = GetDrawView();
1422  pDrawView->AddWindowToPaintView(pVout, nullptr);
1423 
1424  // clear mpWin during DLPrePaint2 to get paint preparation for mpOut, but set it again
1425  // immediately afterwards. There are many decisions in SW which imply that Printing
1426  // is used when mpWin == 0 (wrong but widely used).
1427  vcl::Window* pOldWin = mpWin;
1428  mpWin = nullptr;
1429  DLPrePaint2(vcl::Region(aRect.SVRect()));
1430  mpWin = pOldWin;
1431 
1432  // SW paint stuff
1433  PaintDesktop(*GetOut(), aRect);
1434  SwViewShell::sbLstAct = true;
1435  GetLayout()->PaintSwFrame( *GetOut(), aRect );
1436  SwViewShell::sbLstAct = false;
1437 
1438  // end paint and destroy ObjectContact again
1439  DLPostPaint2(true);
1440  pDrawView->DeleteWindowFromPaintView(pVout);
1441  }
1442 
1443  mpOut = pOld;
1444  maVisArea = aOldVis;
1445 
1446  //Now shift in parts and copy the new Pixel from the virtual device.
1447 
1448  // ??????????????????????
1449  // or is it better to get the scrollfactor from the User
1450  // as option?
1451  // ??????????????????????
1452  tools::Long lMaDelta = aPixSz.Height();
1453  if ( std::abs(lYDiff) > ( maVisArea.Height() / 3 ) )
1454  lMaDelta *= 6;
1455  else
1456  lMaDelta *= 2;
1457 
1458  lMaDelta *= lMult;
1459 
1460  if ( lYDiff < 0 )
1461  lMaDelta = -lMaDelta;
1462 
1463  tools::Long lDiff = lYDiff;
1464  while ( lDiff )
1465  {
1466  tools::Long lScroll;
1467  if ( Imp()->m_bStopSmooth || std::abs(lDiff) <= std::abs(lMaDelta) )
1468  {
1469  lScroll = lDiff;
1470  lDiff = 0;
1471  }
1472  else
1473  {
1474  lScroll = lMaDelta;
1475  lDiff -= lMaDelta;
1476  }
1477 
1478  const SwRect aTmpOldVis = VisArea();
1479  maVisArea.Pos().AdjustY( -lScroll );
1480  maVisArea.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( VisArea().Pos()));
1481  lScroll = aTmpOldVis.Top() - VisArea().Top();
1482  if ( pRect )
1483  {
1484  tools::Rectangle aTmp( aTmpOldVis.SVRect() );
1485  aTmp.SetLeft( pRect->Left() );
1486  aTmp.SetRight( pRect->Right() );
1487  GetWin()->Scroll( 0, lScroll, aTmp, ScrollFlags::Children);
1488  }
1489  else
1490  GetWin()->Scroll( 0, lScroll, ScrollFlags::Children );
1491 
1492  const Point aTmpPt( -VisArea().Left(), -VisArea().Top() );
1493  MapMode aTmpMapMode( GetWin()->GetMapMode() );
1494  aTmpMapMode.SetOrigin( aTmpPt );
1495  GetWin()->SetMapMode( aTmpMapMode );
1496 
1497  if ( Imp()->HasDrawView() )
1498  Imp()->GetDrawView()->VisAreaChanged( GetWin()->GetOutDev() );
1499 
1501  if ( !Imp()->m_bStopSmooth )
1502  {
1503  const bool bScrollDirectionIsUp(lScroll > 0);
1504  Imp()->m_aSmoothRect = VisArea();
1505 
1506  if(bScrollDirectionIsUp)
1507  {
1508  Imp()->m_aSmoothRect.Bottom( VisArea().Top() + lScroll + aPixSz.Height());
1509  }
1510  else
1511  {
1512  Imp()->m_aSmoothRect.Top( VisArea().Bottom() + lScroll - aPixSz.Height());
1513  }
1514 
1515  Imp()->m_bSmoothUpdate = true;
1516  GetWin()->PaintImmediately();
1517  Imp()->m_bSmoothUpdate = false;
1518 
1519  if(!Imp()->m_bStopSmooth)
1520  {
1521  // start paint on logic base
1522  const tools::Rectangle aTargetLogic(Imp()->m_aSmoothRect.SVRect());
1523  DLPrePaint2(vcl::Region(aTargetLogic));
1524 
1525  // get target rectangle in discrete pixels
1527  const tools::Rectangle aTargetPixel(rTargetDevice.LogicToPixel(aTargetLogic));
1528 
1529  // get source top-left in discrete pixels
1530  const Point aSourceTopLeft(pVout->LogicToPixel(aTargetLogic.TopLeft()));
1531 
1532  // switch off MapModes
1533  const bool bMapModeWasEnabledDest(rTargetDevice.IsMapModeEnabled());
1534  const bool bMapModeWasEnabledSource(pVout->IsMapModeEnabled());
1535  rTargetDevice.EnableMapMode(false);
1536  pVout->EnableMapMode(false);
1537 
1538  rTargetDevice.DrawOutDev(
1539  aTargetPixel.TopLeft(), aTargetPixel.GetSize(), // dest
1540  aSourceTopLeft, aTargetPixel.GetSize(), // source
1541  *pVout);
1542 
1543  // restore MapModes
1544  rTargetDevice.EnableMapMode(bMapModeWasEnabledDest);
1545  pVout->EnableMapMode(bMapModeWasEnabledSource);
1546 
1547  // end paint on logoc base
1548  DLPostPaint2(true);
1549  }
1550  else
1551  --mnLockPaint;
1552  }
1553  }
1554  pVout.disposeAndClear();
1555  GetWin()->PaintImmediately();
1556  if ( !Imp()->m_bStopSmooth )
1557  --mnLockPaint;
1559  return true;
1560  }
1561  pVout.disposeAndClear();
1562  }
1563 #endif
1564 
1565  maVisArea.Pos().AdjustX( -lXDiff );
1566  maVisArea.Pos().AdjustY( -lYDiff );
1567  if ( pRect )
1568  GetWin()->Scroll( lXDiff, lYDiff, *pRect, ScrollFlags::Children);
1569  else
1570  GetWin()->Scroll( lXDiff, lYDiff, ScrollFlags::Children);
1571  return false;
1572 }
1573 
1574 void SwViewShell::PaintDesktop(const vcl::RenderContext& rRenderContext, const SwRect &rRect)
1575 {
1576  if ( !GetWin() && !GetOut()->GetConnectMetaFile() )
1577  return; //for the printer we don't do anything here.
1578 
1580  return;
1581 
1582  //Catch exceptions, so that it doesn't look so surprising.
1583  //Can e.g. happen during Idle.
1584  //Unfortunately we must at any rate Paint the rectangles next to the pages,
1585  //as these are not painted at VisPortChgd.
1586  bool bBorderOnly = false;
1587  const SwRootFrame *pRoot = GetLayout();
1588  if ( rRect.Top() > pRoot->getFrameArea().Bottom() )
1589  {
1590  const SwFrame *pPg = pRoot->Lower();
1591  while ( pPg && pPg->GetNext() )
1592  pPg = pPg->GetNext();
1593  if ( !pPg || !pPg->getFrameArea().Overlaps( VisArea() ) )
1594  bBorderOnly = true;
1595  }
1596 
1597  const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
1598 
1599  SwRegionRects aRegion( rRect );
1600 
1601  //mod #i6193: remove sidebar area to avoid flickering
1602  const SwPostItMgr* pPostItMgr = GetPostItMgr();
1603  const SwTwips nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ?
1604  pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() :
1605  0;
1606 
1607  if ( bBorderOnly )
1608  {
1609  const SwFrame *pPage =pRoot->Lower();
1610  SwRect aLeft( rRect ), aRight( rRect );
1611  while ( pPage )
1612  {
1613  tools::Long nTmp = pPage->getFrameArea().Left();
1614  if ( nTmp < aLeft.Right() )
1615  aLeft.Right( nTmp );
1616  nTmp = pPage->getFrameArea().Right();
1617  if ( nTmp > aRight.Left() )
1618  {
1619  aRight.Left( nTmp + nSidebarWidth );
1620  }
1621  pPage = pPage->GetNext();
1622  }
1623  aRegion.clear();
1624  if ( aLeft.HasArea() )
1625  aRegion.push_back( aLeft );
1626  if ( aRight.HasArea() )
1627  aRegion.push_back( aRight );
1628  }
1629  else
1630  {
1631  const SwFrame *pPage = Imp()->GetFirstVisPage(&rRenderContext);
1632  const SwTwips nBottom = rRect.Bottom();
1633  while ( pPage && !aRegion.empty() &&
1634  (pPage->getFrameArea().Top() <= nBottom) )
1635  {
1636  SwRect aPageRect( pPage->getFrameArea() );
1637  if ( bBookMode )
1638  {
1639  const SwPageFrame& rFormatPage = static_cast<const SwPageFrame*>(pPage)->GetFormatPage();
1640  aPageRect.SSize( rFormatPage.getFrameArea().SSize() );
1641  }
1642 
1643  const bool bSidebarRight =
1645  aPageRect.Pos().AdjustX( -(bSidebarRight ? 0 : nSidebarWidth) );
1646  aPageRect.AddWidth(nSidebarWidth );
1647 
1648  if ( aPageRect.Overlaps( rRect ) )
1649  aRegion -= aPageRect;
1650 
1651  pPage = pPage->GetNext();
1652  }
1653  }
1654  if ( !aRegion.empty() )
1655  PaintDesktop_(aRegion);
1656 }
1657 
1658 // PaintDesktop is split in two, this part is also used by PreviewPage
1660 {
1661  // OD 2004-04-23 #116347#
1663  GetOut()->SetLineColor();
1664 
1665  for ( auto &rRgn : rRegion )
1666  {
1667  const tools::Rectangle aRectangle(rRgn.SVRect());
1668 
1669  // #i93170#
1670  // Here we have a real Problem. On the one hand we have the buffering for paint
1671  // and overlay which needs an embracing pair of DLPrePaint2/DLPostPaint2 calls,
1672  // on the other hand the MapMode is not set correctly when this code is executed.
1673  // This is done in the users of this method, for each SWpage before painting it.
1674  // Since the MapMode is not correct here, the call to DLPostPaint2 will paint
1675  // existing FormControls due to the current MapMode.
1676 
1677  // There are basically three solutions for this:
1678 
1679  // (1) Set the MapMode correct, move the background painting to the users of
1680  // this code
1681 
1682  // (2) Do no DLPrePaint2/DLPostPaint2 here; no SdrObjects are allowed to lie in
1683  // the desktop region. Disadvantage: the desktop will not be part of the
1684  // buffers, e.g. overlay. Thus, as soon as overlay will be used over the
1685  // desktop, it will not work.
1686 
1687  // (3) expand DLPostPaint2 with a flag to signal if FormControl paints shall
1688  // be done or not
1689 
1690  // Currently, (3) will be the best possible solution. It will keep overlay and
1691  // buffering intact and work without MapMode for single pages. In the medium
1692  // to long run, (1) will need to be used and the bool bPaintFormLayer needs
1693  // to be removed again
1694 
1695  // #i68597# inform Drawinglayer about display change
1696  DLPrePaint2(vcl::Region(aRectangle));
1697 
1698  // #i75172# needed to move line/Fill color setters into loop since DLPrePaint2
1699  // may exchange GetOut(), that's it's purpose. This happens e.g. at print preview.
1701  GetOut()->SetLineColor();
1702  GetOut()->DrawRect(aRectangle);
1703 
1704  DLPostPaint2(false);
1705  }
1706 
1707  GetOut()->Pop();
1708 }
1709 
1711 {
1712  if ( !GetWin() )
1713  return false;
1714 
1715  const SwPageFrame *pPage = Imp()->GetFirstVisPage(GetOut());
1716  const SwTwips nBottom = VisArea().Bottom();
1717  const SwTwips nRight = VisArea().Right();
1718  bool bRet = false;
1719  while ( !bRet && pPage && ((pPage->getFrameArea().Top() <= nBottom) &&
1720  (pPage->getFrameArea().Left() <= nRight)))
1721  {
1722  if ( pPage->IsInvalid() || pPage->IsInvalidFly() )
1723  bRet = true;
1724  pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
1725  }
1726 
1727  if ( bRet )
1728  {
1729  //Unfortunately Start/EndAction won't help here, as the Paint originated
1730  //from GUI and so Clipping has been set against getting through.
1731  //Ergo: do it all yourself (see ImplEndAction())
1732  if ( Imp()->HasPaintRegion() && Imp()->GetPaintRegion()->GetOrigin() != VisArea())
1733  Imp()->DeletePaintRegion();
1734 
1735  SwLayAction aAction( GetLayout(), Imp() );
1736  aAction.SetComplete( false );
1737  // We increment the action counter to avoid a recursive call of actions
1738  // e.g. from a SwFEShell::RequestObjectResize(..) in bug 95829.
1739  // A recursive call of actions is no good idea because the inner action
1740  // can't format frames which are locked by the outer action. This may
1741  // cause and endless loop.
1742  ++mnStartAction;
1743  aAction.Action(GetWin()->GetOutDev());
1744  --mnStartAction;
1745 
1746  std::unique_ptr<SwRegionRects> pRegion = Imp()->TakePaintRegion();
1747  if ( pRegion && aAction.IsBrowseActionStop() )
1748  {
1749  //only of interest when something has changed in the visible range
1750  bool bStop = true;
1751  for ( size_t i = 0; i < pRegion->size(); ++i )
1752  {
1753  const SwRect &rTmp = (*pRegion)[i];
1754  bStop = rTmp.Overlaps( VisArea() );
1755  if ( !bStop )
1756  break;
1757  }
1758  if ( bStop )
1759  pRegion.reset();
1760  }
1761 
1762  if ( pRegion )
1763  {
1764  pRegion->LimitToOrigin();
1765  pRegion->Compress( SwRegionRects::CompressFuzzy );
1766  bRet = false;
1767  if ( !pRegion->empty() )
1768  {
1769  SwRegionRects aRegion( rRect );
1770  for ( size_t i = 0; i < pRegion->size(); ++i )
1771  { const SwRect &rTmp = (*pRegion)[i];
1772  if ( !rRect.Contains( rTmp ) )
1773  {
1774  InvalidateWindows( rTmp );
1775  if ( rTmp.Overlaps( VisArea() ) )
1776  { aRegion -= rTmp;
1777  bRet = true;
1778  }
1779  }
1780  }
1781  if ( bRet )
1782  {
1783  for ( size_t i = 0; i < aRegion.size(); ++i )
1784  GetWin()->Invalidate( aRegion[i].SVRect() );
1785 
1786  if ( rRect != VisArea() )
1787  {
1788  //rRect == VisArea is the special case for new or
1789  //Shift-Ctrl-R, when it shouldn't be necessary to
1790  //hold the rRect again in Document coordinates.
1791  if ( maInvalidRect.IsEmpty() )
1792  maInvalidRect = rRect;
1793  else
1794  maInvalidRect.Union( rRect );
1795  }
1796  }
1797  }
1798  else
1799  bRet = false;
1800  }
1801  else
1802  bRet = false;
1803  }
1804  return bRet;
1805 }
1806 
1807 namespace
1808 {
1810 class RenderContextGuard
1811 {
1812  std::unique_ptr<SdrPaintWindow> m_TemporaryPaintWindow;
1813  SdrPageWindow* m_pPatchedPageWindow;
1814  SdrPaintWindow* m_pPreviousPaintWindow = nullptr;
1815 
1816 public:
1817  RenderContextGuard(VclPtr<vcl::RenderContext>& pRef, vcl::RenderContext* pValue, SwViewShell* pShell)
1818  : m_pPatchedPageWindow(nullptr)
1819  {
1820  pRef = pValue;
1821 
1822  if (pValue == pShell->GetWin()->GetOutDev())
1823  return;
1824 
1825  SdrView* pDrawView(pShell->Imp()->GetDrawView());
1826 
1827  if (nullptr == pDrawView)
1828  return;
1829 
1830  SdrPageView* pSdrPageView(pDrawView->GetSdrPageView());
1831 
1832  if (nullptr != pSdrPageView)
1833  {
1834  m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*pShell->GetWin()->GetOutDev());
1835 
1836  if (nullptr != m_pPatchedPageWindow)
1837  {
1838  m_TemporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, *pValue));
1839  m_pPreviousPaintWindow = m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow);
1840  }
1841  }
1842  }
1843 
1844  ~RenderContextGuard()
1845  {
1846  if(nullptr != m_pPatchedPageWindow)
1847  {
1848  m_pPatchedPageWindow->unpatchPaintWindow(m_pPreviousPaintWindow);
1849  }
1850  }
1851 };
1852 }
1853 
1854 void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect)
1855 {
1856  RenderContextGuard aGuard(mpOut, &rRenderContext, this);
1857  if ( mnLockPaint )
1858  {
1859  if ( Imp()->m_bSmoothUpdate )
1860  {
1861  SwRect aTmp( rRect );
1862  if ( !Imp()->m_aSmoothRect.Contains( aTmp ) )
1863  Imp()->m_bStopSmooth = true;
1864  else
1865  {
1866  Imp()->m_aSmoothRect = aTmp;
1867  return;
1868  }
1869  }
1870  else
1871  return;
1872  }
1873 
1874  if ( SwRootFrame::IsInPaint() )
1875  {
1876  //During the publication of a page at printing the Paint is buffered.
1877  SwPaintQueue::Add( this, SwRect( rRect ) );
1878  return;
1879  }
1880 
1881  //With !nStartAction I try to protect me against erroneous code at other places.
1882  //Hopefully it will not lead to problems!?
1883  if ( mbPaintWorks && !mnStartAction )
1884  {
1885  if( GetWin() && GetWin()->IsVisible() )
1886  {
1887  SwRect aRect( rRect );
1888  if ( mbPaintInProgress ) //Guard against double Paints!
1889  {
1890  GetWin()->Invalidate( rRect );
1891  return;
1892  }
1893 
1894  mbPaintInProgress = true;
1895  CurrShell aCurr( this );
1896  SwRootFrame::SetNoVirDev( true );
1897 
1898  //We don't want to Clip to and from, we trust that all are limited
1899  //to the rectangle and only need to calculate the clipping once.
1900  //The ClipRect is removed here once and not recovered, as externally
1901  //no one needs it anymore anyway.
1902  //Not when we paint a Metafile.
1903  if( !GetOut()->GetConnectMetaFile() && GetOut()->IsClipRegion())
1904  GetOut()->SetClipRegion();
1905 
1906  if ( IsPreview() )
1907  {
1908  //When useful, process or destroy the old InvalidRect.
1909  if ( aRect.Contains( maInvalidRect ) )
1910  ResetInvalidRect();
1911  SwViewShell::sbLstAct = true;
1912  GetLayout()->PaintSwFrame( rRenderContext, aRect );
1913  SwViewShell::sbLstAct = false;
1914  }
1915  else
1916  {
1917  //When one of the visible pages still has anything entered for
1918  //Repaint, Repaint must be triggered.
1919  if ( !CheckInvalidForPaint( aRect ) )
1920  {
1921  // --> OD 2009-08-12 #i101192#
1922  // start Pre/PostPaint encapsulation to avoid screen blinking
1923  const vcl::Region aRepaintRegion(aRect.SVRect());
1924  DLPrePaint2(aRepaintRegion);
1925 
1926  // <--
1927  PaintDesktop(rRenderContext, aRect);
1928 
1929  //When useful, process or destroy the old InvalidRect.
1930  if ( aRect.Contains( maInvalidRect ) )
1931  ResetInvalidRect();
1932  SwViewShell::sbLstAct = true;
1933  GetLayout()->PaintSwFrame( rRenderContext, aRect );
1934  SwViewShell::sbLstAct = false;
1935  // --> OD 2009-08-12 #i101192#
1936  // end Pre/PostPaint encapsulation
1937  DLPostPaint2(true);
1938  // <--
1939  }
1940  }
1941  SwRootFrame::SetNoVirDev( false );
1942  mbPaintInProgress = false;
1943  UISizeNotify();
1944  }
1945  }
1946  else
1947  {
1948  if ( maInvalidRect.IsEmpty() )
1949  maInvalidRect = SwRect( rRect );
1950  else
1951  maInvalidRect.Union( SwRect( rRect ) );
1952 
1953  if ( mbInEndAction && GetWin() )
1954  {
1955  const vcl::Region aRegion(GetWin()->GetPaintRegion());
1956  RectangleVector aRectangles;
1957  aRegion.GetRegionRectangles(aRectangles);
1958 
1959  for(const auto& rRectangle : aRectangles)
1960  {
1961  Imp()->AddPaintRect(SwRect(rRectangle));
1962  }
1963 
1964  //RegionHandle hHdl( aRegion.BeginEnumRects() );
1965  //Rectangle aRect;
1966  //while ( aRegion.GetEnumRects( hHdl, aRect ) )
1967  // Imp()->AddPaintRect( aRect );
1968  //aRegion.EndEnumRects( hHdl );
1969  }
1970  else if ( SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) &&
1971  GetOut() == GetWin()->GetOutDev() )
1972  {
1973  // #i68597#
1974  const vcl::Region aDLRegion(rRect);
1975  DLPrePaint2(aDLRegion);
1976 
1978  rRenderContext.SetFillColor( Imp()->GetRetoucheColor() );
1979  rRenderContext.SetLineColor();
1980  rRenderContext.DrawRect( rRect );
1981  rRenderContext.Pop();
1982  // #i68597#
1983  DLPostPaint2(true);
1984  }
1985  }
1986 }
1987 
1988 void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contextHeight, int tilePosX, int tilePosY, tools::Long tileWidth, tools::Long tileHeight)
1989 {
1990  // SwViewShell's output device setup
1991  // TODO clean up SwViewShell's approach to output devices (the many of
1992  // them - mpBufferedOut, mpOut, mpWin, ...)
1993  OutputDevice *pSaveOut = mpOut;
1995  mpOut = &rDevice;
1996 
1997  // resizes the virtual device so to contain the entries context
1998  rDevice.SetOutputSizePixel(Size(contextWidth, contextHeight));
1999 
2000  // setup the output device to draw the tile
2001  MapMode aMapMode(rDevice.GetMapMode());
2002  aMapMode.SetMapUnit(MapUnit::MapTwip);
2003  aMapMode.SetOrigin(Point(-tilePosX, -tilePosY));
2004 
2005  // Scaling. Must convert from pixels to twips. We know
2006  // that VirtualDevices use a DPI of 96.
2008  Fraction scaleX = Fraction(contextWidth, tileWidth) * scale;
2009  Fraction scaleY = Fraction(contextHeight, tileHeight) * scale;
2010  aMapMode.SetScaleX(scaleX);
2011  aMapMode.SetScaleY(scaleY);
2012  rDevice.SetMapMode(aMapMode);
2013 
2014  // Update scaling of SwEditWin and its sub-widgets, needed for comments.
2015  sal_uInt16 nOldZoomValue = 0;
2016  if (GetWin() && GetWin()->GetMapMode().GetScaleX() != scaleX)
2017  {
2018  double fScale = double(scaleX);
2019  SwViewOption aOption(*GetViewOptions());
2020  nOldZoomValue = aOption.GetZoom();
2021  aOption.SetZoom(fScale * 100);
2022  ApplyViewOptions(aOption);
2023  // Make sure the map mode (disabled in SwXTextDocument::initializeForTiledRendering()) is still disabled.
2024  GetWin()->EnableMapMode(false);
2025  }
2026 
2027  tools::Rectangle aOutRect(Point(tilePosX, tilePosY),
2028  rDevice.PixelToLogic(Size(contextWidth, contextHeight)));
2029 
2030  // Make the requested area visible -- we can't use MakeVisible as that will
2031  // only scroll the contents, but won't zoom/resize if needed.
2032  // Without this, items/text that are outside the visible area (in the SwView)
2033  // won't be painted when rendering tiles (at least when using either the
2034  // tiledrendering app, or the gtktiledviewer) -- although ultimately we
2035  // probably want to fix things so that the SwView's area doesn't affect
2036  // tiled rendering?
2037  VisPortChgd(SwRect(aOutRect));
2038 
2039  // Invoke SwLayAction if layout is not yet ready.
2040  CheckInvalidForPaint(SwRect(aOutRect));
2041 
2042  // draw - works in logic coordinates
2043  Paint(rDevice, aOutRect);
2044 
2045  SwPostItMgr* pPostItMgr = GetPostItMgr();
2046  if (GetViewOptions()->IsPostIts() && pPostItMgr)
2047  pPostItMgr->PaintTile(rDevice);
2048 
2049  // SwViewShell's output device tear down
2050 
2051  // A view shell can get a PaintTile call for a tile at a zoom level
2052  // different from the one, the related client really is.
2053  // In such a case it is better to reset the current scale value to
2054  // the original one, since such a value should be in synchronous with
2055  // the zoom level in the client (see setClientZoom).
2056  // At present the zoom value returned by GetViewOptions()->GetZoom() is
2057  // used in SwXTextDocument methods (postMouseEvent and setGraphicSelection)
2058  // for passing the correct mouse position to an edited chart (if any).
2059  if (nOldZoomValue !=0)
2060  {
2061  SwViewOption aOption(*GetViewOptions());
2062  aOption.SetZoom(nOldZoomValue);
2063  ApplyViewOptions(aOption);
2064 
2065  // Changing the zoom value doesn't always trigger the updating of
2066  // the client ole object area, so we call it directly.
2067  SfxInPlaceClient* pIPClient = GetSfxViewShell()->GetIPClient();
2068  if (pIPClient)
2069  {
2070  pIPClient->VisAreaChanged();
2071  }
2072  // Make sure the map mode (disabled in SwXTextDocument::initializeForTiledRendering()) is still disabled.
2073  GetWin()->EnableMapMode(false);
2074  }
2075 
2076  mpOut = pSaveOut;
2078 }
2079 
2081 {
2082  if( rNew != maBrowseBorder )
2083  {
2084  maBrowseBorder = rNew;
2085  if ( maVisArea.HasArea() )
2086  InvalidateLayout( false );
2087  }
2088 }
2089 
2091 {
2092  return maBrowseBorder;
2093 }
2094 
2096 {
2097  const SwPostItMgr* pPostItMgr = GetPostItMgr();
2098  if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
2099  {
2100  Size aBorder( maBrowseBorder );
2101  aBorder.AdjustWidth(maBrowseBorder.Width() );
2102  aBorder.AdjustWidth(pPostItMgr->GetSidebarWidth(true) + pPostItMgr->GetSidebarBorderWidth(true) );
2103  return maVisArea.Width() - GetOut()->PixelToLogic(aBorder).Width();
2104  }
2105  else
2106  return maVisArea.Width() - 2 * GetOut()->PixelToLogic(maBrowseBorder).Width();
2107 }
2108 
2109 void SwViewShell::InvalidateLayout( bool bSizeChanged )
2110 {
2111  if ( !bSizeChanged && !GetViewOptions()->getBrowseMode() &&
2112  !GetViewOptions()->IsWhitespaceHidden() )
2113  return;
2114 
2115  CurrShell aCurr( this );
2116 
2117  OSL_ENSURE( GetLayout(), "Layout not ready" );
2118 
2119  // When the Layout doesn't have a height yet, nothing is formatted.
2120  // That leads to problems with Invalidate, e.g. when setting up a new View
2121  // the content is inserted and formatted (regardless of empty VisArea).
2122  // Therefore the pages must be roused for formatting.
2123  if( !GetLayout()->getFrameArea().Height() )
2124  {
2125  SwFrame* pPage = GetLayout()->Lower();
2126  while( pPage )
2127  {
2128  pPage->InvalidateSize_();
2129  pPage = pPage->GetNext();
2130  }
2131  return;
2132  }
2133 
2134  LockPaint();
2135  StartAction();
2136 
2137  SwPageFrame *pPg = static_cast<SwPageFrame*>(GetLayout()->Lower());
2138  do
2139  { pPg->InvalidateSize();
2140  pPg->InvalidatePrt_();
2141  pPg->InvaPercentLowers();
2142  if ( bSizeChanged )
2143  {
2144  pPg->PrepareHeader();
2145  pPg->PrepareFooter();
2146  }
2147  pPg = static_cast<SwPageFrame*>(pPg->GetNext());
2148  } while ( pPg );
2149 
2150  // When the size ratios in browse mode change,
2151  // the Position and PrtArea of the Content and Tab frames must be Invalidated.
2153  // In case of layout or mode change, the ContentFrames need a size-Invalidate
2154  // because of printer/screen formatting.
2155  if ( bSizeChanged )
2157 
2158  GetLayout()->InvalidateAllContent( nInv );
2159 
2160  SwFrame::CheckPageDescs( static_cast<SwPageFrame*>(GetLayout()->Lower()) );
2161 
2162  EndAction();
2163  UnlockPaint();
2164 }
2165 
2167 {
2168  return mpLayout.get();
2169 }
2170 
2172 {
2173  OutputDevice* pTmpOut = nullptr;
2174  if ( GetWin() &&
2175  GetViewOptions()->getBrowseMode() &&
2176  !GetViewOptions()->IsPrtFormat() )
2177  pTmpOut = GetWin()->GetOutDev();
2178  else
2179  pTmpOut = GetDoc()->getIDocumentDeviceAccess().getReferenceDevice( true );
2180 
2181  return *pTmpOut;
2182 }
2183 
2185 {
2186  return mxDoc->GetNodes();
2187 }
2188 
2190 {
2191 }
2192 
2194 {
2195  Size aSz;
2196  const SwRootFrame* pRoot = GetLayout();
2197  if( pRoot )
2198  aSz = pRoot->getFrameArea().SSize();
2199 
2200  return aSz;
2201 }
2202 
2204 {
2205  return GetDoc()->GetAttrPool();
2206 }
2207 
2209 {
2210  for(SwViewShell& rSh : GetRingContainer())
2211  rSh.StartAction();
2212 
2213  ImplApplyViewOptions( rOpt );
2214 
2215  // With one layout per view it is no longer necessary
2216  // to sync these "layout related" view options
2217  // But as long as we have to disable "multiple layout"
2218 
2219  for(SwViewShell& rSh : GetRingContainer())
2220  {
2221  if(&rSh == this)
2222  continue;
2223  SwViewOption aOpt( *rSh.GetViewOptions() );
2224  aOpt.SetFieldName( rOpt.IsFieldName() );
2225  aOpt.SetShowHiddenField( rOpt.IsShowHiddenField() );
2226  aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
2227  aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
2228  aOpt.SetViewLayoutBookMode( rOpt.IsViewLayoutBookMode() );
2229  aOpt.SetHideWhitespaceMode(rOpt.IsHideWhitespaceMode());
2230  aOpt.SetViewLayoutColumns(rOpt.GetViewLayoutColumns());
2231  aOpt.SetPostIts(rOpt.IsPostIts());
2232  if ( !(aOpt == *rSh.GetViewOptions()) )
2233  rSh.ImplApplyViewOptions( aOpt );
2234  }
2235  // End of disabled multiple window
2236 
2237  for(SwViewShell& rSh : GetRingContainer())
2238  rSh.EndAction();
2239 }
2240 
2241 static bool
2243 {
2244  if (eMode == sw::FieldmarkMode::ShowBoth)
2245  {
2246  return false;
2247  }
2248  IDocumentMarkAccess const& rIDMA(*rCursor.GetDoc().getIDocumentMarkAccess());
2249  // iterate, for nested fieldmarks
2250  for (auto iter = rIDMA.getFieldmarksBegin(); iter != rIDMA.getFieldmarksEnd(); ++iter)
2251  {
2252  if (*rCursor.GetPoint() <= (**iter).GetMarkStart())
2253  {
2254  return false;
2255  }
2256  if (*rCursor.GetPoint() < (**iter).GetMarkEnd())
2257  {
2258  SwPosition const sepPos(sw::mark::FindFieldSep(
2259  dynamic_cast<sw::mark::IFieldmark&>(**iter)));
2260  if (eMode == sw::FieldmarkMode::ShowResult)
2261  {
2262  if (*rCursor.GetPoint() <= sepPos
2263  && *rCursor.GetPoint() != (**iter).GetMarkStart())
2264  {
2265  return true;
2266  }
2267  }
2268  else
2269  {
2270  if (sepPos < *rCursor.GetPoint())
2271  {
2272  return true;
2273  }
2274  }
2275  }
2276  }
2277  return false;
2278 }
2279 
2281 {
2282  if (*mpOpt == rOpt)
2283  return;
2284 
2285  vcl::Window *pMyWin = GetWin();
2286  if( !pMyWin )
2287  {
2288  OSL_ENSURE( pMyWin, "SwViewShell::ApplyViewOptions: no window" );
2289  return;
2290  }
2291 
2292  CurrShell aCurr( this );
2293 
2294  bool bReformat = false;
2295 
2296  if( mpOpt->IsShowHiddenField() != rOpt.IsShowHiddenField() )
2297  {
2298  static_cast<SwHiddenTextFieldType*>(mxDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenText ))->
2299  SetHiddenFlag( !rOpt.IsShowHiddenField() );
2300  bReformat = true;
2301  }
2302  if ( mpOpt->IsShowHiddenPara() != rOpt.IsShowHiddenPara() )
2303  {
2304  SwHiddenParaFieldType* pFieldType = static_cast<SwHiddenParaFieldType*>(GetDoc()->
2305  getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::HiddenPara));
2306  if( pFieldType && pFieldType->HasWriterListeners() )
2307  pFieldType->PrintHiddenPara();
2308  bReformat = true;
2309  }
2310  if ( !bReformat && mpOpt->IsShowHiddenChar() != rOpt.IsShowHiddenChar() )
2311  {
2312  bReformat = GetDoc()->ContainsHiddenChars();
2313  }
2314  if ( mpOpt->IsShowChangesInMargin() != rOpt.IsShowChangesInMargin() ||
2315  mpOpt->IsShowChangesInMargin2() != rOpt.IsShowChangesInMargin2() )
2316  {
2317  if (rOpt.IsShowChangesInMargin())
2319  /*bDeletion=*/!rOpt.IsShowChangesInMargin2() );
2320  else
2322  GetLayout()->SetHideRedlines( false );
2323  }
2324 
2325  // bReformat becomes true, if ...
2326  // - fieldnames apply or not ...
2327  // ( - SwEndPortion must _no_ longer be generated. )
2328  // - Of course, the screen is something completely different than the printer ...
2329  bool const isToggleFieldNames(mpOpt->IsFieldName() != rOpt.IsFieldName());
2330 
2331  if (mpOpt->IsFieldName() != rOpt.IsFieldName())
2332  {
2336  bReformat = true;
2337  }
2338 
2339  // The map mode is changed, minima/maxima will be attended by UI
2340  if( mpOpt->GetZoom() != rOpt.GetZoom() && !IsPreview() )
2341  {
2342  MapMode aMode( pMyWin->GetMapMode() );
2343  Fraction aNewFactor( rOpt.GetZoom(), 100 );
2344  aMode.SetScaleX( aNewFactor );
2345  aMode.SetScaleY( aNewFactor );
2346  pMyWin->SetMapMode( aMode );
2347  // if not a reference device (printer) is used for formatting,
2348  // but the screen, new formatting is needed for zoomfactor changes.
2349  if (mpOpt->getBrowseMode() || mpOpt->IsWhitespaceHidden())
2350  bReformat = true;
2351  }
2352 
2353  bool bBrowseModeChanged = false;
2354  if( mpOpt->getBrowseMode() != rOpt.getBrowseMode() )
2355  {
2356  bBrowseModeChanged = true;
2357  bReformat = true;
2358  }
2359  else if( mpOpt->getBrowseMode() && mpOpt->IsPrtFormat() != rOpt.IsPrtFormat() )
2360  bReformat = true;
2361 
2362  bool bHideWhitespaceModeChanged = false;
2363  if (mpOpt->IsWhitespaceHidden() != rOpt.IsWhitespaceHidden())
2364  {
2365  // When whitespace is hidden, view change needs reformatting.
2366  bHideWhitespaceModeChanged = true;
2367  bReformat = true;
2368  }
2369 
2370  if ( HasDrawView() || rOpt.IsGridVisible() )
2371  {
2372  if ( !HasDrawView() )
2373  MakeDrawView();
2374 
2375  SwDrawView *pDView = Imp()->GetDrawView();
2376  if ( pDView->IsDragStripes() != rOpt.IsCrossHair() )
2377  pDView->SetDragStripes( rOpt.IsCrossHair() );
2378 
2379  if ( pDView->IsGridSnap() != rOpt.IsSnap() )
2380  pDView->SetGridSnap( rOpt.IsSnap() );
2381 
2382  if ( pDView->IsGridVisible() != rOpt.IsGridVisible() )
2383  pDView->SetGridVisible( rOpt.IsGridVisible() );
2384 
2385  const Size &rSz = rOpt.GetSnapSize();
2386  pDView->SetGridCoarse( rSz );
2387 
2388  const Size aFSize
2389  ( rSz.Width() ? rSz.Width() / (rOpt.GetDivisionX()+1) : 0,
2390  rSz.Height()? rSz.Height()/ (rOpt.GetDivisionY()+1) : 0);
2391  pDView->SetGridFine( aFSize );
2392  Fraction aSnGrWdtX(rSz.Width(), rOpt.GetDivisionX() + 1);
2393  Fraction aSnGrWdtY(rSz.Height(), rOpt.GetDivisionY() + 1);
2394  pDView->SetSnapGridWidth( aSnGrWdtX, aSnGrWdtY );
2395 
2396  // set handle size to 9 pixels, always
2397  pDView->SetMarkHdlSizePixel(9);
2398  }
2399 
2400  bool bOnlineSpellChgd = mpOpt->IsOnlineSpell() != rOpt.IsOnlineSpell();
2401 
2402  *mpOpt = rOpt; // First the options are taken.
2403  mpOpt->SetUIOptions(rOpt);
2404 
2405  mxDoc->GetDocumentSettingManager().set(DocumentSettingId::HTML_MODE, 0 != ::GetHtmlMode(mxDoc->GetDocShell()));
2406 
2407  if( bBrowseModeChanged || bHideWhitespaceModeChanged )
2408  {
2409  // #i44963# Good occasion to check if page sizes in
2410  // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import)
2411  mxDoc->CheckDefaultPageFormat();
2412  InvalidateLayout( true );
2413  }
2414 
2415  pMyWin->Invalidate();
2416  if ( bReformat )
2417  {
2418  // Nothing helps, we need to send all ContentFrames a
2419  // Prepare, we format anew:
2420  StartAction();
2421  Reformat();
2422  EndAction();
2423  }
2424 
2425  if (isToggleFieldNames)
2426  {
2427  for(SwViewShell& rSh : GetRingContainer())
2428  {
2429  if (SwCursorShell *const pSh = dynamic_cast<SwCursorShell *>(&rSh))
2430  {
2431  if ((mpOpt->IsFieldName() && pSh->CursorInsideInputField())
2432  || IsCursorInFieldmarkHidden(*pSh->GetCursor(),
2433  pSh->GetLayout()->GetFieldmarkMode()))
2434  { // move cursor out of field
2435  pSh->Left(1, CRSR_SKIP_CHARS);
2436  }
2437  }
2438  }
2439  }
2440 
2441  if( !bOnlineSpellChgd )
2442  return;
2443 
2444  bool bOnlineSpl = rOpt.IsOnlineSpell();
2445  for(SwViewShell& rSh : GetRingContainer())
2446  {
2447  if(&rSh == this)
2448  continue;
2449  rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
2450  vcl::Window *pTmpWin = rSh.GetWin();
2451  if( pTmpWin )
2452  pTmpWin->Invalidate();
2453  }
2454 
2455 }
2456 
2458 {
2459  mpOpt->SetUIOptions(rOpt);
2460  //the API-Flag of the view options is set but never reset
2461  //it is required to set scroll bars in readonly documents
2462  if(rOpt.IsStarOneSetting())
2463  mpOpt->SetStarOneSetting(true);
2464 
2465  mpOpt->SetSymbolFont(rOpt.GetSymbolFont());
2466 }
2467 
2469 {
2470  //JP 01.02.99: at readonly flag query properly
2471  // and if need be format; Bug 61335
2472 
2473  // Are we switching from readonly to edit?
2474  if( bSet == mpOpt->IsReadonly() )
2475  return;
2476 
2477  // so that the flags can be queried properly.
2478  mpOpt->SetReadonly( false );
2479 
2480  bool bReformat = mpOpt->IsFieldName();
2481 
2482  mpOpt->SetReadonly( bSet );
2483 
2484  if( bReformat )
2485  {
2486  StartAction();
2487  Reformat();
2488  if ( GetWin() )
2489  GetWin()->Invalidate();
2490  EndAction();
2491  }
2492  else if ( GetWin() )
2493  GetWin()->Invalidate();
2494  if( Imp()->IsAccessible() )
2496 }
2497 
2499 {
2500  if( bSet != mpOpt->IsPDFExport() )
2501  {
2502  if( bSet && mpOpt->getBrowseMode() )
2503  mpOpt->SetPrtFormat( true );
2504  mpOpt->SetPDFExport(bSet);
2505  }
2506 }
2507 
2509 {
2510  if( bSet != mpOpt->IsSelectionInReadonly() )
2511  {
2512  mpOpt->SetSelectionInReadonly(bSet);
2513  }
2514 }
2515 
2517 {
2518  mpOpt->SetPrtFormat( bSet );
2519 }
2520 
2522 {
2523  if ( mbDocSizeChgd )
2524  {
2525  mbDocSizeChgd = false;
2526  bool bOld = bInSizeNotify;
2527  bInSizeNotify = true;
2528  ::SizeNotify( this, GetDocSize() );
2529  bInSizeNotify = bOld;
2530  }
2531 }
2532 
2533 void SwViewShell::SetRestoreActions(sal_uInt16 nSet)
2534 {
2535  OSL_ENSURE(!GetRestoreActions()||!nSet, "multiple restore of the Actions ?");
2536  Imp()->SetRestoreActions(nSet);
2537 }
2539 {
2540  return Imp()->GetRestoreActions();
2541 }
2542 
2544 {
2545  return GetLayout()->IsNewLayout();
2546 }
2547 
2548 uno::Reference< css::accessibility::XAccessible > SwViewShell::CreateAccessible()
2549 {
2550  uno::Reference< css::accessibility::XAccessible > xAcc;
2551 
2552  // We require a layout and an XModel to be accessible.
2553  OSL_ENSURE( mpLayout, "no layout, no access" );
2554  OSL_ENSURE( GetWin(), "no window, no access" );
2555 
2556  if( mxDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && GetWin() )
2557  xAcc = Imp()->GetAccessibleMap().GetDocumentView();
2558 
2559  return xAcc;
2560 }
2561 
2562 uno::Reference< css::accessibility::XAccessible > SwViewShell::CreateAccessiblePreview()
2563 {
2564  OSL_ENSURE( IsPreview(),
2565  "Can't create accessible preview for non-preview SwViewShell" );
2566 
2567  // We require a layout and an XModel to be accessible.
2568  OSL_ENSURE( mpLayout, "no layout, no access" );
2569  OSL_ENSURE( GetWin(), "no window, no access" );
2570 
2571  if ( IsPreview() && GetLayout()&& GetWin() )
2572  {
2574  PagePreviewLayout()->maPreviewPages,
2575  GetWin()->GetMapMode().GetScaleX(),
2576  GetLayout()->GetPageByPageNum( PagePreviewLayout()->mnSelectedPageNum ),
2577  PagePreviewLayout()->maWinSize );
2578  }
2579  return nullptr;
2580 }
2581 
2583 {
2584  if( Imp() && Imp()->IsAccessible() )
2586 }
2587 
2592  const SwTextFrame* _pToTextFrame )
2593 {
2594  if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2595  {
2596  Imp()->InvalidateAccessibleParaFlowRelation_( _pFromTextFrame, _pToTextFrame );
2597  }
2598 }
2599 
2604 {
2605  if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2606  {
2608  }
2609 }
2610 
2615 {
2616  if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2617  {
2618  Imp()->InvalidateAccessibleParaAttrs_( rTextFrame );
2619  }
2620 }
2621 
2623 {
2624  if ( Imp()->IsAccessible() )
2625  {
2626  return &(Imp()->GetAccessibleMap());
2627  }
2628 
2629  return nullptr;
2630 }
2631 
2633 {
2635  return;
2637  {
2638  mpAccOptions->SetAlwaysAutoColor(false);
2639  mpAccOptions->SetStopAnimatedGraphics(false);
2640  }
2641  else
2642  {
2643  mpAccOptions->SetAlwaysAutoColor(rAccessibilityOptions.GetIsAutomaticFontColor());
2644  mpAccOptions->SetStopAnimatedGraphics(! rAccessibilityOptions.GetIsAllowAnimatedGraphics());
2645 
2646  // Form view
2647  // Always set this option, not only if document is read-only:
2648  mpOpt->SetSelectionInReadonly(rAccessibilityOptions.IsSelectionInReadonly());
2649  }
2650 }
2651 
2653 {
2654  return spShellRes;
2655 }
2656 
2657 void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew)
2658 {
2659  (*spCareDialog.get()) = rNew;
2660 }
2661 
2662 sal_uInt16 SwViewShell::GetPageCount() const
2663 {
2664  return GetLayout() ? GetLayout()->GetPageNum() : 1;
2665 }
2666 
2667 Size SwViewShell::GetPageSize( sal_uInt16 nPageNum, bool bSkipEmptyPages ) const
2668 {
2669  Size aSize;
2670  const SwRootFrame* pTmpRoot = GetLayout();
2671  if( pTmpRoot && nPageNum )
2672  {
2673  const SwPageFrame* pPage = static_cast<const SwPageFrame*>
2674  (pTmpRoot->Lower());
2675 
2676  while( --nPageNum && pPage->GetNext() )
2677  pPage = static_cast<const SwPageFrame*>( pPage->GetNext() );
2678 
2679  if( !bSkipEmptyPages && pPage->IsEmptyPage() && pPage->GetNext() )
2680  pPage = static_cast<const SwPageFrame*>( pPage->GetNext() );
2681 
2682  aSize = pPage->getFrameArea().SSize();
2683  }
2684  return aSize;
2685 }
2686 
2688 {
2689  for(SwViewShell& rShell : GetRingContainer())
2690  {
2691  CurrShell aCurr(&rShell);
2692  if(rShell.IsPreview())
2693  {
2694  if(rShell.GetWin())
2695  ::RepaintPagePreview(&rShell, rRect);
2696  }
2697  else if(rShell.VisArea().Overlaps(rRect) && OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType())
2698  {
2699  // invalidate instead of painting
2700  rShell.GetWin()->Invalidate(rRect.SVRect());
2701  }
2702  }
2703 }
2704 // #i12836# enhanced pdf export
2705 sal_Int32 SwViewShell::GetPageNumAndSetOffsetForPDF( OutputDevice& rOut, const SwRect& rRect ) const
2706 {
2707  OSL_ENSURE( GetLayout(), "GetPageNumAndSetOffsetForPDF assumes presence of layout" );
2708 
2709  sal_Int32 nRet = -1;
2710 
2711  // #i40059# Position out of bounds:
2712  SwRect aRect( rRect );
2713  aRect.Pos().setX( std::max( aRect.Left(), GetLayout()->getFrameArea().Left() ) );
2714 
2715  const SwPageFrame* pPage = GetLayout()->GetPageAtPos( aRect.Center() );
2716  if ( pPage )
2717  {
2718  OSL_ENSURE( pPage, "GetPageNumAndSetOffsetForPDF: No page found" );
2719 
2720  Point aOffset( pPage->getFrameArea().Pos() );
2721  aOffset.setX( -aOffset.X() );
2722  aOffset.setY( -aOffset.Y() );
2723 
2724  MapMode aMapMode( rOut.GetMapMode() );
2725  aMapMode.SetOrigin( aOffset );
2726  rOut.SetMapMode( aMapMode );
2727 
2728  nRet = pPage->GetPhyPageNum() - 1;
2729  }
2730 
2731  return nRet;
2732 }
2733 
2734 // --> PB 2007-05-30 #146850#
2735 const BitmapEx& SwViewShell::GetReplacementBitmap( bool bIsErrorState )
2736 {
2737  if (bIsErrorState)
2738  {
2739  if (!m_xErrorBmp)
2740  m_xErrorBmp.reset(new BitmapEx(RID_GRAPHIC_ERRORBMP));
2741  return *m_xErrorBmp;
2742  }
2743 
2744  if (!m_xReplaceBmp)
2745  m_xReplaceBmp.reset(new BitmapEx(RID_GRAPHIC_REPLACEBMP));
2746  return *m_xReplaceBmp;
2747 }
2748 
2750 {
2751  m_xErrorBmp.reset();
2752  m_xReplaceBmp.reset();
2753 }
2754 
2756 {
2757  SwView* pView = GetDoc()->GetDocShell() ? GetDoc()->GetDocShell()->GetView() : nullptr;
2758  if ( pView )
2759  return pView->GetPostItMgr();
2760 
2761  return nullptr;
2762 }
2763 
2764 /*
2765  * Document Interface Access
2766  */
2767 const IDocumentSettingAccess& SwViewShell::getIDocumentSettingAccess() const { return mxDoc->GetDocumentSettingManager(); }
2768 IDocumentSettingAccess& SwViewShell::getIDocumentSettingAccess() { return mxDoc->GetDocumentSettingManager(); }
2769 const IDocumentDeviceAccess& SwViewShell::getIDocumentDeviceAccess() const { return mxDoc->getIDocumentDeviceAccess(); }
2770 IDocumentDeviceAccess& SwViewShell::getIDocumentDeviceAccess() { return mxDoc->getIDocumentDeviceAccess(); }
2771 const IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() const { return mxDoc->getIDocumentMarkAccess(); }
2772 IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() { return mxDoc->getIDocumentMarkAccess(); }
2773 const IDocumentDrawModelAccess& SwViewShell::getIDocumentDrawModelAccess() const { return mxDoc->getIDocumentDrawModelAccess(); }
2774 IDocumentDrawModelAccess& SwViewShell::getIDocumentDrawModelAccess() { return mxDoc->getIDocumentDrawModelAccess(); }
2775 const IDocumentRedlineAccess& SwViewShell::getIDocumentRedlineAccess() const { return mxDoc->getIDocumentRedlineAccess(); }
2776 IDocumentRedlineAccess& SwViewShell::getIDocumentRedlineAccess() { return mxDoc->getIDocumentRedlineAccess(); }
2777 const IDocumentLayoutAccess& SwViewShell::getIDocumentLayoutAccess() const { return mxDoc->getIDocumentLayoutAccess(); }
2778 IDocumentLayoutAccess& SwViewShell::getIDocumentLayoutAccess() { return mxDoc->getIDocumentLayoutAccess(); }
2779 IDocumentContentOperations& SwViewShell::getIDocumentContentOperations() { return mxDoc->getIDocumentContentOperations(); }
2780 IDocumentStylePoolAccess& SwViewShell::getIDocumentStylePoolAccess() { return mxDoc->getIDocumentStylePoolAccess(); }
2781 const IDocumentStatistics& SwViewShell::getIDocumentStatistics() const { return mxDoc->getIDocumentStatistics(); }
2782 
2784 { return mxDoc->GetIDocumentUndoRedo(); }
2786 { return mxDoc->GetIDocumentUndoRedo(); }
2787 
2788 // --> OD 2007-11-14 #i83479#
2790 {
2791  return &mxDoc->getIDocumentListItems();
2792 }
2793 
2795 {
2796  return &mxDoc->getIDocumentOutlineNodes();
2797 }
2798 
2799 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
std::shared_ptr< SfxDialogController > & GetController()
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:339
void SetClipRegion()
SfxViewFrame * GetViewFrame() const
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
VclPtr< OutputDevice > mpPrePostOutDev
Definition: viewsh.hxx:222
bool mbInEndAction
Definition: viewsh.hxx:127
void setOutputToWindow(bool bOutputToWindow)
Definition: viewsh.cxx:132
Base class of the Writer layout elements.
Definition: frame.hxx:315
std::stack< vcl::Region > mPrePostPaintRegions
Definition: viewsh.hxx:221
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:159
void FireAccessibleEvents()
Fire all accessible events that have been collected so far.
Definition: viewimp.cxx:489
void SetAddExtLeading(bool bNew)
Definition: viewsh.cxx:895
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: viewsh.cxx:142
void EnablePaint(bool bEnable)
void Right(const tools::Long nRight)
Definition: swrect.hxx:202
void PageNumNotify(SwViewShell const *pVwSh)
Definition: edtwin3.cxx:67
void SetMsWordCompTrailingBlanks(bool _bMsWordCompTrailingBlanks)
Definition: viewsh.cxx:1017
SdrPreRenderDevice * GetPreRenderDevice() const
MapMode maPrePostMapMode
Definition: viewsh.hxx:223
virtual void ApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2208
static void notifyDocumentSizeChanged(SfxViewShell const *pThisView, const OString &rPayload, vcl::ITiledRenderable *pDoc, bool bInvalidateAll=true)
Marks a position in the document model.
Definition: pam.hxx:36
virtual void DeleteWindowFromPaintView(OutputDevice *pOldWin) override
SfxChildWindow * GetChildWindow(sal_uInt16)
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2184
const SwRect & GetOrigin() const
Definition: swregion.hxx:62
void ImplEndAction(const bool bIdleEnd)
Definition: viewsh.cxx:245
SdrView * GetDrawView()
Definition: vnew.cxx:373
const SwPageFrame * GetPageAtPos(const Point &rPt, const Size *pSize=nullptr, bool bExtend=false) const
Point rPt: The point that should be used to find the page Size pSize: If given, we return the (first)...
Definition: findfrm.cxx:605
bool HasCharts() const
Definition: viewsh.cxx:770
SwRect & Union(const SwRect &rRect)
Definition: swrect.cxx:35
void SetGridFine(const Size &rSiz)
void EndDrawLayers(SdrPaintWindow &rPaintWindow, bool bPaintFormLayer)
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:164
void setWidth(tools::Long nWidth)
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:519
const IDocumentStatistics & getIDocumentStatistics() const
Provides access to the document statistics interface.
Definition: viewsh.cxx:2781
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:115
SwViewShellImp * Imp()
Definition: viewsh.hxx:182
void SetDoNotJustifyLinesWithManualBreak(bool _bDoNotJustifyLinesWithManualBreak)
Definition: viewsh.cxx:999
static void CheckPageDescs(SwPageFrame *pStart, bool bNotifyFields=true, SwPageFrame **ppPrev=nullptr)
Check all pages (starting from the given one) if they use the appropriate frame format.
Definition: pagechg.cxx:1056
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2652
void SetParaSpaceMaxAtPages(bool bNew)
Definition: viewsh.cxx:871
void SetInputType(VclInputFlags nNew)
Definition: layact.hxx:153
void SetAddParaSpacingToTableCells(bool _bAddParaSpacingToTableCells)
Sets if paragraph and table spacing is added at bottom of table cells.
Definition: viewsh.cxx:926
SwDocShell * GetDocShell()
Definition: doc.hxx:1352
virtual void CalcLayout()
Definition: viewsh.cxx:1078
void InvalidateAllContent(SwInvalidateFlags nInvalidate)
Invalidate all Content, Size or PrtArea.
Definition: wsfrm.cxx:4153
static vcl::DeleteOnDeinit< std::shared_ptr< weld::Window > > spCareDialog
Avoid this window.
Definition: viewsh.hxx:167
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
void InvalidateAccessibleParaAttrs(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewsh.cxx:2614
static bool IsInPaint()
Definition: rootfrm.hxx:366
constexpr SwTwips DOCUMENTBORDER
Definition: swtypes.hxx:80
virtual void UpdatePageFields(SfxPoolItem *)=0
SAL_DLLPRIVATE void ImplApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2280
bool HasPaintRegion()
Definition: viewimp.hxx:151
constexpr tools::Long Left() const
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
void InvalidateAccessibleParaAttrs_(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewimp.cxx:455
const IDocumentOutlineNodes * getIDocumentOutlineNodesAccess() const
Definition: viewsh.cxx:2794
static void SetNoVirDev(const bool bNew)
Definition: rootfrm.hxx:368
virtual void SetModified()=0
Must be called manually at changes of format.
sal_uIntPtr sal_uLong
long Long
void disposeAndClear()
Provides numbered items of a document.
bool IsPostIts() const
Definition: viewopt.hxx:280
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
const OUString & GetChartTableName() const
Definition: ndole.hxx:155
bool IsMapModeEnabled() const
SwAccessibleMap & GetAccessibleMap()
Definition: viewimp.hxx:276
Provides access to the marks of a document.
void InvalidateSize_()
Definition: frame.hxx:772
Definition: doc.hxx:188
bool mbShowFooterSeparator
Flag to say that we are showing the footer control.
Definition: viewsh.hxx:135
VclPtr< OutputDevice > mpOut
Window, Printer, VirtDev, ...
Definition: viewsh.hxx:115
virtual void setReferenceDeviceType(bool bNewVirtual, bool bNewHiRes)=0
Sets the type of the reference device used for formatting the document.
sal_Int16 nId
VclPtr< vcl::Window > mpWin
= 0 during printing or pdf export
Definition: viewsh.hxx:114
bool HasDrawView() const
Definition: vnew.cxx:358
SwPosition FindFieldSep(IFieldmark const &rMark)
return position of the CH_TXT_ATR_FIELDSEP for rMark
const SwPageFrame & GetFormatPage() const
Definition: pagechg.cxx:2446
const MapMode & GetMapMode() const
SwRect m_aSmoothRect
Definition: viewimp.hxx:85
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2767
void UpdateAllCharts()
update all charts for which any table exists
Definition: viewsh.cxx:763
sw::sidebarwindows::SidebarPosition SidebarPosition() const
asks the page on which side a margin should be shown, e.g for notes returns true for left side...
Definition: pagechg.cxx:1436
::sw::DocumentRedlineManager const & GetDocumentRedlineManager() const
Definition: doc.cxx:345
SwNode & GetNode() const
Definition: ndindex.hxx:121
void SetSnapGridWidth(const Fraction &rX, const Fraction &rY)
std::unique_ptr< BitmapEx > m_xErrorBmp
error display of missed images
Definition: viewsh.hxx:98
void EndProgress(SwDocShell const *pDocShell)
Definition: mainwn.cxx:92
virtual void VisPortChgd(const SwRect &)
Definition: viewsh.cxx:1170
bool mbOutputToWindow
The virtual device we paint to will end up on the screen.
Definition: viewsh.hxx:178
void Pos(const Point &rNew)
Definition: swrect.hxx:171
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1790
void VisAreaChanged(const OutputDevice *pOut)
void EnableMapMode(bool bEnable=true)
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:446
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
Paint once for every visible page which is touched by Rect.
Definition: paintfrm.cxx:3064
void setTiledPainting(bool bTiledPainting)
void SetRestoreActions(sal_uInt16 nSet)
Definition: viewsh.cxx:2533
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
bool IsShowHiddenPara() const
Definition: viewopt.hxx:404
void UISizeNotify()
Definition: viewsh.cxx:2521
void StartProgress(TranslateId pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
Definition: mainwn.cxx:52
void SetGridCoarse(const Size &rSiz)
void PaintImmediately()
bool HasWriterListeners() const
Definition: calbck.hxx:203
void SizeNotify(SwViewShell const *pVwSh, const Size &rSize)
Definition: edtwin3.cxx:56
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
For old documents the Field-Which IDs must be preserved !!!
void SetMapMode()
sal_Int32 GetBrowseWidth() const
Definition: viewsh.cxx:2095
sal_uInt16 GetRestoreActions() const
Definition: viewsh.cxx:2538
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:744
static void lcl_InvalidateAllObjPos(SwViewShell &_rSh)
local method to invalidate/re-calculate positions of floating screen objects (Writer fly frame and dr...
Definition: viewsh.cxx:841
void SetCalcLayout(bool bNew)
Definition: layact.hxx:154
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
virtual void SetReadonlyOption(bool bSet)
Definition: viewsh.cxx:2468
void PaintTransparentChildren(vcl::Window const &rWindow, tools::Rectangle const &rPixelRect)
const SwPageFrame * GetFirstVisPage(OutputDevice const *pRenderContext) const
Management of the first visible Page.
Definition: viewimp.cxx:308
void DeletePaintRegion()
Definition: viewimp.hxx:154
FieldmarkMode
Definition: rootfrm.hxx:50
std::vector< tools::Rectangle > RectangleVector
void CheckViewLayout(const SwViewOption *pViewOpt, const SwRect *pVisArea)
Definition: pagechg.cxx:2104
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:204
virtual void LockExpFields()=0
IDocumentContentOperations & getIDocumentContentOperations()
Provides access to the content operations interface.
Definition: viewsh.cxx:2779
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields)=0
constexpr tools::Long Width() const
bool AddPaintRect(const SwRect &rRect)
Definition: viewsh.cxx:536
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
void SetGridSnap(bool bOn)
void SetUseFormerTextWrapping(bool _bUseFormerTextWrapping)
Definition: viewsh.cxx:986
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
bool IsFieldName() const
Definition: viewopt.hxx:276
sal_uInt16 mnLockPaint
!= 0 if Paint is locked.
Definition: viewsh.hxx:174
bool IsShowChangesInMargin2() const
Definition: viewopt.hxx:307
wrapper class for the positioning of Writer fly frames and drawing objects
static bool sbLstAct
Definition: viewsh.hxx:100
const SwRegionRects * GetPaintRegion()
Definition: viewimp.hxx:153
SwAccessibleMap * GetAccessibleMap()
Definition: viewsh.cxx:2622
Color GetFillColor(Color const &rColor, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
short GetDivisionX() const
Definition: viewopt.hxx:457
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:171
void ReformatAllTextObjects()
const SwRect & getFrameArea() const
Definition: frame.hxx:180
OUTDEV_WINDOW
bool IsGridVisible() const
bool getBrowseMode() const
Definition: viewopt.hxx:485
OutputDevice & GetTargetOutputDevice()
bool IsEmptyPage() const
Definition: pagefrm.hxx:157
short GetDivisionY() const
Definition: viewopt.hxx:459
void PrePaint()
Definition: viewsh.cxx:169
void InvalidateLayout(bool bSizeChanged)
Definition: viewsh.cxx:2109
css::uno::Reference< css::accessibility::XAccessible > GetDocumentPreview(const std::vector< std::unique_ptr< PreviewPage >> &_rPreviewPages, const Fraction &_rScale, const SwPageFrame *_pSelectedPageFrame, const Size &_rPreviewWinSize)
Definition: accmap.cxx:1795
void SetRestoreActions(sal_uInt16 nSet)
Definition: viewimp.hxx:214
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:993
void EnableMapMode(bool bEnable=true)
static bool IsFuzzing()
Size maBrowseBorder
Definition: viewsh.hxx:106
void SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara)
Definition: viewsh.cxx:1035
static void lcl_PaintTransparentFormControls(SwViewShell const &rShell, SwRect const &rRect)
Definition: viewsh.cxx:149
SwRect maVisArea
The modern version of VisArea.
Definition: viewsh.hxx:169
void Flush()
Definition: fntcache.cxx:128
bool m_bStopSmooth
Definition: viewimp.hxx:82
void Action(OutputDevice *pRenderContext)
Definition: layact.cxx:360
void SetUIOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2457
void ApplyAccessibilityOptions(SvtAccessibilityOptions const &rAccessibilityOptions)
Definition: viewsh.cxx:2632
constexpr tools::Long GetWidth() const
SwInvalidateFlags
Definition: rootfrm.hxx:53
void Width(tools::Long nNew)
Definition: swrect.hxx:189
void UnlockPaint()
Definition: vdraw.cxx:84
bool mbHeaderFooterEdit
Flag to say that we are editing header or footer (according to the bShow(Header|Footer)Separator abov...
Definition: viewsh.hxx:136
IDocumentStylePoolAccess & getIDocumentStylePoolAccess()
Provides access to the document style pool interface.
Definition: viewsh.cxx:2780
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
bool empty() const
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2771
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:154
static Color & GetAppBackgroundColor()
Definition: viewopt.cxx:409
void unpatchPaintWindow(SdrPaintWindow *pPreviousPaintWindow)
virtual bool get_visible() const =0
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: viewsh.cxx:2773
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: viewsh.cxx:2775
SwPagePreviewLayout * PagePreviewLayout()
Definition: viewpg.cxx:33
void PrepareFooter()
Creates or removes footer.
Definition: hffrm.cxx:723
bool IsEmpty() const
Definition: swrect.hxx:304
void SetBrowseBorder(const Size &rNew)
Definition: viewsh.cxx:2080
void ResetInvalidRect()
Definition: viewsh.hxx:590
static weld::Window * GetCareDialog(SwViewShell const &rVSh)
Definition: viewsh.hxx:443
void DrawRect(const tools::Rectangle &rRect)
bool IsDummyPage(sal_uInt16 nPageNum) const
Definition: viewsh.cxx:695
void SetPDFExportOption(bool bSet)
Definition: viewsh.cxx:2498
Specific frame formats (frames, DrawObjects).
bool GetIsAllowAnimatedGraphics() const
vcl::RenderContext & GetRefDev() const
Definition: viewsh.cxx:2171
void MakeVisible(const SwRect &)
Definition: viewsh.cxx:633
void PaintTile(OutputDevice &rRenderContext)
Definition: PostItMgr.cxx:974
constexpr void SetLeft(tools::Long v)
std::unique_ptr< SwRegionRects > TakePaintRegion()
Definition: viewimp.hxx:152
void SetHideRedlines(bool)
Definition: wsfrm.cxx:4673
SAL_DLLPRIVATE bool CheckInvalidForPaint(const SwRect &)
Definition: viewsh.cxx:1710
void SetStatBar(bool bNew)
Definition: layact.cxx:90
void FlushPendingLOKInvalidateTiles()
Definition: viewsh.cxx:595
bool IsInvalidFly() const
Definition: pagefrm.hxx:443
bool CalcRects()
Definition: PostItMgr.cxx:532
Fraction conversionFract(o3tl::Length from, o3tl::Length to)
void SizeChgNotify()
Definition: viewsh.cxx:1139
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
Try to prevent visible SwParaPortions from being deleted.
Definition: swcache.hxx:122
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: viewsh.cxx:2769
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:617
void SetLineColor()
Style of a layout element.
Definition: frmfmt.hxx:59
bool IsCrossHair() const
Definition: viewopt.hxx:392
SdrPaintWindow * BeginDrawLayers(OutputDevice *pOut, const vcl::Region &rReg, bool bDisableIntersect=false)
#define SAL_MAX_INT32
SfxViewShell * mpSfxViewShell
Definition: viewsh.hxx:109
void Reset()
Definition: layact.cxx:274
css::uno::Reference< css::accessibility::XAccessible > GetDocumentView()
Definition: accmap.cxx:1790
sal_uInt16 GetPageCount() const
Definition: viewsh.cxx:2662
bool ContainsHiddenChars() const
Checks if any of the text node contains hidden characters.
Definition: doc.cxx:1763
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:132
int i
void UpdateFields(bool bCloseDB=false)
Forces update of each field.
Definition: viewsh.cxx:706
const SwRect & VisArea() const
Definition: viewsh.cxx:626
void PaintTile(VirtualDevice &rDevice, int contextWidth, int contextHeight, int tilePosX, int tilePosY, tools::Long tileWidth, tools::Long tileHeight)
Paint tile.
Definition: viewsh.cxx:1988
SdrPaintWindow * patchPaintWindow(SdrPaintWindow &rPaintWindow)
const SwPosition * GetPoint() const
Definition: pam.hxx:208
virtual void DrawSelChanged()
Definition: viewsh.cxx:2189
The usage of LayAction is always the same:
Definition: layact.hxx:55
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:492
void RepaintPagePreview(SwViewShell const *pVwSh, const SwRect &rRect)
Definition: edtwin3.cxx:109
bool mbShowHeaderSeparator
Flag to say that we are showing the header control.
Definition: viewsh.hxx:134
bool SmoothScroll(tools::Long lXDiff, tools::Long lYDiff, const tools::Rectangle *)
Definition: viewsh.cxx:1341
Document statistics information.
SwRect GetBoundRect(OutputDevice const *pOutputDevice) const
Definition: paintfrm.cxx:6265
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow)
Definition: viewsh.cxx:99
static bool bInSizeNotify
Definition: viewsh.cxx:94
const MapMode & GetMapMode() const
bool IsDummyPage(sal_uInt16 nPageNum) const
Definition: trvlfrm.cxx:1613
void LayoutIdle()
Definition: viewsh.cxx:788
void InvalidateAccessibleFocus()
Definition: viewsh.cxx:2582
bool SetOutputSizePixel(const Size &rNewSize, bool bErase=true)
const SwFrame * Lower() const
Definition: layfrm.hxx:101
bool ActionPend() const
Definition: viewsh.hxx:196
std::unique_ptr< SwAccessibilityOptions > mpAccOptions
Definition: viewsh.hxx:118
Size GetDocSize() const
Definition: viewsh.cxx:2193
void Reformat()
Invalidates complete Layout (ApplyViewOption).
Definition: viewsh.cxx:1053
sal_Int32 scale
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
bool IsPreview() const
Definition: viewsh.hxx:493
void SetOrigin(const Point &rOrigin)
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:301
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:357
bool SetOutputSize(const Size &rNewSize)
void SetReadonlySelectionOption(bool bSet)
Definition: viewsh.cxx:2508
void StartAction()
Definition: vdraw.cxx:51
SAL_DLLPRIVATE void PaintDesktop_(const SwRegionRects &rRegion)
Definition: viewsh.cxx:1659
void StartAction()
Definition: viewsh.hxx:595
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
bool HasArea() const
Definition: swrect.hxx:300
constexpr tools::Long Right() const
void SetFillColor()
css::uno::Reference< css::accessibility::XAccessible > CreateAccessiblePreview()
Definition: viewsh.cxx:2562
const Color & GetLineColor() const
void ImplStartAction()
Definition: viewsh.cxx:466
void DeleteReplacementBitmaps()
Definition: viewsh.cxx:2749
void UpdateAllCharts()
Definition: doc.hxx:1293
virtual css::uno::Reference< css::frame::XModel > GetCurrentDocument() const
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
Provides access to settings of a document.
bool IsExpFields() const
Definition: layact.hxx:169
constexpr tools::Long Top() const
void DLPostPaint2(bool bPaintFormLayer)
Definition: viewsh.cxx:217
void Validate()
void AddWidth(const tools::Long nAdd)
Definition: swrect.cxx:123
tools::ULong GetSidebarBorderWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2133
Marks a node in the document model.
Definition: ndindex.hxx:32
void LockPaint()
Definition: viewsh.hxx:607
static weld::Window * CareChildWin(SwViewShell const &rVSh)
Definition: viewsh.cxx:663
bool IsExtraData(const SwDoc *pDoc)
Definition: frmtool.cxx:3878
bool isOutputToWindow() const
Definition: viewsh.cxx:137
ring_container GetRingContainer()
bool IsOnlineSpell() const
Definition: viewopt.hxx:378
Text operation/manipulation interface.
Point PixelToLogic(const Point &rDevicePt) const
void ChgNumberDigits()
Definition: viewsh.cxx:1070
void SSize(const Size &rNew)
Definition: swrect.hxx:180
void PrepareHeader()
Make this public, so that the SwViewShell can access it when switching from browse mode Add/remove he...
Definition: hffrm.cxx:682
virtual sal_uInt16 GetBitCount() const
SwStartNode * GetStartNode()
Definition: node.hxx:595
void SetActualWin(const OutputDevice *pWin)
tools::ULong GetSidebarWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2107
SwFntCache * pFntCache
Definition: fntcache.cxx:66
A page of the document layout.
Definition: pagefrm.hxx:57
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: viewsh.cxx:2777
tools::Long SwTwips
Definition: swtypes.hxx:52
bool mbPaintInProgress
Definition: viewsh.hxx:124
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:552
const long LONG_MAX
const OUString & GetSymbolFont() const
Definition: viewopt.hxx:588
void SetFieldName(bool b)
Definition: viewopt.hxx:277
void InvalidateAllObjPos()
Invalidate/re-calculate the position of all floating screen objects (Writer fly frames and drawing ob...
Definition: wsfrm.cxx:4199
bool Contains(const Point &rPOINT) const
Definition: swrect.hxx:356
Point Center() const
Definition: swrect.hxx:338
void AddPendingLOKInvalidation(const SwRect &rRect)
Definition: viewimp.cxx:161
void EndAction()
Definition: vdraw.cxx:61
void InvalidateSize()
Definition: frame.hxx:1030
bool m_bSmoothUpdate
Definition: viewimp.hxx:81
Size GetPageSize(sal_uInt16 nPageNum, bool bSkipEmptyPages) const
Definition: viewsh.cxx:2667
void InvalidateFocus()
Definition: accmap.cxx:2721
void EndAction(const bool bIdleEnd=false)
Definition: viewsh.hxx:600
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
void LayoutPostIts()
Definition: PostItMgr.cxx:687
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
void StartAction()
Definition: crsrsh.cxx:226
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2591
bool IsHideWhitespaceMode() const
Definition: viewopt.hxx:496
void SetConsiderWrapOnObjPos(bool _bConsiderWrapOnObjPos)
Definition: viewsh.cxx:975
Provides access to the formatting devices of a document.
void UpdateAccessible()
Update (this) accessible view.
Definition: viewimp.cxx:323
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
void UpdateOleObjectPreviews()
Update the previews of all OLE objects.
Definition: viewsh.cxx:724
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2785
FrameControlType
Definition: swtypes.hxx:234
sal_uInt16 GetNumPages() const
Definition: viewsh.cxx:688
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:211
void SetFieldmarkMode(sw::FieldmarkMode)
Definition: wsfrm.cxx:4695
static void Add(SwViewShell *pSh, const SwRect &rNew)
Definition: vprint.cxx:84
bool mbDocSizeChgd
Definition: viewsh.hxx:120
SfxInPlaceClient * GetIPClient() const
void Compress(CompressType type)
Definition: swregion.cxx:155
void MakeDrawView()
Definition: vnew.cxx:363
static bool IsCursorInFieldmarkHidden(SwPaM const &rCursor, sw::FieldmarkMode const eMode)
Definition: viewsh.cxx:2242
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void SetUseFormerLineSpacing(bool _bUseFormerLineSpacing)
Sets if former formatting of text lines with proportional line spacing should used.
Definition: viewsh.cxx:946
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2657
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
void ScrollMDI(SwViewShell const *pVwSh, const SwRect &rRect, sal_uInt16 nRangeX, sal_uInt16 nRangeY)
Definition: edtwin3.cxx:35
SwDrawView * GetDrawView()
Definition: viewimp.hxx:161
void PrePaint()
void SetAddExtLeading(bool bEnabled)
#define SAL_WARN_IF(condition, area, stream)
void CorrectPositions()
Definition: PostItMgr.cxx:2048
void ToggleHeaderFooterEdit()
Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags.
Definition: viewsh.cxx:111
bool IsBrowseActionStop() const
Definition: layact.hxx:172
constexpr tools::Long Height() const
const SwNodes & GetNodes() const
Definition: ndindex.hxx:158
const IDocumentListItems * getIDocumentListItemsAccess() const
Definition: viewsh.cxx:2789
void InvaPercentLowers(SwTwips nDiff=0)
Invalidates the inner Frames, whose width and/or height are calculated using percentages.
Definition: wsfrm.cxx:3561
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
sal_Int32 GetPageNumAndSetOffsetForPDF(OutputDevice &rOut, const SwRect &rRect) const
Definition: viewsh.cxx:2705
void SetUseFormerObjectPositioning(bool _bUseFormerObjPos)
Sets IDocumentSettingAccess if former object positioning should be used.
Definition: viewsh.cxx:963
vcl::Window * GetWin() const
Definition: viewsh.hxx:338
Provides outline nodes of a document.
bool mbPaintWorks
Definition: viewsh.hxx:122
static void lcl_InvalidateAllContent(SwViewShell &rSh, SwInvalidateFlags nInv)
Definition: viewsh.cxx:821
bool IsStarOneSetting() const
Definition: viewopt.hxx:645
Color GetLineColor(Color const &rColor, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
Point GetPagePos(sal_uInt16 nPageNum) const
Definition: viewsh.cxx:683
std::unique_ptr< BitmapEx > m_xReplaceBmp
replaced display of still loaded images
Definition: viewsh.hxx:97
void SetComplete(bool bNew)
Definition: layact.hxx:151
const Size & GetSnapSize() const
Definition: viewopt.hxx:371
VclPtr< OutputDevice > mpBufferedOut
Definition: viewsh.hxx:142
void LockPaint()
Definition: vdraw.cxx:71
void SetChanged()
Definition: ndole.cxx:649
void GetRegionRectangles(RectangleVector &rTarget) const
::OutputDevice const * GetOutDev() const
void SetReschedule(bool bNew)
Definition: layact.hxx:155
SwNodes & GetNodes()
Definition: doc.hxx:409
void SetGridVisible(bool bOn)
tools::Long AdjustWidth(tools::Long n)
bool IsGridSnap() const
static VclPtr< reference_type > Create(Arg &&...arg)
virtual Dialog * getDialog()=0
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: viewsh.cxx:1854
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:639
static ShellResource * spShellRes
Resources for the Shell.
Definition: viewsh.hxx:166
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:518
void SetUseVirDev(bool bNew)
Definition: viewsh.cxx:910
const Size & GetBrowseBorder() const
Definition: viewsh.cxx:2090
bool IsUseHeaderFooterMenu() const
Definition: viewopt.hxx:313
void Rescale()
Definition: PostItMgr.cxx:2227
bool HasNotes() const
Definition: PostItMgr.cxx:2102
void DLPrePaint2(const vcl::Region &rRegion)
Definition: viewsh.cxx:178
virtual OutputDevice * getReferenceDevice(bool bCreate) const =0
Returns the current reference device.
virtual void AddWindowToPaintView(OutputDevice *pNewWin, vcl::Window *pWindow) override
bool IsPrtFormat() const
Definition: viewopt.hxx:554
void SetParaSpaceMax(bool bNew)
Definition: viewsh.cxx:859
void ImplUnlockPaint(bool bVirDev)
Definition: viewsh.cxx:479
tools::Long AdjustHeight(tools::Long n)
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool IsScrollMDI(SwViewShell const *pVwSh, const SwRect &rRect)
Definition: edtwin3.cxx:45
#define FAR_AWAY
Definition: frmtool.hxx:53
static SfxProgress * GetActiveProgress(SfxObjectShell const *pDocSh=nullptr)
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
bool IsSelectionInReadonly() const
const SwPostItMgr * GetPostItMgr() const
Definition: viewsh.hxx:561
void InvalidateAccessibleParaTextSelection()
invalidate text selection for paragraphs
Definition: viewsh.cxx:2603
void InvalidateAccessibleParaFlowRelation_(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewimp.cxx:415
void InvalidateAccessibleEditableState(bool bAllShells, const SwFrame *pFrame=nullptr)
Invalidate editable state for all accessible frames.
Definition: viewimp.cxx:386
bool IsGridVisible() const
Definition: viewopt.hxx:373
SwRootFramePtr mpLayout
Definition: viewsh.hxx:144
void SetPaint(bool bNew)
Definition: layact.hxx:150
SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position...
Definition: hints.hxx:243
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:65
VirtualDevice * get() const
Provides access to the layout of a document.
void InvalidatePrt_()
Definition: frame.hxx:780
void SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys)
Definition: viewsh.cxx:1029
Access to the style pool.
bool mbEnableSmooth
Definition: viewsh.hxx:130
void SetPrtFormatOption(bool bSet)
Definition: viewsh.cxx:2516
SdrPaintWindow * mpTargetPaintWindow
Definition: viewsh.hxx:141
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2380
struct _xmlTextWriter * xmlTextWriterPtr
bool IsEndActionByVirDev() const
Definition: viewsh.hxx:200
bool GetIsAutomaticFontColor() const
SAL_DLLPRIVATE void PaintDesktop(const vcl::RenderContext &rRenderContext, const SwRect &)
Definition: viewsh.cxx:1574
size_t size() const
SwDoc & GetDoc() const
Definition: pam.hxx:244
const SwView * GetView() const
Definition: docsh.hxx:221
Left
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:328
bool IsNewLayout() const
Definition: rootfrm.hxx:373
bool AddPaintRect(const SwRect &rRect)
Definition: viewimp.cxx:116
void SetDragStripes(bool bOn)
SwRect maInvalidRect
Definition: viewsh.hxx:107
Point GetPagePos(sal_uInt16 nPageNum) const
Returns the absolute document position of the desired page.
Definition: trvlfrm.cxx:1574
bool IsShowHiddenField() const
Definition: viewopt.hxx:335
bool IsInvalid() const
Definition: pagefrm.hxx:439
void SetFirstVisPageInvalid()
Definition: viewsh.cxx:1130
virtual void UnlockExpFields()=0
sal_uInt16 GetRestoreActions() const
Definition: viewimp.hxx:215
bool IsDragStripes() const
virtual void UpdateFields(bool bCloseDB)=0
bool ShowNotes() const
Definition: PostItMgr.cxx:2096
bool IsShowHeaderFooterSeparator(FrameControlType eControl)
Definition: viewsh.hxx:568
std::unique_ptr< SwViewOption > mpOpt
Definition: viewsh.hxx:117
void SetProtectForm(bool _bProtectForm)
Definition: viewsh.cxx:1011
bool IsSnap() const
Definition: viewopt.hxx:365
bool IsWhitespaceHidden() const
Definition: viewopt.hxx:501
const BitmapEx & GetReplacementBitmap(bool bIsErrorState)
Definition: viewsh.cxx:2735
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2166
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:207
void SetTabCompat(bool bNew)
Definition: viewsh.cxx:883
void SetMarkHdlSizePixel(sal_uInt16 nSiz)
bool HasDrawViewDrag() const
Definition: vnew.cxx:368
void Height(tools::Long nNew)
Definition: swrect.hxx:193
void OnGraphicArrived(const SwRect &)
Definition: viewsh.cxx:2687
void SetMapMode()
void UpdateDrawLayersRegion(const OutputDevice *pOut, const vcl::Region &rReg)
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374
sal_uInt16 GetPageNum() const
Definition: rootfrm.hxx:313
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:494
sal_uInt16 mnStartAction
!= 0 if at least one Action is active.
Definition: viewsh.hxx:173
void PrintHiddenPara()
Definition: fldbas.cxx:149
bool IsViewLocked() const
Definition: viewsh.hxx:466
SAL_DLLPRIVATE void DrawOutDev(const Point &, const Size &, const Point &, const Size &, const Printer &)=delete
Definition: view.hxx:144
void ImplLockPaint()
Definition: viewsh.cxx:472
const Color & GetFillColor() const
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
void UnlockPaint(bool bVirDev=false)
Definition: viewsh.hxx:612
css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
Definition: viewsh.cxx:2548
bool IsNewLayout() const
Definition: viewsh.cxx:2543
SwFrame * GetNext()
Definition: frame.hxx:677
Base class of the Writer document model elements.
Definition: node.hxx:81
void InvalidateAccessibleParaTextSelection_()
invalidate text selection for paragraphs
Definition: viewimp.cxx:443
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo