basctl/source/basicide/baside2.cxx                    |    6 
 basctl/source/basicide/baside2b.cxx                   |    4 
 basctl/source/basicide/baside3.cxx                    |    2 
 basctl/source/basicide/basides1.cxx                   |   33 ++---
 basctl/source/basicide/basides2.cxx                   |   13 -
 basctl/source/basicide/basides3.cxx                   |    2 
 basctl/source/basicide/basidesh.cxx                   |   17 +-
 basctl/source/basicide/basobj3.cxx                    |   14 +-
 basctl/source/basicide/bastypes.cxx                   |    4 
 basctl/source/basicide/localizationmgr.cxx            |    2 
 basctl/source/basicide/moduldl2.cxx                   |    8 -
 desktop/qa/desktop_lib/test_desktop_lib.cxx           |   22 +--
 desktop/source/lib/init.cxx                           |    6 
 include/sfx2/lokhelper.hxx                            |    2 
 include/sfx2/viewsh.hxx                               |   39 ++---
 sc/qa/unit/scshapetest.cxx                            |    6 
 sc/qa/unit/tiledrendering/tiledrendering.cxx          |   58 ++++----
 sc/source/core/data/global.cxx                        |    2 
 sc/source/ui/Accessibility/AccessibleDocument.cxx     |   17 +-
 sc/source/ui/app/inputhdl.cxx                         |    8 -
 sc/source/ui/app/inputwin.cxx                         |    4 
 sc/source/ui/dbgui/validate.cxx                       |   12 -
 sc/source/ui/docshell/datastream.cxx                  |    2 
 sc/source/ui/docshell/docsh.cxx                       |    2 
 sc/source/ui/docshell/docsh4.cxx                      |    4 
 sc/source/ui/drawfunc/drawsh.cxx                      |    4 
 sc/source/ui/drawfunc/drawsh2.cxx                     |    4 
 sc/source/ui/drawfunc/drawsh5.cxx                     |    6 
 sc/source/ui/drawfunc/drtxtob.cxx                     |   14 +-
 sc/source/ui/drawfunc/drtxtob2.cxx                    |    8 -
 sc/source/ui/drawfunc/fudraw.cxx                      |    2 
 sc/source/ui/drawfunc/fuins1.cxx                      |    2 
 sc/source/ui/drawfunc/fuins2.cxx                      |    4 
 sc/source/ui/drawfunc/fusel.cxx                       |    2 
 sc/source/ui/drawfunc/futext.cxx                      |   10 -
 sc/source/ui/inc/ChildWindowWrapper.hxx               |    2 
 sc/source/ui/miscdlgs/acredlin.cxx                    |   12 -
 sc/source/ui/navipi/content.cxx                       |    2 
 sc/source/ui/unoobj/dispuno.cxx                       |    9 -
 sc/source/ui/unoobj/docuno.cxx                        |    6 
 sc/source/ui/unoobj/viewuno.cxx                       |   20 +--
 sc/source/ui/vba/excelvbahelper.cxx                   |    2 
 sc/source/ui/vba/vbawindow.cxx                        |    8 -
 sc/source/ui/vba/vbaworksheets.cxx                    |    2 
 sc/source/ui/view/cellsh.cxx                          |    2 
 sc/source/ui/view/cellsh1.cxx                         |  118 +++++++++---------
 sc/source/ui/view/cellsh2.cxx                         |  109 ++++++++--------
 sc/source/ui/view/cellsh3.cxx                         |   32 ++--
 sc/source/ui/view/drawvie3.cxx                        |    2 
 sc/source/ui/view/drawview.cxx                        |   49 +++----
 sc/source/ui/view/editsh.cxx                          |    8 -
 sc/source/ui/view/formatsh.cxx                        |    6 
 sc/source/ui/view/gridwin.cxx                         |   33 ++---
 sc/source/ui/view/preview.cxx                         |    2 
 sc/source/ui/view/prevwsh.cxx                         |   32 ++--
 sc/source/ui/view/reffact.cxx                         |    6 
 sc/source/ui/view/spelleng.cxx                        |    6 
 sc/source/ui/view/tabcont.cxx                         |    6 
 sc/source/ui/view/tabview.cxx                         |   27 +---
 sc/source/ui/view/tabview3.cxx                        |   37 ++---
 sc/source/ui/view/tabview5.cxx                        |   15 --
 sc/source/ui/view/tabvwsh2.cxx                        |   10 -
 sc/source/ui/view/tabvwsh3.cxx                        |   28 ++--
 sc/source/ui/view/tabvwsh4.cxx                        |   64 ++++-----
 sc/source/ui/view/tabvwsh5.cxx                        |    2 
 sc/source/ui/view/tabvwsh9.cxx                        |   20 +--
 sc/source/ui/view/tabvwsha.cxx                        |   18 +-
 sc/source/ui/view/tabvwshb.cxx                        |   16 +-
 sc/source/ui/view/tabvwshc.cxx                        |    8 -
 sc/source/ui/view/tabvwshd.cxx                        |    6 
 sc/source/ui/view/tabvwshf.cxx                        |    4 
 sc/source/ui/view/viewdata.cxx                        |    6 
 sc/source/ui/view/viewutil.cxx                        |    4 
 sd/qa/unit/tiledrendering/tiledrendering.cxx          |   28 ++--
 sd/source/ui/docshell/docshell.cxx                    |    8 -
 sd/source/ui/framework/factories/BasicViewFactory.cxx |    4 
 sd/source/ui/framework/factories/ChildWindowPane.cxx  |   37 ++---
 sd/source/ui/sidebar/LayoutMenu.cxx                   |   13 -
 sd/source/ui/sidebar/MasterPagesSelector.cxx          |    6 
 sd/source/ui/slideshow/SlideShowRestarter.cxx         |    4 
 sd/source/ui/table/tablefunction.cxx                  |    2 
 sd/source/ui/view/ToolBarManager.cxx                  |    4 
 sd/source/ui/view/ViewShellBase.cxx                   |   21 +--
 sd/source/ui/view/ViewShellImplementation.cxx         |    2 
 sd/source/ui/view/ViewTabBar.cxx                      |    4 
 sd/source/ui/view/drviews1.cxx                        |    4 
 sd/source/ui/view/viewshe2.cxx                        |   12 -
 sd/source/ui/view/viewshel.cxx                        |    4 
 sfx2/source/appl/appopen.cxx                          |    2 
 sfx2/source/appl/appserv.cxx                          |   22 +--
 sfx2/source/control/shell.cxx                         |   10 -
 sfx2/source/notebookbar/SfxNotebookBar.cxx            |    2 
 sfx2/source/view/ipclient.cxx                         |   22 +--
 sfx2/source/view/lokhelper.cxx                        |   21 +--
 sfx2/source/view/sfxbasecontroller.cxx                |   53 +++-----
 sfx2/source/view/viewfrm.cxx                          |    6 
 sfx2/source/view/viewprn.cxx                          |    6 
 sfx2/source/view/viewsh.cxx                           |  118 +++++++-----------
 starmath/inc/view.hxx                                 |    2 
 starmath/source/SmElementsPanel.cxx                   |    2 
 starmath/source/dialog.cxx                            |    2 
 starmath/source/document.cxx                          |    2 
 starmath/source/edit.cxx                              |    4 
 starmath/source/view.cxx                              |   42 +++---
 svx/qa/unit/customshapes.cxx                          |    2 
 svx/source/form/fmshell.cxx                           |   37 ++---
 svx/source/form/fmshimp.cxx                           |   80 ++++--------
 svx/source/form/fmview.cxx                            |    2 
 svx/source/form/navigatortree.cxx                     |    8 -
 sw/qa/core/doc/doc.cxx                                |    2 
 sw/qa/core/layout/layout.cxx                          |    2 
 sw/qa/core/undo/undo.cxx                              |    2 
 sw/qa/extras/tiledrendering/tiledrendering.cxx        |   32 ++--
 sw/qa/extras/uiwriter/uiwriter.cxx                    |    2 
 sw/qa/extras/uiwriter/uiwriter4.cxx                   |    2 
 sw/qa/extras/uiwriter/uiwriter5.cxx                   |   54 ++++----
 sw/qa/extras/uiwriter/uiwriter6.cxx                   |    2 
 sw/qa/uibase/shells/shells.cxx                        |   14 +-
 sw/source/core/access/accpara.cxx                     |    8 -
 sw/source/core/graphic/GraphicSizeCheck.cxx           |    4 
 sw/source/core/view/viewsh.cxx                        |    4 
 sw/source/ui/config/optpage.cxx                       |    2 
 sw/source/ui/dbui/mmresultdialogs.cxx                 |    2 
 sw/source/ui/dialog/macassgn.cxx                      |    2 
 sw/source/ui/dialog/uiregionsw.cxx                    |    6 
 sw/source/ui/fldui/changedb.cxx                       |    2 
 sw/source/ui/fldui/fldedt.cxx                         |    2 
 sw/source/ui/fldui/fldpage.cxx                        |    4 
 sw/source/ui/fldui/fldtdlg.cxx                        |    2 
 sw/source/ui/fmtui/tmpdlg.cxx                         |    2 
 sw/source/ui/frmdlg/column.cxx                        |    2 
 sw/source/ui/frmdlg/frmdlg.cxx                        |    2 
 sw/source/ui/index/cnttab.cxx                         |    4 
 sw/source/ui/misc/bookmark.cxx                        |    2 
 sw/source/ui/misc/glossary.cxx                        |   14 +-
 sw/source/ui/misc/linenum.cxx                         |    2 
 sw/source/ui/vba/vbawindow.cxx                        |   12 -
 sw/source/uibase/app/apphdl.cxx                       |   32 ++--
 sw/source/uibase/app/appopt.cxx                       |   12 -
 sw/source/uibase/app/docsh.cxx                        |    4 
 sw/source/uibase/app/docsh2.cxx                       |   48 +++----
 sw/source/uibase/app/docst.cxx                        |    8 -
 sw/source/uibase/app/swmodul1.cxx                     |    2 
 sw/source/uibase/dbui/dbmgr.cxx                       |    4 
 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx  |    2 
 sw/source/uibase/dochdl/swdtflvr.cxx                  |   16 +-
 sw/source/uibase/docvw/AnnotationWin2.cxx             |   10 -
 sw/source/uibase/docvw/HeaderFooterWin.cxx            |    8 -
 sw/source/uibase/docvw/PageBreakWin.cxx               |    4 
 sw/source/uibase/docvw/PostItMgr.cxx                  |    4 
 sw/source/uibase/docvw/SidebarTxtControl.cxx          |    6 
 sw/source/uibase/docvw/edtdd.cxx                      |   10 -
 sw/source/uibase/docvw/edtwin.cxx                     |  106 ++++++++--------
 sw/source/uibase/docvw/romenu.cxx                     |   12 -
 sw/source/uibase/docvw/srcedtw.cxx                    |   21 +--
 sw/source/uibase/fldui/fldmgr.cxx                     |    2 
 sw/source/uibase/lingu/olmenu.cxx                     |   34 ++---
 sw/source/uibase/misc/redlndlg.cxx                    |    4 
 sw/source/uibase/misc/swruler.cxx                     |    2 
 sw/source/uibase/ribbar/conrect.cxx                   |    2 
 sw/source/uibase/ribbar/drawbase.cxx                  |   12 -
 sw/source/uibase/ribbar/dselect.cxx                   |    2 
 sw/source/uibase/ribbar/inputwin.cxx                  |   14 +-
 sw/source/uibase/ribbar/workctrl.cxx                  |    6 
 sw/source/uibase/shells/annotsh.cxx                   |   24 +--
 sw/source/uibase/shells/basesh.cxx                    |   84 ++++++------
 sw/source/uibase/shells/beziersh.cxx                  |    6 
 sw/source/uibase/shells/drawdlg.cxx                   |    6 
 sw/source/uibase/shells/drawsh.cxx                    |   12 -
 sw/source/uibase/shells/drformsh.cxx                  |    4 
 sw/source/uibase/shells/drwbassh.cxx                  |    6 
 sw/source/uibase/shells/drwtxtex.cxx                  |   20 +--
 sw/source/uibase/shells/drwtxtsh.cxx                  |   24 +--
 sw/source/uibase/shells/frmsh.cxx                     |   14 +-
 sw/source/uibase/shells/grfsh.cxx                     |    8 -
 sw/source/uibase/shells/grfshex.cxx                   |    4 
 sw/source/uibase/shells/langhelper.cxx                |    4 
 sw/source/uibase/shells/listsh.cxx                    |    4 
 sw/source/uibase/shells/tabsh.cxx                     |   25 +--
 sw/source/uibase/shells/textfld.cxx                   |   38 ++---
 sw/source/uibase/shells/textidx.cxx                   |   12 -
 sw/source/uibase/shells/textsh.cxx                    |    6 
 sw/source/uibase/shells/textsh1.cxx                   |   62 ++++-----
 sw/source/uibase/shells/textsh2.cxx                   |    6 
 sw/source/uibase/shells/txtattr.cxx                   |    4 
 sw/source/uibase/shells/txtcrsr.cxx                   |    2 
 sw/source/uibase/shells/txtnum.cxx                    |    6 
 sw/source/uibase/table/chartins.cxx                   |    2 
 sw/source/uibase/uiview/pview.cxx                     |   42 +++---
 sw/source/uibase/uiview/srcview.cxx                   |   10 -
 sw/source/uibase/uiview/uivwimp.cxx                   |    4 
 sw/source/uibase/uiview/view.cxx                      |   85 ++++++------
 sw/source/uibase/uiview/view0.cxx                     |    2 
 sw/source/uibase/uiview/view1.cxx                     |   27 +---
 sw/source/uibase/uiview/view2.cxx                     |   98 +++++++-------
 sw/source/uibase/uiview/viewdraw.cxx                  |   28 ++--
 sw/source/uibase/uiview/viewling.cxx                  |    8 -
 sw/source/uibase/uiview/viewmdi.cxx                   |   14 +-
 sw/source/uibase/uiview/viewport.cxx                  |   20 +--
 sw/source/uibase/uiview/viewprt.cxx                   |    6 
 sw/source/uibase/uiview/viewsrch.cxx                  |    4 
 sw/source/uibase/uiview/viewstat.cxx                  |   16 +-
 sw/source/uibase/uiview/viewtab.cxx                   |    2 
 sw/source/uibase/uno/unodispatch.cxx                  |    4 
 sw/source/uibase/uno/unotxdoc.cxx                     |    2 
 sw/source/uibase/utlui/content.cxx                    |   18 +-
 sw/source/uibase/utlui/glbltree.cxx                   |   12 -
 sw/source/uibase/utlui/gotodlg.cxx                    |    2 
 sw/source/uibase/utlui/navipi.cxx                     |    8 -
 sw/source/uibase/utlui/tmplctrl.cxx                   |    2 
 sw/source/uibase/web/wview.cxx                        |    4 
 sw/source/uibase/wrtsh/move.cxx                       |    2 
 sw/source/uibase/wrtsh/navmgr.cxx                     |   12 -
 sw/source/uibase/wrtsh/select.cxx                     |   10 -
 sw/source/uibase/wrtsh/wrtsh1.cxx                     |    4 
 sw/source/uibase/wrtsh/wrtsh2.cxx                     |   10 -
 sw/source/uibase/wrtsh/wrtsh3.cxx                     |    4 
 vbahelper/source/vbahelper/vbahelper.cxx              |    6 
 218 files changed, 1491 insertions(+), 1617 deletions(-)

