diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-11 11:19:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-12 13:04:37 +0200 |
commit | 61dd9cafab20af893204deaca81ef26c1e7f7bb0 (patch) | |
tree | 295d290223a484138c2bea2f7e000e274815794a /editeng/source | |
parent | e722564d40143fa029fe10d22a625539c795ee04 (diff) |
make SvxEditSource::Clone return std::unique_ptr
Change-Id: If0d93024a642cc80a2a84d0c15525af1c0596546
Reviewed-on: https://gerrit.libreoffice.org/52715
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/uno/unoedprx.cxx | 6 | ||||
-rw-r--r-- | editeng/source/uno/unotext.cxx | 9 | ||||
-rw-r--r-- | editeng/source/uno/unotext2.cxx | 5 | ||||
-rw-r--r-- | editeng/source/xml/editsource.hxx | 2 | ||||
-rw-r--r-- | editeng/source/xml/xmltxtexp.cxx | 4 |
5 files changed, 14 insertions, 12 deletions
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index c17c97971658..2ebc9bf56a01 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -300,7 +300,7 @@ SvxEditSourceAdapter::~SvxEditSourceAdapter() { } -SvxEditSource* SvxEditSourceAdapter::Clone() const +std::unique_ptr<SvxEditSource> SvxEditSourceAdapter::Clone() const { if( mbEditSourceValid && mpAdaptee.get() ) { @@ -308,9 +308,9 @@ SvxEditSource* SvxEditSourceAdapter::Clone() const if( pClonedAdaptee.get() ) { - SvxEditSourceAdapter* pClone = new SvxEditSourceAdapter(); + std::unique_ptr<SvxEditSourceAdapter> pClone(new SvxEditSourceAdapter()); pClone->SetEditSource( std::move(pClonedAdaptee) ); - return pClone; + return std::unique_ptr< SvxEditSource >(pClone.release()); } } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 09805ce0705d..39cff94eb2d6 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -219,7 +219,7 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase(const SvxEditSource* pSource, const Svx DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!"); - mpEditSource.reset( pSource->Clone() ); + mpEditSource = pSource->Clone(); if (mpEditSource != nullptr) { ESelection aSelection; @@ -244,7 +244,8 @@ SvxUnoTextRangeBase::SvxUnoTextRangeBase(const SvxUnoTextRangeBase& rRange) { SolarMutexGuard aGuard; - mpEditSource.reset( rRange.mpEditSource ? rRange.mpEditSource->Clone() : nullptr ); + if (rRange.mpEditSource) + mpEditSource = rRange.mpEditSource->Clone(); SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : nullptr; if( pForwarder ) @@ -2291,9 +2292,9 @@ SvxDummyTextSource::~SvxDummyTextSource() { }; -SvxEditSource* SvxDummyTextSource::Clone() const +std::unique_ptr<SvxEditSource> SvxDummyTextSource::Clone() const { - return new SvxDummyTextSource; + return std::unique_ptr<SvxEditSource>(new SvxDummyTextSource); } SvxTextForwarder* SvxDummyTextSource::GetTextForwarder() diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx index 9c2c26151cfd..09c178e8c434 100644 --- a/editeng/source/uno/unotext2.cxx +++ b/editeng/source/uno/unotext2.cxx @@ -45,7 +45,7 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase { mxParentText = const_cast<SvxUnoTextBase*>(&_rText); if( mrText.GetEditSource() ) - mpEditSource.reset( mrText.GetEditSource()->Clone() ); + mpEditSource = mrText.GetEditSource()->Clone(); mnNextParagraph = 0; for( sal_Int32 currentPara = 0; currentPara < mrText.GetEditSource()->GetTextForwarder()->GetParagraphCount(); currentPara++ ) { @@ -384,7 +384,8 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rTe mnNextPortion( 0 ), mnSel( rSel ) { - mpEditSource.reset( rText.GetEditSource() ? rText.GetEditSource()->Clone() : nullptr ); + if (rText.GetEditSource()) + mpEditSource = rText.GetEditSource()->Clone(); if( mpEditSource && mpEditSource->GetTextForwarder() && (mnParagraph == mnSel.nStartPara && mnParagraph == mnSel.nEndPara) ) { diff --git a/editeng/source/xml/editsource.hxx b/editeng/source/xml/editsource.hxx index 335427808690..51d5fc968976 100644 --- a/editeng/source/xml/editsource.hxx +++ b/editeng/source/xml/editsource.hxx @@ -31,7 +31,7 @@ public: explicit SvxEditEngineSource( EditEngine* pEditEngine ); virtual ~SvxEditEngineSource() override; - virtual SvxEditSource* Clone() const override; + virtual std::unique_ptr<SvxEditSource> Clone() const override; virtual SvxTextForwarder* GetTextForwarder() override; virtual void UpdateData() override; diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index 083d23626bd8..0f4e59ebefcb 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -108,9 +108,9 @@ SvxEditEngineSource::~SvxEditEngineSource() { } -SvxEditSource* SvxEditEngineSource::Clone() const +std::unique_ptr<SvxEditSource> SvxEditEngineSource::Clone() const { - return new SvxEditEngineSource( mxImpl.get() ); + return std::unique_ptr<SvxEditSource>(new SvxEditEngineSource( mxImpl.get() )); } SvxTextForwarder* SvxEditEngineSource::GetTextForwarder() |