diff options
author | Michael Stahl <mstahl@redhat.com> | 2015-07-20 17:33:40 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-07-20 22:43:27 +0200 |
commit | 1fc105cec523a081f18ca78fff43e58e3a881232 (patch) | |
tree | 6e6030e44e51668f55c6977131733c25129601a0 /sd | |
parent | 63de1888f67dc43c30d5a102651b7c2738243efb (diff) |
svtools: change these SvTreeListEntry functions to unique_ptr
... parameters to make it clear that they take ownership.
Change-Id: I572c5fa6268438a86d0a4fa1d2aef15382cb5607
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/animations/CustomAnimationList.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/dlg/dlgassim.cxx | 19 | ||||
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 4 |
3 files changed, 22 insertions, 13 deletions
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 670895acbad4..7789f4bb7485 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -621,11 +621,13 @@ void CustomAnimationList::update() if( xShape.is() ) { SvTreeListEntry* pLBoxEntry = new CustomAnimationListEntry; - pLBoxEntry->AddItem( new SvLBoxContextBmp( pLBoxEntry, 0, Image(), Image(), false)); + pLBoxEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>( + new SvLBoxContextBmp(pLBoxEntry, 0, Image(), Image(), false))); OUString aDescription = SD_RESSTR(STR_CUSTOMANIMATION_TRIGGER); aDescription += ": "; aDescription += getShapeDescription( xShape, false ); - pLBoxEntry->AddItem( new CustomAnimationTriggerEntryItem( pLBoxEntry, 0, aDescription ) ); + pLBoxEntry->AddItem(std::unique_ptr<CustomAnimationTriggerEntryItem>( + new CustomAnimationTriggerEntryItem(pLBoxEntry, 0, aDescription))); Insert( pLBoxEntry ); SvViewDataEntry* pViewData = GetViewData( pLBoxEntry ); if( pViewData ) @@ -729,8 +731,10 @@ void CustomAnimationList::append( CustomAnimationEffectPtr pEffect ) // create an entry for the effect SvTreeListEntry* pEntry = new CustomAnimationListEntry( pEffect ); - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false)); - pEntry->AddItem( new CustomAnimationListEntryItem( pEntry, 0, aDescription, pEffect, this ) ); + pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp( + pEntry, 0, Image(), Image(), false))); + pEntry->AddItem(std::unique_ptr<CustomAnimationListEntryItem>( + new CustomAnimationListEntryItem(pEntry, 0, aDescription, pEffect, this))); if( pParentEntry ) { diff --git a/sd/source/ui/dlg/dlgassim.cxx b/sd/source/ui/dlg/dlgassim.cxx index fdbf21c662f5..ffc77b863187 100644 --- a/sd/source/ui/dlg/dlgassim.cxx +++ b/sd/source/ui/dlg/dlgassim.cxx @@ -96,10 +96,12 @@ SvTreeListEntry* SdPageListControl::InsertPage( const OUString& rPageName ) { SvTreeListEntry* pEntry = new SvTreeListEntry; - pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, - 0, m_pCheckButton)); - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false)); // otherwise boom! - pEntry->AddItem( new SvLBoxString( pEntry, 0, rPageName ) ); + pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton( + pEntry, SvLBoxButtonKind_enabledCheckbox, 0, m_pCheckButton))); + pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp( + pEntry, 0, Image(), Image(), false))); // otherwise boom! + pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString( + pEntry, 0, rPageName))); GetModel()->Insert( pEntry ); @@ -109,9 +111,12 @@ SvTreeListEntry* SdPageListControl::InsertPage( const OUString& rPageName ) void SdPageListControl::InsertTitle( SvTreeListEntry* pParent, const OUString& rTitle ) { SvTreeListEntry* pEntry = new SvTreeListEntry; - pEntry->AddItem( new SvLBoxString( pEntry, 0, OUString() ) ); - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false)); // otherwise boom! - pEntry->AddItem( new SvLBoxString( pEntry, 0, rTitle ) ); + pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString( + pEntry, 0, OUString()))); + pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp( + pEntry, 0, Image(), Image(), false))); // otherwise boom! + pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString( + pEntry, 0, rTitle))); GetModel()->Insert( pEntry,pParent ); } diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 46493a4e7201..9282a4788b34 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -374,8 +374,8 @@ void SdPageObjsTLB::InitEntry(SvTreeListEntry* pEntry, sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2" SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite )); - SvLBoxString* pStr = new SvLBoxString( pEntry, 0, rCol.GetText() ); - pEntry->ReplaceItem( pStr, nColToHilite ); + std::unique_ptr<SvLBoxString> pStr(new SvLBoxString(pEntry, 0, rCol.GetText())); + pEntry->ReplaceItem(std::move(pStr), nColToHilite ); } void SdPageObjsTLB::SaveExpandedTreeItemState(SvTreeListEntry* pEntry, std::vector<OUString>& vectTreeItem) |