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