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