Kaydet (Commit) 4633d3d5 authored tarafından Kohei Yoshida's avatar Kohei Yoshida Kaydeden (comit) Kohei Yoshida

Use std::unique_ptr for these guys.

Change-Id: I36510129f95548db3b156025a1bfe631577ec610
Reviewed-on: https://gerrit.libreoffice.org/37267Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKohei Yoshida <libreoffice@kohei.us>
üst a7f1df96
...@@ -2603,8 +2603,8 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) ...@@ -2603,8 +2603,8 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
bool bMatrix = ( nBlockMode == ScEnterMode::MATRIX ); bool bMatrix = ( nBlockMode == ScEnterMode::MATRIX );
SfxApplication* pSfxApp = SfxGetpApp(); SfxApplication* pSfxApp = SfxGetpApp();
EditTextObject* pObject = nullptr; std::unique_ptr<EditTextObject> pObject;
ScPatternAttr* pCellAttrs = nullptr; std::unique_ptr<ScPatternAttr> pCellAttrs;
bool bForget = false; // Remove due to validity? bool bForget = false; // Remove due to validity?
OUString aString = GetEditText(mpEditEngine.get()); OUString aString = GetEditText(mpEditEngine.get());
...@@ -2742,7 +2742,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) ...@@ -2742,7 +2742,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
if ( pCommonAttrs ) if ( pCommonAttrs )
{ {
ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument(); ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument();
pCellAttrs = new ScPatternAttr( pDoc->GetPool() ); pCellAttrs = o3tl::make_unique<ScPatternAttr>(pDoc->GetPool());
pCellAttrs->GetFromEditItemSet( pCommonAttrs ); pCellAttrs->GetFromEditItemSet( pCommonAttrs );
delete pCommonAttrs; delete pCommonAttrs;
} }
...@@ -2798,7 +2798,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) ...@@ -2798,7 +2798,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
if (bAttrib) if (bAttrib)
{ {
mpEditEngine->ClearSpellErrors(); mpEditEngine->ClearSpellErrors();
pObject = mpEditEngine->CreateTextObject(); pObject.reset(mpEditEngine->CreateTextObject());
} }
else if (bAutoComplete) // Adjust Upper/Lower case else if (bAutoComplete) // Adjust Upper/Lower case
{ {
...@@ -2893,7 +2893,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) ...@@ -2893,7 +2893,7 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
ScInputStatusItem aItem( FID_INPUTLINE_STATUS, ScInputStatusItem aItem( FID_INPUTLINE_STATUS,
aCursorPos, aCursorPos, aCursorPos, aCursorPos, aCursorPos, aCursorPos,
aString, pObject ); aString, pObject.get() );
if (!aMisspellRanges.empty()) if (!aMisspellRanges.empty())
aItem.SetMisspellRanges(&aMisspellRanges); aItem.SetMisspellRanges(&aMisspellRanges);
...@@ -2917,9 +2917,6 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) ...@@ -2917,9 +2917,6 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
pExecuteSh->AdjustBlockHeight(); pExecuteSh->AdjustBlockHeight();
} }
delete pCellAttrs;
delete pObject;
HideTip(); HideTip();
HideTipBelow(); HideTipBelow();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment