loplugin:useuniqueptr in ScSimpleEditSourceHelper

Change-Id: Iebe62753d9e6f83f985e4c55fb938d5861613898
Reviewed-on: https://gerrit.libreoffice.org/56903
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2018-07-03 09:36:24 +02:00
parent 2ddddc46fd
commit 38733c7daa
3 changed files with 14 additions and 11 deletions

View File

@ -68,6 +68,9 @@ public:
// SwRedlineData::pNext and pExtraData have complex handling // SwRedlineData::pNext and pExtraData have complex handling
if (fn == SRCDIR "/sw/source/core/doc/docredln.cxx") if (fn == SRCDIR "/sw/source/core/doc/docredln.cxx")
return; return;
// ScTempDocSource::pTempDoc
if (fn == SRCDIR "/sc/source/ui/unoobj/funcuno.cxx")
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
} }

View File

@ -293,16 +293,16 @@ public:
class ScSimpleEditSourceHelper class ScSimpleEditSourceHelper
{ {
ScEditEngineDefaulter* pEditEngine; std::unique_ptr<ScEditEngineDefaulter> pEditEngine;
SvxEditEngineForwarder* pForwarder; std::unique_ptr<SvxEditEngineForwarder> pForwarder;
ScSimpleEditSource* pOriginalSource; std::unique_ptr<ScSimpleEditSource> pOriginalSource;
public: public:
ScSimpleEditSourceHelper(); ScSimpleEditSourceHelper();
~ScSimpleEditSourceHelper(); ~ScSimpleEditSourceHelper();
ScSimpleEditSource* GetOriginalSource() const { return pOriginalSource; } ScSimpleEditSource* GetOriginalSource() const { return pOriginalSource.get(); }
ScEditEngineDefaulter* GetEditEngine() const { return pEditEngine; } ScEditEngineDefaulter* GetEditEngine() const { return pEditEngine.get(); }
}; };
class ScEditEngineTextObj : public ScSimpleEditSourceHelper, public SvxUnoText class ScEditEngineTextObj : public ScSimpleEditSourceHelper, public SvxUnoText

View File

@ -822,18 +822,18 @@ ScSimpleEditSourceHelper::ScSimpleEditSourceHelper()
pEnginePool->SetDefaultMetric( MapUnit::Map100thMM ); pEnginePool->SetDefaultMetric( MapUnit::Map100thMM );
pEnginePool->FreezeIdRanges(); pEnginePool->FreezeIdRanges();
pEditEngine = new ScFieldEditEngine(nullptr, pEnginePool, nullptr, true); // TRUE: become owner of pool pEditEngine.reset( new ScFieldEditEngine(nullptr, pEnginePool, nullptr, true) ); // TRUE: become owner of pool
pForwarder = new SvxEditEngineForwarder( *pEditEngine ); pForwarder.reset( new SvxEditEngineForwarder( *pEditEngine ) );
pOriginalSource = new ScSimpleEditSource( pForwarder ); pOriginalSource.reset( new ScSimpleEditSource( pForwarder.get() ) );
} }
ScSimpleEditSourceHelper::~ScSimpleEditSourceHelper() ScSimpleEditSourceHelper::~ScSimpleEditSourceHelper()
{ {
SolarMutexGuard aGuard; // needed for EditEngine dtor SolarMutexGuard aGuard; // needed for EditEngine dtor
delete pOriginalSource; pOriginalSource.reset();
delete pForwarder; pForwarder.reset();
delete pEditEngine; pEditEngine.reset();
} }
ScEditEngineTextObj::ScEditEngineTextObj() : ScEditEngineTextObj::ScEditEngineTextObj() :