sw/source/core/access/accdoc.cxx |    6 -
 sw/source/core/draw/dview.cxx    |   16 ++--
 sw/source/core/frmedt/fews.cxx   |    4 -
 sw/source/core/inc/viewimp.hxx   |    8 +-
 sw/source/core/layout/layact.cxx |  130 +++++++++++++++++++--------------------
 sw/source/core/view/vdraw.cxx    |   22 +++---
 sw/source/core/view/viewimp.cxx  |   74 +++++++++++-----------
 sw/source/core/view/vnew.cxx     |    4 -
 8 files changed, 131 insertions(+), 133 deletions(-)

New commits:
commit 3f1f4a0880d367410d6f0508c8737c51a0741263
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 15 15:31:55 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Apr 15 22:58:00 2025 +0200

    sw: Let SwViewShellImp hold/return ref instead of pointer to its SwViewShell
    
    Switch SwViewShellImp::m_pShell from a pointer to a reference
    (and rename it) and return that reference instead of a pointer
    in SvViewShellImp::GetShell.
    
    This makes more obvious that it's always non-null.
    
    Change-Id: Iccb2549bfaef37d14f3f7a4b9c691c583b189bb3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184227
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index c13daea7e47a..9bdf6acee63f 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -119,7 +119,7 @@ SwDrawView::SwDrawView(
 
     SetHitTolerancePixel( GetMarkHdlSizePixel()/2 );
 
-    SetPrintPreview( rI.GetShell()->IsPreview() );
+    SetPrintPreview( rI.GetShell().IsPreview() );
 
     // #i73602# Use default from the configuration
     SetBufferedOverlayAllowed(!comphelper::IsFuzzing() && 
officecfg::Office::Common::Drawinglayer::OverlayBuffer_Writer::get());
@@ -799,7 +799,7 @@ void SwDrawView::ShowDragAnchor()
 
 void SwDrawView::MarkListHasChanged()
 {
-    Imp().GetShell()->DrawSelChanged();
+    Imp().GetShell().DrawSelChanged();
     FmFormView::MarkListHasChanged();
 }
 
@@ -838,8 +838,8 @@ void SwDrawView::ModelHasChanged()
 
 void SwDrawView::MakeVisible( const tools::Rectangle &rRect, vcl::Window & )
 {
-    OSL_ENSURE( m_rImp.GetShell()->GetWin(), "MakeVisible, unknown Window");
-    m_rImp.GetShell()->MakeVisible( SwRect( rRect ) );
+    OSL_ENSURE( m_rImp.GetShell().GetWin(), "MakeVisible, unknown Window");
+    m_rImp.GetShell().MakeVisible( SwRect( rRect ) );
 }
 
 void SwDrawView::CheckPossibilities()
@@ -888,7 +888,7 @@ void SwDrawView::CheckPossibilities()
                             bSzProtect |= ( 
embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( 
embed::Aspects::MSOLE_CONTENT ) ) != 0;
 
                             // #i972: protect position if it is a Math object 
anchored 'as char' and baseline alignment is activated
-                            SwDoc* pDoc = Imp().GetShell()->GetDoc();
+                            SwDoc* pDoc = Imp().GetShell().GetDoc();
                             const bool bProtectMathPos = SotExchange::IsMath( 
xObj->getClassID() )
                                     && RndStdIds::FLY_AS_CHAR == 
pFly->GetFormat()->GetAnchor().GetAnchorId()
                                     && pDoc->GetDocumentSettingManager().get( 
DocumentSettingId::MATH_BASELINE_ALIGNMENT );
@@ -980,12 +980,12 @@ void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& 
_rMarkView )
 
 SfxViewShell* SwDrawView::GetSfxViewShell() const
 {
-    return m_rImp.GetShell()->GetSfxViewShell();
+    return m_rImp.GetShell().GetSfxViewShell();
 }
 
 void SwDrawView::DeleteMarked()
 {
-    SwDoc* pDoc = Imp().GetShell()->GetDoc();
+    SwDoc* pDoc = Imp().GetShell().GetDoc();
     SwRootFrame *pTmpRoot = 
pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
     if ( pTmpRoot )
         pTmpRoot->StartAllAction();
@@ -1021,7 +1021,7 @@ void SwDrawView::DeleteMarked()
     if ( pDoc->DeleteSelection( *this ) )
     {
         FmFormView::DeleteMarked();
-        ::FrameNotify( Imp().GetShell(), FLY_DRAG_END );
+        ::FrameNotify( &Imp().GetShell(), FLY_DRAG_END );
     }
 
     // Only delete these now: earlier deletion would clear the mark list as 
well.
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx
index c2b49c33d942..f9036293bfeb 100644
--- a/sw/source/core/inc/viewimp.hxx
+++ b/sw/source/core/inc/viewimp.hxx
@@ -75,7 +75,7 @@ class SwViewShellImp
     // for paint of page preview
     friend class SwPagePreviewLayout;
 
-    SwViewShell *m_pShell;           // If someone passes an Imp, but needs a 
SwViewShell, we
+    SwViewShell& m_rShell;      // If someone passes an Imp, but needs a 
SwViewShell, we
                                 // keep a backlink here
 
     std::unique_ptr<SwDrawView> m_pDrawView; // Our DrawView
@@ -151,12 +151,12 @@ private:
     void InvalidateAccessibleParaAttrs_( const SwTextFrame& rTextFrame );
 
 public:
-    SwViewShellImp( SwViewShell * );
+    SwViewShellImp( SwViewShell& );
     ~SwViewShellImp();
     void Init( const SwViewOption * ); /// Only for SwViewShell::Init()
 
-    const SwViewShell *GetShell() const { return m_pShell; }
-          SwViewShell *GetShell()       { return m_pShell; }
+    const SwViewShell& GetShell() const { return m_rShell; }
+    SwViewShell& GetShell() { return m_rShell; }
 
     Color GetRetoucheColor() const;
 
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index b46db9f2b537..bd4c099014d9 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -74,7 +74,7 @@ void SwLayAction::CheckWaitCursor()
 {
     if (IsReschedule())
     {
-        ::RescheduleProgress(m_pImp->GetShell()->GetDoc()->GetDocShell());
+        ::RescheduleProgress(m_pImp->GetShell().GetDoc()->GetDocShell());
     }
     if ( !m_pWait && IsWaitAllowed() && IsPaint() &&
          ((std::clock() - m_nStartTicks) * 1000 / CLOCKS_PER_SEC >= 
CLOCKS_PER_SEC/2) )
@@ -181,7 +181,7 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, 
const SwContentFrame *p
 
     bool bRetPaint = false;
     for ( const auto& rRegionRect : aTmp )
-        bRetPaint |= m_pImp->GetShell()->AddPaintRect( rRegionRect );
+        bRetPaint |= m_pImp->GetShell().AddPaintRect( rRegionRect );
     return bRetPaint;
 }
 
@@ -194,7 +194,7 @@ inline bool SwLayAction::PaintContent_( const 
SwContentFrame *pContent,
         if ( pPage->GetSortedObjs() )
             return PaintWithoutFlys( rRect, pContent, pPage );
         else
-            return m_pImp->GetShell()->AddPaintRect( rRect );
+            return m_pImp->GetShell().AddPaintRect( rRect );
     }
     return false;
 }
