From 0908c7c1184ab7acb7b6f6740a82c2f12c296fae Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 16 Feb 2023 10:42:06 +0000 Subject: SfxViewShell::GetViewFrame never returns null, change to a reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/sfx2/lokhelper.hxx | 2 +- include/sfx2/viewsh.hxx | 39 +++++++++++++++++---------------------- 2 files changed, 18 insertions(+), 23 deletions(-) (limited to 'include') 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 getInPlaceDocWindow(SfxViewShell* pViewShell); private: - static int createView(SfxViewFrame* pViewFrame, ViewShellDocId docId); + static int createView(SfxViewFrame& rViewFrame, ViewShellDocId docId); }; template 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 pImpl; - SfxViewFrame* pFrame; + SfxViewFrame& rFrame; VclPtr 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 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] + + + */ + SfxViewFrame& GetViewFrame() const + { + return rFrame; + } // Printing Interface virtual SfxPrinter* GetPrinter( bool bCreate = false ); @@ -442,26 +457,6 @@ public: void SetStoringHelper(std::shared_ptr xHelper) { m_xHelper = xHelper; } }; - -inline SfxViewFrame* SfxViewShell::GetViewFrame() const - -/* [Description] - - This method returns a pointer to the 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] - - -*/ - -{ - return pFrame; -} - #endif // INCLUDED_SFX2_VIEWSH_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit