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::unique_ptr<SwRegionRects> pRegion = 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 = pRegion && dynamic_cast<const SwCursorShell*>(this) != nullptr;
330 if( bShowCursor )
331 static_cast<SwCursorShell*>(this)->HideCursors();
332
333 if ( pRegion )
334 {
335 SwRootFrame* pCurrentLayout = GetLayout();
336
337 pRegion->LimitToOrigin();
338 pRegion->Compress( SwRegionRects::CompressFuzzy );
339
341 while ( !pRegion->empty() )
342 {
343 SwRect aRect( pRegion->back() );
344 pRegion->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() && !comphelper::LibreOfficeKit::isActive())
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
914void SwViewShell::SetUseVirDev( bool bNewVirtual )
915{
917 if ( rIDSA.get(DocumentSettingId::USE_VIRTUAL_DEVICE) != bNewVirtual )
918 {
919 SwWait aWait( *GetDoc()->GetDocShell(), true );
920 // this sets the flag at the document and calls PrtDataChanged
922 rIDDA.setReferenceDeviceType( bNewVirtual, true );
923 }
924}
925
930void SwViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells )
931{
933 if (rIDSA.get(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells
934 || rIDSA.get(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells)
935 {
936 SwWait aWait( *GetDoc()->GetDocShell(), true );
937 rIDSA.set(DocumentSettingId::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells );
938 // note: the dialog can't change the value to indeterminate, so only false/false and true/true
939 rIDSA.set(DocumentSettingId::ADD_PARA_LINE_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells );
941 lcl_InvalidateAllContent( *this, nInv );
942 }
943}
944
950void SwViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing )
951{
953 if ( rIDSA.get(DocumentSettingId::OLD_LINE_SPACING) != _bUseFormerLineSpacing )
954 {
955 SwWait aWait( *GetDoc()->GetDocShell(), true );
956 rIDSA.set(DocumentSettingId::OLD_LINE_SPACING, _bUseFormerLineSpacing );
958 lcl_InvalidateAllContent( *this, nInv );
959 }
960}
961
967void SwViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos )
968{
970 if ( rIDSA.get(DocumentSettingId::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos )
971 {
972 SwWait aWait( *GetDoc()->GetDocShell(), true );
973 rIDSA.set(DocumentSettingId::USE_FORMER_OBJECT_POS, _bUseFormerObjPos );
975 }
976}
977
978// #i28701#
979void SwViewShell::SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos )
980{
982 if ( rIDSA.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos )
983 {
984 SwWait aWait( *GetDoc()->GetDocShell(), true );
985 rIDSA.set(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos );
987 }
988}
989
990void SwViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping )
991{
993 if ( rIDSA.get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping )
994 {
995 SwWait aWait( *GetDoc()->GetDocShell(), true );
996 rIDSA.set(DocumentSettingId::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping );
998 lcl_InvalidateAllContent( *this, nInv );
999 }
1000}
1001
1002// #i45491#
1003void SwViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWithManualBreak )
1004{
1006 if ( rIDSA.get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak )
1007 {
1008 SwWait aWait( *GetDoc()->GetDocShell(), true );
1009 rIDSA.set(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak );
1011 lcl_InvalidateAllContent( *this, nInv );
1012 }
1013}
1014
1015void SwViewShell::SetProtectForm( bool _bProtectForm )
1016{
1018 rIDSA.set(DocumentSettingId::PROTECT_FORM, _bProtectForm );
1019}
1020
1021void SwViewShell::SetMsWordCompTrailingBlanks( bool _bMsWordCompTrailingBlanks )
1022{
1024 if (rIDSA.get(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS) != _bMsWordCompTrailingBlanks)
1025 {
1026 SwWait aWait(*GetDoc()->GetDocShell(), true);
1027 rIDSA.set(DocumentSettingId::MS_WORD_COMP_TRAILING_BLANKS, _bMsWordCompTrailingBlanks);
1029 lcl_InvalidateAllContent(*this, nInv);
1030 }
1031}
1032
1033void SwViewShell::SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys)
1034{
1036 rIDSA.set(DocumentSettingId::SUBTRACT_FLYS, bSubtractFlysAnchoredAtFlys);
1037}
1038
1039void SwViewShell::SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara)
1040{
1042 if (rIDSA.get(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA) == bEmptyDbFieldHidesPara)
1043 return;
1044
1045 SwWait aWait(*GetDoc()->GetDocShell(), true);
1046 rIDSA.set(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA, bEmptyDbFieldHidesPara);
1047 StartAction();
1049 for (auto const & pFieldType : *GetDoc()->getIDocumentFieldsAccess().GetFieldTypes())
1050 {
1051 if(pFieldType->Which() == SwFieldIds::Database)
1052 pFieldType->UpdateFields();
1053 }
1054 EndAction();
1055}
1056
1058{
1059 SwWait aWait( *GetDoc()->GetDocShell(), true );
1060
1061 // we go for safe: get rid of the old font information,
1062 // when the printer resolution or zoom factor changes.
1063 // Init() and Reformat() are the safest locations.
1064 pFntCache->Flush( );
1065
1066 if( GetLayout()->IsCallbackActionEnabled() )
1067 {
1068 StartAction();
1070 EndAction();
1071 }
1072}
1073
1075{
1077 if ( pTmpDrawModel )
1078 pTmpDrawModel->ReformatAllTextObjects();
1079 Reformat();
1080}
1081
1083{
1084 // extremely likely to be a Bad Idea to call this without StartAction
1085 // (except the Page Preview apparently only has a non-subclassed ViewShell)
1086 assert((typeid(*this) == typeid(SwViewShell)) || mnStartAction);
1087
1088 CurrShell aCurr( this );
1089 SwWait aWait( *GetDoc()->GetDocShell(), true );
1090
1091 // Preserve top of the text frame cache.
1092 SwSaveSetLRUOfst aSaveLRU;
1093
1094 //switch on Progress when none is running yet.
1095 const bool bEndProgress = SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) == nullptr;
1096 if ( bEndProgress )
1097 {
1098 tools::Long nEndPage = GetLayout()->GetPageNum();
1099 nEndPage += nEndPage * 10 / 100;
1100 ::StartProgress( STR_STATSTR_REFORMAT, 0, nEndPage, GetDoc()->GetDocShell() );
1101 }
1102
1103 SwLayAction aAction( GetLayout(), Imp() );
1104 aAction.SetPaint( false );
1105 aAction.SetStatBar( true );
1106 aAction.SetCalcLayout( true );
1107 aAction.SetReschedule( true );
1109 aAction.Action(GetOut());
1111
1112 //the SetNewFieldLst() on the Doc was cut off and must be fetched again
1113 //(see flowfrm.cxx, txtfld.cxx)
1114 if ( aAction.IsExpFields() )
1115 {
1116 aAction.Reset();
1117 aAction.SetPaint( false );
1118 aAction.SetStatBar( true );
1119 aAction.SetReschedule( true );
1120
1121 SwDocPosUpdate aMsgHint( 0 );
1124
1125 aAction.Action(GetOut());
1126 }
1127
1128 if ( VisArea().HasArea() )
1130 if ( bEndProgress )
1131 ::EndProgress( GetDoc()->GetDocShell() );
1132}
1133
1135{
1136 for(SwViewShell& rSh : GetRingContainer())
1137 {
1138 if ( rSh.Imp() )
1139 rSh.Imp()->SetFirstVisPageInvalid();
1140 }
1141}
1142
1144{
1145 if ( !mpWin )
1146 mbDocSizeChgd = true;
1147 else if( ActionPend() || Imp()->IsCalcLayoutProgress() || mbPaintInProgress )
1148 {
1149 mbDocSizeChgd = true;
1150
1151 if ( !Imp()->IsCalcLayoutProgress() && dynamic_cast<const SwCursorShell*>( this ) != nullptr )
1152 {
1153 PageNumNotify(this);
1154
1156 {
1157 Size aDocSize = GetDocSize();
1158 std::stringstream ss;
1159 ss << aDocSize.Width() + 2 * DOCUMENTBORDER << ", " << aDocSize.Height() + 2 * DOCUMENTBORDER;
1160 OString sSize = ss.str().c_str();
1161
1162 SwXTextDocument* pModel = comphelper::getFromUnoTunnel<SwXTextDocument>(GetSfxViewShell()->GetCurrentDocument());
1164 }
1165 }
1166 }
1167 else
1168 {
1169 mbDocSizeChgd = false;
1170 ::SizeNotify( this, GetDocSize() );
1171 }
1172}
1173
1175{
1176 OSL_ENSURE( GetWin(), "VisPortChgd without Window." );
1177
1178 if ( rRect == VisArea() )
1179 return;
1180
1181 // Is someone spuriously rescheduling again?
1182 SAL_WARN_IF(mbInEndAction, "sw.core", "Scrolling during EndAction");
1183
1184 //First get the old visible page, so we don't have to look
1185 //for it afterwards.
1186 const SwFrame *pOldPage = Imp()->GetFirstVisPage(GetWin()->GetOutDev());
1187
1188 const SwRect aPrevArea( VisArea() );
1189 const bool bFull = aPrevArea.IsEmpty();
1190 maVisArea = rRect;
1192
1193 //When there a PaintRegion still exists and the VisArea has changed,
1194 //the PaintRegion is at least by now obsolete. The PaintRegion can
1195 //have been created by RootFrame::PaintSwFrame.
1196 if ( !mbInEndAction &&
1197 Imp()->HasPaintRegion() && Imp()->GetPaintRegion()->GetOrigin() != VisArea() )
1199
1200 CurrShell aCurr( this );
1201
1202 bool bScrolled = false;
1203
1204 SwPostItMgr* pPostItMgr = GetPostItMgr();
1205
1206 if ( bFull )
1207 GetWin()->Invalidate();
1208 else
1209 {
1210 //Calculate amount to be scrolled.
1211 const tools::Long nXDiff = aPrevArea.Left() - VisArea().Left();
1212 const tools::Long nYDiff = aPrevArea.Top() - VisArea().Top();
1213
1214 if( !nXDiff && !GetViewOptions()->getBrowseMode() &&
1215 (!Imp()->HasDrawView() || !Imp()->GetDrawView()->IsGridVisible() ) )
1216 {
1217 // If possible, don't scroll the application background
1218 // (PaintDesktop). Also limit the left and right side of
1219 // the scroll range to the pages.
1220 const SwPageFrame *pPage = static_cast<SwPageFrame*>(GetLayout()->Lower());
1221 if ( pPage->getFrameArea().Top() > pOldPage->getFrameArea().Top() )
1222 pPage = static_cast<const SwPageFrame*>(pOldPage);
1223 SwRect aBoth( VisArea() );
1224 aBoth.Union( aPrevArea );
1225 const SwTwips nBottom = aBoth.Bottom();
1226 SwTwips nMinLeft = SAL_MAX_INT32;
1227 SwTwips nMaxRight= 0;
1228
1229 const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
1230
1231 while ( pPage && pPage->getFrameArea().Top() <= nBottom )
1232 {
1233 SwRect aPageRect( pPage->GetBoundRect(GetWin()->GetOutDev()) );
1234 if ( bBookMode )
1235 {
1236 const SwPageFrame& rFormatPage = pPage->GetFormatPage();
1237 aPageRect.SSize( rFormatPage.GetBoundRect(GetWin()->GetOutDev()).SSize() );
1238 }
1239
1240 // #i9719# - consider new border and shadow width
1241 if ( aPageRect.Overlaps( aBoth ) )
1242 {
1243 SwTwips nPageLeft = 0;
1244 SwTwips nPageRight = 0;
1245 const sw::sidebarwindows::SidebarPosition aSidebarPos = pPage->SidebarPosition();
1246
1248 {
1249 nPageLeft = aPageRect.Left();
1250 nPageRight = aPageRect.Right();
1251 }
1252
1253 if( nPageLeft < nMinLeft )
1254 nMinLeft = nPageLeft;
1255 if( nPageRight > nMaxRight )
1256 nMaxRight = nPageRight;
1257 //match with the draw objects
1258 //take nOfst into account as the objects have been
1259 //selected and have handles attached.
1260 if ( pPage->GetSortedObjs() )
1261 {
1262 const tools::Long nOfst = GetOut()->PixelToLogic(
1263 Size(Imp()->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width();
1264 for (SwAnchoredObject* pObj : *pPage->GetSortedObjs())
1265 {
1266 // ignore objects that are not actually placed on the page
1267 if (pObj->IsFormatPossible())
1268 {
1269 const tools::Rectangle &rBound = pObj->GetObjRect().SVRect();
1270 if (rBound.Left() != FAR_AWAY) {
1271 // OD 03.03.2003 #107927# - use correct datatype
1272 const SwTwips nL = std::max( SwTwips(0), SwTwips(rBound.Left() - nOfst) );
1273 if ( nL < nMinLeft )
1274 nMinLeft = nL;
1275 if( rBound.Right() + nOfst > nMaxRight )
1276 nMaxRight = rBound.Right() + nOfst;
1277 }
1278 }
1279 }
1280 }
1281 }
1282 pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
1283 }
1284 tools::Rectangle aRect( aPrevArea.SVRect() );
1285 aRect.SetLeft( nMinLeft );
1286 aRect.SetRight( nMaxRight );
1287 if( VisArea().Overlaps( aPrevArea ) && !mnLockPaint )
1288 {
1289 bScrolled = true;
1290 maVisArea.Pos() = aPrevArea.Pos();
1291 if ( SmoothScroll( nXDiff, nYDiff, &aRect ) )
1292 return;
1293 maVisArea.Pos() = rRect.Pos();
1294 }
1295 else
1296 GetWin()->Invalidate( aRect );
1297 }
1298 else if ( !mnLockPaint ) //will be released in Unlock
1299 {
1300 if( VisArea().Overlaps( aPrevArea ) )
1301 {
1302 bScrolled = true;
1303 maVisArea.Pos() = aPrevArea.Pos();
1304 if ( SmoothScroll( nXDiff, nYDiff, nullptr ) )
1305 return;
1306 maVisArea.Pos() = rRect.Pos();
1307 }
1308 else
1309 GetWin()->Invalidate();
1310 }
1311 }
1312
1313 // When tiled rendering, the map mode of the window is disabled, avoid
1314 // enabling it here.
1316 {
1317 Point aPt( VisArea().Pos() );
1318 aPt.setX( -aPt.X() ); aPt.setY( -aPt.Y() );
1319 MapMode aMapMode( GetWin()->GetMapMode() );
1320 aMapMode.SetOrigin( aPt );
1321 GetWin()->SetMapMode( aMapMode );
1322 }
1323
1324 if ( HasDrawView() )
1325 {
1326 Imp()->GetDrawView()->VisAreaChanged( GetWin()->GetOutDev() );
1327 Imp()->GetDrawView()->SetActualWin( GetWin()->GetOutDev() );
1328 }
1330
1331 if ( pPostItMgr ) // #i88070#
1332 {
1333 pPostItMgr->Rescale();
1334 pPostItMgr->CalcRects();
1335 pPostItMgr->LayoutPostIts();
1336 }
1337
1338 if ( !bScrolled && pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
1339 pPostItMgr->CorrectPositions();
1340
1341#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1342 if( Imp()->IsAccessible() )
1343 Imp()->UpdateAccessible();
1344#endif
1345}
1346
1348{
1349#if !defined(MACOSX) && !defined(ANDROID) && !defined(IOS)
1350 // #i98766# - disable smooth scrolling for Mac
1351
1352 const sal_uLong nBitCnt = mpOut->GetBitCount();
1353 tools::Long lMult = 1, lMax = LONG_MAX;
1354 if ( nBitCnt == 16 )
1355 {
1356 lMax = 7000;
1357 lMult = 2;
1358 }
1359 if ( nBitCnt == 24 )
1360 {
1361 lMax = 5000;
1362 lMult = 6;
1363 }
1364 else if ( nBitCnt == 1 )
1365 {
1366 lMax = 3000;
1367 lMult = 12;
1368 }
1369
1370 // #i75172# isolated static conditions
1371 const bool bOnlyYScroll(!lXDiff && std::abs(lYDiff) != 0 && std::abs(lYDiff) < lMax);
1372 const bool bAllowedWithChildWindows(GetWin()->GetWindowClipRegionPixel().IsNull());
1373 const bool bSmoothScrollAllowed(bOnlyYScroll && mbEnableSmooth && GetViewOptions()->IsSmoothScroll() && bAllowedWithChildWindows);
1374
1375 if(bSmoothScrollAllowed)
1376 {
1377 Imp()->m_bStopSmooth = false;
1378
1379 const SwRect aOldVis( VisArea() );
1380
1381 //create virtual device and set.
1382 const Size aPixSz = GetWin()->PixelToLogic(Size(1,1));
1383 VclPtrInstance<VirtualDevice> pVout( *GetWin()->GetOutDev() );
1384 pVout->SetLineColor( GetWin()->GetOutDev()->GetLineColor() );
1385 pVout->SetFillColor( GetWin()->GetOutDev()->GetFillColor() );
1386 MapMode aMapMode( GetWin()->GetMapMode() );
1387 pVout->SetMapMode( aMapMode );
1388 Size aSize( maVisArea.Width()+2*aPixSz.Width(), std::abs(lYDiff)+(2*aPixSz.Height()) );
1389 if ( pRect )
1390 aSize.setWidth( std::min(aSize.Width(), pRect->GetWidth()+2*aPixSz.Width()) );
1391 if ( pVout->SetOutputSize( aSize ) )
1392 {
1393 mnLockPaint++;
1394
1395 //First Paint everything in the virtual device.
1396 SwRect aRect( VisArea() );
1397 aRect.Height( aSize.Height() );
1398 if ( pRect )
1399 {
1400 aRect.Pos().setX( std::max(aRect.Left(),pRect->Left()-aPixSz.Width()) );
1401 aRect.Right( std::min(aRect.Right()+2*aPixSz.Width(), pRect->Right()+aPixSz.Width()));
1402 }
1403 else
1404 aRect.AddWidth(2*aPixSz.Width() );
1405 aRect.Pos().setY( lYDiff < 0 ? aOldVis.Bottom() - aPixSz.Height()
1406 : aRect.Top() - aSize.Height() + aPixSz.Height() );
1407 aRect.Pos().setX( std::max( tools::Long(0), aRect.Left()-aPixSz.Width() ) );
1408 aRect.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.Pos()));
1409 aRect.SSize( GetWin()->PixelToLogic( GetWin()->LogicToPixel( aRect.SSize())) );
1410 maVisArea = aRect;
1411 const Point aPt( -aRect.Left(), -aRect.Top() );
1412 aMapMode.SetOrigin( aPt );
1413 pVout->SetMapMode( aMapMode );
1414 OutputDevice *pOld = mpOut;
1415 mpOut = pVout.get();
1416
1417 {
1418 // #i75172# To get a clean repaint, a new ObjectContact is needed here. Without, the
1419 // repaint would not be correct since it would use the wrong DrawPage visible region.
1420 // This repaint IS about painting something currently outside the visible part (!).
1421 // For that purpose, AddWindowToPaintView is used which creates a new SdrPageViewWindow
1422 // and all the necessary stuff. It's not cheap, but necessary here. Alone because repaint
1423 // target really is NOT the current window.
1424 // Also will automatically NOT use PreRendering and overlay (since target is VirtualDevice)
1425 if(!HasDrawView())
1426 MakeDrawView();
1427 SdrView* pDrawView = GetDrawView();
1428 pDrawView->AddWindowToPaintView(pVout, nullptr);
1429
1430 // clear mpWin during DLPrePaint2 to get paint preparation for mpOut, but set it again
1431 // immediately afterwards. There are many decisions in SW which imply that Printing
1432 // is used when mpWin == 0 (wrong but widely used).
1433 vcl::Window* pOldWin = mpWin;
1434 mpWin = nullptr;
1435 DLPrePaint2(vcl::Region(aRect.SVRect()));
1436 mpWin = pOldWin;
1437
1438 // SW paint stuff
1439 PaintDesktop(*GetOut(), aRect);
1440 SwViewShell::sbLstAct = true;
1441 GetLayout()->PaintSwFrame( *GetOut(), aRect );
1442 SwViewShell::sbLstAct = false;
1443
1444 // end paint and destroy ObjectContact again
1445 DLPostPaint2(true);
1446 pDrawView->DeleteWindowFromPaintView(pVout);
1447 }
1448
1449 mpOut = pOld;
1450 maVisArea = aOldVis;
1451
1452 //Now shift in parts and copy the new Pixel from the virtual device.
1453
1454 // ??????????????????????
1455 // or is it better to get the scrollfactor from the User
1456 // as option?
1457 // ??????????????????????
1458 tools::Long lMaDelta = aPixSz.Height();
1459 if ( std::abs(lYDiff) > ( maVisArea.Height() / 3 ) )
1460 lMaDelta *= 6;
1461 else
1462 lMaDelta *= 2;
1463
1464 lMaDelta *= lMult;
1465
1466 if ( lYDiff < 0 )
1467 lMaDelta = -lMaDelta;
1468
1469 tools::Long lDiff = lYDiff;
1470 while ( lDiff )
1471 {
1472 tools::Long lScroll;
1473 if ( Imp()->m_bStopSmooth || std::abs(lDiff) <= std::abs(lMaDelta) )
1474 {
1475 lScroll = lDiff;
1476 lDiff = 0;
1477 }
1478 else
1479 {
1480 lScroll = lMaDelta;
1481 lDiff -= lMaDelta;
1482 }
1483
1484 const SwRect aTmpOldVis = VisArea();
1485 maVisArea.Pos().AdjustY( -lScroll );
1486 maVisArea.Pos() = GetWin()->PixelToLogic( GetWin()->LogicToPixel( VisArea().Pos()));
1487 lScroll = aTmpOldVis.Top() - VisArea().Top();
1488 if ( pRect )
1489 {
1490 tools::Rectangle aTmp( aTmpOldVis.SVRect() );
1491 aTmp.SetLeft( pRect->Left() );
1492 aTmp.SetRight( pRect->Right() );
1493 GetWin()->Scroll( 0, lScroll, aTmp, ScrollFlags::Children);
1494 }
1495 else
1496 GetWin()->Scroll( 0, lScroll, ScrollFlags::Children );
1497
1498 const Point aTmpPt( -VisArea().Left(), -VisArea().Top() );
1499 MapMode aTmpMapMode( GetWin()->GetMapMode() );
1500 aTmpMapMode.SetOrigin( aTmpPt );
1501 GetWin()->SetMapMode( aTmpMapMode );
1502
1503 if ( Imp()->HasDrawView() )
1504 Imp()->GetDrawView()->VisAreaChanged( GetWin()->GetOutDev() );
1505
1507 if ( !Imp()->m_bStopSmooth )
1508 {
1509 const bool bScrollDirectionIsUp(lScroll > 0);
1510 Imp()->m_aSmoothRect = VisArea();
1511
1512 if(bScrollDirectionIsUp)
1513 {
1514 Imp()->m_aSmoothRect.Bottom( VisArea().Top() + lScroll + aPixSz.Height());
1515 }
1516 else
1517 {
1518 Imp()->m_aSmoothRect.Top( VisArea().Bottom() + lScroll - aPixSz.Height());
1519 }
1520
1521 Imp()->m_bSmoothUpdate = true;
1523 Imp()->m_bSmoothUpdate = false;
1524
1525 if(!Imp()->m_bStopSmooth)
1526 {
1527 // start paint on logic base
1528 const tools::Rectangle aTargetLogic(Imp()->m_aSmoothRect.SVRect());
1529 DLPrePaint2(vcl::Region(aTargetLogic));
1530
1531 // get target rectangle in discrete pixels
1533 const tools::Rectangle aTargetPixel(rTargetDevice.LogicToPixel(aTargetLogic));
1534
1535 // get source top-left in discrete pixels
1536 const Point aSourceTopLeft(pVout->LogicToPixel(aTargetLogic.TopLeft()));
1537
1538 // switch off MapModes
1539 const bool bMapModeWasEnabledDest(rTargetDevice.IsMapModeEnabled());
1540 const bool bMapModeWasEnabledSource(pVout->IsMapModeEnabled());
1541 rTargetDevice.EnableMapMode(false);
1542 pVout->EnableMapMode(false);
1543
1544 rTargetDevice.DrawOutDev(
1545 aTargetPixel.TopLeft(), aTargetPixel.GetSize(), // dest
1546 aSourceTopLeft, aTargetPixel.GetSize(), // source
1547 *pVout);
1548
1549 // restore MapModes
1550 rTargetDevice.EnableMapMode(bMapModeWasEnabledDest);
1551 pVout->EnableMapMode(bMapModeWasEnabledSource);
1552
1553 // end paint on logoc base
1554 DLPostPaint2(true);
1555 }
1556 else
1557 --mnLockPaint;
1558 }
1559 }
1560 pVout.disposeAndClear();
1562 if ( !Imp()->m_bStopSmooth )
1563 --mnLockPaint;
1565 return true;
1566 }
1567 pVout.disposeAndClear();
1568 }
1569#endif
1570
1571 maVisArea.Pos().AdjustX( -lXDiff );
1572 maVisArea.Pos().AdjustY( -lYDiff );
1573 if ( pRect )
1574 GetWin()->Scroll( lXDiff, lYDiff, *pRect, ScrollFlags::Children);
1575 else
1576 GetWin()->Scroll( lXDiff, lYDiff, ScrollFlags::Children);
1577 return false;
1578}
1579
1580void SwViewShell::PaintDesktop(const vcl::RenderContext& rRenderContext, const SwRect &rRect)
1581{
1582 if ( !GetWin() && !GetOut()->GetConnectMetaFile() )
1583 return; //for the printer we don't do anything here.
1584
1586 return;
1587
1588 //Catch exceptions, so that it doesn't look so surprising.
1589 //Can e.g. happen during Idle.
1590 //Unfortunately we must at any rate Paint the rectangles next to the pages,
1591 //as these are not painted at VisPortChgd.
1592 bool bBorderOnly = false;
1593 const SwRootFrame *pRoot = GetLayout();
1594 if ( rRect.Top() > pRoot->getFrameArea().Bottom() )
1595 {
1596 const SwFrame *pPg = pRoot->Lower();
1597 while ( pPg && pPg->GetNext() )
1598 pPg = pPg->GetNext();
1599 if ( !pPg || !pPg->getFrameArea().Overlaps( VisArea() ) )
1600 bBorderOnly = true;
1601 }
1602
1603 const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
1604
1605 SwRegionRects aRegion( rRect );
1606
1607 //mod #i6193: remove sidebar area to avoid flickering
1608 const SwPostItMgr* pPostItMgr = GetPostItMgr();
1609 const SwTwips nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ?
1610 pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() :
1611 0;
1612
1613 if ( bBorderOnly )
1614 {
1615 const SwFrame *pPage =pRoot->Lower();
1616 SwRect aLeft( rRect ), aRight( rRect );
1617 while ( pPage )
1618 {
1619 tools::Long nTmp = pPage->getFrameArea().Left();
1620 if ( nTmp < aLeft.Right() )
1621 aLeft.Right( nTmp );
1622 nTmp = pPage->getFrameArea().Right();
1623 if ( nTmp > aRight.Left() )
1624 {
1625 aRight.Left( nTmp + nSidebarWidth );
1626 }
1627 pPage = pPage->GetNext();
1628 }
1629 aRegion.clear();
1630 if ( aLeft.HasArea() )
1631 aRegion.push_back( aLeft );
1632 if ( aRight.HasArea() )
1633 aRegion.push_back( aRight );
1634 }
1635 else
1636 {
1637 const SwFrame *pPage = Imp()->GetFirstVisPage(&rRenderContext);
1638 const SwTwips nBottom = rRect.Bottom();
1639 while ( pPage && !aRegion.empty() &&
1640 (pPage->getFrameArea().Top() <= nBottom) )
1641 {
1642 SwRect aPageRect( pPage->getFrameArea() );
1643 if ( bBookMode )
1644 {
1645 const SwPageFrame& rFormatPage = static_cast<const SwPageFrame*>(pPage)->GetFormatPage();
1646 aPageRect.SSize( rFormatPage.getFrameArea().SSize() );
1647 }
1648
1649 const bool bSidebarRight =
1651 aPageRect.Pos().AdjustX( -(bSidebarRight ? 0 : nSidebarWidth) );
1652 aPageRect.AddWidth(nSidebarWidth );
1653
1654 if ( aPageRect.Overlaps( rRect ) )
1655 aRegion -= aPageRect;
1656
1657 pPage = pPage->GetNext();
1658 }
1659 }
1660 if ( !aRegion.empty() )
1661 PaintDesktop_(aRegion);
1662}
1663
1664// PaintDesktop is split in two, this part is also used by PreviewPage
1666{
1667 // OD 2004-04-23 #116347#
1669 GetOut()->SetLineColor();
1670
1671 for ( auto &rRgn : rRegion )
1672 {
1673 const tools::Rectangle aRectangle(rRgn.SVRect());
1674
1675 // #i93170#
1676 // Here we have a real Problem. On the one hand we have the buffering for paint
1677 // and overlay which needs an embracing pair of DLPrePaint2/DLPostPaint2 calls,
1678 // on the other hand the MapMode is not set correctly when this code is executed.
1679 // This is done in the users of this method, for each SWpage before painting it.
1680 // Since the MapMode is not correct here, the call to DLPostPaint2 will paint
1681 // existing FormControls due to the current MapMode.
1682
1683 // There are basically three solutions for this:
1684
1685 // (1) Set the MapMode correct, move the background painting to the users of
1686 // this code
1687
1688 // (2) Do no DLPrePaint2/DLPostPaint2 here; no SdrObjects are allowed to lie in
1689 // the desktop region. Disadvantage: the desktop will not be part of the
1690 // buffers, e.g. overlay. Thus, as soon as overlay will be used over the
1691 // desktop, it will not work.
1692
1693 // (3) expand DLPostPaint2 with a flag to signal if FormControl paints shall
1694 // be done or not
1695
1696 // Currently, (3) will be the best possible solution. It will keep overlay and
1697 // buffering intact and work without MapMode for single pages. In the medium
1698 // to long run, (1) will need to be used and the bool bPaintFormLayer needs
1699 // to be removed again
1700
1701 // #i68597# inform Drawinglayer about display change
1702 DLPrePaint2(vcl::Region(aRectangle));
1703
1704 // #i75172# needed to move line/Fill color setters into loop since DLPrePaint2
1705 // may exchange GetOut(), that's it's purpose. This happens e.g. at print preview.
1707 GetOut()->SetLineColor();
1708 GetOut()->DrawRect(aRectangle);
1709
1710 DLPostPaint2(false);
1711 }
1712
1713 GetOut()->Pop();
1714}
1715
1717{
1718 if ( !GetWin() )
1719 return false;
1720
1721 const SwPageFrame *pPage = Imp()->GetFirstVisPage(GetOut());
1722 const SwTwips nBottom = VisArea().Bottom();
1723 const SwTwips nRight = VisArea().Right();
1724 bool bRet = false;
1725 while ( !bRet && pPage && ((pPage->getFrameArea().Top() <= nBottom) &&
1726 (pPage->getFrameArea().Left() <= nRight)))
1727 {
1728 if ( pPage->IsInvalid() || pPage->IsInvalidFly() )
1729 bRet = true;
1730 pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
1731 }
1732
1733 if ( bRet )
1734 {
1735 //Unfortunately Start/EndAction won't help here, as the Paint originated
1736 //from GUI and so Clipping has been set against getting through.
1737 //Ergo: do it all yourself (see ImplEndAction())
1738 if ( Imp()->HasPaintRegion() && Imp()->GetPaintRegion()->GetOrigin() != VisArea())
1740
1741 SwLayAction aAction( GetLayout(), Imp() );
1742 aAction.SetComplete( false );
1743 // We increment the action counter to avoid a recursive call of actions
1744 // e.g. from a SwFEShell::RequestObjectResize(..) in bug 95829.
1745 // A recursive call of actions is no good idea because the inner action
1746 // can't format frames which are locked by the outer action. This may
1747 // cause and endless loop.
1748 ++mnStartAction;
1749 aAction.Action(GetWin()->GetOutDev());
1750 --mnStartAction;
1751
1752 std::unique_ptr<SwRegionRects> pRegion = Imp()->TakePaintRegion();
1753 if ( pRegion && aAction.IsBrowseActionStop() )
1754 {
1755 //only of interest when something has changed in the visible range
1756 bool bStop = true;
1757 for ( size_t i = 0; i < pRegion->size(); ++i )
1758 {
1759 const SwRect &rTmp = (*pRegion)[i];
1760 bStop = rTmp.Overlaps( VisArea() );
1761 if ( !bStop )
1762 break;
1763 }
1764 if ( bStop )
1765 pRegion.reset();
1766 }
1767
1768 if ( pRegion )
1769 {
1770 pRegion->LimitToOrigin();
1771 pRegion->Compress( SwRegionRects::CompressFuzzy );
1772 bRet = false;
1773 if ( !pRegion->empty() )
1774 {
1775 SwRegionRects aRegion( rRect );
1776 for ( size_t i = 0; i < pRegion->size(); ++i )
1777 { const SwRect &rTmp = (*pRegion)[i];
1778 if ( !rRect.Contains( rTmp ) )
1779 {
1780 InvalidateWindows( rTmp );
1781 if ( rTmp.Overlaps( VisArea() ) )
1782 { aRegion -= rTmp;
1783 bRet = true;
1784 }
1785 }
1786 }
1787 if ( bRet )
1788 {
1789 for ( size_t i = 0; i < aRegion.size(); ++i )
1790 GetWin()->Invalidate( aRegion[i].SVRect() );
1791
1792 if ( rRect != VisArea() )
1793 {
1794 //rRect == VisArea is the special case for new or
1795 //Shift-Ctrl-R, when it shouldn't be necessary to
1796 //hold the rRect again in Document coordinates.
1797 if ( maInvalidRect.IsEmpty() )
1798 maInvalidRect = rRect;
1799 else
1800 maInvalidRect.Union( rRect );
1801 }
1802 }
1803 }
1804 else
1805 bRet = false;
1806 }
1807 else
1808 bRet = false;
1809 }
1810 return bRet;
1811}
1812
1813namespace
1814{
1816class RenderContextGuard
1817{
1818 std::unique_ptr<SdrPaintWindow> m_TemporaryPaintWindow;
1819 SdrPageWindow* m_pPatchedPageWindow;
1820 SdrPaintWindow* m_pPreviousPaintWindow = nullptr;
1821
1822public:
1823 RenderContextGuard(VclPtr<vcl::RenderContext>& pRef, vcl::RenderContext* pValue, SwViewShell* pShell)
1824 : m_pPatchedPageWindow(nullptr)
1825 {
1826 pRef = pValue;
1827
1828 if (pValue == pShell->GetWin()->GetOutDev())
1829 return;
1830
1831 SdrView* pDrawView(pShell->Imp()->GetDrawView());
1832
1833 if (nullptr == pDrawView)
1834 return;
1835
1836 SdrPageView* pSdrPageView(pDrawView->GetSdrPageView());
1837
1838 if (nullptr != pSdrPageView)
1839 {
1840 m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*pShell->GetWin()->GetOutDev());
1841
1842 if (nullptr != m_pPatchedPageWindow)
1843 {
1844 m_TemporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, *pValue));
1845 m_pPreviousPaintWindow = m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow);
1846 }
1847 }
1848 }
1849
1850 ~RenderContextGuard()
1851 {
1852 if(nullptr != m_pPatchedPageWindow)
1853 {
1854 m_pPatchedPageWindow->unpatchPaintWindow(m_pPreviousPaintWindow);
1855 }
1856 }
1857};
1858}
1859
1860void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect)
1861{
1862 RenderContextGuard aGuard(mpOut, &rRenderContext, this);
1863 if ( mnLockPaint )
1864 {
1865 if ( Imp()->m_bSmoothUpdate )
1866 {
1867 SwRect aTmp( rRect );
1868 if ( !Imp()->m_aSmoothRect.Contains( aTmp ) )
1869 Imp()->m_bStopSmooth = true;
1870 else
1871 {
1872 Imp()->m_aSmoothRect = aTmp;
1873 return;
1874 }
1875 }
1876 else
1877 return;
1878 }
1879
1880 if ( SwRootFrame::IsInPaint() )
1881 {
1882 //During the publication of a page at printing the Paint is buffered.
1883 SwPaintQueue::Add( this, SwRect( rRect ) );
1884 return;
1885 }
1886
1887 //With !nStartAction I try to protect me against erroneous code at other places.
1888 //Hopefully it will not lead to problems!?
1889 if ( mbPaintWorks && !mnStartAction )
1890 {
1891 if( GetWin() && GetWin()->IsVisible() )
1892 {
1893 SwRect aRect( rRect );
1894 if ( mbPaintInProgress ) //Guard against double Paints!
1895 {
1896 GetWin()->Invalidate( rRect );
1897 return;
1898 }
1899
1900 mbPaintInProgress = true;
1901 CurrShell aCurr( this );
1903
1904 //We don't want to Clip to and from, we trust that all are limited
1905 //to the rectangle and only need to calculate the clipping once.
1906 //The ClipRect is removed here once and not recovered, as externally
1907 //no one needs it anymore anyway.
1908 //Not when we paint a Metafile.
1909 if( !GetOut()->GetConnectMetaFile() && GetOut()->IsClipRegion())
1910 GetOut()->SetClipRegion();
1911
1912 if ( IsPreview() )
1913 {
1914 //When useful, process or destroy the old InvalidRect.
1915 if ( aRect.Contains( maInvalidRect ) )
1917 SwViewShell::sbLstAct = true;
1918 GetLayout()->PaintSwFrame( rRenderContext, aRect );
1919 SwViewShell::sbLstAct = false;
1920 }
1921 else
1922 {
1923 //When one of the visible pages still has anything entered for
1924 //Repaint, Repaint must be triggered.
1925 if ( !CheckInvalidForPaint( aRect ) )
1926 {
1927 // --> OD 2009-08-12 #i101192#
1928 // start Pre/PostPaint encapsulation to avoid screen blinking
1929 const vcl::Region aRepaintRegion(aRect.SVRect());
1930 DLPrePaint2(aRepaintRegion);
1931
1932 // <--
1933 PaintDesktop(rRenderContext, aRect);
1934
1935 //When useful, process or destroy the old InvalidRect.
1936 if ( aRect.Contains( maInvalidRect ) )
1938 SwViewShell::sbLstAct = true;
1939 GetLayout()->PaintSwFrame( rRenderContext, aRect );
1940 SwViewShell::sbLstAct = false;
1941 // --> OD 2009-08-12 #i101192#
1942 // end Pre/PostPaint encapsulation
1943 DLPostPaint2(true);
1944 // <--
1945 }
1946 }
1947 SwRootFrame::SetNoVirDev( false );
1948 mbPaintInProgress = false;
1949 UISizeNotify();
1950 }
1951 }
1952 else
1953 {
1954 if ( maInvalidRect.IsEmpty() )
1955 maInvalidRect = SwRect( rRect );
1956 else
1957 maInvalidRect.Union( SwRect( rRect ) );
1958
1959 if ( mbInEndAction && GetWin() )
1960 {
1961 const vcl::Region aRegion(GetWin()->GetPaintRegion());
1962 RectangleVector aRectangles;
1963 aRegion.GetRegionRectangles(aRectangles);
1964
1965 for(const auto& rRectangle : aRectangles)
1966 {
1967 Imp()->AddPaintRect(SwRect(rRectangle));
1968 }
1969
1970 //RegionHandle hHdl( aRegion.BeginEnumRects() );
1971 //Rectangle aRect;
1972 //while ( aRegion.GetEnumRects( hHdl, aRect ) )
1973 // Imp()->AddPaintRect( aRect );
1974 //aRegion.EndEnumRects( hHdl );
1975 }
1976 else if ( SfxProgress::GetActiveProgress( GetDoc()->GetDocShell() ) &&
1977 GetOut() == GetWin()->GetOutDev() )
1978 {
1979 // #i68597#
1980 const vcl::Region aDLRegion(rRect);
1981 DLPrePaint2(aDLRegion);
1982
1984 rRenderContext.SetFillColor( Imp()->GetRetoucheColor() );
1985 rRenderContext.SetLineColor();
1986 rRenderContext.DrawRect( rRect );
1987 rRenderContext.Pop();
1988 // #i68597#
1989 DLPostPaint2(true);
1990 }
1991 }
1992}
1993
1994void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contextHeight, int tilePosX, int tilePosY, tools::Long tileWidth, tools::Long tileHeight)
1995{
1996 // SwViewShell's output device setup
1997 // TODO clean up SwViewShell's approach to output devices (the many of
1998 // them - mpBufferedOut, mpOut, mpWin, ...)
1999 OutputDevice *pSaveOut = mpOut;
2001 mpOut = &rDevice;
2002
2003 // resizes the virtual device so to contain the entries context
2004 rDevice.SetOutputSizePixel(Size(contextWidth, contextHeight));
2005
2006 // setup the output device to draw the tile
2007 MapMode aMapMode(rDevice.GetMapMode());
2008 aMapMode.SetMapUnit(MapUnit::MapTwip);
2009 aMapMode.SetOrigin(Point(-tilePosX, -tilePosY));
2010
2011 // Scaling. Must convert from pixels to twips. We know
2012 // that VirtualDevices use a DPI of 96.
2014 Fraction scaleX = Fraction(contextWidth, tileWidth) * scale;
2015 Fraction scaleY = Fraction(contextHeight, tileHeight) * scale;
2016 aMapMode.SetScaleX(scaleX);
2017 aMapMode.SetScaleY(scaleY);
2018 rDevice.SetMapMode(aMapMode);
2019
2020 // Update scaling of SwEditWin and its sub-widgets, needed for comments.
2021 sal_uInt16 nOldZoomValue = 0;
2022 if (GetWin() && GetWin()->GetMapMode().GetScaleX() != scaleX)
2023 {
2024 double fScale = double(scaleX);
2025 SwViewOption aOption(*GetViewOptions());
2026 nOldZoomValue = aOption.GetZoom();
2027 aOption.SetZoom(fScale * 100);
2028 ApplyViewOptions(aOption);
2029 // Make sure the map mode (disabled in SwXTextDocument::initializeForTiledRendering()) is still disabled.
2030 GetWin()->EnableMapMode(false);
2031 }
2032
2033 tools::Rectangle aOutRect(Point(tilePosX, tilePosY),
2034 rDevice.PixelToLogic(Size(contextWidth, contextHeight)));
2035
2036 // Make the requested area visible -- we can't use MakeVisible as that will
2037 // only scroll the contents, but won't zoom/resize if needed.
2038 // Without this, items/text that are outside the visible area (in the SwView)
2039 // won't be painted when rendering tiles (at least when using either the
2040 // tiledrendering app, or the gtktiledviewer) -- although ultimately we
2041 // probably want to fix things so that the SwView's area doesn't affect
2042 // tiled rendering?
2043 VisPortChgd(SwRect(aOutRect));
2044
2045 // Invoke SwLayAction if layout is not yet ready.
2046 CheckInvalidForPaint(SwRect(aOutRect));
2047
2048 // draw - works in logic coordinates
2049 Paint(rDevice, aOutRect);
2050
2051 SwPostItMgr* pPostItMgr = GetPostItMgr();
2052 if (GetViewOptions()->IsPostIts() && pPostItMgr)
2053 pPostItMgr->PaintTile(rDevice);
2054
2055 // SwViewShell's output device tear down
2056
2057 // A view shell can get a PaintTile call for a tile at a zoom level
2058 // different from the one, the related client really is.
2059 // In such a case it is better to reset the current scale value to
2060 // the original one, since such a value should be in synchronous with
2061 // the zoom level in the client (see setClientZoom).
2062 // At present the zoom value returned by GetViewOptions()->GetZoom() is
2063 // used in SwXTextDocument methods (postMouseEvent and setGraphicSelection)
2064 // for passing the correct mouse position to an edited chart (if any).
2065 if (nOldZoomValue !=0)
2066 {
2067 SwViewOption aOption(*GetViewOptions());
2068 aOption.SetZoom(nOldZoomValue);
2069 ApplyViewOptions(aOption);
2070
2071 // Changing the zoom value doesn't always trigger the updating of
2072 // the client ole object area, so we call it directly.
2074 if (pIPClient)
2075 {
2076 pIPClient->VisAreaChanged();
2077 }
2078 // Make sure the map mode (disabled in SwXTextDocument::initializeForTiledRendering()) is still disabled.
2079 GetWin()->EnableMapMode(false);
2080 }
2081
2082 mpOut = pSaveOut;
2084}
2085
2087{
2088 if( rNew != maBrowseBorder )
2089 {
2090 maBrowseBorder = rNew;
2091 if ( maVisArea.HasArea() )
2092 InvalidateLayout( false );
2093 }
2094}
2095
2097{
2098 return maBrowseBorder;
2099}
2100
2102{
2103 const SwPostItMgr* pPostItMgr = GetPostItMgr();
2104 if ( pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() )
2105 {
2106 Size aBorder( maBrowseBorder );
2107 aBorder.AdjustWidth(maBrowseBorder.Width() );
2108 aBorder.AdjustWidth(pPostItMgr->GetSidebarWidth(true) + pPostItMgr->GetSidebarBorderWidth(true) );
2109 return maVisArea.Width() - GetOut()->PixelToLogic(aBorder).Width();
2110 }
2111 else
2112 return maVisArea.Width() - 2 * GetOut()->PixelToLogic(maBrowseBorder).Width();
2113}
2114
2115void SwViewShell::InvalidateLayout( bool bSizeChanged )
2116{
2117 if ( !bSizeChanged && !GetViewOptions()->getBrowseMode() &&
2118 !GetViewOptions()->IsWhitespaceHidden() )
2119 return;
2120
2121 CurrShell aCurr( this );
2122
2123 OSL_ENSURE( GetLayout(), "Layout not ready" );
2124
2125 // When the Layout doesn't have a height yet, nothing is formatted.
2126 // That leads to problems with Invalidate, e.g. when setting up a new View
2127 // the content is inserted and formatted (regardless of empty VisArea).
2128 // Therefore the pages must be roused for formatting.
2129 if( !GetLayout()->getFrameArea().Height() )
2130 {
2131 SwFrame* pPage = GetLayout()->Lower();
2132 while( pPage )
2133 {
2134 pPage->InvalidateSize_();
2135 pPage = pPage->GetNext();
2136 }
2137 return;
2138 }
2139
2140 LockPaint();
2141 StartAction();
2142
2143 SwPageFrame *pPg = static_cast<SwPageFrame*>(GetLayout()->Lower());
2144 do
2145 { pPg->InvalidateSize();
2146 pPg->InvalidatePrt_();
2147 pPg->InvaPercentLowers();
2148 if ( bSizeChanged )
2149 {
2150 pPg->PrepareHeader();
2151 pPg->PrepareFooter();
2152 }
2153 pPg = static_cast<SwPageFrame*>(pPg->GetNext());
2154 } while ( pPg );
2155
2156 // When the size ratios in browse mode change,
2157 // the Position and PrtArea of the Content and Tab frames must be Invalidated.
2159 // In case of layout or mode change, the ContentFrames need a size-Invalidate
2160 // because of printer/screen formatting.
2161 if ( bSizeChanged )
2163
2165
2166 SwFrame::CheckPageDescs( static_cast<SwPageFrame*>(GetLayout()->Lower()) );
2167
2168 EndAction();
2169 UnlockPaint();
2170}
2171
2173{
2174 return mpLayout.get();
2175}
2176
2178{
2179 OutputDevice* pTmpOut = nullptr;
2180 if ( GetWin() &&
2181 GetViewOptions()->getBrowseMode() &&
2182 !GetViewOptions()->IsPrtFormat() )
2183 pTmpOut = GetWin()->GetOutDev();
2184 else
2185 pTmpOut = GetDoc()->getIDocumentDeviceAccess().getReferenceDevice( true );
2186
2187 return *pTmpOut;
2188}
2189
2191{
2192 return mxDoc->GetNodes();
2193}
2194
2196{
2197}
2198
2200{
2201 Size aSz;
2202 const SwRootFrame* pRoot = GetLayout();
2203 if( pRoot )
2204 aSz = pRoot->getFrameArea().SSize();
2205
2206 return aSz;
2207}
2208
2210{
2211 return GetDoc()->GetAttrPool();
2212}
2213
2215{
2216 for(SwViewShell& rSh : GetRingContainer())
2217 rSh.StartAction();
2218
2219 ImplApplyViewOptions( rOpt );
2220
2221 // With one layout per view it is no longer necessary
2222 // to sync these "layout related" view options
2223 // But as long as we have to disable "multiple layout"
2224
2225 for(SwViewShell& rSh : GetRingContainer())
2226 {
2227 if(&rSh == this)
2228 continue;
2229 SwViewOption aOpt( *rSh.GetViewOptions() );
2230 aOpt.SetFieldName( rOpt.IsFieldName() );
2232 aOpt.SetShowHiddenPara( rOpt.IsShowHiddenPara() );
2233 aOpt.SetShowHiddenChar( rOpt.IsShowHiddenChar() );
2237 aOpt.SetPostIts(rOpt.IsPostIts());
2238 if ( !(aOpt == *rSh.GetViewOptions()) )
2239 rSh.ImplApplyViewOptions( aOpt );
2240 }
2241 // End of disabled multiple window
2242
2243 for(SwViewShell& rSh : GetRingContainer())
2244 rSh.EndAction();
2245}
2246
2247static bool
2249{
2251 {
2252 return false;
2253 }
2254 IDocumentMarkAccess const& rIDMA(*rCursor.GetDoc().getIDocumentMarkAccess());
2255 // iterate, for nested fieldmarks
2256 for (auto iter = rIDMA.getFieldmarksBegin(); iter != rIDMA.getFieldmarksEnd(); ++iter)
2257 {
2258 if (*rCursor.GetPoint() <= (**iter).GetMarkStart())
2259 {
2260 return false;
2261 }
2262 if (*rCursor.GetPoint() < (**iter).GetMarkEnd())
2263 {
2265 dynamic_cast<sw::mark::IFieldmark&>(**iter)));
2267 {
2268 if (*rCursor.GetPoint() <= sepPos
2269 && *rCursor.GetPoint() != (**iter).GetMarkStart())
2270 {
2271 return true;
2272 }
2273 }
2274 else
2275 {
2276 if (sepPos < *rCursor.GetPoint())
2277 {
2278 return true;
2279 }
2280 }
2281 }
2282 }
2283 return false;
2284}
2285
2287{
2288 if (*mpOpt == rOpt)
2289 return;
2290
2291 vcl::Window *pMyWin = GetWin();
2292 if( !pMyWin )
2293 {
2294 OSL_ENSURE( pMyWin, "SwViewShell::ApplyViewOptions: no window" );
2295 return;
2296 }
2297
2298 CurrShell aCurr( this );
2299
2300 bool bReformat = false;
2301
2302 if( mpOpt->IsShowHiddenField() != rOpt.IsShowHiddenField() )
2303 {
2304 static_cast<SwHiddenTextFieldType*>(mxDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenText ))->
2305 SetHiddenFlag( !rOpt.IsShowHiddenField() );
2306 bReformat = true;
2307 }
2308 if ( mpOpt->IsShowHiddenPara() != rOpt.IsShowHiddenPara() )
2309 {
2310 SwHiddenParaFieldType* pFieldType = static_cast<SwHiddenParaFieldType*>(GetDoc()->
2311 getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::HiddenPara));
2312 if( pFieldType && pFieldType->HasWriterListeners() )
2313 pFieldType->PrintHiddenPara();
2314 bReformat = true;
2315 }
2316 if ( !bReformat && mpOpt->IsShowHiddenChar() != rOpt.IsShowHiddenChar() )
2317 {
2318 bReformat = GetDoc()->ContainsHiddenChars();
2319 }
2320 if ( mpOpt->IsShowChangesInMargin() != rOpt.IsShowChangesInMargin() ||
2321 mpOpt->IsShowChangesInMargin2() != rOpt.IsShowChangesInMargin2() )
2322 {
2323 if (rOpt.IsShowChangesInMargin())
2325 /*bDeletion=*/!rOpt.IsShowChangesInMargin2() );
2326 else
2328 GetLayout()->SetHideRedlines( false );
2329 }
2330
2331 // bReformat becomes true, if ...
2332 // - fieldnames apply or not ...
2333 // ( - SwEndPortion must _no_ longer be generated. )
2334 // - Of course, the screen is something completely different than the printer ...
2335 bool const isToggleFieldNames(mpOpt->IsFieldName() != rOpt.IsFieldName());
2336
2337 if (mpOpt->IsFieldName() != rOpt.IsFieldName())
2338 {
2342 bReformat = true;
2343 }
2344
2345 // The map mode is changed, minima/maxima will be attended by UI
2346 if( mpOpt->GetZoom() != rOpt.GetZoom() && !IsPreview() )
2347 {
2348 MapMode aMode( pMyWin->GetMapMode() );
2349 Fraction aNewFactor( rOpt.GetZoom(), 100 );
2350 aMode.SetScaleX( aNewFactor );
2351 aMode.SetScaleY( aNewFactor );
2352 pMyWin->SetMapMode( aMode );
2353 // if not a reference device (printer) is used for formatting,
2354 // but the screen, new formatting is needed for zoomfactor changes.
2355 if (mpOpt->getBrowseMode() || mpOpt->IsWhitespaceHidden())
2356 bReformat = true;
2357 }
2358
2359 bool bBrowseModeChanged = false;
2360 if( mpOpt->getBrowseMode() != rOpt.getBrowseMode() )
2361 {
2362 bBrowseModeChanged = true;
2363 bReformat = true;
2364 }
2365 else if( mpOpt->getBrowseMode() && mpOpt->IsPrtFormat() != rOpt.IsPrtFormat() )
2366 bReformat = true;
2367
2368 bool bHideWhitespaceModeChanged = false;
2369 if (mpOpt->IsWhitespaceHidden() != rOpt.IsWhitespaceHidden())
2370 {
2371 // When whitespace is hidden, view change needs reformatting.
2372 bHideWhitespaceModeChanged = true;
2373 bReformat = true;
2374 }
2375
2376 if ( HasDrawView() || rOpt.IsGridVisible() )
2377 {
2378 if ( !HasDrawView() )
2379 MakeDrawView();
2380
2381 SwDrawView *pDView = Imp()->GetDrawView();
2382 if ( pDView->IsDragStripes() != rOpt.IsCrossHair() )
2383 pDView->SetDragStripes( rOpt.IsCrossHair() );
2384
2385 if ( pDView->IsGridSnap() != rOpt.IsSnap() )
2386 pDView->SetGridSnap( rOpt.IsSnap() );
2387
2388 if ( pDView->IsGridVisible() != rOpt.IsGridVisible() )
2389 pDView->SetGridVisible( rOpt.IsGridVisible() );
2390
2391 const Size &rSz = rOpt.GetSnapSize();
2392 pDView->SetGridCoarse( rSz );
2393
2394 const Size aFSize
2395 ( rSz.Width() ? rSz.Width() / (rOpt.GetDivisionX()+1) : 0,
2396 rSz.Height()? rSz.Height()/ (rOpt.GetDivisionY()+1) : 0);
2397 pDView->SetGridFine( aFSize );
2398 Fraction aSnGrWdtX(rSz.Width(), rOpt.GetDivisionX() + 1);
2399 Fraction aSnGrWdtY(rSz.Height(), rOpt.GetDivisionY() + 1);
2400 pDView->SetSnapGridWidth( aSnGrWdtX, aSnGrWdtY );
2401
2402 // set handle size to 9 pixels, always
2403 pDView->SetMarkHdlSizePixel(9);
2404 }
2405
2406 bool bOnlineSpellChgd = mpOpt->IsOnlineSpell() != rOpt.IsOnlineSpell();
2407
2408 *mpOpt = rOpt; // First the options are taken.
2409 mpOpt->SetUIOptions(rOpt);
2410
2411 mxDoc->GetDocumentSettingManager().set(DocumentSettingId::HTML_MODE, 0 != ::GetHtmlMode(mxDoc->GetDocShell()));
2412
2413 if( bBrowseModeChanged || bHideWhitespaceModeChanged )
2414 {
2415 // #i44963# Good occasion to check if page sizes in
2416 // page descriptions are still set to (LONG_MAX, LONG_MAX) (html import)
2417 mxDoc->CheckDefaultPageFormat();
2418 InvalidateLayout( true );
2419 }
2420
2421 pMyWin->Invalidate();
2422 if ( bReformat )
2423 {
2424 // Nothing helps, we need to send all ContentFrames a
2425 // Prepare, we format anew:
2426 StartAction();
2427 Reformat();
2428 EndAction();
2429 }
2430
2431 if (isToggleFieldNames)
2432 {
2433 for(SwViewShell& rSh : GetRingContainer())
2434 {
2435 if (SwCursorShell *const pSh = dynamic_cast<SwCursorShell *>(&rSh))
2436 {
2437 if ((mpOpt->IsFieldName() && pSh->CursorInsideInputField())
2438 || IsCursorInFieldmarkHidden(*pSh->GetCursor(),
2439 pSh->GetLayout()->GetFieldmarkMode()))
2440 { // move cursor out of field
2441 pSh->Left(1, CRSR_SKIP_CHARS);
2442 }
2443 }
2444 }
2445 }
2446
2447 if( !bOnlineSpellChgd )
2448 return;
2449
2450 bool bOnlineSpl = rOpt.IsOnlineSpell();
2451 for(SwViewShell& rSh : GetRingContainer())
2452 {
2453 if(&rSh == this)
2454 continue;
2455 rSh.mpOpt->SetOnlineSpell( bOnlineSpl );
2456 vcl::Window *pTmpWin = rSh.GetWin();
2457 if( pTmpWin )
2458 pTmpWin->Invalidate();
2459 }
2460
2461}
2462
2464{
2465 mpOpt->SetUIOptions(rOpt);
2466 //the API-Flag of the view options is set but never reset
2467 //it is required to set scroll bars in readonly documents
2468 if(rOpt.IsStarOneSetting())
2469 mpOpt->SetStarOneSetting(true);
2470
2471 mpOpt->SetSymbolFont(rOpt.GetSymbolFont());
2472}
2473
2475{
2476 //JP 01.02.99: at readonly flag query properly
2477 // and if need be format; Bug 61335
2478
2479 // Are we switching from readonly to edit?
2480 if( bSet == mpOpt->IsReadonly() )
2481 return;
2482
2483 // so that the flags can be queried properly.
2484 mpOpt->SetReadonly( false );
2485
2486 bool bReformat = mpOpt->IsFieldName();
2487
2488 mpOpt->SetReadonly( bSet );
2489
2490 if( bReformat )
2491 {
2492 StartAction();
2493 Reformat();
2494 if ( GetWin() )
2495 GetWin()->Invalidate();
2496 EndAction();
2497 }
2498 else if ( GetWin() )
2499 GetWin()->Invalidate();
2500#if !ENABLE_WASM_STRIP_ACCESSIBILITY
2501 if( Imp()->IsAccessible() )
2503#endif
2504}
2505
2507{
2508 if( bSet != mpOpt->IsPDFExport() )
2509 {
2510 if( bSet && mpOpt->getBrowseMode() )
2511 mpOpt->SetPrtFormat( true );
2512 mpOpt->SetPDFExport(bSet);
2513 }
2514}
2515
2517{
2518 if( bSet != mpOpt->IsSelectionInReadonly() )
2519 {
2520 mpOpt->SetSelectionInReadonly(bSet);
2521 }
2522}
2523
2525{
2526 mpOpt->SetPrtFormat( bSet );
2527}
2528
2530{
2531 if ( mbDocSizeChgd )
2532 {
2533 mbDocSizeChgd = false;
2534 bool bOld = bInSizeNotify;
2535 bInSizeNotify = true;
2536 ::SizeNotify( this, GetDocSize() );
2537 bInSizeNotify = bOld;
2538 }
2539}
2540
2542{
2543 OSL_ENSURE(!GetRestoreActions()||!nSet, "multiple restore of the Actions ?");
2544 Imp()->SetRestoreActions(nSet);
2545}
2547{
2548 return Imp()->GetRestoreActions();
2549}
2550
2552{
2553 return GetLayout()->IsNewLayout();
2554}
2555
2556#if !ENABLE_WASM_STRIP_ACCESSIBILITY
2557uno::Reference< css::accessibility::XAccessible > SwViewShell::CreateAccessible()
2558{
2559 uno::Reference< css::accessibility::XAccessible > xAcc;
2560
2561 // We require a layout and an XModel to be accessible.
2562 OSL_ENSURE( mpLayout, "no layout, no access" );
2563 OSL_ENSURE( GetWin(), "no window, no access" );
2564
2565 if( mxDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && GetWin() )
2566 xAcc = Imp()->GetAccessibleMap().GetDocumentView();
2567
2568 return xAcc;
2569}
2570
2571uno::Reference< css::accessibility::XAccessible > SwViewShell::CreateAccessiblePreview()
2572{
2573 OSL_ENSURE( IsPreview(),
2574 "Can't create accessible preview for non-preview SwViewShell" );
2575
2576 // We require a layout and an XModel to be accessible.
2577 OSL_ENSURE( mpLayout, "no layout, no access" );
2578 OSL_ENSURE( GetWin(), "no window, no access" );
2579
2580 if ( IsPreview() && GetLayout()&& GetWin() )
2581 {
2583 PagePreviewLayout()->maPreviewPages,
2584 GetWin()->GetMapMode().GetScaleX(),
2585 GetLayout()->GetPageByPageNum( PagePreviewLayout()->mnSelectedPageNum ),
2586 PagePreviewLayout()->maWinSize );
2587 }
2588 return nullptr;
2589}
2590
2592{
2593 if( Imp() && Imp()->IsAccessible() )
2595}
2596
2601 const SwTextFrame* _pToTextFrame )
2602{
2603 if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2604 {
2605 Imp()->InvalidateAccessibleParaFlowRelation_( _pFromTextFrame, _pToTextFrame );
2606 }
2607}
2608
2613{
2614 if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2615 {
2617 }
2618}
2619
2624{
2625 if ( GetLayout() && GetLayout()->IsAnyShellAccessible() )
2626 {
2627 Imp()->InvalidateAccessibleParaAttrs_( rTextFrame );
2628 }
2629}
2630
2632{
2633 if ( Imp()->IsAccessible() )
2634 {
2635 return &(Imp()->GetAccessibleMap());
2636 }
2637
2638 return nullptr;
2639}
2640
2642{
2644 return;
2646 {
2647 mpAccOptions->SetAlwaysAutoColor(false);
2648 mpAccOptions->SetStopAnimatedGraphics(false);
2649 }
2650 else
2651 {
2652 mpAccOptions->SetAlwaysAutoColor(rAccessibilityOptions.GetIsAutomaticFontColor());
2653 mpAccOptions->SetStopAnimatedGraphics(! rAccessibilityOptions.GetIsAllowAnimatedGraphics());
2654
2655 // Form view
2656 // Always set this option, not only if document is read-only:
2657 mpOpt->SetSelectionInReadonly(rAccessibilityOptions.IsSelectionInReadonly());
2658 }
2659}
2660#endif // ENABLE_WASM_STRIP_ACCESSIBILITY
2661
2663{
2664 return spShellRes;
2665}
2666
2667void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew)
2668{
2669 (*spCareDialog.get()) = rNew;
2670}
2671
2673{
2674 return GetLayout() ? GetLayout()->GetPageNum() : 1;
2675}
2676
2677Size SwViewShell::GetPageSize( sal_uInt16 nPageNum, bool bSkipEmptyPages ) const
2678{
2679 Size aSize;
2680 const SwRootFrame* pTmpRoot = GetLayout();
2681 if( pTmpRoot && nPageNum )
2682 {
2683 const SwPageFrame* pPage = static_cast<const SwPageFrame*>
2684 (pTmpRoot->Lower());
2685
2686 while( --nPageNum && pPage->GetNext() )
2687 pPage = static_cast<const SwPageFrame*>( pPage->GetNext() );
2688
2689 if( !bSkipEmptyPages && pPage->IsEmptyPage() && pPage->GetNext() )
2690 pPage = static_cast<const SwPageFrame*>( pPage->GetNext() );
2691
2692 aSize = pPage->getFrameArea().SSize();
2693 }
2694 return aSize;
2695}
2696
2698{
2699 for(SwViewShell& rShell : GetRingContainer())
2700 {
2701 CurrShell aCurr(&rShell);
2702 if(rShell.IsPreview())
2703 {
2704 if(rShell.GetWin())
2705 ::RepaintPagePreview(&rShell, rRect);
2706 }
2707 else if(rShell.VisArea().Overlaps(rRect) && OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType())
2708 {
2709 // invalidate instead of painting
2710 rShell.GetWin()->Invalidate(rRect.SVRect());
2711 }
2712 }
2713}
2714// #i12836# enhanced pdf export
2716{
2717 OSL_ENSURE( GetLayout(), "GetPageNumAndSetOffsetForPDF assumes presence of layout" );
2718
2719 sal_Int32 nRet = -1;
2720
2721 // #i40059# Position out of bounds:
2722 SwRect aRect( rRect );
2723 aRect.Pos().setX( std::max( aRect.Left(), GetLayout()->getFrameArea().Left() ) );
2724
2725 const SwPageFrame* pPage = GetLayout()->GetPageAtPos( aRect.Center() );
2726 if ( pPage )
2727 {
2728 OSL_ENSURE( pPage, "GetPageNumAndSetOffsetForPDF: No page found" );
2729
2730 Point aOffset( pPage->getFrameArea().Pos() );
2731 aOffset.setX( -aOffset.X() );
2732 aOffset.setY( -aOffset.Y() );
2733
2734 MapMode aMapMode( rOut.GetMapMode() );
2735 aMapMode.SetOrigin( aOffset );
2736 rOut.SetMapMode( aMapMode );
2737
2738 nRet = pPage->GetPhyPageNum() - 1;
2739 }
2740
2741 return nRet;
2742}
2743
2744// --> PB 2007-05-30 #146850#
2746{
2747 if (bIsErrorState)
2748 {
2749 if (!m_xErrorBmp)
2750 m_xErrorBmp.reset(new BitmapEx(RID_GRAPHIC_ERRORBMP));
2751 return *m_xErrorBmp;
2752 }
2753
2754 if (!m_xReplaceBmp)
2755 m_xReplaceBmp.reset(new BitmapEx(RID_GRAPHIC_REPLACEBMP));
2756 return *m_xReplaceBmp;
2757}
2758
2760{
2761 m_xErrorBmp.reset();
2762 m_xReplaceBmp.reset();
2763}
2764
2766{
2767 SwView* pView = GetDoc()->GetDocShell() ? GetDoc()->GetDocShell()->GetView() : nullptr;
2768 if ( pView )
2769 return pView->GetPostItMgr();
2770
2771 return nullptr;
2772}
2773
2774/*
2775 * Document Interface Access
2776 */
2777const IDocumentSettingAccess& SwViewShell::getIDocumentSettingAccess() const { return mxDoc->GetDocumentSettingManager(); }
2779const IDocumentDeviceAccess& SwViewShell::getIDocumentDeviceAccess() const { return mxDoc->getIDocumentDeviceAccess(); }
2781const IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() const { return mxDoc->getIDocumentMarkAccess(); }
2782IDocumentMarkAccess* SwViewShell::getIDocumentMarkAccess() { return mxDoc->getIDocumentMarkAccess(); }
2783const IDocumentDrawModelAccess& SwViewShell::getIDocumentDrawModelAccess() const { return mxDoc->getIDocumentDrawModelAccess(); }
2785const IDocumentRedlineAccess& SwViewShell::getIDocumentRedlineAccess() const { return mxDoc->getIDocumentRedlineAccess(); }
2787const IDocumentLayoutAccess& SwViewShell::getIDocumentLayoutAccess() const { return mxDoc->getIDocumentLayoutAccess(); }
2791const IDocumentStatistics& SwViewShell::getIDocumentStatistics() const { return mxDoc->getIDocumentStatistics(); }
2792
2794{ return mxDoc->GetIDocumentUndoRedo(); }
2796{ return mxDoc->GetIDocumentUndoRedo(); }
2797
2798// --> OD 2007-11-14 #i83479#
2800{
2801 return &mxDoc->getIDocumentListItems();
2802}
2803
2805{
2806 return &mxDoc->getIDocumentOutlineNodes();
2807}
2808
2809/* 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 void setReferenceDeviceType(bool bNewVirtual, bool bNewHiRes)=0
Sets the type of the reference device used for formatting the 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 DeleteWindowFromPaintView(OutputDevice *pOldWin) override
virtual void AddWindowToPaintView(OutputDevice *pNewWin, 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
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:1769
css::uno::Reference< css::accessibility::XAccessible > GetDocumentView()
Definition: accmap.cxx:1764
void InvalidateFocus()
Definition: accmap.cxx:2695
wrapper class for the positioning of Writer fly frames and drawing objects
void StartAction()
Definition: crsrsh.cxx:227
SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position...
Definition: hints.hxx:246
const SwView * GetView() const
Definition: docsh.hxx:221
Definition: doc.hxx:188
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
IDocumentDeviceAccess const & getIDocumentDeviceAccess() const
Definition: doc.cxx:238
bool ContainsHiddenChars() const
Checks if any of the text node contains hidden characters.
Definition: doc.cxx:1763
SwNodes & GetNodes()
Definition: doc.hxx:408
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
void UpdateAllCharts()
Definition: doc.hxx:1292
::sw::DocumentRedlineManager const & GetDocumentRedlineManager() const
Definition: doc.cxx:345
IDocumentMarkAccess * getIDocumentMarkAccess()
Definition: docbm.cxx:1792
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1318
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:743
SwDocShell * GetDocShell()
Definition: doc.hxx:1351
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:61
Specific frame formats (frames, DrawObjects).
bool empty() const
size_t size() const
Base class of the Writer layout elements.
Definition: frame.hxx:315
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
void InvalidatePrt_()
Definition: frame.hxx:779
void InvalidateSize_()
Definition: frame.hxx:771
void InvalidateSize()
Definition: frame.hxx:1029
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:3586
const SwFrame * Lower() const
Definition: layfrm.hxx:101
bool HasWriterListeners() const
Definition: calbck.hxx:202
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwNodes & GetNodes() const
Definition: ndindex.hxx:165
SwNode & GetNode() const
Definition: ndindex.hxx:128
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:161
Base class of the Writer document model elements.
Definition: node.hxx:83
SwStartNode * GetStartNode()
Definition: node.hxx:603
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:164
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc....
Definition: nodes.cxx:2379
void SetChanged()
Definition: ndole.cxx:648
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:115
const OUString & GetChartTableName() const
Definition: ndole.hxx:155
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:990
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:138
SwDoc & GetDoc() const
Definition: pam.hxx:244
const SwPosition * GetPoint() const
Definition: pam.hxx:208
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
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:2110
bool ShowNotes() const
Definition: PostItMgr.cxx:2104
tools::ULong GetSidebarWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2115
void LayoutPostIts()
Definition: PostItMgr.cxx:695
tools::ULong GetSidebarBorderWidth(bool bPx=false) const
Definition: PostItMgr.cxx:2141
void Rescale()
Definition: PostItMgr.cxx:2235
bool CalcRects()
Definition: PostItMgr.cxx:540
void PaintTile(OutputDevice &rRenderContext)
Definition: PostItMgr.cxx:982
void CorrectPositions()
Definition: PostItMgr.cxx:2056
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
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374
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
const SwRect & GetOrigin() const
Definition: swregion.hxx:62
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:1627
void SetHideRedlines(bool)
Definition: wsfrm.cxx:4698
Point GetPagePos(sal_uInt16 nPageNum) const
Returns the absolute document position of the desired page.
Definition: trvlfrm.cxx:1588
void InvalidateAllContent(SwInvalidateFlags nInvalidate)
Invalidate all Content, Size or PrtArea.
Definition: wsfrm.cxx:4178
void InvalidateAllObjPos()
Invalidate/re-calculate the position of all floating screen objects (Writer fly frames and drawing ob...
Definition: wsfrm.cxx:4224
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:3064
void SetFieldmarkMode(sw::FieldmarkMode)
Definition: wsfrm.cxx:4720
Try to prevent visible SwParaPortions from being deleted.
Definition: swcache.hxx:123
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:163
bool IsShowChangesInMargin2() const
Definition: viewopt.hxx:300
bool IsHideWhitespaceMode() const
Definition: viewopt.hxx:483
void SetHideWhitespaceMode(bool bMode)
Definition: viewopt.hxx:484
const OUString & GetSymbolFont() const
Definition: viewopt.hxx:575
bool IsViewLayoutBookMode() const
Definition: viewopt.hxx:479
bool IsGridVisible() const
Definition: viewopt.hxx:366
bool IsShowHiddenField() const
Definition: viewopt.hxx:328
void SetShowHiddenChar(bool b)
Definition: viewopt.hxx:325
bool IsShowHiddenPara() const
Definition: viewopt.hxx:397
short GetDivisionY() const
Definition: viewopt.hxx:446
sal_uInt16 GetZoom() const
Definition: viewopt.hxx:505
void SetPostIts(bool b)
Definition: viewopt.hxx:275
bool IsPrtFormat() const
Definition: viewopt.hxx:541
void SetZoom(sal_uInt16 n)
Definition: viewopt.hxx:506
sal_uInt16 GetViewLayoutColumns() const
Definition: viewopt.hxx:481
void SetShowHiddenField(bool b)
Definition: viewopt.hxx:330
const Size & GetSnapSize() const
Definition: viewopt.hxx:364
bool getBrowseMode() const
Definition: viewopt.hxx:472
bool IsShowHiddenChar(bool bHard=false) const
Definition: viewopt.hxx:321
bool IsFieldName() const
Definition: viewopt.hxx:269
bool IsPostIts() const
Definition: viewopt.hxx:273
void SetViewLayoutColumns(sal_uInt16 nNew)
Definition: viewopt.hxx:482
void SetShowHiddenPara(bool b)
Definition: viewopt.hxx:400
bool IsOnlineSpell() const
Definition: viewopt.hxx:371
short GetDivisionX() const
Definition: viewopt.hxx:444
static Color & GetAppBackgroundColor()
Definition: viewopt.cxx:406
void SetFieldName(bool b)
Definition: viewopt.hxx:270
bool IsWhitespaceHidden() const
Definition: viewopt.hxx:488
bool IsUseHeaderFooterMenu() const
Definition: viewopt.hxx:306
void SetViewLayoutBookMode(bool bNew)
Definition: viewopt.hxx:480
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:294
bool IsSnap() const
Definition: viewopt.hxx:358
bool IsCrossHair() const
Definition: viewopt.hxx:385
bool IsStarOneSetting() const
Definition: viewopt.hxx:632
void InvalidateAccessibleEditableState(bool bAllShells, const SwFrame *pFrame=nullptr)
Invalidate editable state for all accessible frames.
Definition: viewimp.cxx:391
void UpdateAccessible()
Update (this) accessible view.
Definition: viewimp.cxx:328
const SwPageFrame * GetFirstVisPage(OutputDevice const *pRenderContext) const
Management of the first visible Page.
Definition: viewimp.cxx:312
bool HasPaintRegion()
Definition: viewimp.hxx:151
bool AddPaintRect(const SwRect &rRect)
Definition: viewimp.cxx:119
void SetRestoreActions(sal_uInt16 nSet)
Definition: viewimp.hxx:214
SwRect m_aSmoothRect
Definition: viewimp.hxx:85
std::unique_ptr< SwRegionRects > TakePaintRegion()
Definition: viewimp.hxx:152
void InvalidateAccessibleParaFlowRelation_(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewimp.cxx:420
SwAccessibleMap & GetAccessibleMap()
Definition: viewimp.hxx:276
void LockPaint()
Definition: vdraw.cxx:69
void StartAction()
Definition: vdraw.cxx:49
void UnlockPaint()
Definition: vdraw.cxx:82
void DeletePaintRegion()
Definition: viewimp.hxx:154
bool m_bSmoothUpdate
Definition: viewimp.hxx:81
void EndAction()
Definition: vdraw.cxx:59
void InvalidateAccessibleParaTextSelection_()
invalidate text selection for paragraphs
Definition: viewimp.cxx:448
sal_uInt16 GetRestoreActions() const
Definition: viewimp.hxx:215
void AddPendingLOKInvalidation(const SwRect &rRect)
Definition: viewimp.cxx:165
SwDrawView * GetDrawView()
Definition: viewimp.hxx:161
void InvalidateAccessibleParaAttrs_(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewimp.cxx:460
void FireAccessibleEvents()
Fire all accessible events that have been collected so far.
Definition: viewimp.cxx:494
const SwRegionRects * GetPaintRegion()
Definition: viewimp.hxx:153
bool m_bStopSmooth
Definition: viewimp.hxx:82
bool mbInEndAction
Definition: viewsh.hxx:127
bool IsViewLocked() const
Definition: viewsh.hxx:466
void PaintTile(VirtualDevice &rDevice, int contextWidth, int contextHeight, int tilePosX, int tilePosY, tools::Long tileWidth, tools::Long tileHeight)
Paint tile.
Definition: viewsh.cxx:1994
const IDocumentListItems * getIDocumentListItemsAccess() const
Definition: viewsh.cxx:2799
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:339
VclPtr< vcl::Window > mpWin
= 0 during printing or pdf export
Definition: viewsh.hxx:114
void DLPrePaint2(const vcl::Region &rRegion)
Definition: viewsh.cxx:178
bool SmoothScroll(tools::Long lXDiff, tools::Long lYDiff, const tools::Rectangle *)
Definition: viewsh.cxx:1347
sal_Int32 GetPageNumAndSetOffsetForPDF(OutputDevice &rOut, const SwRect &rRect) const
Definition: viewsh.cxx:2715
void SizeChgNotify()
Definition: viewsh.cxx:1143
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: viewsh.cxx:142
bool IsPreview() const
Definition: viewsh.hxx:493
bool IsNewLayout() const
Definition: viewsh.cxx:2551
const IDocumentStatistics & getIDocumentStatistics() const
Provides access to the document statistics interface.
Definition: viewsh.cxx:2791
bool HasDrawView() const
Definition: vnew.cxx:358
virtual void DrawSelChanged()
Definition: viewsh.cxx:2195
SAL_DLLPRIVATE void PaintDesktop_(const SwRegionRects &rRegion)
Definition: viewsh.cxx:1665
SdrPaintWindow * mpTargetPaintWindow
Definition: viewsh.hxx:141
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: viewsh.cxx:1860
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
void UnlockPaint(bool bVirDev=false)
Definition: viewsh.hxx:612
static void SetCareDialog(const std::shared_ptr< weld::Window > &rNew)
Definition: viewsh.cxx:2667
void SetProtectForm(bool _bProtectForm)
Definition: viewsh.cxx:1015
void InvalidateAccessibleParaAttrs(const SwTextFrame &rTextFrame)
invalidate attributes for paragraphs and paragraph's characters
Definition: viewsh.cxx:2623
VclPtr< OutputDevice > mpOut
Window, Printer, VirtDev, ...
Definition: viewsh.hxx:115
void SetReadonlySelectionOption(bool bSet)
Definition: viewsh.cxx:2516
bool isOutputToWindow() const
Definition: viewsh.cxx:137
void SetParaSpaceMax(bool bNew)
Definition: viewsh.cxx:863
void SetPDFExportOption(bool bSet)
Definition: viewsh.cxx:2506
bool HasCharts() const
Definition: viewsh.cxx:774
SwPagePreviewLayout * PagePreviewLayout()
Definition: viewpg.cxx:35
void SetUseFormerTextWrapping(bool _bUseFormerTextWrapping)
Definition: viewsh.cxx:990
void setOutputToWindow(bool bOutputToWindow)
Definition: viewsh.cxx:132
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: viewsh.cxx:2777
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2190
void StartAction()
Definition: viewsh.hxx:595
virtual void ApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2214
bool AddPaintRect(const SwRect &rRect)
Definition: viewsh.cxx:540
void SetDoNotJustifyLinesWithManualBreak(bool _bDoNotJustifyLinesWithManualBreak)
Definition: viewsh.cxx:1003
void ChgNumberDigits()
Definition: viewsh.cxx:1074
IDocumentContentOperations & getIDocumentContentOperations()
Provides access to the content operations interface.
Definition: viewsh.cxx:2789
void DLPostPaint2(bool bPaintFormLayer)
Definition: viewsh.cxx:217
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:171
static bool sbLstAct
Definition: viewsh.hxx:100
void Reformat()
Invalidates complete Layout (ApplyViewOption).
Definition: viewsh.cxx:1057
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
Definition: viewsh.cxx:2781
VclPtr< OutputDevice > mpBufferedOut
Definition: viewsh.hxx:142
bool mbDocSizeChgd
Definition: viewsh.hxx:120
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: viewsh.cxx:2779
SwViewShellImp * Imp()
Definition: viewsh.hxx:182
VclPtr< OutputDevice > mpPrePostOutDev
Definition: viewsh.hxx:222
void DeleteReplacementBitmaps()
Definition: viewsh.cxx:2759
void SetPrtFormatOption(bool bSet)
Definition: viewsh.cxx:2524
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:950
void EndAction(const bool bIdleEnd=false)
Definition: viewsh.hxx:600
std::unique_ptr< SwViewOption > mpOpt
Definition: viewsh.hxx:117
void ApplyAccessibilityOptions(SvtAccessibilityOptions const &rAccessibilityOptions)
Definition: viewsh.cxx:2641
std::stack< vcl::Region > mPrePostPaintRegions
Definition: viewsh.hxx:221
SfxViewShell * mpSfxViewShell
Definition: viewsh.hxx:109
bool IsEndActionByVirDev() const
Definition: viewsh.hxx:200
static ShellResource * GetShellRes()
Definition: viewsh.cxx:2662
void SetRestoreActions(sal_uInt16 nSet)
Definition: viewsh.cxx:2541
void InvalidateLayout(bool bSizeChanged)
Definition: viewsh.cxx:2115
bool ActionPend() const
Definition: viewsh.hxx:196
void InvalidateAccessibleFocus()
Definition: viewsh.cxx:2591
bool mbOutputToWindow
The virtual device we paint to will end up on the screen.
Definition: viewsh.hxx:178
bool HasDrawViewDrag() const
Definition: vnew.cxx:368
SwRootFramePtr mpLayout
Definition: viewsh.hxx:144
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2172
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2600
bool mbEnableSmooth
Definition: viewsh.hxx:130
std::unique_ptr< SwAccessibilityOptions > mpAccOptions
Definition: viewsh.hxx:118
void SetUseFormerObjectPositioning(bool _bUseFormerObjPos)
Sets IDocumentSettingAccess if former object positioning should be used.
Definition: viewsh.cxx:967
SwRect maInvalidRect
Definition: viewsh.hxx:107
sal_uInt16 GetNumPages() const
Definition: viewsh.cxx:692
SwRect maVisArea
The modern version of VisArea.
Definition: viewsh.hxx:169
Size maBrowseBorder
Definition: viewsh.hxx:106
vcl::Window * GetWin() const
Definition: viewsh.hxx:338
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: viewsh.cxx:2783
bool mbShowHeaderSeparator
Flag to say that we are showing the header control.
Definition: viewsh.hxx:134
void UpdateAllCharts()
update all charts for which any table exists
Definition: viewsh.cxx:767
Size GetDocSize() const
Definition: viewsh.cxx:2199
void LockPaint()
Definition: viewsh.hxx:607
void MakeDrawView()
Definition: vnew.cxx:363
void UISizeNotify()
Definition: viewsh.cxx:2529
const SwRect & VisArea() const
Definition: viewsh.cxx:630
void OnGraphicArrived(const SwRect &)
Definition: viewsh.cxx:2697
void SetBrowseBorder(const Size &rNew)
Definition: viewsh.cxx:2086
SAL_DLLPRIVATE bool CheckInvalidForPaint(const SwRect &)
Definition: viewsh.cxx:1716
void ImplUnlockPaint(bool bVirDev)
Definition: viewsh.cxx:483
SAL_DLLPRIVATE void ImplApplyViewOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2286
SAL_DLLPRIVATE void PaintDesktop(const vcl::RenderContext &rRenderContext, const SwRect &)
Definition: viewsh.cxx:1580
sal_uInt16 GetRestoreActions() const
Definition: viewsh.cxx:2546
bool mbPaintWorks
Definition: viewsh.hxx:122
css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
Definition: viewsh.cxx:2557
IDocumentUndoRedo const & GetIDocumentUndoRedo() const
Provides access to the document undo/redo interface.
Definition: viewsh.cxx:2795
std::unique_ptr< BitmapEx > m_xErrorBmp
error display of missed images
Definition: viewsh.hxx:98
sal_Int32 GetBrowseWidth() const
Definition: viewsh.cxx:2101
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:556
bool IsShowHeaderFooterSeparator(FrameControlType eControl)
Definition: viewsh.hxx:568
sal_uInt16 mnStartAction
!= 0 if at least one Action is active.
Definition: viewsh.hxx:173
virtual void SetReadonlyOption(bool bSet)
Definition: viewsh.cxx:2474
void SetUseVirDev(bool bNew)
Definition: viewsh.cxx:914
static ShellResource * spShellRes
Resources for the Shell.
Definition: viewsh.hxx:166
static weld::Window * CareChildWin(SwViewShell const &rVSh)
Definition: viewsh.cxx:667
static weld::Window * GetCareDialog(SwViewShell const &rVSh)
Definition: viewsh.hxx:443
SwAccessibleMap * GetAccessibleMap()
Definition: viewsh.cxx:2631
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: viewsh.cxx:2787
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:2790
void PrePaint()
Definition: viewsh.cxx:169
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
bool mbHeaderFooterEdit
Flag to say that we are editing header or footer (according to the bShow(Header|Footer)Separator abov...
Definition: viewsh.hxx:136
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:446
bool mbPaintInProgress
Definition: viewsh.hxx:124
Size GetPageSize(sal_uInt16 nPageNum, bool bSkipEmptyPages) const
Definition: viewsh.cxx:2677
void SetUIOptions(const SwViewOption &rOpt)
Definition: viewsh.cxx:2463
virtual void CalcLayout()
Definition: viewsh.cxx:1082
void FlushPendingLOKInvalidateTiles()
Definition: viewsh.cxx:599
sal_uInt16 GetPageCount() const
Definition: viewsh.cxx:2672
MapMode maPrePostMapMode
Definition: viewsh.hxx:223
sal_uInt16 mnLockPaint
!= 0 if Paint is locked.
Definition: viewsh.hxx:174
bool mbShowFooterSeparator
Flag to say that we are showing the footer control.
Definition: viewsh.hxx:135
void SetConsiderWrapOnObjPos(bool _bConsiderWrapOnObjPos)
Definition: viewsh.cxx:979
const Size & GetBrowseBorder() const
Definition: viewsh.cxx:2096
const IDocumentOutlineNodes * getIDocumentOutlineNodesAccess() const
Definition: viewsh.cxx:2804
vcl::RenderContext & GetRefDev() const
Definition: viewsh.cxx:2177
void SetFirstVisPageInvalid()
Definition: viewsh.cxx:1134
void SetTabCompat(bool bNew)
Definition: viewsh.cxx:887
const SwPostItMgr * GetPostItMgr() const
Definition: viewsh.hxx:561
const IDocumentRedlineAccess & getIDocumentRedlineAccess() const
Provides access to the document redline interface.
Definition: viewsh.cxx:2785
void SetMsWordCompTrailingBlanks(bool _bMsWordCompTrailingBlanks)
Definition: viewsh.cxx:1021
void SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys)
Definition: viewsh.cxx:1033
virtual void VisPortChgd(const SwRect &)
Definition: viewsh.cxx:1174
void SetAddParaSpacingToTableCells(bool _bAddParaSpacingToTableCells)
Sets if paragraph and table spacing is added at bottom of table cells.
Definition: viewsh.cxx:930
Point GetPagePos(sal_uInt16 nPageNum) const
Definition: viewsh.cxx:687
void SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara)
Definition: viewsh.cxx:1039
void ResetInvalidRect()
Definition: viewsh.hxx:590
std::unique_ptr< BitmapEx > m_xReplaceBmp
replaced display of still loaded images
Definition: viewsh.hxx:97
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:617
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:167
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:2571
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:2612
const BitmapEx & GetReplacementBitmap(bool bIsErrorState)
Definition: viewsh.cxx:2745
Definition: view.hxx:145
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:639
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:3890
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
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:65
tools::Long SwTwips
Definition: swtypes.hxx:51
constexpr SwTwips DOCUMENTBORDER
Definition: swtypes.hxx:79
FrameControlType
Definition: swtypes.hxx:234
Left
#define SAL_MAX_INT32
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:354
static bool bInSizeNotify
Definition: viewsh.cxx:94
static bool IsCursorInFieldmarkHidden(SwPaM const &rCursor, sw::FieldmarkMode const eMode)
Definition: viewsh.cxx:2248
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