@@ -263,7 +263,7 @@ SwLayAction::SwLayAction( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
     m_nEndPage( USHRT_MAX ),
     m_nCheckPageNum( USHRT_MAX )
 {
-    m_bPaintExtraData = ::IsExtraData( m_pImp->GetShell()->GetDoc() );
+    m_bPaintExtraData = ::IsExtraData( m_pImp->GetShell().GetDoc() );
     m_bPaint = m_bComplete = m_bWaitAllowed = m_bCheckPages = true;
     m_bInterrupt = m_bAgain = m_bNextCycle = m_bCalcLayout = m_bIdle = 
m_bReschedule =
     m_bUpdateExpFields = m_bBrowseActionStop = m_bActionInProgress = false;
@@ -554,7 +554,7 @@ void SwLayAction::InternalAction(OutputDevice* 
pRenderContext)
         if ( m_nEndPage != USHRT_MAX && pPage->GetPhyPageNum() > 
nPercentPageNum )
         {
             nPercentPageNum = pPage->GetPhyPageNum();
-            ::SetProgressState( nPercentPageNum, 
m_pImp->GetShell()->GetDoc()->GetDocShell());
+            ::SetProgressState( nPercentPageNum, 
m_pImp->GetShell().GetDoc()->GetDocShell());
         }
         m_pOptTab = nullptr;
 
@@ -735,8 +735,8 @@ void SwLayAction::InternalAction(OutputDevice* 
pRenderContext)
         if (lcl_isLayoutLooping()) return;
         // LOK case: VisArea() is the entire document and getLOKVisibleArea() 
may contain the actual
         // visible area.
-        const SwRect &rVisArea = m_pImp->GetShell()->VisArea();
-        SwRect aLokVisArea(m_pImp->GetShell()->getLOKVisibleArea());
+        const SwRect &rVisArea = m_pImp->GetShell().VisArea();
+        SwRect aLokVisArea(m_pImp->GetShell().getLOKVisibleArea());
         bool bUseLokVisArea = comphelper::LibreOfficeKit::isActive() && 
!aLokVisArea.IsEmpty();
         const SwRect& rVis = bUseLokVisArea ? aLokVisArea : rVisArea;
 
@@ -860,7 +860,7 @@ bool SwLayAction::TurboAction_( const SwContentFrame *pCnt )
     {
         const SwRect aOldRect( pCnt->UnionFrame( true ) );
         const tools::Long   nOldBottom = pCnt->getFrameArea().Top() + 
pCnt->getFramePrintArea().Bottom();
-        pCnt->Calc(m_pImp->GetShell()->GetOut());
+        pCnt->Calc(m_pImp->GetShell().GetOut());
         if ( pCnt->getFrameArea().Bottom() < aOldRect.Bottom() )
             pCnt->SetRetouche();
 
@@ -874,7 +874,7 @@ bool SwLayAction::TurboAction_( const SwContentFrame *pCnt )
             if ( nAllLines != static_cast<const 
SwTextFrame*>(pCnt)->GetAllLines() )
             {
                 if ( IsPaintExtraData() )
-                    m_pImp->GetShell()->AddPaintRect( pCnt->getFrameArea() );
+                    m_pImp->GetShell().AddPaintRect( pCnt->getFrameArea() );
                 // This is to calculate the remaining LineNums on the page,
                 // and we don't stop processing here. To perform this inside 
RecalcAllLines
                 // would be expensive, because we would have to notify the 
page even
@@ -1040,7 +1040,7 @@ static const SwAnchoredObject* lcl_FindFirstInvaObj( 
const SwPageFrame* _pPage,
  */
 bool SwLayAction::IsShortCut( SwPageFrame *&prPage )
 {
-    vcl::RenderContext* pRenderContext = m_pImp->GetShell()->GetOut();
+    vcl::RenderContext* pRenderContext = m_pImp->GetShell().GetOut();
     bool bRet = false;
     const SwViewShell *pSh = m_pRoot->GetCurrShell();
     const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
@@ -1071,10 +1071,10 @@ bool SwLayAction::IsShortCut( SwPageFrame *&prPage )
     }
 
     // Decide if prPage is visible, i.e. part of the visible area.
-    const SwRect &rVisArea = m_pImp->GetShell()->VisArea();
+    const SwRect &rVisArea = m_pImp->GetShell().VisArea();
     // LOK case: VisArea() is the entire document and getLOKVisibleArea() may 
contain the actual
     // visible area.
-    SwRect aLokVisArea(m_pImp->GetShell()->getLOKVisibleArea());
+    SwRect aLokVisArea(m_pImp->GetShell().getLOKVisibleArea());
     bool bUseLokVisArea = comphelper::LibreOfficeKit::isActive() && 
!aLokVisArea.IsEmpty();
     const SwRect& rVis = bUseLokVisArea ? aLokVisArea : rVisArea;
 
@@ -1334,7 +1334,7 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
                 // Is the change even visible?
                 if ( pLay->IsCompletePaint() )
                 {
-                    m_pImp->GetShell()->AddPaintRect( aPaint );
+                    m_pImp->GetShell().AddPaintRect( aPaint );
                     bAddRect = false;
                 }
                 else
@@ -1342,18 +1342,18 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
                     SwRegionRects aRegion( aOldRect );
                     aRegion -= aPaint;
                     for ( auto const& aRect : aRegion )
-                        m_pImp->GetShell()->AddPaintRect( aRect );
+                        m_pImp->GetShell().AddPaintRect( aRect );
                     aRegion.ChangeOrigin( aPaint );
                     aRegion.clear();
                     aRegion.push_back( aPaint );
                     aRegion -= aOldRect;
                     for ( auto const& aRect : aRegion )
-                        m_pImp->GetShell()->AddPaintRect( aRect );
+                        m_pImp->GetShell().AddPaintRect( aRect );
                 }
             }
             else
             {
-                m_pImp->GetShell()->AddPaintRect( aPaint );
+                m_pImp->GetShell().AddPaintRect( aPaint );
                 bAlreadyPainted = true;
                 // remember frame at complete paint
                 aFrameAtCompletePaint = pLay->getFrameArea();
@@ -1387,14 +1387,14 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
                     aSpaceToPrevPage.Top( aSpaceToPrevPage.Top() - 
nHalfDocBorder );
                     aSpaceToPrevPage.Bottom( pLay->getFrameArea().Top() );
                     if(!aSpaceToPrevPage.IsEmpty())
-                        m_pImp->GetShell()->AddPaintRect( aSpaceToPrevPage );
+                        m_pImp->GetShell().AddPaintRect( aSpaceToPrevPage );
 
                     // left
                     aSpaceToPrevPage = aPageRect;
                     aSpaceToPrevPage.Left( aSpaceToPrevPage.Left() - 
nHalfDocBorder );
                     aSpaceToPrevPage.Right( pLay->getFrameArea().Left() );
                     if(!aSpaceToPrevPage.IsEmpty())
-                        m_pImp->GetShell()->AddPaintRect( aSpaceToPrevPage );
+                        m_pImp->GetShell().AddPaintRect( aSpaceToPrevPage );
                 }
                 if ( bNext )
                 {
@@ -1403,14 +1403,14 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
                     aSpaceToNextPage.Bottom( aSpaceToNextPage.Bottom() + 
nHalfDocBorder );
                     aSpaceToNextPage.Top( pLay->getFrameArea().Bottom() );
                     if(!aSpaceToNextPage.IsEmpty())
-                        m_pImp->GetShell()->AddPaintRect( aSpaceToNextPage );
+                        m_pImp->GetShell().AddPaintRect( aSpaceToNextPage );
 
                     // right
                     aSpaceToNextPage = aPageRect;
                     aSpaceToNextPage.Right( aSpaceToNextPage.Right() + 
nHalfDocBorder );
                     aSpaceToNextPage.Left( pLay->getFrameArea().Right() );
                     if(!aSpaceToNextPage.IsEmpty())
-                        m_pImp->GetShell()->AddPaintRect( aSpaceToNextPage );
+                        m_pImp->GetShell().AddPaintRect( aSpaceToNextPage );
                 }
             }
         }
@@ -1424,7 +1424,7 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
         SwRectFnSet aRectFnSet(pLay);
         SwRect aRect( pLay->GetUpper()->GetPaintArea() );
         aRectFnSet.SetTop( aRect, aRectFnSet.GetPrtBottom(*pLay) );
-        if ( !m_pImp->GetShell()->AddPaintRect( aRect ) )
+        if ( !m_pImp->GetShell().AddPaintRect( aRect ) )
             pLay->ResetRetouche();
     }
 