New commits:
commit 0908c7c1184ab7acb7b6f6740a82c2f12c296fae
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Feb 16 10:42:06 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Feb 16 15:13:21 2023 +0000

    SfxViewShell::GetViewFrame never returns null, change to a reference
    
    various null checks can be seen to be redundant and removed
    
    Change-Id: Icf49c1de4b0302795d2769a370af3abceaad0221
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147147
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/basctl/source/basicide/baside2.cxx 
b/basctl/source/basicide/baside2.cxx
index 60f0ccaa4332..ad1dd3682b22 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -282,7 +282,7 @@ void ModulWindow::CheckCompileBasic()
 
     bool bDone = false;
 
-    GetShell()->GetViewFrame()->GetWindow().EnterWait();
+    GetShell()->GetViewFrame().GetWindow().EnterWait();
 
     AssertValidEditEngine();
     GetEditorWindow().SetSourceInBasic();
@@ -302,7 +302,7 @@ void ModulWindow::CheckCompileBasic()
         GetBreakPoints().SetBreakPointsInBasic( m_xModule.get() );
     }
 
-    GetShell()->GetViewFrame()->GetWindow().LeaveWait();
+    GetShell()->GetViewFrame().GetWindow().LeaveWait();
 
     m_aStatus.bError = !bDone;
     m_aStatus.bIsRunning = false;
