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