@@ -1499,14 +1499,14 @@ bool SwLayAction::FormatLayout( OutputDevice 
*pRenderContext, SwLayoutFrame *pLa
            aBoundRect.Height() > aFrameAtCompletePaint.Height() )
        )
     {
-        m_pImp->GetShell()->AddPaintRect( aBoundRect );
+        m_pImp->GetShell().AddPaintRect( aBoundRect );
     }
     return bChanged || bTabChanged;
 }
 
 void SwLayAction::FormatLayoutFly( SwFlyFrame* pFly )
 {
-    vcl::RenderContext* pRenderContext = m_pImp->GetShell()->GetOut();
+    vcl::RenderContext* pRenderContext = m_pImp->GetShell().GetOut();
     OSL_ENSURE( !IsAgain(), "Attention to the invalid page." );
     if ( IsAgain() )
         return;
@@ -1523,7 +1523,7 @@ void SwLayAction::FormatLayoutFly( SwFlyFrame* pFly )
 
         if ( IsPaint() && (pFly->IsCompletePaint() || bChanged) &&
                     pFly->getFrameArea().Top() > 0 && 
pFly->getFrameArea().Left() > 0 )
-            m_pImp->GetShell()->AddPaintRect( pFly->getFrameArea() );
+            m_pImp->GetShell().AddPaintRect( pFly->getFrameArea() );
 
         if ( bChanged )
             pFly->Invalidate();
@@ -1546,7 +1546,7 @@ void SwLayAction::FormatLayoutFly( SwFlyFrame* pFly )
             if ( pLow->IsTabFrame() )
                 FormatLayoutTab( static_cast<SwTabFrame*>(pLow), bAddRect );
             else
-                FormatLayout( m_pImp->GetShell()->GetOut(), 
static_cast<SwLayoutFrame*>(pLow), bAddRect );
+                FormatLayout( m_pImp->GetShell().GetOut(), 
static_cast<SwLayoutFrame*>(pLow), bAddRect );
         }
         pLow = pLow->GetNext();
     }
@@ -1559,7 +1559,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, bool 
bAddRect )
     if ( IsAgain() || !pTab->Lower() )
         return false;
 
-    vcl::RenderContext* pRenderContext = m_pImp->GetShell()->GetOut();
+    vcl::RenderContext* pRenderContext = m_pImp->GetShell().GetOut();
     IDocumentTimerAccess& rTimerAccess = 
m_pRoot->GetFormat()->getIDocumentTimerAccess();
     rTimerAccess.BlockIdling();
 
@@ -1606,14 +1606,14 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, 
bool bAddRect )
                 {
                     aMarginRect = pTab->getFrameArea();
                     aRectFnSet.SetWidth( aMarginRect, nLeftMargin );
-                    m_pImp->GetShell()->AddPaintRect( aMarginRect );
+                    m_pImp->GetShell().AddPaintRect( aMarginRect );
                 }
 
                 if ( aRectFnSet.GetRightMargin(*pTab) > 0)
                 {
                     aMarginRect = pTab->getFrameArea();
                     aRectFnSet.SetLeft( aMarginRect, 
aRectFnSet.GetPrtRight(*pTab) );
-                    m_pImp->GetShell()->AddPaintRect( aMarginRect );
+                    m_pImp->GetShell().AddPaintRect( aMarginRect );
                 }
 
                 SwTwips nTopMargin = aRectFnSet.GetTopMargin(*pTab);
@@ -1621,19 +1621,19 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, 
bool bAddRect )
                 {
                     aMarginRect = pTab->getFrameArea();
                     aRectFnSet.SetHeight( aMarginRect, nTopMargin );
-                    m_pImp->GetShell()->AddPaintRect( aMarginRect );
+                    m_pImp->GetShell().AddPaintRect( aMarginRect );
                 }
 
                 if ( aRectFnSet.GetBottomMargin(*pTab) > 0)
                 {
                     aMarginRect = pTab->getFrameArea();
                     aRectFnSet.SetTop( aMarginRect, 
aRectFnSet.GetPrtBottom(*pTab) );
-                    m_pImp->GetShell()->AddPaintRect( aMarginRect );
+                    m_pImp->GetShell().AddPaintRect( aMarginRect );
                 }
             }
             else if ( pTab->IsCompletePaint() )
             {
-                m_pImp->GetShell()->AddPaintRect( aPaintFrame );
+                m_pImp->GetShell().AddPaintRect( aPaintFrame );
                 bAddRect = false;
                 bPainted = true;
             }
@@ -1643,7 +1643,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, bool 
bAddRect )
                 SwRect aRect( pTab->GetUpper()->GetPaintArea() );
                 // vertical layout support
                 aRectFnSet.SetTop( aRect, aRectFnSet.GetPrtBottom(*pTab) );
-                if ( !m_pImp->GetShell()->AddPaintRect( aRect ) )
+                if ( !m_pImp->GetShell().AddPaintRect( aRect ) )
                     pTab->ResetRetouche();
             }
         }
@@ -1661,7 +1661,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, bool 
bAddRect )
         SwRect aRect( pTab->GetUpper()->GetPaintArea() );
         // vertical layout support
         aRectFnSet.SetTop( aRect, aRectFnSet.GetPrtBottom(*pTab) );
-        if ( !m_pImp->GetShell()->AddPaintRect( aRect ) )
+        if ( !m_pImp->GetShell().AddPaintRect( aRect ) )
             pTab->ResetRetouche();
     }
 
@@ -1671,7 +1671,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, bool 
bAddRect )
 
     // Ugly shortcut!
     if ( pTab->IsLowersFormatted() &&
-         (bPainted || !m_pImp->GetShell()->VisArea().Overlaps( 
pTab->getFrameArea())) )
+         (bPainted || !m_pImp->GetShell().VisArea().Overlaps( 
pTab->getFrameArea())) )
         return false;
 
     // Now, deal with the lowers
