diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-29 15:38:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-02 08:47:58 +0200 |
commit | 50c63e5c2f7962e8893e2d04b0e958209432f4c9 (patch) | |
tree | 308893225e96328c5ff5fd071a97c2110e61577b /filter | |
parent | loplugin:unusedfields improve checking for write-only fields (diff) | |
download | core-50c63e5c2f7962e8893e2d04b0e958209432f4c9.tar.gz core-50c63e5c2f7962e8893e2d04b0e958209432f4c9.zip |
pass OutlinerParaObject around by std::unique_ptr
SdrText::SetOutlinerParaObject was modified to not check for
self-assign, and instead assert because
the existing check was no longer possible.
Fix bug in SdrUndoObjSetText::Undo(), where it was calling
SdrText::SetOutlinerParaObject unnecessarily,
because NbcSetOutlinerParaObjectForText already does that.
Optimise Outliner::GetEmptyParaObject by creating a new constructor for
OutlinerParaObject,
so we don't need to copy the new object we get back from
GetEmptyTextObject, unnecessarily.
Change-Id: I57c475583d6c31658c154e24992b3d587bad9841
Reviewed-on: https://gerrit.libreoffice.org/56730
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 8 | ||||
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 7d7e5e385390..29741fa2fc3b 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -3660,10 +3660,10 @@ void SvxMSDffManager::ReadObjText( const OUString& rText, SdrObject* pObj ) rOutliner.QuickSetAttribs( aParagraphAttribs, aSelection ); nParaIndex++; } - OutlinerParaObject* pNewText = rOutliner.CreateParaObject(); + std::unique_ptr<OutlinerParaObject> pNewText = rOutliner.CreateParaObject(); rOutliner.Clear(); rOutliner.SetUpdateMode( bOldUpdateMode ); - pText->SetOutlinerParaObject( pNewText ); + pText->SetOutlinerParaObject( std::move(pNewText) ); } } @@ -4496,9 +4496,9 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r } if ( bCreateNewParaObject ) { - OutlinerParaObject* pNewText = rOutliner.CreateParaObject(); + std::unique_ptr<OutlinerParaObject> pNewText = rOutliner.CreateParaObject(); rOutliner.Init( OutlinerMode::TextObject ); - static_cast<SdrObjCustomShape*>(pRet)->NbcSetOutlinerParaObject( pNewText ); + static_cast<SdrObjCustomShape*>(pRet)->NbcSetOutlinerParaObject( std::move(pNewText) ); } } rOutliner.Clear(); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 0f36b690634b..09590554ddd3 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -2350,10 +2350,10 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* rOutliner.QuickSetAttribs( aParagraphAttribs, aSelection ); } } - OutlinerParaObject* pNewText = rOutliner.CreateParaObject(); + std::unique_ptr<OutlinerParaObject> pNewText = rOutliner.CreateParaObject(); rOutliner.Clear(); rOutliner.SetUpdateMode( bOldUpdateMode ); - pText->SetOutlinerParaObject( pNewText ); + pText->SetOutlinerParaObject( std::move(pNewText) ); } return pText; } @@ -7634,7 +7634,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, const sal_uInt32 { SdrText* pSdrText = pTable->getText( nTableIndex ); if ( pSdrText ) - pSdrText->SetOutlinerParaObject(new OutlinerParaObject(*pParaObject) ); + pSdrText->SetOutlinerParaObject(o3tl::make_unique<OutlinerParaObject>(*pParaObject) ); } } } |