summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2016-11-23 16:59:23 -0500
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-12-06 20:41:12 -0500
commit13b5d1944cb84586ceaa2d79fb361a58fe62446c (patch)
tree6b45cdf7b6ba7a9faa72577ceb028dd2af777005
parentd0ed70a83e86701778bf576b521203a979da6093 (diff)
Use std::unique_ptr for the input handler instance here.
Change-Id: I73024b4d49bc99fa2110f5f0f0b80f950ad57baa Reviewed-on: https://gerrit.libreoffice.org/31137 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoffice@kohei.us> (cherry picked from commit 7fe08af6b1c579dc12da836b6bcfa2f84734328a)
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx5
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx15
-rw-r--r--sc/source/ui/view/tabvwsha.cxx6
3 files changed, 14 insertions, 12 deletions
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index cf60eb656d46..9c417c2554ec 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -115,7 +115,7 @@ private:
FmFormShell* pFormShell;
- ScInputHandler* pInputHandler; // for OLE input cell
+ std::unique_ptr<ScInputHandler> mpInputHandler; // for OLE input cell
::editeng::SvxBorderLine* pCurFrameLine;
@@ -236,7 +236,8 @@ public:
bool IsRefInputMode() const;
void ExecuteInputDirect();
- ScInputHandler* GetInputHandler() const { return pInputHandler;}
+ const ScInputHandler* GetInputHandler() const { return mpInputHandler.get(); }
+ ScInputHandler* GetInputHandler() { return mpInputHandler.get(); }
void UpdateInputHandler( bool bForce = false, bool bStopEditing = true );
void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
bool TabKeyInput(const KeyEvent& rKEvt);
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 68371855f459..9889bea2b52f 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -40,6 +40,7 @@
#include <tools/urlobj.hxx>
#include <sfx2/docfile.hxx>
#include <vcl/openglwin.hxx>
+#include <o3tl/make_unique.hxx>
#include "tabvwsh.hxx"
#include "sc.hrc"
@@ -126,7 +127,7 @@ void ScTabViewShell::Activate(bool bMDI)
// RegisterNewTargetNames does not exist anymore
SfxViewFrame* pThisFrame = GetViewFrame();
- if ( pInputHandler && pThisFrame->HasChildWindow(FID_INPUTLINE_STATUS) )
+ if ( mpInputHandler && pThisFrame->HasChildWindow(FID_INPUTLINE_STATUS) )
{
// actually only required for Reload (last version):
// The InputWindow remains, but the View along with the InputHandler is newly created,
@@ -151,7 +152,7 @@ void ScTabViewShell::Activate(bool bMDI)
pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
}
- pWin->SetInputHandler( pInputHandler );
+ pWin->SetInputHandler( mpInputHandler.get() );
}
}
}
@@ -1505,7 +1506,7 @@ void ScTabViewShell::Construct( TriState nForceDesignMode )
// As an intermediate solution each View gets its own InputHandler,
// which only yields problems if two Views are in one task window.
- pInputHandler = new ScInputHandler;
+ mpInputHandler = o3tl::make_unique<ScInputHandler>();
// old version:
// if ( !GetViewFrame()->ISA(SfxTopViewFrame) ) // OLE or Plug-In
@@ -1658,7 +1659,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame,
pExtrusionBarShell(nullptr),
pFontworkBarShell(nullptr),
pFormShell(nullptr),
- pInputHandler(nullptr),
+ mpInputHandler(nullptr),
pCurFrameLine(nullptr),
aTarget(this),
pDialogDPObject(nullptr),
@@ -1768,8 +1769,8 @@ ScTabViewShell::~ScTabViewShell()
// all to NULL, in case the TabView-dtor tries to access them
//! (should not really! ??!?!)
- if (pInputHandler)
- pInputHandler->SetDocumentDisposing(true);
+ if (mpInputHandler)
+ mpInputHandler->SetDocumentDisposing(true);
DELETEZ(pFontworkBarShell);
DELETEZ(pExtrusionBarShell);
@@ -1786,7 +1787,7 @@ ScTabViewShell::~ScTabViewShell()
DELETEZ(pPivotShell);
DELETEZ(pAuditingShell);
DELETEZ(pCurFrameLine);
- DELETEZ(pInputHandler);
+ mpInputHandler.reset();
DELETEZ(pPivotSource);
DELETEZ(pDialogDPObject);
DELETEZ(pNavSettings);
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index e9055fd64484..a5672100d1b4 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -617,7 +617,7 @@ void ScTabViewShell::ExecuteInputDirect()
void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bStopEditing /* = sal_True */ )
{
- ScInputHandler* pHdl = pInputHandler ? pInputHandler : SC_MOD()->GetInputHdl();
+ ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : SC_MOD()->GetInputHdl();
if ( pHdl )
{
@@ -694,7 +694,7 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt
// if using the view's local input handler, this view can always be set
// as current view inside NotifyChange.
- ScTabViewShell* pSourceSh = pInputHandler ? this : nullptr;
+ ScTabViewShell* pSourceSh = mpInputHandler ? this : nullptr;
pHdl->NotifyChange( &aState, bForce, pSourceSh, bStopEditing );
}
@@ -707,7 +707,7 @@ void ScTabViewShell::UpdateInputHandler( bool bForce /* = sal_False */, bool bSt
void ScTabViewShell::UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust )
{
- if( ScInputHandler* pHdl = pInputHandler ? pInputHandler : SC_MOD()->GetInputHdl() )
+ if( ScInputHandler* pHdl = mpInputHandler ? mpInputHandler.get() : SC_MOD()->GetInputHdl() )
pHdl->UpdateCellAdjust( eJust );
}