diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-17 10:11:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 05:39:18 +0000 |
commit | 9767537e22e178eb23872de138ea70e57c1a6725 (patch) | |
tree | 5abf4eee091215affc75477b08def703188de513 /sc/source/ui/unoobj/fielduno.cxx | |
parent | 7c817d73402583f1b077d31a695c565a53468887 (diff) |
new loplugin: useuniqueptr: sc part 2
Change-Id: I37936a297027313e2a8ae18f355567462955739e
Reviewed-on: https://gerrit.libreoffice.org/33203
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj/fielduno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index e67e93822e21..d397e05c0a10 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -165,16 +165,16 @@ enum ScUnoCollectMode class ScUnoEditEngine : public ScEditEngineDefaulter { ScUnoCollectMode eMode; - sal_uInt16 nFieldCount; + sal_uInt16 nFieldCount; sal_Int32 mnFieldType; - SvxFieldData* pFound; // lokale Kopie + std::unique_ptr<SvxFieldData> + pFound; // lokale Kopie sal_Int32 nFieldPar; sal_Int32 nFieldPos; - sal_uInt16 nFieldIndex; + sal_uInt16 nFieldIndex; public: explicit ScUnoEditEngine(ScEditEngineDefaulter* pSource); - virtual ~ScUnoEditEngine() override; virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor ) override; @@ -202,11 +202,6 @@ ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource) delete pData; } -ScUnoEditEngine::~ScUnoEditEngine() -{ - delete pFound; -} - OUString ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rTxtColor, Color*& rFldColor ) { @@ -220,14 +215,14 @@ OUString ScUnoEditEngine::CalcFieldValue( const SvxFieldItem& rField, { if ( eMode == SC_UNO_COLLECT_FINDINDEX && !pFound && nFieldCount == nFieldIndex ) { - pFound = pFieldData->Clone(); + pFound.reset( pFieldData->Clone() ); nFieldPar = nPara; nFieldPos = nPos; } if ( eMode == SC_UNO_COLLECT_FINDPOS && !pFound && nPara == nFieldPar && nPos == nFieldPos ) { - pFound = pFieldData->Clone(); + pFound.reset( pFieldData->Clone() ); nFieldIndex = nFieldCount; } ++nFieldCount; @@ -257,7 +252,7 @@ SvxFieldData* ScUnoEditEngine::FindByIndex(sal_uInt16 nIndex) UpdateFields(); eMode = SC_UNO_COLLECT_NONE; - return pFound; + return pFound.get(); } SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int32 nType) @@ -271,7 +266,7 @@ SvxFieldData* ScUnoEditEngine::FindByPos(sal_Int32 nPar, sal_Int32 nPos, sal_Int mnFieldType = text::textfield::Type::UNSPECIFIED; eMode = SC_UNO_COLLECT_NONE; - return pFound; + return pFound.get(); } ScCellFieldsObj::ScCellFieldsObj( @@ -1129,13 +1124,12 @@ void ScEditFieldObj::InitDoc( mpData.reset(); aSelection = rSel; - mpEditSource = pEditSrc; + mpEditSource.reset( pEditSrc ); } } ScEditFieldObj::~ScEditFieldObj() { - delete mpEditSource; } SvxFieldItem ScEditFieldObj::CreateFieldItem() |