@@ -1691,7 +1691,7 @@ bool SwLayAction::FormatLayoutTab( SwTabFrame *pTab, bool 
bAddRect )
         while ( pLow )
         {
             SwFrameDeleteGuard rowG(pLow); // tdf#124675 prevent 
RemoveFollowFlowLine()
-            bChanged |= FormatLayout( m_pImp->GetShell()->GetOut(), pLow, 
bAddRect );
+            bChanged |= FormatLayout( m_pImp->GetShell().GetOut(), pLow, 
bAddRect );
             if ( IsAgain() )
                 return false;
             pLow = static_cast<SwLayoutFrame*>(pLow->GetNext());
@@ -1839,7 +1839,7 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
                 const_cast<SwTextFrame*>(static_cast<const 
SwTextFrame*>(pContent))->RecalcAllLines();
                 if ( IsPaintExtraData() && IsPaint() &&
                      nAllLines != static_cast<const 
SwTextFrame*>(pContent)->GetAllLines() )
-                    m_pImp->GetShell()->AddPaintRect( pContent->getFrameArea() 
);
+                    m_pImp->GetShell().AddPaintRect( pContent->getFrameArea() 
);
             }
 
             if ( IsAgain() )
@@ -1907,9 +1907,9 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
             if ( bSetContent )
             {
                 if ( bBrowse && !IsIdle() && !IsCalcLayout() && !IsComplete() 
&&
-                     pContent->getFrameArea().Top() > 
m_pImp->GetShell()->VisArea().Bottom())
+                     pContent->getFrameArea().Top() > 
m_pImp->GetShell().VisArea().Bottom())
                 {
-                    const tools::Long nBottom = 
m_pImp->GetShell()->VisArea().Bottom();
+                    const tools::Long nBottom = 
m_pImp->GetShell().VisArea().Bottom();
                     const SwFrame *pTmp = lcl_FindFirstInvaContent( pPage,
                                                             nBottom, pContent 
);
                     if ( !pTmp )
@@ -1931,7 +1931,7 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
 
             if (IsReschedule())
             {
-                
::RescheduleProgress(m_pImp->GetShell()->GetDoc()->GetDocShell());
+                
::RescheduleProgress(m_pImp->GetShell().GetDoc()->GetDocShell());
             }
         }
         else
@@ -1942,7 +1942,7 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
                 const_cast<SwTextFrame*>(static_cast<const 
SwTextFrame*>(pContent))->RecalcAllLines();
                 if ( IsPaintExtraData() && IsPaint() &&
                      nAllLines != static_cast<const 
SwTextFrame*>(pContent)->GetAllLines() )
-                    m_pImp->GetShell()->AddPaintRect( pContent->getFrameArea() 
);
+                    m_pImp->GetShell().AddPaintRect( pContent->getFrameArea() 
);
             }
 
             // Do this if the frame has been formatted before.
@@ -1957,9 +1957,9 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage)
                     return false;
             }
             if ( bBrowse && !IsIdle() && !IsCalcLayout() && !IsComplete() &&
-                 pContent->getFrameArea().Top() > 
m_pImp->GetShell()->VisArea().Bottom())
+                 pContent->getFrameArea().Top() > 
m_pImp->GetShell().VisArea().Bottom())
             {
-                const tools::Long nBottom = 
m_pImp->GetShell()->VisArea().Bottom();
+                const tools::Long nBottom = 
m_pImp->GetShell().VisArea().Bottom();
                 const SwFrame *pTmp = lcl_FindFirstInvaContent( pPage,
                                                     nBottom, pContent );
                 if ( !pTmp )
@@ -2038,7 +2038,7 @@ void SwLayAction::FormatFlyContent( const SwFlyFrame 
*pFly )
             const_cast<SwTextFrame*>(static_cast<const 
SwTextFrame*>(pContent))->RecalcAllLines();
             if ( IsPaintExtraData() && IsPaint() &&
                  nAllLines != static_cast<const 
SwTextFrame*>(pContent)->GetAllLines() )
-                m_pImp->GetShell()->AddPaintRect( pContent->getFrameArea() );
+                m_pImp->GetShell().AddPaintRect( pContent->getFrameArea() );
         }
 
         if ( IsAgain() )
