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