@@ -612,7 +612,7 @@ void ModulWindow::ManageBreakPoints()
 
 void ModulWindow::BasicErrorHdl( StarBASIC const * pBasic )
 {
-    GetShell()->GetViewFrame()->ToTop();
+    GetShell()->GetViewFrame().ToTop();
 
     // Return value: BOOL
     //  FALSE:  cancel
diff --git a/basctl/source/basicide/baside2b.cxx 
b/basctl/source/basicide/baside2b.cxx
index 2601b5f987c1..d941a653dc8b 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1045,7 +1045,7 @@ void EditorWindow::CreateEditEngine()
     // nLines*4: SetText+Formatting+DoHighlight+Formatting
     // it could be cut down on one formatting but you would wait even longer
     // for the text then if the source code is long...
-    pProgress.reset(new 
ProgressInfo(GetShell()->GetViewFrame()->GetObjectShell(),
+    pProgress.reset(new 
ProgressInfo(GetShell()->GetViewFrame().GetObjectShell(),
                                      IDEResId(RID_STR_GENERATESOURCE),
                                      nLines * 4));
     setTextEngineText(*pEditEngine, aOUSource);
@@ -1393,7 +1393,7 @@ void EditorWindow::CreateProgress( const OUString& rText, 
sal_uInt32 nRange )
 {
     DBG_ASSERT( !pProgress, "ProgressInfo exists already" );
     pProgress.reset(new ProgressInfo(
-        GetShell()->GetViewFrame()->GetObjectShell(),
+        GetShell()->GetViewFrame().GetObjectShell(),
         rText,
         nRange
     ));
diff --git a/basctl/source/basicide/baside3.cxx 
b/basctl/source/basicide/baside3.cxx
index 33528679b2fd..309caa0357c9 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -313,7 +313,7 @@ void DialogWindow::GetState( SfxItemSet& rSet )
             case SID_SHOW_PROPERTYBROWSER:
             {
                 Shell* pShell = GetShell();
-                SfxViewFrame* pViewFrame = pShell ? pShell->GetViewFrame() : 
nullptr;
+                SfxViewFrame* pViewFrame = pShell ? &pShell->GetViewFrame() : 
nullptr;
                 if ( pViewFrame && !pViewFrame->HasChildWindow( 
SID_SHOW_PROPERTYBROWSER ) && !m_pEditor->GetView().AreObjectsMarked() )
                     rSet.DisableItem( nWh );
 
diff --git a/basctl/source/basicide/basides1.cxx 
b/basctl/source/basicide/basides1.cxx
index b870a14a92a5..c690dccddc54 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -92,7 +92,7 @@ void Shell::ExecuteSearch( SfxRequest& rReq )
             break;
         case FID_SEARCH_ON:
             mbJustOpened = true;
-            GetViewFrame()->GetBindings().Invalidate(SID_SEARCH_ITEM);
+            GetViewFrame().GetBindings().Invalidate(SID_SEARCH_ITEM);
             break;
         case SID_BASICIDE_REPEAT_SEARCH:
         case FID_SEARCH_NOW:
@@ -175,8 +175,8 @@ void Shell::ExecuteSearch( SfxRequest& rReq )
                     {
                         if ( !pWin )
                         {
-                            SfxViewFrame* pViewFrame = GetViewFrame();
-                            SfxChildWindow* pChildWin = pViewFrame ? 
pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : nullptr;
+                            SfxViewFrame& rViewFrame = GetViewFrame();
+                            SfxChildWindow* pChildWin = 
rViewFrame.GetChildWindow(SID_SEARCH_DLG);
                             auto xParent = pChildWin ? 
pChildWin->GetController() : nullptr;
 
                             std::unique_ptr<weld::MessageDialog> 
xQueryBox(Application::CreateMessageDialog(xParent ? xParent->getDialog() : 
nullptr,
@@ -260,7 +260,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
         case SID_UNDO:
         case SID_REDO:
             if ( GetUndoManager() && pCurWin->AllowUndo() )
-                GetViewFrame()->ExecuteSlot( rReq );
+                GetViewFrame().ExecuteSlot( rReq );
             break;
         default:
             pCurWin->ExecuteCommand( rReq );
@@ -399,9 +399,8 @@ void Shell::ExecuteGlobal( SfxRequest& rReq )
                 if ( pModule && !pModule->GetMethods()->Find( 
rInfo.GetMethod(), SbxClassType::Method ) )
                     CreateMacro( pModule, rInfo.GetMethod() );
             }
-            SfxViewFrame* pViewFrame = GetViewFrame();
-            if ( pViewFrame )
-                pViewFrame->ToTop();
+            SfxViewFrame& rViewFrame = GetViewFrame();
+            rViewFrame.ToTop();
             VclPtr<ModulWindow> pWin = FindBasWin( aDocument, aLibName, 
rInfo.GetModule(), true );
             DBG_ASSERT( pWin, "Edit/Create Macro: Window was not 
created/found!" );
             SetCurWindow( pWin, true );
@@ -1047,7 +1046,7 @@ void Shell::GetState(SfxItemSet &rSet)
             case SID_REDO:
             {
                 if( GetUndoManager() )  // recursive GetState else
-                    GetViewFrame()->GetSlotState( nWh, nullptr, &rSet );
+                    GetViewFrame().GetSlotState( nWh, nullptr, &rSet );
             }
             break;
             case SID_BASICIDE_CURRENT_LANG:
@@ -1189,17 +1188,17 @@ void Shell::SetCurWindow( BaseWindow* pNewWin, bool 
bUpdateTabBar, bool bRemembe
             pLayout = pModulLayout.get();
         else
             pLayout = pDialogLayout.get();
-        AdjustPosSizePixel(Point(0, 0), 
GetViewFrame()->GetWindow().GetOutputSizePixel());
+        AdjustPosSizePixel(Point(0, 0), 
GetViewFrame().GetWindow().GetOutputSizePixel());
         pLayout->Activating(*pCurWin);
-        GetViewFrame()->GetWindow().SetHelpId(pCurWin->GetHid());
+        GetViewFrame().GetWindow().SetHelpId(pCurWin->GetHid());
         if (bRememberAsCurrent)
             pCurWin->InsertLibInfo();
-        if (GetViewFrame()->GetWindow().IsVisible()) // SFX will do it later 
otherwise
+        if (GetViewFrame().GetWindow().IsVisible()) // SFX will do it later 
otherwise
             pCurWin->Show();
         pCurWin->Init();
         if (!GetExtraData()->ShellInCriticalSection())
         {
-            vcl::Window* pFrameWindow = &GetViewFrame()->GetWindow();
+            vcl::Window* pFrameWindow = &GetViewFrame().GetWindow();
             vcl::Window* pFocusWindow = Application::GetFocusWindow();
             while ( pFocusWindow && ( pFocusWindow != pFrameWindow ) )
                 pFocusWindow = pFocusWindow->GetParent();
@@ -1230,7 +1229,7 @@ void Shell::SetCurWindow( BaseWindow* pNewWin, bool 
bUpdateTabBar, bool bRemembe
     else if (pLayout)
     {
         SetWindow(pLayout);
-        GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
+        GetViewFrame().GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
         SfxObjectShell::SetCurrentComponent(nullptr);
     }
     aObjectCatalog->SetCurrentEntry(pCurWin);
@@ -1260,7 +1259,7 @@ void Shell::ManageToolbars()
         return;
 
     Reference< beans::XPropertySet > xFrameProps
-        ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
+        ( GetViewFrame().GetFrame().GetFrameInterface(), uno::UNO_QUERY );
     if ( !xFrameProps.is() )
         return;
 
@@ -1341,7 +1340,7 @@ BasicDebugFlags Shell::CallBasicBreakHdl( StarBASIC const 
* pBasic )
             {
                 Shell* pShell = GetShell();
                 for ( sal_uInt16 n = 0; n < nWaitCount; n++ )
-                    pShell->GetViewFrame()->GetWindow().EnterWait();
+                    pShell->GetViewFrame().GetWindow().EnterWait();
             }
         }
     }
@@ -1385,11 +1384,11 @@ VclPtr<ModulWindow> Shell::ShowActiveModuleWindow( 
StarBASIC const * pBasic )
 void Shell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
 {
     // not if iconified because the whole text would be displaced then at 
restore
-    if ( GetViewFrame()->GetWindow().GetOutputSizePixel().Height() == 0 )
+    if ( GetViewFrame().GetWindow().GetOutputSizePixel().Height() == 0 )
         return;
 
     Size aTabBarSize;
-    aTabBarSize.setHeight( 
GetViewFrame()->GetWindow().GetFont().GetFontHeight() + TAB_HEIGHT_MARGIN );
+    aTabBarSize.setHeight( 
GetViewFrame().GetWindow().GetFont().GetFontHeight() + TAB_HEIGHT_MARGIN );
     aTabBarSize.setWidth( rSize.Width() );
 
     Size aSz( rSize );
diff --git a/basctl/source/basicide/basides2.cxx 
b/basctl/source/basicide/basides2.cxx
index ca219f4c9059..5bd69b76f380 100644
--- a/basctl/source/basicide/basides2.cxx
+++ b/basctl/source/basicide/basides2.cxx
@@ -82,7 +82,7 @@ SfxPrinter* Shell::GetPrinter( bool bCreate )
 {
     if ( pCurWin )
     {
-        DocShell* pDocShell = 
static_cast<DocShell*>(GetViewFrame()->GetObjectShell());
+        DocShell* pDocShell = 
static_cast<DocShell*>(GetViewFrame().GetObjectShell());
         assert(pDocShell && "DocShell ?!");
         return pDocShell->GetPrinter( bCreate );
     }
@@ -91,7 +91,7 @@ SfxPrinter* Shell::GetPrinter( bool bCreate )
 
 sal_uInt16 Shell::SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags )
 {
-    DocShell* pDocShell = 
static_cast<DocShell*>(GetViewFrame()->GetObjectShell());
+    DocShell* pDocShell = 
static_cast<DocShell*>(GetViewFrame().GetObjectShell());
     assert(pDocShell && "DocShell ?!");
     pDocShell->SetPrinter( pNewPrinter );
     return 0;
@@ -114,11 +114,8 @@ void Shell::SetMDITitle()
         aTitle += " " + IDEResId(RID_STR_SIGNED) + " ";
     }
 
-    SfxViewFrame* pViewFrame = GetViewFrame();
-    if ( !pViewFrame )
-        return;
-
-    SfxObjectShell* pShell = pViewFrame->GetObjectShell();
+    SfxViewFrame& rViewFrame = GetViewFrame();
+    SfxObjectShell* pShell = rViewFrame.GetObjectShell();
     if ( pShell && pShell->GetTitle( SFX_TITLE_CAPTION ) != aTitle )
     {
         pShell->SetTitle( aTitle );
@@ -168,7 +165,7 @@ VclPtr<ModulWindow> Shell::CreateBasWin( const 
ScriptDocument& rDocument, const
             {
                 // new module window
                 if (!pModulLayout)
-                    
pModulLayout.reset(VclPtr<ModulWindowLayout>::Create(&GetViewFrame()->GetWindow(),
 *aObjectCatalog));
+                    
pModulLayout.reset(VclPtr<ModulWindowLayout>::Create(&GetViewFrame().GetWindow(),
 *aObjectCatalog));
                 pWin = VclPtr<ModulWindow>::Create(pModulLayout.get(), 
rDocument, aLibName, aModName, aModule);
                 nKey = InsertWindowInTable( pWin );
             }
diff --git a/basctl/source/basicide/basides3.cxx 
b/basctl/source/basicide/basides3.cxx
index d47b6ae3a26c..44bc54ba624f 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -81,7 +81,7 @@ VclPtr<DialogWindow> Shell::CreateDlgWin( const 
ScriptDocument& rDocument, const
 
                 // new dialog window
                 if (!pDialogLayout)
-                    
pDialogLayout.reset(VclPtr<DialogWindowLayout>::Create(&GetViewFrame()->GetWindow(),
 *aObjectCatalog));
+                    
pDialogLayout.reset(VclPtr<DialogWindowLayout>::Create(&GetViewFrame().GetWindow(),
 *aObjectCatalog));
                 pWin = VclPtr<DialogWindow>::Create(pDialogLayout.get(), 
rDocument, aLibName, aDlgName, xDialogModel);
                 nKey = InsertWindowInTable( pWin );
             }
diff --git a/basctl/source/basicide/basidesh.cxx 
b/basctl/source/basicide/basidesh.cxx
index 0c3c5bb16de7..73d27e2eea34 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -164,10 +164,10 @@ unsigned Shell::nShellCount = 0;
 Shell::Shell( SfxViewFrame& rFrame_, SfxViewShell* /* pOldShell */ ) :
     SfxViewShell( rFrame_, SfxViewShellFlags::NO_NEWWINDOW ),
     m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
-    aHScrollBar( VclPtr<ScrollAdaptor>::Create(&GetViewFrame()->GetWindow(), 
true) ),
-    aVScrollBar( VclPtr<ScrollAdaptor>::Create(&GetViewFrame()->GetWindow(), 
false) ),
+    aHScrollBar( VclPtr<ScrollAdaptor>::Create(&GetViewFrame().GetWindow(), 
true) ),
+    aVScrollBar( VclPtr<ScrollAdaptor>::Create(&GetViewFrame().GetWindow(), 
false) ),
     pLayout(nullptr),
-    
aObjectCatalog(VclPtr<ObjectCatalog>::Create(&GetViewFrame()->GetWindow())),
+    aObjectCatalog(VclPtr<ObjectCatalog>::Create(&GetViewFrame().GetWindow())),
     m_bAppBasicModified( false ),
     m_aNotifier( *this )
 {
@@ -192,15 +192,15 @@ void Shell::Init()
     LanguageBoxControl::RegisterControl( SID_BASICIDE_CURRENT_LANG );
     SvxZoomSliderControl::RegisterControl( SID_ATTR_ZOOMSLIDER );
 
-    GetViewFrame()->GetWindow().SetBackground(
-        
GetViewFrame()->GetWindow().GetSettings().GetStyleSettings().GetWindowColor()
+    GetViewFrame().GetWindow().SetBackground(
+        
GetViewFrame().GetWindow().GetSettings().GetStyleSettings().GetWindowColor()
     );
 
     pCurWin = nullptr;
     m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
     bCreatingWindow = false;
 
-    pTabBar.reset(VclPtr<TabBar>::Create(&GetViewFrame()->GetWindow()));
+    pTabBar.reset(VclPtr<TabBar>::Create(&GetViewFrame().GetWindow()));
 
     nCurKey = 100;
     InitScrollBars();
@@ -427,17 +427,16 @@ void Shell::StoreAllWindowData( bool bPersistent )
     }
 }
 
-
 bool Shell::PrepareClose( bool bUI )
 {
     // reset here because it's modified after printing etc. (DocInfo)
-    GetViewFrame()->GetObjectShell()->SetModified(false);
+    GetViewFrame().GetObjectShell()->SetModified(false);
 
     if ( StarBASIC::IsRunning() )
     {
         if( bUI )
         {
-            std::unique_ptr<weld::MessageDialog> 
xInfoBox(Application::CreateMessageDialog(GetViewFrame()->GetFrameWeld(),
+            std::unique_ptr<weld::MessageDialog> 
xInfoBox(Application::CreateMessageDialog(GetViewFrame().GetFrameWeld(),
                                                           
VclMessageType::Info, VclButtonsType::Ok,
                                                           
IDEResId(RID_STR_CANNOTCLOSE)));
             xInfoBox->run();
diff --git a/basctl/source/basicide/basobj3.cxx 
b/basctl/source/basicide/basobj3.cxx
index a470461be6a7..4672cdd52c2b 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -321,9 +321,9 @@ void BasicStopped(
     if (Shell* pShell = GetShell())
     {
         sal_uInt16 nWait = 0;
-        while ( pShell->GetViewFrame()->GetWindow().IsWait() )
+        while ( pShell->GetViewFrame().GetWindow().IsWait() )
         {
-            pShell->GetViewFrame()->GetWindow().LeaveWait();
+            pShell->GetViewFrame().GetWindow().LeaveWait();
             nWait++;
         }
         if ( pnWaitCount )
@@ -430,7 +430,7 @@ SfxBindings* GetBindingsPtr()
     SfxViewFrame* pFrame = nullptr;
     if (Shell* pShell = GetShell())
     {
-        pFrame = pShell->GetViewFrame();
+        pFrame = &pShell->GetViewFrame();
     }
     else
     {
@@ -454,9 +454,11 @@ SfxBindings* GetBindingsPtr()
 SfxDispatcher* GetDispatcher ()
 {
     if (Shell* pShell = GetShell())
-        if (SfxViewFrame* pViewFrame = pShell->GetViewFrame())
-            if (SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher())
-                return pDispatcher;
+    {
+        SfxViewFrame& rViewFrame = pShell->GetViewFrame();
+        if (SfxDispatcher* pDispatcher = rViewFrame.GetDispatcher())
+            return pDispatcher;
+    }
     return nullptr;
 }
 } // namespace basctl
diff --git a/basctl/source/basicide/bastypes.cxx 
b/basctl/source/basicide/bastypes.cxx
index 0bf829b2bb5d..5fd607108dc1 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -94,7 +94,7 @@ void BaseWindow::Init()
         pShellHScrollBar->SetScrollHdl( LINK( this, BaseWindow, HorzScrollHdl 
) );
 
     // Show the read-only infobar if the module/dialog is read-only
-    GetShell()->GetViewFrame()->RemoveInfoBar(BASIC_IDE_READONLY_INFOBAR);
+    GetShell()->GetViewFrame().RemoveInfoBar(BASIC_IDE_READONLY_INFOBAR);
     if (IsReadOnly())
         ShowReadOnlyInfoBar();
 
@@ -240,7 +240,7 @@ void BaseWindow::ShowReadOnlyInfoBar()
     else
         aMsg = IDEResId(RID_STR_DIALOG_READONLY);
 
-    GetShell()->GetViewFrame()->AppendInfoBar(BASIC_IDE_READONLY_INFOBAR, 
OUString(),
+    GetShell()->GetViewFrame().AppendInfoBar(BASIC_IDE_READONLY_INFOBAR, 
OUString(),
                                               aMsg, InfobarType::INFO, true);
 }
 
diff --git a/basctl/source/basicide/localizationmgr.cxx 
b/basctl/source/basicide/localizationmgr.cxx
index 18a19d6e7b17..17371bed2968 100644
--- a/basctl/source/basicide/localizationmgr.cxx
+++ b/basctl/source/basicide/localizationmgr.cxx
@@ -82,7 +82,7 @@ void LocalizationMgr::handleTranslationbar ()
     static constexpr OUStringLiteral aToolBarResName = 
u"private:resource/toolbar/translationbar";
 
     Reference< beans::XPropertySet > xFrameProps
-        ( m_pShell->GetViewFrame()->GetFrame().GetFrameInterface(), 
uno::UNO_QUERY );
+        ( m_pShell->GetViewFrame().GetFrame().GetFrameInterface(), 
uno::UNO_QUERY );
     if ( !xFrameProps.is() )
         return;
 
diff --git a/basctl/source/basicide/moduldl2.cxx 
b/basctl/source/basicide/moduldl2.cxx
index 82443228dbe8..12650fc8f66a 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -461,10 +461,10 @@ IMPL_LINK( LibPage, ButtonHdl, weld::Button&, rButton, 
void )
         {
             Shell* pShell = GetShell();
             if (pShell)
-                pShell->GetViewFrame()->GetWindow().EnterWait();
+                pShell->GetViewFrame().GetWindow().EnterWait();
             xModLibContainer->loadLibrary( aLibName );
             if (pShell)
-                pShell->GetViewFrame()->GetWindow().LeaveWait();
+                pShell->GetViewFrame().GetWindow().LeaveWait();
         }
 
         // load dialog library (if not loaded)
@@ -473,10 +473,10 @@ IMPL_LINK( LibPage, ButtonHdl, weld::Button&, rButton, 
void )
         {
             Shell* pShell = GetShell();
             if (pShell)
-                pShell->GetViewFrame()->GetWindow().EnterWait();
+                pShell->GetViewFrame().GetWindow().EnterWait();
             xDlgLibContainer->loadLibrary( aLibName );
             if (pShell)
-                pShell->GetViewFrame()->GetWindow().LeaveWait();
+                pShell->GetViewFrame().GetWindow().LeaveWait();
         }
 
         // check, if library is password protected
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx 
b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index a5560dd6be8d..6be2de622b1d 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1216,7 +1216,7 @@ void DesktopLOKTest::testSheetDragDrop()
     Scheduler::ProcessEventsToIdle();
     {
         SfxViewShell* pViewShell = SfxViewShell::Current();
-        SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+        SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
 
         OUString sValue;
         css::uno::Any aValue;
@@ -1228,7 +1228,7 @@ void DesktopLOKTest::testSheetDragDrop()
         aURL.Path = "Address";
         aURL.Main = ".uno:Address";
 
-        
pViewFrame->GetBindings().QueryState(pViewFrame->GetBindings().QuerySlotId(aURL),
 pState);
+        
rViewFrame.GetBindings().QueryState(rViewFrame.GetBindings().QuerySlotId(aURL), 
pState);
         pState->QueryValue(aValue);
         aValue >>= sValue;
         CPPUNIT_ASSERT_EQUAL(OUString("Sheet5.A1:E1"), sValue);
@@ -1272,7 +1272,7 @@ void DesktopLOKTest::testSheetDragDrop()
     Scheduler::ProcessEventsToIdle();
     {
         SfxViewShell* pViewShell = SfxViewShell::Current();
-        SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
+        SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
 
         OUString sValue;
         css::uno::Any aValue;
@@ -1284,7 +1284,7 @@ void DesktopLOKTest::testSheetDragDrop()
         aURL.Path = "Address";
         aURL.Main = ".uno:Address";
 
-        
pViewFrame->GetBindings().QueryState(pViewFrame->GetBindings().QuerySlotId(aURL),
 pState);
+        
rViewFrame.GetBindings().QueryState(rViewFrame.GetBindings().QuerySlotId(aURL), 
pState);
         pState->QueryValue(aValue);
         aValue >>= sValue;
         CPPUNIT_ASSERT_EQUAL(OUString("Sheet5.D1:H1"), sValue);
@@ -2040,7 +2040,7 @@ void DesktopLOKTest::testDialogInput()
     Scheduler::ProcessEventsToIdle();
 
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    pViewShell->GetViewFrame()->GetBindings().Update();
+    pViewShell->GetViewFrame().GetBindings().Update();
 
     VclPtr<vcl::Window> pWindow(Application::GetActiveTopWindow());
     CPPUNIT_ASSERT(pWindow);
@@ -2970,7 +2970,7 @@ void DesktopLOKTest::testDialogPaste()
     Scheduler::ProcessEventsToIdle();
 
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    pViewShell->GetViewFrame()->GetBindings().Update();
+    pViewShell->GetViewFrame().GetBindings().Update();
 
     VclPtr<vcl::Window> pWindow(Application::GetActiveTopWindow());
     CPPUNIT_ASSERT(pWindow);
@@ -3249,10 +3249,8 @@ namespace
         SfxViewShell* pViewShell = SfxViewShell::Current();
         CPPUNIT_ASSERT(pViewShell);
 
-        SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
-        CPPUNIT_ASSERT(pViewFrame);
-
-        SfxChildWindow* pSideBar = pViewFrame->GetChildWindow(SID_SIDEBAR);
+        SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+        SfxChildWindow* pSideBar = rViewFrame.GetChildWindow(SID_SIDEBAR);
         CPPUNIT_ASSERT(pSideBar);
 
         auto pDockingWin = dynamic_cast<sfx2::sidebar::SidebarDockingWindow 
*>(pSideBar->GetWindow());
@@ -3273,8 +3271,8 @@ void DesktopLOKTest::testControlState()
 
     boost::property_tree::ptree aState;
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    pViewShell->GetViewFrame()->GetBindings().Update();
-    
pViewShell->GetViewFrame()->GetBindings().QueryControlState(SID_ATTR_TRANSFORM_WIDTH,
 aState);
+    pViewShell->GetViewFrame().GetBindings().Update();
+    
pViewShell->GetViewFrame().GetBindings().QueryControlState(SID_ATTR_TRANSFORM_WIDTH,
 aState);
     CPPUNIT_ASSERT(!aState.empty());
 }
 
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index d0c67bda098f..ed601003d042 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -906,7 +906,7 @@ void ExecuteOrientationChange()
 void setupSidebar(std::u16string_view sidebarDeckId = u"")
 {
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    SfxViewFrame* pViewFrame = pViewShell ? pViewShell->GetViewFrame() : 
nullptr;
+    SfxViewFrame* pViewFrame = pViewShell ? &pViewShell->GetViewFrame() : 
nullptr;
     if (pViewFrame)
     {
         if (!pViewFrame->GetChildWindow(SID_SIDEBAR))
@@ -949,7 +949,7 @@ void setupSidebar(std::u16string_view sidebarDeckId = u"")
 void hideSidebar()
 {
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): nullptr;
+    SfxViewFrame* pViewFrame = pViewShell ? &pViewShell->GetViewFrame() : 
nullptr;
     if (pViewFrame)
         pViewFrame->SetChildWindow(SID_SIDEBAR, false , false );
     else
@@ -3422,7 +3422,7 @@ static void doc_iniUnoCommands ()
 
     util::URL aCommandURL;
     SfxViewShell* pViewShell = SfxViewShell::Current();
-    SfxViewFrame* pViewFrame = pViewShell? pViewShell->GetViewFrame(): nullptr;
+    SfxViewFrame* pViewFrame = pViewShell ? &pViewShell->GetViewFrame() : 
nullptr;
 
     // check if Frame-Controller were created.
     if (!pViewFrame)
diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 90ddd52d01a4..f7de18112c04 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -188,7 +188,7 @@ public:
     static VclPtr<vcl::Window> getInPlaceDocWindow(SfxViewShell* pViewShell);
 
 private:
-    static int createView(SfxViewFrame* pViewFrame, ViewShellDocId docId);
+    static int createView(SfxViewFrame& rViewFrame, ViewShellDocId docId);
 };
 
 template<typename ViewShellType, typename FunctionType>
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 1e70f8301bda..0465fd036d4b 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -163,7 +163,7 @@ friend class SfxBaseController;
 friend class SfxPrinterController;
 
     std::unique_ptr<struct SfxViewShell_Impl>   pImpl;
-    SfxViewFrame*               pFrame;
+    SfxViewFrame&               rFrame;
     VclPtr<vcl::Window>         pWindow;
     bool                        bNoNewWindow;
     bool                        mbPrinterSettingsModified;
@@ -262,7 +262,22 @@ public:
     const SvBorder&             GetBorderPixel() const;
     void                        SetBorderPixel( const SvBorder &rBorder );
     void                        InvalidateBorder();
-    inline SfxViewFrame*        GetViewFrame() const;
+
+    /*  [Description]
+
+        This method returns a reference to the <SfxViewFrame> Instance in which
+        this SfxViewShell is displayed. This is the instance that was passed
+        on in the constructor. It is guaranteed that the returned reference
+        is a valid SfxViewFrame instance.
+
+        [Cross-reference]
+
+        <SfxShell::GetFrame()const>
+    */
+    SfxViewFrame& GetViewFrame() const
+    {
+        return rFrame;
+    }
 
     // Printing Interface
     virtual SfxPrinter*         GetPrinter( bool bCreate = false );
@@ -442,26 +457,6 @@ public:
     void SetStoringHelper(std::shared_ptr<SfxStoringHelper> xHelper) { 
m_xHelper = xHelper; }
 };
 
-
-inline SfxViewFrame* SfxViewShell::GetViewFrame() const
-
-/*  [Description]
-
-    This method returns a pointer to the <SfxViewFrame> Instance in which
-    this SfxViewShell is displayed. This is the instance that was passed
-    on in the constructor. It is guaranteed that the returned pointer
-    points on the valid SfxViewFrame instance.
-
-    [Cross-reference]
-
-    <SfxShell::GetFrame()const>
-*/
-
-{
-    return pFrame;
-}
-
 #endif // INCLUDED_SFX2_VIEWSH_HXX
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index dc60439a536f..df6fb030d691 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -135,7 +135,7 @@ void ScShapeTest::testTdf144242_OpenBezier_noSwapWH()
 
     // Insert default open Bezier curve
     ScTabViewShell* pTabViewShell = getViewShell();
-    SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_BEZIER_NOFILL);
+    SfxRequest aReq(&pTabViewShell->GetViewFrame(), SID_DRAW_BEZIER_NOFILL);
     aReq.SetModifier(KEY_MOD1); // Ctrl
     pTabViewShell->ExecDraw(aReq);
     pTabViewShell->SetDrawShell(false);
@@ -168,7 +168,7 @@ void ScShapeTest::testTdf144242_Line_noSwapWH()
 
     // Insert default line
     ScTabViewShell* pTabViewShell = getViewShell();
-    SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_LINE);
+    SfxRequest aReq(&pTabViewShell->GetViewFrame(), SID_DRAW_LINE);
     aReq.SetModifier(KEY_MOD1); // Ctrl
     pTabViewShell->ExecDraw(aReq);
     pTabViewShell->SetDrawShell(false);
@@ -611,7 +611,7 @@ void 
ScShapeTest::testTdf137576_LogicRectInDefaultMeasureline()
 
     // Create default measureline by SfxRequest that corresponds to Ctrl+Click
     ScTabViewShell* pTabViewShell = getViewShell();
-    SfxRequest aReq(pTabViewShell->GetViewFrame(), SID_DRAW_MEASURELINE);
+    SfxRequest aReq(&pTabViewShell->GetViewFrame(), SID_DRAW_MEASURELINE);
     aReq.SetModifier(KEY_MOD1); // Ctrl
     pTabViewShell->ExecDraw(aReq);
 
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 84b9a941ba50..1434cfe80e95 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1590,8 +1590,8 @@ void ScTiledRenderingTest::testDocumentRepair()
     {
         std::unique_ptr<SfxBoolItem> pItem1;
         std::unique_ptr<SfxBoolItem> pItem2;
-        pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, 
pItem1);
-        pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, 
pItem2);
+        pView1->GetViewFrame().GetBindings().QueryState(SID_DOC_REPAIR, 
pItem1);
+        pView2->GetViewFrame().GetBindings().QueryState(SID_DOC_REPAIR, 
pItem2);
         CPPUNIT_ASSERT(pItem1);
         CPPUNIT_ASSERT(pItem2);
         CPPUNIT_ASSERT_EQUAL(false, pItem1->GetValue());
@@ -1609,8 +1609,8 @@ void ScTiledRenderingTest::testDocumentRepair()
     {
         std::unique_ptr<SfxBoolItem> pItem1;
         std::unique_ptr<SfxBoolItem> pItem2;
-        pView1->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, 
pItem1);
-        pView2->GetViewFrame()->GetBindings().QueryState(SID_DOC_REPAIR, 
pItem2);
+        pView1->GetViewFrame().GetBindings().QueryState(SID_DOC_REPAIR, 
pItem1);
+        pView2->GetViewFrame().GetBindings().QueryState(SID_DOC_REPAIR, 
pItem2);
         CPPUNIT_ASSERT(pItem1);
         CPPUNIT_ASSERT(pItem2);
         CPPUNIT_ASSERT_EQUAL(true, pItem1->GetValue());
@@ -1640,8 +1640,8 @@ void ScTiledRenderingTest::testLanguageStatus()
     {
         std::unique_ptr<SfxPoolItem> xItem1;
         std::unique_ptr<SfxPoolItem> xItem2;
-        pView1->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, 
xItem1);
-        pView2->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, 
xItem2);
+        pView1->GetViewFrame().GetBindings().QueryState(SID_LANGUAGE_STATUS, 
xItem1);
+        pView2->GetViewFrame().GetBindings().QueryState(SID_LANGUAGE_STATUS, 
xItem2);
         const SfxStringItem* pItem1 = dynamic_cast<const 
SfxStringItem*>(xItem1.get());
         const SfxStringItem* pItem2 = dynamic_cast<const 
SfxStringItem*>(xItem2.get());
         CPPUNIT_ASSERT(pItem1);
@@ -1652,15 +1652,15 @@ void ScTiledRenderingTest::testLanguageStatus()
 
     {
         SfxStringItem aLangString(SID_LANGUAGE_STATUS, "Default_Spanish 
(Bolivia)");
-        
pView1->GetViewFrame()->GetDispatcher()->ExecuteList(SID_LANGUAGE_STATUS,
+        
pView1->GetViewFrame().GetDispatcher()->ExecuteList(SID_LANGUAGE_STATUS,
             SfxCallMode::SYNCHRON, { &aLangString });
     }
 
     {
         std::unique_ptr<SfxPoolItem> xItem1;
         std::unique_ptr<SfxPoolItem> xItem2;
-        pView1->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, 
xItem1);
-        pView2->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, 
xItem2);
+        pView1->GetViewFrame().GetBindings().QueryState(SID_LANGUAGE_STATUS, 
xItem1);
+        pView2->GetViewFrame().GetBindings().QueryState(SID_LANGUAGE_STATUS, 
xItem2);
         const SfxStringItem* pItem1 = dynamic_cast<const 
SfxStringItem*>(xItem1.get());
         const SfxStringItem* pItem2 = dynamic_cast<const 
SfxStringItem*>(xItem2.get());
         CPPUNIT_ASSERT(pItem1);
@@ -1702,19 +1702,19 @@ void ScTiledRenderingTest::testMultiViewCopyPaste()
 
     // copy text view 1
     pView1->SetCursor(0, 0);
-    pView1->GetViewFrame()->GetBindings().Execute(SID_COPY);
+    pView1->GetViewFrame().GetBindings().Execute(SID_COPY);
 
     // copy text view 2
     pView2->SetCursor(1, 0);
-    pView2->GetViewFrame()->GetBindings().Execute(SID_COPY);
+    pView2->GetViewFrame().GetBindings().Execute(SID_COPY);
 
      // paste text view 1
     pView1->SetCursor(0, 1);
-    pView1->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+    pView1->GetViewFrame().GetBindings().Execute(SID_PASTE);
 
     // paste text view 2
     pView2->SetCursor(1, 1);
-    pView2->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+    pView2->GetViewFrame().GetBindings().Execute(SID_PASTE);
 
     CPPUNIT_ASSERT_EQUAL(OUString("TestCopy1"), pDoc->GetString(ScAddress(0, 
1, 0)));
     CPPUNIT_ASSERT_EQUAL(OUString("TestCopy2"), pDoc->GetString(ScAddress(1, 
1, 0)));
@@ -1768,23 +1768,23 @@ void ScTiledRenderingTest::testFilterDlg()
     SfxViewShell* pView2 = SfxViewShell::Current();
     CPPUNIT_ASSERT(pView1 != pView2);
     {
-        pView2->GetViewFrame()->GetDispatcher()->Execute(SID_FILTER,
+        pView2->GetViewFrame().GetDispatcher()->Execute(SID_FILTER,
             SfxCallMode::SLOT|SfxCallMode::RECORD);
     }
 
     Scheduler::ProcessEventsToIdle();
-    SfxChildWindow* pRefWindow = 
pView2->GetViewFrame()->GetChildWindow(SID_FILTER);
+    SfxChildWindow* pRefWindow = 
pView2->GetViewFrame().GetChildWindow(SID_FILTER);
     CPPUNIT_ASSERT(pRefWindow);
 
     // switch to view 1
     SfxLokHelper::setView(nView1);
-    CPPUNIT_ASSERT_EQUAL(true, 
pView2->GetViewFrame()->GetDispatcher()->IsLocked());
-    CPPUNIT_ASSERT_EQUAL(false, 
pView1->GetViewFrame()->GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(true, 
pView2->GetViewFrame().GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, 
pView1->GetViewFrame().GetDispatcher()->IsLocked());
 
     pRefWindow->GetController()->response(RET_CANCEL);
 
-    CPPUNIT_ASSERT_EQUAL(false, 
pView2->GetViewFrame()->GetDispatcher()->IsLocked());
-    CPPUNIT_ASSERT_EQUAL(false, 
pView1->GetViewFrame()->GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, 
pView2->GetViewFrame().GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, 
pView1->GetViewFrame().GetDispatcher()->IsLocked());
 
     SfxViewShell::Current()->setLibreOfficeKitViewCallback(nullptr);
     SfxLokHelper::setView(nView1);
@@ -1799,11 +1799,11 @@ void ScTiledRenderingTest::testFunctionDlg()
     SfxViewShell* pView1 = SfxViewShell::Current();
     int nView1 = SfxLokHelper::getView();
     {
-        pView1->GetViewFrame()->GetDispatcher()->Execute(SID_OPENDLG_FUNCTION,
+        pView1->GetViewFrame().GetDispatcher()->Execute(SID_OPENDLG_FUNCTION,
             SfxCallMode::SLOT|SfxCallMode::RECORD);
     }
     Scheduler::ProcessEventsToIdle();
-    SfxChildWindow* pRefWindow = 
pView1->GetViewFrame()->GetChildWindow(SID_OPENDLG_FUNCTION);
+    SfxChildWindow* pRefWindow = 
pView1->GetViewFrame().GetChildWindow(SID_OPENDLG_FUNCTION);
     CPPUNIT_ASSERT(pRefWindow);
 
     // view #2
@@ -1812,14 +1812,14 @@ void ScTiledRenderingTest::testFunctionDlg()
     CPPUNIT_ASSERT(pView1 != pView2);
 
     // check locking
-    CPPUNIT_ASSERT_EQUAL(true, 
pView1->GetViewFrame()->GetDispatcher()->IsLocked());
-    CPPUNIT_ASSERT_EQUAL(false, 
pView2->GetViewFrame()->GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(true, 
pView1->GetViewFrame().GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, 
pView2->GetViewFrame().GetDispatcher()->IsLocked());
 
     SfxLokHelper::setView(nView1);
     pRefWindow->GetController()->response(RET_CANCEL);
 
-    CPPUNIT_ASSERT_EQUAL(false, 
pView1->GetViewFrame()->GetDispatcher()->IsLocked());
-    CPPUNIT_ASSERT_EQUAL(false, 
pView2->GetViewFrame()->GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, 
pView1->GetViewFrame().GetDispatcher()->IsLocked());
+    CPPUNIT_ASSERT_EQUAL(false, 
pView2->GetViewFrame().GetDispatcher()->IsLocked());
 
     SfxViewShell::Current()->setLibreOfficeKitViewCallback(nullptr);
     SfxLokHelper::setView(nView2);
@@ -2512,7 +2512,7 @@ void ScTiledRenderingTest::testPasteIntoWrapTextCell()
     // copy A1
     pView->SetCursor(0, 0);
     Scheduler::ProcessEventsToIdle();
-    pView->GetViewFrame()->GetBindings().Execute(SID_COPY);
+    pView->GetViewFrame().GetBindings().Execute(SID_COPY);
     Scheduler::ProcessEventsToIdle();
 
     // verify clipboard
@@ -2530,7 +2530,7 @@ void ScTiledRenderingTest::testPasteIntoWrapTextCell()
     pView->SetCursor(0, 1);
     Scheduler::ProcessEventsToIdle();
     aView.m_sInvalidateSheetGeometry = "";
-    pView->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+    pView->GetViewFrame().GetBindings().Execute(SID_PASTE);
     Scheduler::ProcessEventsToIdle();
 
     CPPUNIT_ASSERT_EQUAL(sCopyContent, pDoc->GetString(0, 1, 0));
@@ -2542,7 +2542,7 @@ void ScTiledRenderingTest::testPasteIntoWrapTextCell()
     Scheduler::ProcessEventsToIdle();
 
     // cut from A2
-    pView->GetViewFrame()->GetBindings().Execute(SID_CUT);
+    pView->GetViewFrame().GetBindings().Execute(SID_CUT);
     Scheduler::ProcessEventsToIdle();
 
     // verify clipboard
@@ -2559,7 +2559,7 @@ void ScTiledRenderingTest::testPasteIntoWrapTextCell()
     pView->SetCursor(0, 2);
     Scheduler::ProcessEventsToIdle();
     aView.m_sInvalidateSheetGeometry = "";
-    pView->GetViewFrame()->GetBindings().Execute(SID_PASTE);
+    pView->GetViewFrame().GetBindings().Execute(SID_PASTE);
     Scheduler::ProcessEventsToIdle();
 
     // SG invalidations for all
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index b0a91cb397d8..61c873737dc1 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -824,7 +824,7 @@ void ScGlobal::OpenURL(const OUString& rURL, const 
OUString& rTarget, bool bIgno
     OUString aReferName;
     if ( pScActiveViewShell )
     {
-        pFrame = pScActiveViewShell->GetViewFrame();
+        pFrame = &pScActiveViewShell->GetViewFrame();
         pObjShell = pFrame->GetObjectShell();
         const SfxMedium* pMed = pObjShell->GetMedium();
         if (pMed)
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 475dd9597673..304c8932b1b7 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -288,17 +288,14 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* 
pAccessibleDocument, Sc
 {
     if (mpViewShell)
     {
-        SfxViewFrame* pViewFrame = mpViewShell->GetViewFrame();
-        if (pViewFrame)
+        SfxViewFrame& rViewFrame = mpViewShell->GetViewFrame();
+        xSelectionSupplier = 
uno::Reference<view::XSelectionSupplier>(rViewFrame.GetFrame().GetController(), 
uno::UNO_QUERY);
+        if (xSelectionSupplier.is())
         {
-            xSelectionSupplier = 
uno::Reference<view::XSelectionSupplier>(pViewFrame->GetFrame().GetController(),
 uno::UNO_QUERY);
-            if (xSelectionSupplier.is())
-            {
-                
xSelectionSupplier->addSelectionChangeListener(mpAccessibleDocument);
-                uno::Reference<drawing::XShapes> 
xShapes(mpViewShell->getSelectedXShapes());
-                if (xShapes.is())
-                    mnShapesSelected = xShapes->getCount();
-            }
+            
xSelectionSupplier->addSelectionChangeListener(mpAccessibleDocument);
+            uno::Reference<drawing::XShapes> 
xShapes(mpViewShell->getSelectedXShapes());
+            if (xShapes.is())
+                mnShapesSelected = xShapes->getCount();
         }
     }
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f80b6c1b49a8..8d310e1c94d5 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -878,7 +878,7 @@ void ScInputHandler::UpdateRefDevice()
         return;
 
     bool bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg();
-    bool bInPlace = pActiveViewSh && 
pActiveViewSh->GetViewFrame()->GetFrame().IsInPlace();
+    bool bInPlace = pActiveViewSh && 
pActiveViewSh->GetViewFrame().GetFrame().IsInPlace();
     EEControlBits nCtrl = mpEditEngine->GetControlWord();
     if ( bTextWysiwyg || bInPlace )
         nCtrl |= EEControlBits::FORMAT100;    // EditEngine default: always 
format for 100%
@@ -2860,11 +2860,11 @@ void ScInputHandler::ShowRefFrame()
         return;
 
     bool bFound = false;
-    SfxViewFrame* pRefFrame = pRefViewSh->GetViewFrame();
+    SfxViewFrame& rRefFrame = pRefViewSh->GetViewFrame();
     SfxViewFrame* pOneFrame = SfxViewFrame::GetFirst();
     while ( pOneFrame && !bFound )
     {
-        if ( pOneFrame == pRefFrame )
+        if ( pOneFrame == &rRefFrame )
             bFound = true;
         pOneFrame = SfxViewFrame::GetNext( *pOneFrame );
     }
@@ -3371,7 +3371,7 @@ void ScInputHandler::EnterHandler( ScEnterMode 
nBlockMode, bool bBeforeSavingInL
 
         if ( pExecuteSh )
         {
-            SfxBindings& rBindings = pExecuteSh->GetViewFrame()->GetBindings();
+            SfxBindings& rBindings = pExecuteSh->GetViewFrame().GetBindings();
 
             sal_uInt16 nId = FID_INPUTLINE_ENTER;
             if ( nBlockMode == ScEnterMode::BLOCK )
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index ed82c9d7a0a3..f833e743b991 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -2607,8 +2607,8 @@ void ScPosWnd::DoEnter()
                 else if (eType == SC_MANAGE_NAMES)
                 {
                     sal_uInt16          nId  = 
ScNameDlgWrapper::GetChildWindowId();
-                    SfxViewFrame* pViewFrm = pViewSh->GetViewFrame();
-                    SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                    SfxViewFrame& rViewFrm = pViewSh->GetViewFrame();
+                    SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                     SC_MOD()->SetRefDialog( nId, pWnd == nullptr );
                 }
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index d194fdc1070e..9f88e92ceb45 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -841,8 +841,8 @@ bool ScValidationDlg::EnterRefStatus()
     if( !pTabViewShell ) return false;
 
     sal_uInt16 nId  = SLOTID;
-    SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-    SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+    SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+    SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
     if (pWnd && pWnd->GetController().get() != this) pWnd = nullptr;
 
@@ -858,8 +858,8 @@ bool ScValidationDlg::LeaveRefStatus()
     if( !pTabViewShell ) return false;
 
     sal_uInt16 nId  = SLOTID;
-    SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-    if ( pViewFrm->GetChildWindow( nId ) )
+    SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+    if (rViewFrm.GetChildWindow(nId))
     {
         DoClose( nId );
     }
@@ -888,7 +888,7 @@ bool ScValidationDlg::RemoveRefDlg( bool bRestoreModal /* = 
true */ )
 
     if( !pTabVwSh ) return false;
 
-    if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame()->GetChildWindow( 
SID_VALIDITY_REFERENCE ) )
+    if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame().GetChildWindow( 
SID_VALIDITY_REFERENCE ) )
     {
         bVisLock = static_cast<ScValidityRefChildWin*>(pWnd)->LockVisible( 
true );
         bFreeWindowLock = 
static_cast<ScValidityRefChildWin*>(pWnd)->LockFreeWindow( true );
@@ -905,7 +905,7 @@ bool ScValidationDlg::RemoveRefDlg( bool bRestoreModal /* = 
true */ )
         }
     }
 
-    if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame()->GetChildWindow( 
SID_VALIDITY_REFERENCE ) )
+    if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame().GetChildWindow( 
SID_VALIDITY_REFERENCE ) )
     {
         static_cast<ScValidityRefChildWin*>(pWnd)->LockVisible( bVisLock );
         static_cast<ScValidityRefChildWin*>(pWnd)->LockFreeWindow( 
bFreeWindowLock );
diff --git a/sc/source/ui/docshell/datastream.cxx 
b/sc/source/ui/docshell/datastream.cxx
index 2124753bf529..55b2f93381f5 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -240,7 +240,7 @@ void DataStream::MakeToolbarVisible()
         return;
 
     css::uno::Reference< css::frame::XFrame > xFrame =
-        
pViewData->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
+        
pViewData->GetViewShell()->GetViewFrame().GetFrame().GetFrameInterface();
     if (!xFrame.is())
         return;
 
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 9d7b77b888e5..f37b969bd344 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -767,7 +767,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& 
rHint )
                                     uno::Reference< task::XJob > xJob( 
xFactory->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
                                     ScViewData* pViewData = GetViewData();
                                     SfxViewShell* pViewShell = ( pViewData ? 
pViewData->GetViewShell() : nullptr );
-                                    SfxViewFrame* pViewFrame = ( pViewShell ? 
pViewShell->GetViewFrame() : nullptr );
+                                    SfxViewFrame* pViewFrame = ( pViewShell ? 
&pViewShell->GetViewFrame() : nullptr );
                                     SfxFrame* pFrame = ( pViewFrame ? 
&pViewFrame->GetFrame() : nullptr );
                                     uno::Reference< frame::XController > 
xController = ( pFrame ? pFrame->GetController() : nullptr );
                                     uno::Reference< sheet::XSpreadsheetView > 
xSpreadsheetView( xController, uno::UNO_QUERY_THROW );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 5903d575590e..72ca520453b8 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1863,7 +1863,7 @@ void ScDocShell::ExecutePageStyle( const SfxViewShell& 
rCaller,
 
                                 // memorizing for GetState():
                                 GetPageOnFromPageStyleSet( &rStyleSet, 
nCurTab, m_bHeaderOn, m_bFooterOn );
-                                
rCaller.GetViewFrame()->GetBindings().Invalidate( SID_HFEDIT );
+                                
rCaller.GetViewFrame().GetBindings().Invalidate( SID_HFEDIT );
 
                                 ScStyleSaveData aNewData;
                                 aNewData.InitFromStyle( pStyleSheet );
@@ -2631,7 +2631,7 @@ SfxBindings* ScDocShell::GetViewBindings()
 
     SfxViewShell* pViewSh = GetBestViewShell();
     if (pViewSh)
-        return &pViewSh->GetViewFrame()->GetBindings();
+        return &pViewSh->GetViewFrame().GetBindings();
     else
         return nullptr;
 }
diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx
index 568218da662b..d5f50377a8a8 100644
--- a/sc/source/ui/drawfunc/drawsh.cxx
+++ b/sc/source/ui/drawfunc/drawsh.cxx
@@ -127,7 +127,7 @@ void ScDrawShell::setModified()
 
 static void lcl_invalidateTransformAttr(const ScTabViewShell* pViewShell)
 {
-    SfxBindings& rBindings=pViewShell->GetViewFrame()->GetBindings();
+    SfxBindings& rBindings=pViewShell->GetViewFrame().GetBindings();
     rBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH);
     rBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT);
     rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X);
@@ -432,7 +432,7 @@ void ScDrawShell::ExecuteMacroAssign(SdrObject* pObj, 
weld::Window* pWin)
 
     css::uno::Reference < css::frame::XFrame > xFrame;
     if (GetViewShell())
-        xFrame = 
GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface();
+        xFrame = GetViewShell()->GetViewFrame().GetFrame().GetFrameInterface();
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     ScopedVclPtr<SfxAbstractDialog> pMacroDlg(pFact->CreateEventConfigDialog( 
pWin, aItemSet, xFrame ));
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx 
b/sc/source/ui/drawfunc/drawsh2.cxx
index db3fd0541b83..1b83e930c8c1 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -94,8 +94,8 @@ void ScDrawShell::GetState( SfxItemSet& rSet )          // 
Conditions / Toggles
     rSet.Put( SfxBoolItem( SID_BEZIER_EDIT, !pView->IsFrameDragSingles() ) );
 
     sal_uInt16 nFWId = ScGetFontWorkId();
-    SfxViewFrame* pViewFrm = rViewData.GetViewShell()->GetViewFrame();
-    rSet.Put(SfxBoolItem(SID_FONTWORK, pViewFrm->HasChildWindow(nFWId)));
+    SfxViewFrame& rViewFrm = rViewData.GetViewShell()->GetViewFrame();
+    rSet.Put(SfxBoolItem(SID_FONTWORK, rViewFrm.HasChildWindow(nFWId)));
 
         // Notes always default to Page anchor.
     bool bDisableAnchor = false;
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx 
b/sc/source/ui/drawfunc/drawsh5.cxx
index b95f77f9339c..4e95a7d65b07 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -462,15 +462,15 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
         case SID_FONTWORK:
         {
             sal_uInt16 nId = ScGetFontWorkId();
-            SfxViewFrame* pViewFrm = rViewData.GetViewShell()->GetViewFrame();
+            SfxViewFrame& rViewFrm = rViewData.GetViewShell()->GetViewFrame();
 
             if ( rReq.GetArgs() )
-                pViewFrm->SetChildWindow( nId,
+                rViewFrm.SetChildWindow( nId,
                                            static_cast<const SfxBoolItem&>(
                                             
(rReq.GetArgs()->Get(SID_FONTWORK))).
                                                 GetValue() );
             else
-                pViewFrm->ToggleChildWindow( nId );
+                rViewFrm.ToggleChildWindow( nId );
 
             rBindings.Invalidate( SID_FONTWORK );
             rReq.Done();
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx 
b/sc/source/ui/drawfunc/drtxtob.cxx
index f6e8982bd74d..f428465936b3 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -304,7 +304,7 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
             {
                 // Ensure the field is selected first
                 pOutView->SelectFieldAtCursor();
-                
mrViewData.GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
+                
mrViewData.GetViewShell()->GetViewFrame().GetDispatcher()->Execute(SID_HYPERLINK_DIALOG);
             }
             break;
 
@@ -357,8 +357,8 @@ void ScDrawTextObjectBar::Execute( SfxRequest &rReq )
 
 void ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
 {
-    SfxViewFrame* pViewFrm = mrViewData.GetViewShell()->GetViewFrame();
-    bool bHasFontWork = pViewFrm->HasChildWindow(SID_FONTWORK);
+    SfxViewFrame& rViewFrm = mrViewData.GetViewShell()->GetViewFrame();
+    bool bHasFontWork = rViewFrm.HasChildWindow(SID_FONTWORK);
     bool bDisableFontWork = false;
 
     if (IsNoteEdit())
@@ -417,13 +417,13 @@ void ScDrawTextObjectBar::GetState( SfxItemSet& rSet )
     }
 
     if( rSet.GetItemState( SID_TRANSLITERATE_HALFWIDTH ) != 
SfxItemState::UNKNOWN )
-        ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), 
SID_TRANSLITERATE_HALFWIDTH );
+        ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), 
SID_TRANSLITERATE_HALFWIDTH );
     if( rSet.GetItemState( SID_TRANSLITERATE_FULLWIDTH ) != 
SfxItemState::UNKNOWN )
-        ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), 
SID_TRANSLITERATE_FULLWIDTH );
+        ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), 
SID_TRANSLITERATE_FULLWIDTH );
     if( rSet.GetItemState( SID_TRANSLITERATE_HIRAGANA ) != 
SfxItemState::UNKNOWN )
-        ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), 
SID_TRANSLITERATE_HIRAGANA );
+        ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), 
SID_TRANSLITERATE_HIRAGANA );
     if( rSet.GetItemState( SID_TRANSLITERATE_KATAKANA ) != 
SfxItemState::UNKNOWN )
-        ScViewUtil::HideDisabledSlot( rSet, pViewFrm->GetBindings(), 
SID_TRANSLITERATE_KATAKANA );
+        ScViewUtil::HideDisabledSlot( rSet, rViewFrm.GetBindings(), 
SID_TRANSLITERATE_KATAKANA );
 
     if ( rSet.GetItemState( SID_ENABLE_HYPHENATION ) != SfxItemState::UNKNOWN )
     {
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx 
b/sc/source/ui/drawfunc/drtxtob2.cxx
index 2f615104b62c..37629721cff4 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -135,17 +135,17 @@ void ScDrawTextObjectBar::ExecuteExtra( SfxRequest &rReq )
         case SID_FONTWORK:
             {
                 sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
-                SfxViewFrame* pViewFrm = 
mrViewData.GetViewShell()->GetViewFrame();
+                SfxViewFrame& rViewFrm = 
mrViewData.GetViewShell()->GetViewFrame();
 
                 if ( rReq.GetArgs() )
-                    pViewFrm->SetChildWindow( nId,
+                    rViewFrm.SetChildWindow( nId,
                                                static_cast<const SfxBoolItem&>(
                                                 
(rReq.GetArgs()->Get(SID_FONTWORK))).
                                                     GetValue() );
                 else
-                    pViewFrm->ToggleChildWindow( nId );
+                    rViewFrm.ToggleChildWindow( nId );
 
-                pViewFrm->GetBindings().Invalidate( SID_FONTWORK );
+                rViewFrm.GetBindings().Invalidate( SID_FONTWORK );
                 rReq.Done();
             }
             break;
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index ea5f14a820d4..9076a75ada00 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -239,7 +239,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt)
                 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
                 if( !pView->IsTextEdit() && 1 == rMarkList.GetMarkCount() )
                 {
-                    bool bOle = 
rViewShell.GetViewFrame()->GetFrame().IsInPlace();
+                    bool bOle = 
rViewShell.GetViewFrame().GetFrame().IsInPlace();
                     SdrObject* pObj = rMarkList.GetMark( 0 
)->GetMarkedSdrObj();
                     auto pOleObj = dynamic_cast<SdrOle2Obj*>(pObj);
                     if( pOleObj && !bOle )
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index cf7bd58375fc..72886789b448 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -413,7 +413,7 @@ FuInsertMedia::FuInsertMedia( ScTabViewShell&   rViewSh,
         if( pWin )
             pWin->EnterWait();
 
-        css::uno::Reference<css::frame::XDispatchProvider> 
xDispatchProvider(rViewShell.GetViewFrame()->GetFrame().GetFrameInterface(), 
css::uno::UNO_QUERY);
+        css::uno::Reference<css::frame::XDispatchProvider> 
xDispatchProvider(rViewShell.GetViewFrame().GetFrame().GetFrameInterface(), 
css::uno::UNO_QUERY);
 
         rtl::Reference<avmedia::PlayerListener> xPlayerListener(new 
avmedia::PlayerListener(
             [xDispatchProvider, aURL, bLink](const 
css::uno::Reference<css::media::XPlayer>& rPlayer){
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index e753e63214a6..f0d60b45ca19 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -235,13 +235,13 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, 
vcl::Window* pWin, ScDrawView*
     if ( nSlot == SID_INSERT_OBJECT && pNameItem )
     {
         const SvGlobalName& aClassName = pNameItem->GetValue();
-        xObj = 
rViewShell.GetViewFrame()->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject(
 aClassName.GetByteSequence(), aName );
+        xObj = 
rViewShell.GetViewFrame().GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject(
 aClassName.GetByteSequence(), aName );
     }
     else if ( nSlot == SID_INSERT_SMATH )
     {
         if ( SvtModuleOptions().IsMath() )
         {
-            xObj = 
rViewShell.GetViewFrame()->GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject(
 SvGlobalName( SO3_SM_CLASSID_60 ).GetByteSequence(), aName );
+            xObj = 
rViewShell.GetViewFrame().GetObjectShell()->GetEmbeddedObjectContainer().CreateEmbeddedObject(
 SvGlobalName( SO3_SM_CLASSID_60 ).GetByteSequence(), aName );
             rReq.AppendItem( SfxGlobalNameItem( SID_INSERT_OBJECT, 
SvGlobalName( SO3_SM_CLASSID_60 ) ) );
         }
     }
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 9695702c55e3..03fb8c4c86f5 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -340,7 +340,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
     SetMouseButtonCode(rMEvt.GetButtons());
 
     bool bReturn = FuDraw::MouseButtonUp(rMEvt);
-    bool bOle = rViewShell.GetViewFrame()->GetFrame().IsInPlace();
+    bool bOle = rViewShell.GetViewFrame().GetFrame().IsInPlace();
 
     SdrObject* pObj = nullptr;
     if (aDragTimer.IsActive() )
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 9bd670d3fa9d..7f3089fc076d 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -250,7 +250,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
                     }
 
                     pView->SetDragMode(SdrDragMode::Move);
-                    SfxBindings& rBindings = 
rViewShell.GetViewFrame()->GetBindings();
+                    SfxBindings& rBindings = 
rViewShell.GetViewFrame().GetBindings();
                     rBindings.Invalidate( SID_OBJECT_ROTATE );
                     rBindings.Invalidate( SID_OBJECT_MIRROR );
                 }
@@ -314,7 +314,7 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
     {
         pWindow->CaptureMouse();
 //      ForcePointer(&rMEvt);
-        lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
+        lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() );
     }
 
     rViewShell.SetActivePointer(pView->GetPreferredPointer(
@@ -368,7 +368,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt)
         aDragTimer.Stop();
     }
 
-    lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
+    lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() );
 
     Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
 
@@ -485,7 +485,7 @@ bool FuText::KeyInput(const KeyEvent& rKEvt)
     if ( pView->KeyInput(rKEvt, pWindow) )
     {
         bReturn = true;
-        lcl_InvalidateAttribs( rViewShell.GetViewFrame()->GetBindings() );
+        lcl_InvalidateAttribs( rViewShell.GetViewFrame().GetBindings() );
     }
     else
     {
@@ -498,7 +498,7 @@ bool FuText::KeyInput(const KeyEvent& rKEvt)
 void FuText::Activate()
 {
     pView->SetDragMode(SdrDragMode::Move);
-    SfxBindings& rBindings = rViewShell.GetViewFrame()->GetBindings();
+    SfxBindings& rBindings = rViewShell.GetViewFrame().GetBindings();
     rBindings.Invalidate( SID_OBJECT_ROTATE );
     rBindings.Invalidate( SID_OBJECT_MIRROR );
 
diff --git a/sc/source/ui/inc/ChildWindowWrapper.hxx 
b/sc/source/ui/inc/ChildWindowWrapper.hxx
index afc4a2df54c7..5fb038df27dd 100644
--- a/sc/source/ui/inc/ChildWindowWrapper.hxx
+++ b/sc/source/ui/inc/ChildWindowWrapper.hxx
@@ -34,7 +34,7 @@ public:
             SetController(pViewShell->CreateRefDialogController(pBindings, 
this, pInfo, pParentP->GetFrameWeld(), WindowID));
 
         if (pViewShell && !GetController())
-            pViewShell->GetViewFrame()->SetChildWindow( nId, false );
+            pViewShell->GetViewFrame().SetChildWindow( nId, false );
     }
 
     static std::unique_ptr<SfxChildWindow> CreateImpl(
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx 
b/sc/source/ui/miscdlgs/acredlin.cxx
index 87292fe06c1e..3ff295276ab3 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -807,13 +807,13 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, RefHandle, SvxTPFilter*, 
void)
 
     SC_MOD()->SetRefDialog( nId, true );
 
-    SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
-    ScSimpleRefDlgWrapper* pWnd = 
static_cast<ScSimpleRefDlgWrapper*>(pViewFrm->GetChildWindow( nId ));
+    SfxViewFrame& rViewFrm = pViewData->GetViewShell()->GetViewFrame();
+    ScSimpleRefDlgWrapper* pWnd = 
static_cast<ScSimpleRefDlgWrapper*>(rViewFrm.GetChildWindow( nId ));
 
     if(pWnd!=nullptr)
     {
         sal_uInt16 nAcceptId=ScAcceptChgDlgWrapper::GetChildWindowId();
-        pViewFrm->ShowChildWindow(nAcceptId,false);
+        rViewFrm.ShowChildWindow(nAcceptId,false);
         pWnd->SetCloseHdl(LINK( this, ScAcceptChgDlg,RefInfoHandle));
         pWnd->SetRefString(pTPFilter->GetRange());
         ScSimpleRefDlgWrapper::SetAutoReOpen(false);
@@ -830,17 +830,17 @@ IMPL_LINK( ScAcceptChgDlg, RefInfoHandle, const 
OUString*, pResult, void)
 
     ScSimpleRefDlgWrapper::SetAutoReOpen(true);
 
-    SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
+    SfxViewFrame& rViewFrm = pViewData->GetViewShell()->GetViewFrame();
     if (pResult)
     {
         pTPFilter->SetRange(*pResult);
         FilterHandle(pTPFilter);
 
-        pViewFrm->ShowChildWindow(nId);
+        rViewFrm.ShowChildWindow(nId);
     }
     else
     {
-        pViewFrm->SetChildWindow(nId, false);
+        rViewFrm.SetChildWindow(nId, false);
     }
 }
 
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index d3f709b2a94c..35ae45751c81 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -108,7 +108,7 @@ ScDocShell* ScContentTree::GetManualOrCurrent()
         SfxViewShell* pViewSh = SfxViewShell::Current();
         if ( pViewSh )
         {
-            SfxObjectShell* pObjSh = pViewSh->GetViewFrame()->GetObjectShell();
+            SfxObjectShell* pObjSh = pViewSh->GetViewFrame().GetObjectShell();
             pSh = dynamic_cast<ScDocShell*>( pObjSh  );
         }
     }
diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx
index 93ea182a05b3..7f743c5e6777 100644
--- a/sc/source/ui/unoobj/dispuno.cxx
+++ b/sc/source/ui/unoobj/dispuno.cxx
@@ -40,11 +40,8 @@ static uno::Reference<view::XSelectionSupplier> 
lcl_GetSelectionSupplier( const
 {
     if ( pViewShell )
     {
-        SfxViewFrame* pViewFrame = pViewShell->GetViewFrame();
-        if (pViewFrame)
-        {
-            return uno::Reference<view::XSelectionSupplier>( 
pViewFrame->GetFrame().GetController(), uno::UNO_QUERY );
-        }
+        SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+        return uno::Reference<view::XSelectionSupplier>( 
rViewFrame.GetFrame().GetController(), uno::UNO_QUERY );
     }
     return uno::Reference<view::XSelectionSupplier>();
 }
@@ -55,7 +52,7 @@ 
ScDispatchProviderInterceptor::ScDispatchProviderInterceptor(ScTabViewShell* pVi
     if ( !pViewShell )
         return;
 
-    
m_xIntercepted.set(uno::Reference<frame::XDispatchProviderInterception>(pViewShell->GetViewFrame()->GetFrame().GetFrameInterface(),
 uno::UNO_QUERY));
+    
m_xIntercepted.set(uno::Reference<frame::XDispatchProviderInterception>(pViewShell->GetViewFrame().GetFrame().GetFrameInterface(),
 uno::UNO_QUERY));
     if (m_xIntercepted.is())
     {
         osl_atomic_increment( &m_refCount );
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index ba951e95da84..8f236138b345 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -881,16 +881,16 @@ uno::Reference<datatransfer::XTransferable> 
ScModelObj::getSelection()
 
     if (ScViewData* pViewData = ScDocShell::GetViewData())
     {
-        if ( ScEditShell * pShell = dynamic_cast<ScEditShell*>( 
pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ) )
+        if ( ScEditShell * pShell = dynamic_cast<ScEditShell*>( 
pViewData->GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0) ) )
             xTransferable = pShell->GetEditView()->GetTransferable();
-        else if ( nullptr != dynamic_cast<ScDrawTextObjectBar*>( 
pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ))
+        else if ( nullptr != dynamic_cast<ScDrawTextObjectBar*>( 
pViewData->GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0) ))
         {
             ScDrawView* pView = pViewData->GetScDrawView();
             OutlinerView* pOutView = pView->GetTextEditOutlinerView();
             if (pOutView)
                 xTransferable = pOutView->GetEditView().GetTransferable();
         }
-        else if ( ScDrawShell * pDrawShell = dynamic_cast<ScDrawShell*>( 
pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ) )
+        else if ( ScDrawShell * pDrawShell = dynamic_cast<ScDrawShell*>( 
pViewData->GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0) ) )
             xTransferable = pDrawShell->GetDrawView()->CopyToTransferable();
         else
             xTransferable = pViewData->GetViewShell()->CopyToTransferable();
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 984ef70566da..ba292fb15814 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1394,10 +1394,10 @@ void ScTabViewObj::SetZoom(sal_Int16 nZoom)
     pViewSh->PaintGrid();
     pViewSh->PaintTop();
     pViewSh->PaintLeft();
-    pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
-    pViewSh->GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
-    pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_ZOOM_IN);
-    pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_ZOOM_OUT);
+    pViewSh->GetViewFrame().GetBindings().Invalidate( SID_ATTR_ZOOM );
+    pViewSh->GetViewFrame().GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
+    pViewSh->GetViewFrame().GetBindings().Invalidate(SID_ZOOM_IN);
+    pViewSh->GetViewFrame().GetBindings().Invalidate(SID_ZOOM_OUT);
 }
 
 sal_Int16 ScTabViewObj::GetZoomType() const
@@ -1836,7 +1836,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue(
     pViewSh->PaintExtras();
     pViewSh->InvalidateBorder();
 
-    SfxBindings& rBindings = pViewSh->GetViewFrame()->GetBindings();
+    SfxBindings& rBindings = pViewSh->GetViewFrame().GetBindings();
     rBindings.Invalidate( FID_TOGGLEHEADERS ); // -> check in menu
     rBindings.Invalidate( FID_TOGGLESYNTAX );
 }
@@ -2074,11 +2074,11 @@ uno::Sequence<OUString> SAL_CALL 
ScTabViewObj::getSupportedServiceNames()
 css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL 
ScTabViewObj::getTransferable()
 {
     SolarMutexGuard aGuard;
-    ScEditShell* pShell = dynamic_cast<ScEditShell*>( 
GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0)  );
+    ScEditShell* pShell = dynamic_cast<ScEditShell*>( 
GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0)  );
     if (pShell)
         return pShell->GetEditView()->GetTransferable();
 
-    ScDrawTextObjectBar* pTextShell = dynamic_cast<ScDrawTextObjectBar*>( 
GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0)  );
+    ScDrawTextObjectBar* pTextShell = dynamic_cast<ScDrawTextObjectBar*>( 
GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0)  );
     if (pTextShell)
     {
         ScViewData& rViewData = GetViewShell()->GetViewData();
@@ -2088,7 +2088,7 @@ css::uno::Reference< css::datatransfer::XTransferable > 
SAL_CALL ScTabViewObj::g
             return pOutView->GetEditView().GetTransferable();
     }
 
-    ScDrawShell* pDrawShell = dynamic_cast<ScDrawShell*>( 
GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0)  );
+    ScDrawShell* pDrawShell = dynamic_cast<ScDrawShell*>( 
GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0)  );
     if (pDrawShell)
         return pDrawShell->GetDrawView()->CopyToTransferable();
 
@@ -2098,12 +2098,12 @@ css::uno::Reference< css::datatransfer::XTransferable > 
SAL_CALL ScTabViewObj::g
 void SAL_CALL ScTabViewObj::insertTransferable( const css::uno::Reference< 
css::datatransfer::XTransferable >& xTrans )
 {
     SolarMutexGuard aGuard;
-    ScEditShell* pShell = dynamic_cast<ScEditShell*>( 
GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0)  );
+    ScEditShell* pShell = dynamic_cast<ScEditShell*>( 
GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0)  );
     if (pShell)
         pShell->GetEditView()->InsertText( xTrans, OUString(), false );
     else
     {
-        ScDrawTextObjectBar* pTextShell = dynamic_cast<ScDrawTextObjectBar*>( 
GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0)  );
+        ScDrawTextObjectBar* pTextShell = dynamic_cast<ScDrawTextObjectBar*>( 
GetViewShell()->GetViewFrame().GetDispatcher()->GetShell(0)  );
         if (pTextShell)
         {
             ScViewData& rViewData = GetViewShell()->GetViewData();
diff --git a/sc/source/ui/vba/excelvbahelper.cxx 
b/sc/source/ui/vba/excelvbahelper.cxx
index 47621647b096..3224171677e9 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -276,7 +276,7 @@ getViewFrame( const uno::Reference< frame::XModel >& xModel 
)
 {
     ScTabViewShell* pViewShell = getBestViewShell( xModel );
     if ( pViewShell )
-        return pViewShell->GetViewFrame();
+        return &pViewShell->GetViewFrame();
     return nullptr;
 }
 
diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index 6885f9b18ca1..9bc913dcc2b2 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -381,8 +381,8 @@ ScVbaWindow::getWindowState()
     sal_Int32 nwindowState = xlNormal;
     // !! TODO !! get view shell from controller
     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
-    SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame();
-    WorkWindow* pWork = static_cast<WorkWindow*>( 
pViewFrame->GetFrame().GetSystemWindow() );
+    SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+    WorkWindow* pWork = static_cast<WorkWindow*>( 
rViewFrame.GetFrame().GetSystemWindow() );
     if ( pWork )
     {
         if ( pWork -> IsMaximized())
@@ -400,8 +400,8 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate )
     _windowstate >>= nwindowState;
     // !! TODO !! get view shell from controller
     ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel );
-    SfxViewFrame* pViewFrame = pViewShell -> GetViewFrame();
-    WorkWindow* pWork = static_cast<WorkWindow*>( 
pViewFrame->GetFrame().GetSystemWindow() );
+    SfxViewFrame& rViewFrame = pViewShell->GetViewFrame();
+    WorkWindow* pWork = static_cast<WorkWindow*>( 
rViewFrame.GetFrame().GetSystemWindow() );
     if ( pWork )
     {
         if ( nwindowState == xlMaximized)
diff --git a/sc/source/ui/vba/vbaworksheets.cxx 
b/sc/source/ui/vba/vbaworksheets.cxx
index 48795cb9594c..bd552fbb03bc 100644
--- a/sc/source/ui/vba/vbaworksheets.cxx
+++ b/sc/source/ui/vba/vbaworksheets.cxx
@@ -491,7 +491,7 @@ void ScVbaWorksheets::PrintPreview( const css::uno::Any& 
/*EnableChanges*/ )
     ScTabViewShell* pViewShell = excel::getBestViewShell( mxModel );
     SfxViewFrame* pViewFrame = nullptr;
     if ( pViewShell )
-        pViewFrame = pViewShell->GetViewFrame();
+        pViewFrame = &pViewShell->GetViewFrame();
     if ( !pViewFrame )
         return;
 
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 7694061e6093..3b2e69e7364f 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -1284,7 +1284,7 @@ void ScCellShell::GetState(SfxItemSet &rSet)
                     if (rDoc.IsTabProtected(rData.GetTabNo()))
                     {
                         bool bVisible = false;
-                        SfxViewFrame* pViewFrame = ( pTabViewShell ? 
pTabViewShell->GetViewFrame() : nullptr );
+                        SfxViewFrame* pViewFrame = ( pTabViewShell ? 
&pTabViewShell->GetViewFrame() : nullptr );
                         if ( pViewFrame && pViewFrame->HasChildWindow( nWhich 
) )
                         {
                             SfxChildWindow* pChild = 
pViewFrame->GetChildWindow( nWhich );
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 88c1470bc8db..eb8cb4a18382 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -229,7 +229,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 {
     ScModule*           pScMod      = SC_MOD();
     ScTabViewShell* pTabViewShell   = GetViewData().GetViewShell();
-    SfxBindings&        rBindings   = 
pTabViewShell->GetViewFrame()->GetBindings();
+    SfxBindings&        rBindings   = 
pTabViewShell->GetViewFrame().GetBindings();
     const SfxItemSet*   pReqArgs    = rReq.GetArgs();
     sal_uInt16              nSlot       = rReq.GetSlot();
 
@@ -345,7 +345,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         pDlg->StartExecuteAsync([pDlg, 
pTabViewShell](sal_Int32 nResult){
                             if (nResult == RET_OK)
                             {
-                                SfxRequest 
aRequest(pTabViewShell->GetViewFrame(), FID_INS_CELL);
+                                SfxRequest 
aRequest(&pTabViewShell->GetViewFrame(), FID_INS_CELL);
                                 InsertCells(pTabViewShell, aRequest, 
pDlg->GetInsCellCmd());
                             }
                             pDlg->disposeOnce();
@@ -399,7 +399,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         pDlg->StartExecuteAsync([pDlg, 
pTabViewShell](sal_Int32 nResult){
                             if (nResult == RET_OK)
                             {
-                                SfxRequest 
aRequest(pTabViewShell->GetViewFrame(), FID_INS_CELL);
+                                SfxRequest 
aRequest(&pTabViewShell->GetViewFrame(), FID_INS_CELL);
                                 DeleteCells(pTabViewShell, aRequest, 
pDlg->GetDelCellCmd());
                             }
                             pDlg->disposeOnce();
@@ -930,8 +930,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_RANDOM_NUMBER_GENERATOR_DIALOG:
             {
                 sal_uInt16 nId  = 
ScRandomNumberGeneratorDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
 
@@ -940,8 +940,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_SAMPLING_DIALOG:
             {
                 sal_uInt16 nId  = ScSamplingDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -949,8 +949,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_DESCRIPTIVE_STATISTICS_DIALOG:
             {
                 sal_uInt16 nId  = 
ScDescriptiveStatisticsDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -958,8 +958,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_ANALYSIS_OF_VARIANCE_DIALOG:
             {
                 sal_uInt16 nId  = 
ScAnalysisOfVarianceDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -967,8 +967,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_CORRELATION_DIALOG:
             {
                 sal_uInt16 nId  = 
ScCorrelationDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -976,8 +976,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_COVARIANCE_DIALOG:
             {
                 sal_uInt16 nId  = 
ScCovarianceDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -985,8 +985,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_EXPONENTIAL_SMOOTHING_DIALOG:
             {
                 sal_uInt16 nId  = 
ScExponentialSmoothingDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -994,8 +994,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_MOVING_AVERAGE_DIALOG:
             {
                 sal_uInt16 nId  = 
ScMovingAverageDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -1003,8 +1003,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_REGRESSION_DIALOG:
             {
                 sal_uInt16 nId  = 
ScRegressionDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -1012,8 +1012,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_TTEST_DIALOG:
             {
                 sal_uInt16 nId  = ScTTestDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
 
@@ -1022,8 +1022,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_FTEST_DIALOG:
             {
                 sal_uInt16 nId  = ScFTestDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
 
@@ -1032,8 +1032,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_ZTEST_DIALOG:
             {
                 sal_uInt16 nId  = ScZTestDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
 
@@ -1042,8 +1042,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_CHI_SQUARE_TEST_DIALOG:
             {
                 sal_uInt16 nId  = 
ScChiSquareTestDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
 
@@ -1052,8 +1052,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_FOURIER_ANALYSIS_DIALOG:
             {
                 sal_uInt16 nId  = 
ScFourierAnalysisDialogWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
 
@@ -1065,10 +1065,10 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             if (pReqArgs && pReqArgs->HasItem(SID_SEARCH_RESULTS_DIALOG, 
&pItem))
             {
                 bool bVisible = static_cast<const 
SfxBoolItem*>(pItem)->GetValue();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
                 // The window ID should equal the slot ID, but not a biggie if 
it wasn't.
                 sal_uInt16 nId = 
sc::SearchResultsDlgWrapper::GetChildWindowId();
-                pViewFrm->SetChildWindow(nId, bVisible, false);
+                rViewFrm.SetChildWindow(nId, bVisible, false);
             }
             rReq.Done();
         }
@@ -1078,8 +1078,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_EDIT_SPARKLINE_GROUP:
         {
             sal_uInt16 nId  = sc::SparklineDialogWrapper::GetChildWindowId();
-            SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
-            SfxChildWindow* pWindow = pViewFrame->GetChildWindow(nId);
+            SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
+            SfxChildWindow* pWindow = rViewFrame.GetChildWindow(nId);
             pScMod->SetRefDialog(nId, pWindow == nullptr);
             rReq.Done();
         }
@@ -1088,8 +1088,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case SID_EDIT_SPARKLINE:
         {
             sal_uInt16 nId  = 
sc::SparklineDataRangeDialogWrapper::GetChildWindowId();
-            SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
-            SfxChildWindow* pWindow = pViewFrame->GetChildWindow(nId);
+            SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
+            SfxChildWindow* pWindow = rViewFrame.GetChildWindow(nId);
             pScMod->SetRefDialog(nId, pWindow == nullptr);
             rReq.Done();
         }
@@ -1759,8 +1759,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                                 pDlg->Insert( nFormatId, aName );
                             }
 
-                            SfxViewFrame* pViewFrame = 
pTabViewShell->GetViewFrame();
-                            auto xFrame = 
pViewFrame->GetFrame().GetFrameInterface();
+                            SfxViewFrame& rViewFrame = 
pTabViewShell->GetViewFrame();
+                            auto xFrame = 
rViewFrame.GetFrame().GetFrameInterface();
                             const OUString 
aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(xFrame));
                             auto aProperties = 
vcl::CommandInfoProvider::GetCommandProperties(".uno:PasteTextImportDialog", 
aModuleName);
                             OUString 
sLabel(vcl::CommandInfoProvider::GetTooltipLabelForCommand(aProperties));
@@ -1898,15 +1898,15 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
         case SID_SPELL_DIALOG:
             {
-                SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
+                SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
                 if( rReq.GetArgs() )
-                    pViewFrame->SetChildWindow( SID_SPELL_DIALOG,
+                    rViewFrame.SetChildWindow( SID_SPELL_DIALOG,
                         static_cast< const SfxBoolItem& >( rReq.GetArgs()->
                             Get( SID_SPELL_DIALOG ) ).GetValue() );
                 else
-                    pViewFrame->ToggleChildWindow( SID_SPELL_DIALOG );
+                    rViewFrame.ToggleChildWindow( SID_SPELL_DIALOG );
 
-                pViewFrame->GetBindings().Invalidate( SID_SPELL_DIALOG );
+                rViewFrame.GetBindings().Invalidate( SID_SPELL_DIALOG );
                 rReq.Ignore();
             }
             break;
@@ -2091,8 +2091,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             else
             {
                 sal_uInt16          nId  = 
ScNameDlgWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -2100,8 +2100,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
         case FID_ADD_NAME:
             {
                 sal_uInt16          nId  = 
ScNameDefDlgWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
             }
@@ -2131,8 +2131,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 if ( bManaged )
                 {
                     sal_uInt16 nId = 
ScCondFormatDlgWrapper::GetChildWindowId();
-                    SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                    SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                    SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                    SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                     pScMod->SetRefDialog( nId, pWnd == nullptr );
                     break;
@@ -2286,8 +2286,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                     pTabViewShell->GetPool().Put(aDlgItem);
 
                     sal_uInt16      nId      = 
ScCondFormatDlgWrapper::GetChildWindowId();
-                    SfxViewFrame*   pViewFrm = pTabViewShell->GetViewFrame();
-                    SfxChildWindow* pWnd     = pViewFrm->GetChildWindow( nId );
+                    SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                    SfxChildWindow* pWnd     = rViewFrm.GetChildWindow( nId );
 
                     pScMod->SetRefDialog( nId, pWnd == nullptr );
                 }
@@ -2298,8 +2298,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
             {
 
                 sal_uInt16          nId  = 
ScColRowNameRangesDlgWrapper::GetChildWindowId();
-                SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-                SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+                SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+                SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
 
                 pScMod->SetRefDialog( nId, pWnd == nullptr );
 
@@ -2664,8 +2664,8 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 SfxAllItemSet aSet( GetPool() );
                 aSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
                 aSet.Put( SvxFontItem( aCurFont.GetFamilyType(), 
aCurFont.GetFamilyName(), aCurFont.GetStyleName(), aCurFont.GetPitch(), 
aCurFont.GetCharSet(), GetPool().GetWhich(SID_ATTR_CHAR_FONT) ) );
-                SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
-                auto xFrame = pViewFrame->GetFrame().GetFrameInterface();
+                SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
+                auto xFrame = rViewFrame.GetFrame().GetFrameInterface();
                 ScopedVclPtr<SfxAbstractDialog> 
pDlg(pFact->CreateCharMapDialog(pTabViewShell->GetFrameWeld(), aSet, xFrame));
                 pDlg->Execute();
             }
@@ -3112,8 +3112,8 @@ void RunPivotLayoutDialog(ScModule* pScMod,
         //  start layout dialog
 
         sal_uInt16 nId  = ScPivotLayoutWrapper::GetChildWindowId();
-        SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame();
-        SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId );
+        SfxViewFrame& rViewFrm = pTabViewShell->GetViewFrame();
+        SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
         pScMod->SetRefDialog( nId, pWnd == nullptr );
     }
 }
@@ -3354,8 +3354,8 @@ void ScCellShell::ExecuteXMLSourceDialog()
     ScModule* pScMod = SC_MOD();
 
     sal_uInt16 nId = ScXMLSourceDlgWrapper::GetChildWindowId();
-    SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
-    SfxChildWindow* pWnd = pViewFrame->GetChildWindow(nId);
+    SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
+    SfxChildWindow* pWnd = rViewFrame.GetChildWindow(nId);
     pScMod->SetRefDialog(nId, pWnd == nullptr);
 }
 
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index eb6ee98de193..c34f8ce14267 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -245,10 +245,10 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
             {
                 //  check if database beamer is open
 
-                SfxViewFrame* pViewFrame = pTabViewShell->GetViewFrame();
+                SfxViewFrame& rViewFrame = pTabViewShell->GetViewFrame();
                 bool bWasOpen = false;
                 {
-                    uno::Reference<frame::XFrame> xFrame = 
pViewFrame->GetFrame().GetFrameInterface();
+                    uno::Reference<frame::XFrame> xFrame = 
rViewFrame.GetFrame().GetFrameInterface();
                     uno::Reference<frame::XFrame> xBeamerFrame = 
xFrame->findFrame(
                                                         "_beamer",
                                                         
frame::FrameSearchFlag::CHILDREN);
@@ -260,13 +260,13 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                 {
                     //  close database beamer: just forward to SfxViewFrame
 
-                    pViewFrame->ExecuteSlot( rReq );
+                    rViewFrame.ExecuteSlot( rReq );
                 }
                 else
                 {
                     //  show database beamer: SfxViewFrame call must be 
synchronous
 
-                    pViewFrame->ExecuteSlot( rReq, false );      // false = 
synchronous
+                    rViewFrame.ExecuteSlot( rReq, false );      // false = 
synchronous
 
                     //  select current database in database beamer
 
@@ -275,7 +275,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                     if (pDBData)
                         pDBData->GetImportParam( aImportParam );
 
-                    ScDBDocFunc::ShowInBeamer( aImportParam, 
pTabViewShell->GetViewFrame() );
+                    ScDBDocFunc::ShowInBeamer( aImportParam, 
&pTabViewShell->GetViewFrame() );
                 }
                 rReq.Done();        // needed because it's a toggle slot
             }
@@ -528,54 +528,51 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
 
                                     pTabViewShell->UISort( rOutParam );
 
-                                    SfxViewFrame* pViewFrm = 
pTabViewShell->GetViewFrame();
-                                    if (pViewFrm)
-                                    {
-                                        SfxRequest aRequest(pViewFrm, 
SID_SORT);
+                                    SfxViewFrame& rViewFrm = 
pTabViewShell->GetViewFrame();
+                                    SfxRequest aRequest(&rViewFrm, SID_SORT);
 
-                                        if ( rOutParam.bInplace )
+                                    if ( rOutParam.bInplace )
+                                    {
+                                        aRequest.AppendItem( SfxBoolItem( 
SID_SORT_BYROW,
+                                            rOutParam.bByRow ) );
+                                        aRequest.AppendItem( SfxBoolItem( 
SID_SORT_HASHEADER,
+                                            rOutParam.bHasHeader ) );
+                                        aRequest.AppendItem( SfxBoolItem( 
SID_SORT_CASESENS,
+                                            rOutParam.bCaseSens ) );
+                                        aRequest.AppendItem( SfxBoolItem( 
SID_SORT_NATURALSORT,
+                                                    rOutParam.bNaturalSort ) );
+                                        aRequest.AppendItem( SfxBoolItem( 
SID_SORT_INCCOMMENTS,
+                                                    
rOutParam.aDataAreaExtras.mbCellNotes ) );
+                                        aRequest.AppendItem( SfxBoolItem( 
SID_SORT_INCIMAGES,
+                                                    
rOutParam.aDataAreaExtras.mbCellDrawObjects ) );
+                                        aRequest.AppendItem( SfxBoolItem( 
SID_SORT_ATTRIBS,
+                                                    
rOutParam.aDataAreaExtras.mbCellFormats ) );
+                                        sal_uInt16 nUser = rOutParam.bUserDef 
? ( rOutParam.nUserIndex + 1 ) : 0;
+                                        aRequest.AppendItem( SfxUInt16Item( 
SID_SORT_USERDEF, nUser ) );
+                                        if ( rOutParam.maKeyState[0].bDoSort )
                                         {
-                                            aRequest.AppendItem( SfxBoolItem( 
SID_SORT_BYROW,
-                                                rOutParam.bByRow ) );
-                                            aRequest.AppendItem( SfxBoolItem( 
SID_SORT_HASHEADER,
-                                                rOutParam.bHasHeader ) );
-                                            aRequest.AppendItem( SfxBoolItem( 
SID_SORT_CASESENS,
-                                                rOutParam.bCaseSens ) );
-                                            aRequest.AppendItem( SfxBoolItem( 
SID_SORT_NATURALSORT,
-                                                        rOutParam.bNaturalSort 
) );
-                                            aRequest.AppendItem( SfxBoolItem( 
SID_SORT_INCCOMMENTS,
-                                                        
rOutParam.aDataAreaExtras.mbCellNotes ) );
-                                            aRequest.AppendItem( SfxBoolItem( 
SID_SORT_INCIMAGES,
-                                                        
rOutParam.aDataAreaExtras.mbCellDrawObjects ) );
-                                            aRequest.AppendItem( SfxBoolItem( 
SID_SORT_ATTRIBS,
-                                                        
rOutParam.aDataAreaExtras.mbCellFormats ) );
-                                            sal_uInt16 nUser = 
rOutParam.bUserDef ? ( rOutParam.nUserIndex + 1 ) : 0;
-                                            aRequest.AppendItem( 
SfxUInt16Item( SID_SORT_USERDEF, nUser ) );
-                                            if ( 
rOutParam.maKeyState[0].bDoSort )
-                                            {
-                                                aRequest.AppendItem( 
SfxInt32Item( FN_PARAM_1,
-                                                    
rOutParam.maKeyState[0].nField + 1 ) );
-                                                aRequest.AppendItem( 
SfxBoolItem( FN_PARAM_2,
-                                                    
rOutParam.maKeyState[0].bAscending ) );
-                                            }
-                                            if ( 
rOutParam.maKeyState[1].bDoSort )
-                                            {
-                                                aRequest.AppendItem( 
SfxInt32Item( FN_PARAM_3,
-                                                    
rOutParam.maKeyState[1].nField + 1 ) );
-                                                aRequest.AppendItem( 
SfxBoolItem( FN_PARAM_4,
-                                                    
rOutParam.maKeyState[1].bAscending ) );
-                                            }
-                                            if ( 
rOutParam.maKeyState[2].bDoSort )
-                                            {
-                                                aRequest.AppendItem( 
SfxInt32Item( FN_PARAM_5,
-                                                    
rOutParam.maKeyState[2].nField + 1 ) );
-                                                aRequest.AppendItem( 
SfxBoolItem( FN_PARAM_6,
-                                                    
rOutParam.maKeyState[2].bAscending ) );
-                                            }
+                                            aRequest.AppendItem( SfxInt32Item( 
FN_PARAM_1,
+                                                rOutParam.maKeyState[0].nField 
+ 1 ) );
+                                            aRequest.AppendItem( SfxBoolItem( 
FN_PARAM_2,
+                                                
rOutParam.maKeyState[0].bAscending ) );
+                                        }
+                                        if ( rOutParam.maKeyState[1].bDoSort )
+                                        {
+                                            aRequest.AppendItem( SfxInt32Item( 
FN_PARAM_3,
+                                                rOutParam.maKeyState[1].nField 
+ 1 ) );
+                                            aRequest.AppendItem( SfxBoolItem( 
FN_PARAM_4,
+                                                
rOutParam.maKeyState[1].bAscending ) );
+                                        }
+                                        if ( rOutParam.maKeyState[2].bDoSort )
+                                        {
+                                            aRequest.AppendItem( SfxInt32Item( 
FN_PARAM_5,
+                                                rOutParam.maKeyState[2].nField 
+ 1 ) );
+                                            aRequest.AppendItem( SfxBoolItem( 
FN_PARAM_6,
+                                                
rOutParam.maKeyState[2].bAscending ) );

... etc. - the rest is truncated

Reply via email to