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