@@ -2113,11 +2113,11 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
     if( bProcess )
     {
         assert(pTextNode);
-        SwViewShell *pSh = m_pImp->GetShell();
+        SwViewShell &rSh = m_pImp->GetShell();
         if( COMPLETE_STRING == m_nTextPos )
         {
             --m_nTextPos;
-            if( auto pCursorShell = dynamic_cast<SwCursorShell *>( pSh ) )
+            if( auto pCursorShell = dynamic_cast<SwCursorShell *>( &rSh ) )
                 if( !pCursorShell->IsTableMode() )
                 {
                     SwPaM *pCursor = pCursorShell->GetCursor();
@@ -2140,7 +2140,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
                 // PENDING should stop idle spell checking
                 m_bPageValid = m_bPageValid && (sw::WrongState::TODO != 
pTextNode->GetWrongDirty());
                 if ( aRepaint.HasArea() )
-                    m_pImp->GetShell()->InvalidateWindows( aRepaint );
+                    m_pImp->GetShell().InvalidateWindows( aRepaint );
                 if (Application::AnyInput(VCL_INPUT_ANY & 
VclInputFlags(~VclInputFlags::TIMER)))
                     return true;
                 break;
@@ -2167,7 +2167,7 @@ bool SwLayIdle::DoIdleJob_( const SwContentFrame *pCnt, 
IdleJobType eJob )
                     const SwRect aRepaint( 
const_cast<SwTextFrame*>(pTextFrame)->SmartTagScan(*pTextNode) );
                     m_bPageValid = m_bPageValid && 
!pTextNode->IsSmartTagDirty();
                     if ( aRepaint.HasArea() )
-                        m_pImp->GetShell()->InvalidateWindows( aRepaint );
+                        m_pImp->GetShell().InvalidateWindows( aRepaint );
                 } catch( const css::uno::RuntimeException&) {
                     // handle smarttag problems gracefully and provide 
diagnostics
                     TOOLS_WARN_EXCEPTION( "sw.core", "SMART_TAGS");
@@ -2248,15 +2248,15 @@ bool SwLayIdle::DoIdleJob(IdleJobType eJob, IdleJobArea 
eJobArea)
 {
     // Spellcheck all contents of the pages. Either only the
     // visible ones or all of them.
-    const SwViewShell* pViewShell = m_pImp->GetShell();
+    const SwViewShell& rViewShell = m_pImp->GetShell();
 
     // Check if job ius enabled and can run
-    if (!isJobEnabled(eJob, pViewShell))
+    if (!isJobEnabled(eJob, &rViewShell))
         return false;
 
     SwPageFrame *pPage;
     if (eJobArea == IdleJobArea::VISIBLE)
-        pPage = m_pImp->GetFirstVisPage(pViewShell->GetOut());
+        pPage = m_pImp->GetFirstVisPage(rViewShell.GetOut());
     else
         pPage = static_cast<SwPageFrame*>(m_pRoot->Lower());
 
@@ -2322,7 +2322,7 @@ bool SwLayIdle::DoIdleJob(IdleJobType eJob, IdleJobArea 
eJobArea)
 
         pPage = static_cast<SwPageFrame*>(pPage->GetNext());
         if (pPage && eJobArea == IdleJobArea::VISIBLE &&
-            !pPage->getFrameArea().Overlaps( m_pImp->GetShell()->VisArea()))
+            !pPage->getFrameArea().Overlaps( m_pImp->GetShell().VisArea()))
         {
              break;
         }
@@ -2337,7 +2337,7 @@ void SwLayIdle::ShowIdle( Color eColor )
         return;
 
     m_bIndicator = true;
-    vcl::Window *pWin = m_pImp->GetShell()->GetWin();
+    vcl::Window *pWin = m_pImp->GetShell().GetWin();
     if (pWin && !pWin->SupportsDoubleBuffering()) // FIXME make this work with 
double-buffering
     {
         tools::Rectangle aRect( 0, 0, 5, 5 );
@@ -2368,7 +2368,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
 
     SHOW_IDLE( COL_LIGHTRED );
 
-    m_pImp->GetShell()->EnableSmooth( false );
+    m_pImp->GetShell().EnableSmooth( false );
 
     // First, spellcheck the visible area. Only if there's nothing
     // to do there, we trigger the IdleFormat.
@@ -2382,7 +2382,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
         // We remember the shells where the cursor is visible, so we can make
         // it visible again if needed after a document change.
         std::vector<bool> aBools;
-        for(SwViewShell& rSh : m_pImp->GetShell()->GetRingContainer())
+        for(SwViewShell& rSh : m_pImp->GetShell().GetRingContainer())
         {
             ++rSh.mnStartAction;
             bool bVis = false;
@@ -2399,7 +2399,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
             aAction.SetInputType( VCL_INPUT_ANY & 
VclInputFlags(~VclInputFlags::TIMER) );
             aAction.SetIdle( true );
             aAction.SetWaitAllowed( false );
-            aAction.Action(m_pImp->GetShell()->GetOut());
+            aAction.Action(m_pImp->GetShell().GetOut());
             bInterrupt = aAction.IsInterrupt();
         }
 
@@ -2407,7 +2407,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
         // somewhere or if the visibility of the CharRects has changed.
         bool bActions = false;
         size_t nBoolIdx = 0;
-        for(SwViewShell& rSh : m_pImp->GetShell()->GetRingContainer())
+        for(SwViewShell& rSh : m_pImp->GetShell().GetRingContainer())
         {
             --rSh.mnStartAction;
 
@@ -2438,7 +2438,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
             // Prepare start/end actions via CursorShell, so the cursor, 
selection
             // and VisArea can be set correctly.
             nBoolIdx = 0;
-            for(SwViewShell& rSh : m_pImp->GetShell()->GetRingContainer())
+            for(SwViewShell& rSh : m_pImp->GetShell().GetRingContainer())
             {
                 SwCursorShell* pCursorShell = dynamic_cast<SwCursorShell*>( 
&rSh);
 
@@ -2494,14 +2494,14 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
         }
 
         bool bInValid = false;
-        const SwViewOption& rVOpt = *m_pImp->GetShell()->GetViewOptions();
-        const SwViewShell* pViewShell = m_pImp->GetShell();
+        const SwViewOption& rVOpt = *m_pImp->GetShell().GetViewOptions();
+        const SwViewShell& rViewShell = m_pImp->GetShell();
         // See conditions in DoIdleJob()
         const bool bSpell     = rVOpt.IsOnlineSpell();
         const bool bACmplWrd  = SwViewOption::IsAutoCompleteWords();
-        const bool bWordCount = 
pViewShell->getIDocumentStatistics().GetDocStat().bModified;
-        const bool bSmartTags = 
!pViewShell->GetDoc()->GetDocShell()->IsHelpDocument() &&
-                                !pViewShell->GetDoc()->isXForms() &&
+        const bool bWordCount = 
rViewShell.getIDocumentStatistics().GetDocStat().bModified;
+        const bool bSmartTags = 
!rViewShell.GetDoc()->GetDocShell()->IsHelpDocument() &&
+                                !rViewShell.GetDoc()->isXForms() &&
                                 SwSmartTagMgr::Get().IsSmartTagsEnabled();
 
         SwPageFrame *pPg = static_cast<SwPageFrame*>(m_pRoot->Lower());
@@ -2522,12 +2522,12 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
         if ( !bInValid )
         {
             m_pRoot->ResetIdleFormat();
-            SfxObjectShell* pDocShell = 
m_pImp->GetShell()->GetDoc()->GetDocShell();
+            SfxObjectShell* pDocShell = 
m_pImp->GetShell().GetDoc()->GetDocShell();
             pDocShell->Broadcast( SfxEventHint( 
SfxEventHintId::SwEventLayoutFinished, 
SwDocShell::GetEventName(STR_SW_EVENT_LAYOUT_FINISHED), pDocShell ) );
         }
     }
 
-    m_pImp->GetShell()->EnableSmooth( true );
+    m_pImp->GetShell().EnableSmooth( true );
 
 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
     if( m_pImp->IsAccessible() )
@@ -2537,7 +2537,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
     SAL_INFO("sw.idle", "SwLayIdle() return");
 
 #ifdef DBG_UTIL
-    if ( m_bIndicator && m_pImp->GetShell()->GetWin() )
+    if ( m_bIndicator && m_pImp->GetShell().GetWin() )
     {
         // Do not invalidate indicator, this may cause an endless loop. 
Instead, just repaint it
         // This should be replaced by an overlay object in the future, 
anyways. Since it's only for debug
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index 27f60d53e808..0a710b2c63e0 100644
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -50,8 +50,8 @@ void SwViewShellImp::StartAction()
 {
     if ( HasDrawView() )
     {
-        CurrShell aCurr( GetShell() );
-        if ( auto pFEShell = dynamic_cast<SwFEShell*>( m_pShell) )
+        CurrShell aCurr( &GetShell() );
+        if ( auto pFEShell = dynamic_cast<SwFEShell*>(&m_rShell) )
             pFEShell->HideChainMarker(); // might have changed
     }
 }
@@ -60,8 +60,8 @@ void SwViewShellImp::EndAction()
 {
     if ( HasDrawView() )
     {
-        CurrShell aCurr( GetShell() );
-        if ( auto pFEShell = dynamic_cast<SwFEShell*>(m_pShell) )
+        CurrShell aCurr( &GetShell() );
+        if ( auto pFEShell = dynamic_cast<SwFEShell*>(&m_rShell) )
             pFEShell->SetChainMarker(); // might have changed
     }
 }
@@ -96,11 +96,11 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
         return;
 
     //change the draw mode in high contrast mode
-    OutputDevice* pOutDev = GetShell()->GetOut();
+    OutputDevice* pOutDev = GetShell().GetOut();
     DrawModeFlags nOldDrawMode = pOutDev->GetDrawMode();
-    if( GetShell()->GetWin() &&
+    if( GetShell().GetWin() &&
         Application::GetSettings().GetStyleSettings().GetHighContrastMode() &&
-        (!GetShell()->IsPreview() || 
officecfg::Office::Common::Accessibility::IsForPagePreviews::get()))
+        (!GetShell().IsPreview() || 
officecfg::Office::Common::Accessibility::IsForPagePreviews::get()))
     {
         pOutDev->SetDrawMode( nOldDrawMode | DrawModeFlags::SettingsLine | 
DrawModeFlags::SettingsFill |
                             DrawModeFlags::SettingsText | 
DrawModeFlags::SettingsGradient );
@@ -114,7 +114,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
     // set default horizontal text direction on painting <hell> or
     // <heaven>.
     EEHorizontalTextDirection aOldEEHoriTextDir = 
EEHorizontalTextDirection::L2R;
-    const IDocumentDrawModelAccess& rIDDMA = 
GetShell()->getIDocumentDrawModelAccess();
+    const IDocumentDrawModelAccess& rIDDMA = 
GetShell().getIDocumentDrawModelAccess();
     if ( (_nLayerID == rIDDMA.GetHellId()) ||
          (_nLayerID == rIDDMA.GetHeavenId()) )
     {
@@ -173,7 +173,7 @@ bool SwViewShellImp::IsDragPossible( const Point &rPoint )
         aRect.Union( aTmp );
     }
     else
-        aRect = GetShell()->GetLayout()->getFrameArea();
+        aRect = GetShell().GetLayout()->getFrameArea();
 
     aRect.AddTop   (- FUZZY_EDGE );
     aRect.AddBottom(  FUZZY_EDGE );
@@ -203,8 +203,8 @@ void SwViewShellImp::NotifySizeChg( const Size &rNewSz )
     if ( !bCheckDrawObjs )
         return;
 
-    OSL_ENSURE( m_pShell->getIDocumentDrawModelAccess().GetDrawModel(), 
"NotifySizeChg without DrawModel" );
-    SdrPage* pPage = 
m_pShell->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 );
+    OSL_ENSURE( m_rShell.getIDocumentDrawModelAccess().GetDrawModel(), 
"NotifySizeChg without DrawModel" );
+    SdrPage* pPage = 
m_rShell.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 );
     std::vector<SdrObject*> aCandidatesToMove;
     for (const rtl::Reference<SdrObject>& pObj : *pPage)
     {
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index e4f58620376a..cd5d9178f39d 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -45,10 +45,10 @@ void SwViewShellImp::Init( const SwViewOption *pNewOpt )
 {
     OSL_ENSURE( m_pDrawView, "SwViewShellImp::Init without DrawView" );
     //Create PageView if it doesn't exist
-    SwRootFrame *pRoot = m_pShell->GetLayout();
+    SwRootFrame *pRoot = m_rShell.GetLayout();
     if ( !m_pSdrPageView )
     {
-        IDocumentDrawModelAccess& rIDDMA = 
m_pShell->getIDocumentDrawModelAccess();
+        IDocumentDrawModelAccess& rIDDMA = 
m_rShell.getIDocumentDrawModelAccess();
         if ( !pRoot->GetDrawPage() )
             pRoot->SetDrawPage( rIDDMA.GetDrawModel()->GetPage( 0 ) );
 
@@ -75,7 +75,7 @@ void SwViewShellImp::Init( const SwViewOption *pNewOpt )
     if ( pRoot->getFrameArea().HasArea() )
         m_pDrawView->SetWorkArea( pRoot->getFrameArea().SVRect() );
 
-    if ( GetShell()->IsPreview() )
+    if ( GetShell().IsPreview() )
         m_pDrawView->SetAnimationEnabled( false );
 
     m_pDrawView->SetUseIncompatiblePathCreateInterface( false );
@@ -85,8 +85,8 @@ void SwViewShellImp::Init( const SwViewOption *pNewOpt )
 }
 
 /// CTor for the core internals
-SwViewShellImp::SwViewShellImp( SwViewShell *pParent ) :
-    m_pShell( pParent ),
+SwViewShellImp::SwViewShellImp( SwViewShell &rParent ) :
+    m_rShell( rParent ),
     m_pSdrPageView( nullptr ),
     m_pFirstVisiblePage( nullptr ),
     m_pLayAction( nullptr ),
@@ -122,13 +122,13 @@ SwViewShellImp::~SwViewShellImp()
 bool SwViewShellImp::AddPaintRect( const SwRect &rRect )
 {
     // In case of tiled rendering the visual area is the last painted tile -> 
not interesting.
-    if ( rRect.Overlaps( m_pShell->VisArea() ) || 
comphelper::LibreOfficeKit::isActive() )
+    if ( rRect.Overlaps( m_rShell.VisArea() ) || 
comphelper::LibreOfficeKit::isActive() )
     {
         if ( !m_oPaintRegion )
         {
             // In case of normal rendering, this makes sure only visible 
rectangles are painted.
             // Otherwise get the rectangle of the full document, so all paint 
rectangles are invalidated.
-            const SwRect& rArea = comphelper::LibreOfficeKit::isActive() ? 
m_pShell->GetLayout()->getFrameArea() : m_pShell->VisArea();
+            const SwRect& rArea = comphelper::LibreOfficeKit::isActive() ? 
m_rShell.GetLayout()->getFrameArea() : m_rShell.VisArea();
             m_oPaintRegion.emplace();
             m_oPaintRegion->ChangeOrigin(rArea);
         }
@@ -168,8 +168,8 @@ bool SwViewShellImp::AddPaintRect( const SwRect &rRect )
 void SwViewShellImp::AddPendingLOKInvalidation( const SwRect& rRect )
 {
     std::vector<SwRect>& l = m_pendingLOKInvalidations;
-    if(l.empty() && m_pShell && m_pShell->GetSfxViewShell()) // Announce that 
these invalidations will need flushing.
-        
m_pShell->GetSfxViewShell()->libreOfficeKitViewAddPendingInvalidateTiles();
+    if(l.empty() && m_rShell.GetSfxViewShell()) // Announce that these 
invalidations will need flushing.
+        
m_rShell.GetSfxViewShell()->libreOfficeKitViewAddPendingInvalidateTiles();
     // These are often repeated, so check first for duplicates.
     if( std::find( l.begin(), l.end(), rRect ) == l.end())
         l.push_back( rRect );
@@ -205,23 +205,23 @@ bool SwViewShellImp::IsUpdateExpFields()
 
 void SwViewShellImp::SetFirstVisPage(OutputDevice const * pRenderContext)
 {
-    if ( m_pShell->mbDocSizeChgd && m_pShell->VisArea().Top() > 
m_pShell->GetLayout()->getFrameArea().Height() )
+    if ( m_rShell.mbDocSizeChgd && m_rShell.VisArea().Top() > 
m_rShell.GetLayout()->getFrameArea().Height() )
     {
         //We are in an action and because of erase actions the VisArea is
         //after the first visible page.
         //To avoid excessive formatting, hand back the last page.
-        m_pFirstVisiblePage = 
static_cast<SwPageFrame*>(m_pShell->GetLayout()->Lower());
+        m_pFirstVisiblePage = 
static_cast<SwPageFrame*>(m_rShell.GetLayout()->Lower());
         while ( m_pFirstVisiblePage && m_pFirstVisiblePage->GetNext() )
             m_pFirstVisiblePage = 
static_cast<SwPageFrame*>(m_pFirstVisiblePage->GetNext());
     }
     else
     {
-        const SwViewOption* pSwViewOption = GetShell()->GetViewOptions();
+        const SwViewOption* pSwViewOption = GetShell().GetViewOptions();
         const bool bBookMode = pSwViewOption->IsViewLayoutBookMode();
 
-        SwPageFrame *pPage = 
static_cast<SwPageFrame*>(m_pShell->GetLayout()->Lower());
+        SwPageFrame *pPage = 
static_cast<SwPageFrame*>(m_rShell.GetLayout()->Lower());
         SwRect aPageRect = pPage ? pPage->GetBoundRect(pRenderContext) : 
SwRect();
-        while ( pPage && !aPageRect.Overlaps( m_pShell->VisArea() ) )
+        while ( pPage && !aPageRect.Overlaps( m_rShell.VisArea() ) )
         {
             pPage = static_cast<SwPageFrame*>(pPage->GetNext());
             if ( pPage )
@@ -234,14 +234,14 @@ void SwViewShellImp::SetFirstVisPage(OutputDevice const * 
pRenderContext)
                 }
             }
         }
-        m_pFirstVisiblePage = pPage ? pPage : 
static_cast<SwPageFrame*>(m_pShell->GetLayout()->Lower());
+        m_pFirstVisiblePage = pPage ? pPage : 
static_cast<SwPageFrame*>(m_rShell.GetLayout()->Lower());
     }
     m_bFirstPageInvalid = false;
 }
 
 void SwViewShellImp::MakeDrawView()
 {
-    IDocumentDrawModelAccess& rIDDMA = 
GetShell()->getIDocumentDrawModelAccess();
+    IDocumentDrawModelAccess& rIDDMA = 
GetShell().getIDocumentDrawModelAccess();
 
     // the else here is not an error, MakeDrawModel_() calls this method again
     // after the DrawModel is created to create DrawViews for all shells...
@@ -259,12 +259,12 @@ void SwViewShellImp::MakeDrawView()
             // to use GetOut() and check the existing cases.
             // Check worked well. Took a look at viewing, printing, PDF export 
and print preview with a test
             // document which has an empty 2nd page (right page, see bug)
-            auto pWin = GetShell()->GetWin();
+            auto pWin = GetShell().GetWin();
             OutputDevice* pOutDevForDrawView = pWin ? pWin->GetOutDev() : 
nullptr;
 
             if(!pOutDevForDrawView)
             {
-                pOutDevForDrawView = GetShell()->GetOut();
+                pOutDevForDrawView = GetShell().GetOut();
             }
 
             m_pDrawView.reset( new SwDrawView(
@@ -274,7 +274,7 @@ void SwViewShellImp::MakeDrawView()
         }
 
         GetDrawView()->SetActiveLayer(u"Heaven"_ustr);
-        const SwViewOption* pSwViewOption = GetShell()->GetViewOptions();
+        const SwViewOption* pSwViewOption = GetShell().GetViewOptions();
         Init(pSwViewOption);
 
         // #i68597# If document is read-only, we will not profit from overlay,
@@ -292,7 +292,7 @@ void SwViewShellImp::MakeDrawView()
 Color SwViewShellImp::GetRetoucheColor() const
 {
     Color aRet( COL_TRANSPARENT );
-    const SwViewShell &rSh = *GetShell();
+    const SwViewShell &rSh = GetShell();
     if (rSh.GetWin() || rSh.isOutputToWindow())
     {
         if ( rSh.GetViewOptions()->getBrowseMode() &&
@@ -323,12 +323,12 @@ const SwPageFrame 
*SwViewShellImp::GetFirstVisPage(OutputDevice const * pRenderC
 
 const SwPageFrame* SwViewShellImp::GetLastVisPage(const OutputDevice* 
pRenderContext) const
 {
-    const SwViewOption* pSwViewOption = m_pShell->GetViewOptions();
+    const SwViewOption* pSwViewOption = m_rShell.GetViewOptions();
     const bool bBookMode = pSwViewOption->IsViewLayoutBookMode();
     const SwPageFrame* pPage = GetFirstVisPage(pRenderContext);
     const SwPageFrame* pLastVisPage = pPage;
     SwRect aPageRect = pPage->GetBoundRect(pRenderContext);
-    while (pPage && (pPage->IsEmptyPage() || 
aPageRect.Overlaps(m_pShell->VisArea())))
+    while (pPage && (pPage->IsEmptyPage() || 
aPageRect.Overlaps(m_rShell.VisArea())))
     {
         pLastVisPage = pPage;
         pPage = static_cast<const SwPageFrame*>(pPage->GetNext());
@@ -348,18 +348,18 @@ const SwPageFrame* SwViewShellImp::GetLastVisPage(const 
OutputDevice* pRenderCon
 // create page preview layout
 void SwViewShellImp::InitPagePreviewLayout()
 {
-    OSL_ENSURE( m_pShell->GetLayout(), "no layout - page preview layout can 
not be created.");
-    if ( m_pShell->GetLayout() )
-        m_pPagePreviewLayout.reset( new SwPagePreviewLayout( *m_pShell, 
*(m_pShell->GetLayout()) ) );
+    OSL_ENSURE( m_rShell.GetLayout(), "no layout - page preview layout can not 
be created.");
+    if ( m_rShell.GetLayout() )
+        m_pPagePreviewLayout.reset( new SwPagePreviewLayout(m_rShell, 
*(m_rShell.GetLayout()) ) );
 }
 
 #if !ENABLE_WASM_STRIP_ACCESSIBILITY
 void SwViewShellImp::UpdateAccessible()
 {
     // We require a layout and an XModel to be accessible.
-    IDocumentLayoutAccess& rIDLA = GetShell()->getIDocumentLayoutAccess();
-    vcl::Window *pWin = GetShell()->GetWin();
-    OSL_ENSURE( GetShell()->GetLayout(), "no layout, no access" );
+    IDocumentLayoutAccess& rIDLA = GetShell().getIDocumentLayoutAccess();
+    vcl::Window *pWin = GetShell().GetWin();
+    OSL_ENSURE( GetShell().GetLayout(), "no layout, no access" );
     OSL_ENSURE( pWin, "no window, no access" );
 
     if( IsAccessible() && rIDLA.GetCurrentViewShell() && pWin )
@@ -382,7 +382,7 @@ void SwViewShellImp::DisposeAccessible(const SwFrame 
*pFrame,
                                        bool bCanSkipInvisible)
 {
     OSL_ENSURE( !pFrame || pFrame->IsAccessibleFrame(), "frame is not 
accessible" );
-    for(SwViewShell& rTmp : GetShell()->GetRingContainer())
+    for(SwViewShell& rTmp : GetShell().GetRingContainer())
     {
         if( rTmp.Imp()->IsAccessible() )
             rTmp.Imp()->GetAccessibleMap().A11yDispose( pFrame, pObj, nullptr, 
bRecursive, bCanSkipInvisible );
@@ -393,7 +393,7 @@ void SwViewShellImp::MoveAccessible( const SwFrame *pFrame, 
const SdrObject *pOb
                                 const SwRect& rOldFrame )
 {
     OSL_ENSURE( !pFrame || pFrame->IsAccessibleFrame(), "frame is not 
accessible" );
-    for(SwViewShell& rTmp : GetShell()->GetRingContainer())
+    for(SwViewShell& rTmp : GetShell().GetRingContainer())
     {
         if( rTmp.Imp()->IsAccessible() )
             rTmp.Imp()->GetAccessibleMap().InvalidatePosOrSize( pFrame, pObj, 
nullptr,
@@ -404,7 +404,7 @@ void SwViewShellImp::MoveAccessible( const SwFrame *pFrame, 
const SdrObject *pOb
 void SwViewShellImp::InvalidateAccessibleFrameContent( const SwFrame *pFrame )
 {
     OSL_ENSURE( pFrame->IsAccessibleFrame(), "frame is not accessible" );
-    for(SwViewShell& rTmp : GetShell()->GetRingContainer())
+    for(SwViewShell& rTmp : GetShell().GetRingContainer())
     {
         if( rTmp.Imp()->IsAccessible() )
             rTmp.Imp()->GetAccessibleMap().InvalidateContent( pFrame );
@@ -422,7 +422,7 @@ void SwViewShellImp::InvalidateAccessibleEditableState( 
bool bAllShells,
 {
     if( bAllShells )
     {
-        for(SwViewShell& rTmp : GetShell()->GetRingContainer())
+        for(SwViewShell& rTmp : GetShell().GetRingContainer())
         {
             if( rTmp.Imp()->IsAccessible() )
                 rTmp.Imp()->GetAccessibleMap().InvalidateEditableStates( 
pFrame );
@@ -437,7 +437,7 @@ void SwViewShellImp::InvalidateAccessibleEditableState( 
bool bAllShells,
 void SwViewShellImp::InvalidateAccessibleRelationSet( const SwFlyFrame 
*pMaster,
                                                  const SwFlyFrame *pFollow )
 {
-    for(SwViewShell& rTmp : GetShell()->GetRingContainer())
+    for(SwViewShell& rTmp : GetShell().GetRingContainer())
     {
         if( rTmp.Imp()->IsAccessible() )
             rTmp.Imp()->GetAccessibleMap().InvalidateRelationSet( pMaster,
@@ -455,7 +455,7 @@ void SwViewShellImp::InvalidateAccessibleParaFlowRelation_( 
const SwTextFrame* _
         return;
     }
 
-    for(SwViewShell& rTmp : GetShell()->GetRingContainer())
+    for(SwViewShell& rTmp : GetShell().GetRingContainer())
     {
         if ( rTmp.Imp()->IsAccessible() )
         {
@@ -476,7 +476,7 @@ void SwViewShellImp::InvalidateAccessibleParaFlowRelation_( 
const SwTextFrame* _
 /// invalidate text selection for paragraphs
 void SwViewShellImp::InvalidateAccessibleParaTextSelection_()
 {
-    for(SwViewShell& rTmp : GetShell()->GetRingContainer())
+    for(SwViewShell& rTmp : GetShell().GetRingContainer())
     {
         if ( rTmp.Imp()->IsAccessible() )
         {
@@ -488,7 +488,7 @@ void 
SwViewShellImp::InvalidateAccessibleParaTextSelection_()
 /// invalidate attributes for paragraphs
 void SwViewShellImp::InvalidateAccessibleParaAttrs_( const SwTextFrame& 
rTextFrame )
 {
-    for(SwViewShell& rTmp : GetShell()->GetRingContainer())
+    for(SwViewShell& rTmp : GetShell().GetRingContainer())
     {
         if ( rTmp.Imp()->IsAccessible() )
         {
@@ -516,7 +516,7 @@ void SwViewShellImp::InvalidateAccessiblePreviewSelection( 
sal_uInt16 nSelPage )
 SwAccessibleMap *SwViewShellImp::CreateAccessibleMap()
 {
     assert(!m_pAccessibleMap);
-    m_pAccessibleMap = std::make_shared<SwAccessibleMap>(GetShell());
+    m_pAccessibleMap = std::make_shared<SwAccessibleMap>(&GetShell());
     return m_pAccessibleMap.get();
 }
 
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index d3e2c2a4d626..6cd779c81f98 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -154,7 +154,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window 
*pWindow,
                         tools::Long nFlags )
     :
     mpSfxViewShell( nullptr ),
-    mpImp( new SwViewShellImp( this ) ),
+    mpImp( new SwViewShellImp( *this ) ),
     mpWin( pWindow ),
     mpOut( pOutput ? pOutput
                   : pWindow ? pWindow->GetOutDev()
@@ -222,7 +222,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window 
*pWindow,
     : Ring( &rShell ) ,
     maBrowseBorder( rShell.maBrowseBorder ),
     mpSfxViewShell( nullptr ),
-    mpImp( new SwViewShellImp( this ) ),
+    mpImp( new SwViewShellImp( *this ) ),
     mpWin( pWindow ),
     mpOut( pOutput ? pOutput
                   : pWindow ? pWindow->GetOutDev()
commit 185c553ba1ff4fd1a714b2eff2b1cd97954d8d9c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 15 14:34:36 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Apr 15 22:57:52 2025 +0200

    sw: Drop detour to get 'this' in SwFEShell::GetAnyCurRect
    
    The SwViewShellImp's shell is the SwFEShell/SwViewShell itself again,
    so just call SwViewShell::GetOut right away.
    
    Change-Id: I894b8d3f4463068a195b64113f84936cc16687db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184226
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 2ad5d683afd4..6b81521b2040 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -133,9 +133,9 @@ const SwRect& SwFEShell::GetAnyCurRect( CurRectType eType, 
const Point* pPt,
         case CurRectType::PageCalc:
         {
             DisableCallbackAction 
a(const_cast<SwRootFrame&>(*pFrame->getRootFrame()));
-            pFrame->Calc(Imp()->GetShell()->GetOut());
+            pFrame->Calc(GetOut());
             pFrame = pFrame->FindPageFrame();
-            pFrame->Calc(Imp()->GetShell()->GetOut());
+            pFrame->Calc(GetOut());
         }
             break;
         case CurRectType::FlyEmbeddedPrt:
commit 17eea13b2986644a8e59b55aeb2a3c49c4201d4a
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Apr 15 14:12:38 2025 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Tue Apr 15 22:57:46 2025 +0200

    sw a11y: Use vcl::unohelper::ConvertToAWTRect
    
    Change-Id: I7bbb95c5c24843d92c4750a3a444801cd3f8737e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184225
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index db208b5f7406..aced77c5f8a5 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <cppuhelper/typeprovider.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/unohelp.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <viewsh.hxx>
 #include <doc.hxx>
@@ -225,10 +226,7 @@ awt::Rectangle SAL_CALL 
SwAccessibleDocumentBase::getBounds()
         }
 
         tools::Rectangle aPixBounds( pWin->GetWindowExtentsRelative( 
*pWin->GetAccessibleParentWindow() ) );
-        awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
-                             aPixBounds.GetWidth(), aPixBounds.GetHeight() );
-
-        return aBox;
+        return vcl::unohelper::ConvertToAWTRect(aPixBounds);
     }
     catch(const css::lang::IndexOutOfBoundsException &)
     {

Reply via email to