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