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