summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/app/inputhdl.cxx9
-rw-r--r--sc/source/ui/docshell/docsh5.cxx9
2 files changed, 16 insertions, 2 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 6dd8315e7b4e..1c1aaf06963d 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -4227,6 +4227,13 @@ void ScInputHandler::InputCommand( const CommandEvent& rCEvt )
}
}
+static ScInputHdlState* getLastState(const ScInputHdlState* pState)
+{
+ if (!pState)
+ return nullptr;
+ return new ScInputHdlState(*pState);
+}
+
void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
bool bForce, ScTabViewShell* pSourceSh,
bool bStopEditing)
@@ -4260,7 +4267,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
if ( pState != pLastState.get() )
{
- pLastState.reset( pState ? new ScInputHdlState( *pState ) : nullptr);
+ pLastState.reset(getLastState(pState));
}
if ( pState && pActiveViewSh )
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 63bb94408eba..1b2ddf216b9f 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -508,6 +508,13 @@ static OUString lcl_GetAreaName( ScDocument* pDoc, const ScArea* pArea )
return aName;
}
+static ScDBData* getUndoData(ScDBData* pDestData)
+{
+ if (!pDestData)
+ return nullptr;
+ return new ScDBData(*pDestData);
+}
+
void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
{
ScConsData aData;
@@ -568,7 +575,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
aData.GetSize( nColSize, nRowSize );
if (bRecord && nColSize > 0 && nRowSize > 0)
{
- std::unique_ptr<ScDBData> pUndoData(pDestData ? new ScDBData(*pDestData) : nullptr);
+ std::unique_ptr<ScDBData> pUndoData(getUndoData(pDestData));
SCTAB nDestTab = rParam.nTab;
ScArea aDestArea( rParam.nTab, rParam.nCol, rParam.nRow,