sd/source/ui/inc/ViewShell.hxx | 5 -- sd/source/ui/view/viewshel.cxx | 99 ++++++++++++++++++----------------------- 2 files changed, 44 insertions(+), 60 deletions(-)
New commits: commit 27e73648aab7cb31d9315f4a1f6a570f6980b940 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue May 13 22:50:58 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed May 14 08:58:10 2025 +0200 sd: use initializer list Change-Id: Ic882597bc44b3162b107b1e929c3542056f5a00d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185280 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> Tested-by: Jenkins diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx index 56b6ae9869a1..ced1a5e48b95 100644 --- a/sd/source/ui/inc/ViewShell.hxx +++ b/sd/source/ui/inc/ViewShell.hxx @@ -556,11 +556,6 @@ private: */ ::std::unique_ptr< ::sd::WindowUpdater> mpWindowUpdater; - /** Code common to all constructors. It generally is a bad idea - to call this function from outside a constructor. - */ - void construct(); - /** Create the rulers. */ void SetupRulers(); diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 6c139827182e..d76a3ffb73f3 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -150,67 +150,26 @@ SfxViewFrame* ViewShell::GetViewFrame() const /// declare SFX-Slotmap and standard interface ViewShell::ViewShell( vcl::Window* pParentWindow, ViewShellBase& rViewShellBase) -: SfxShell(&rViewShellBase) -, mpParentWindow(pParentWindow) + : SfxShell(&rViewShellBase) + , mbHasRulers(false) + , mpActiveWindow(nullptr) + , mpView(nullptr) + , mpFrameView(nullptr) + , mpZoomList(new ZoomList( this )) + , mfLastZoomScale(0) + , mbStartShowWithDialog(false) + , mnPrintedHandoutPageNum(1) + , mnPrintedHandoutPageCount(0) + , meShellType(ST_NONE) + , mpImpl(new Implementation(*this)) + , mpParentWindow(pParentWindow) + , mpWindowUpdater(new ::sd::WindowUpdater()) { - construct(); -} - -ViewShell::~ViewShell() -{ - // Keep the content window from accessing in its destructor the - // WindowUpdater. - if (mpContentWindow) - suppress_fun_call_w_exception(mpContentWindow->SetViewShell(nullptr)); - - mpZoomList.reset(); - - mpLayerTabBar.disposeAndClear(); - - if (mpImpl->mpSubShellFactory) - GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory( - this,mpImpl->mpSubShellFactory); - - if (mpContentWindow) - { - SAL_INFO( - "sd.view", - "destroying mpContentWindow at " << mpContentWindow.get() - << " with parent " << mpContentWindow->GetParent()); - mpContentWindow.disposeAndClear(); - } - - mpVerticalRuler.disposeAndClear(); - mpHorizontalRuler.disposeAndClear(); - mpVerticalScrollBar.disposeAndClear(); - mpHorizontalScrollBar.disposeAndClear(); -} - -/** - * common initialization part of both constructors - */ -void ViewShell::construct() -{ - mbHasRulers = false; - mpActiveWindow = nullptr; - mpView = nullptr; - mpFrameView = nullptr; - mpZoomList = nullptr; - mfLastZoomScale = 0; - mbStartShowWithDialog = false; - mnPrintedHandoutPageNum = 1; - mnPrintedHandoutPageCount = 0; - mpWindowUpdater.reset( new ::sd::WindowUpdater() ); - mpImpl.reset(new Implementation(*this)); - meShellType = ST_NONE; - OSL_ASSERT (GetViewShell()!=nullptr); if (IsMainViewShell()) GetDocSh()->Connect (this); - mpZoomList.reset( new ZoomList( this ) ); - mpContentWindow.reset(VclPtr< ::sd::Window >::Create(GetParentWindow())); SetActiveWindow (mpContentWindow.get()); @@ -253,6 +212,36 @@ void ViewShell::construct() GetViewShellBase().GetViewShellManager()->AddSubShellFactory(this,mpImpl->mpSubShellFactory); } +ViewShell::~ViewShell() +{ + // Keep the content window from accessing in its destructor the + // WindowUpdater. + if (mpContentWindow) + suppress_fun_call_w_exception(mpContentWindow->SetViewShell(nullptr)); + + mpZoomList.reset(); + + mpLayerTabBar.disposeAndClear(); + + if (mpImpl->mpSubShellFactory) + GetViewShellBase().GetViewShellManager()->RemoveSubShellFactory( + this,mpImpl->mpSubShellFactory); + + if (mpContentWindow) + { + SAL_INFO( + "sd.view", + "destroying mpContentWindow at " << mpContentWindow.get() + << " with parent " << mpContentWindow->GetParent()); + mpContentWindow.disposeAndClear(); + } + + mpVerticalRuler.disposeAndClear(); + mpHorizontalRuler.disposeAndClear(); + mpVerticalScrollBar.disposeAndClear(); + mpHorizontalScrollBar.disposeAndClear(); +} + void ViewShell::doShow() { mpContentWindow->Show();