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