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 /svx/source | |
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 'svx/source')
-rw-r--r-- | svx/source/dialog/ctredlin.cxx | 15 | ||||
-rw-r--r-- | svx/source/dialog/docrecovery.cxx | 5 | ||||
-rw-r--r-- | svx/source/dialog/fontlb.cxx | 10 | ||||
-rw-r--r-- | svx/source/form/filtnav.cxx | 9 |
4 files changed, 24 insertions, 15 deletions
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 1f05706d4c2e..602a7c2a76b8 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -343,18 +343,22 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, { if (nTreeFlags & SvTreeFlags::CHKBTN) { - pEntry->AddItem(new SvLBoxButton(pEntry, eButtonKind, 0, pCheckButtonData)); + pEntry->AddItem(std::unique_ptr<SvLBoxButton>( + new SvLBoxButton(pEntry, eButtonKind, 0, pCheckButtonData))); } - pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, rColl, rExp, true)); + pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>( + new SvLBoxContextBmp(pEntry, 0, rColl, rExp, true))); // the type of the change assert((rStr.isEmpty() && !!maEntryImage) || (!rStr.isEmpty() && !maEntryImage)); if (rStr.isEmpty()) - pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, maEntryImage, maEntryImage, true)); + pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp( + pEntry, 0, maEntryImage, maEntryImage, true))); else - pEntry->AddItem(new SvLBoxColorString(pEntry, 0, rStr, maEntryColor)); + pEntry->AddItem(std::unique_ptr<SvLBoxColorString>( + new SvLBoxColorString(pEntry, 0, rStr, maEntryColor))); // the change tracking entries sal_Int32 nIndex = 0; @@ -362,7 +366,8 @@ void SvxRedlinTable::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, for (sal_uInt16 nToken = 0; nToken < nCount; nToken++) { const OUString aToken = GetToken(maEntryString, nIndex); - pEntry->AddItem(new SvLBoxColorString(pEntry, 0, aToken, maEntryColor)); + pEntry->AddItem(std::unique_ptr<SvLBoxColorString>( + new SvLBoxColorString(pEntry, 0, aToken, maEntryColor))); } } diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 7b9d2fea288a..9ca770c83ce2 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -848,8 +848,9 @@ void RecovDocList::InitEntry(SvTreeListEntry* pEntry, DBG_ASSERT( TabCount() == 2, "*RecovDocList::InitEntry(): structure missmatch" ); SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem(2)); - RecovDocListEntry* p = new RecovDocListEntry(pEntry, 0, rCol.GetText()); - pEntry->ReplaceItem(p, 2); + std::unique_ptr<RecovDocListEntry> p( + new RecovDocListEntry(pEntry, 0, rCol.GetText())); + pEntry->ReplaceItem(std::move(p), 2); } diff --git a/svx/source/dialog/fontlb.cxx b/svx/source/dialog/fontlb.cxx index 11eab21aa453..60845d963156 100644 --- a/svx/source/dialog/fontlb.cxx +++ b/svx/source/dialog/fontlb.cxx @@ -136,10 +136,12 @@ void SvxFontListBox::InitEntry( if( mbUseFont ) { if( nTreeFlags & SvTreeFlags::CHKBTN ) - pEntry->AddItem( new SvLBoxButton( pEntry, eButtonKind, 0, - pCheckButtonData ) ); - pEntry->AddItem( new SvLBoxContextBmp(pEntry, 0, rCollImg, rExpImg, true) ); - pEntry->AddItem( new SvLBoxFontString( pEntry, 0, rEntryText, maEntryFont, mpEntryColor ) ); + pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton( + pEntry, eButtonKind, 0, pCheckButtonData))); + pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp( + pEntry, 0, rCollImg, rExpImg, true))); + pEntry->AddItem(std::unique_ptr<SvLBoxFontString>(new SvLBoxFontString( + pEntry, 0, rEntryText, maEntryFont, mpEntryColor))); } else SvTreeListBox::InitEntry( pEntry, rEntryText, rCollImg, rExpImg, diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 7c0eccecdc40..f601b247af90 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -1411,15 +1411,16 @@ void FmFilterNavigator::InitEntry(SvTreeListEntry* pEntry, SvLBoxButtonKind eButtonKind) { SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); - SvLBoxString* pString = NULL; + std::unique_ptr<SvLBoxString> pString; if (static_cast<FmFilterData*>(pEntry->GetUserData())->ISA(FmFilterItem)) - pString = new FmFilterString(pEntry, 0, rStr, static_cast<FmFilterItem*>(pEntry->GetUserData())->GetFieldName()); + pString.reset(new FmFilterString(pEntry, 0, rStr, + static_cast<FmFilterItem*>(pEntry->GetUserData())->GetFieldName())); else if (static_cast<FmFilterData*>(pEntry->GetUserData())->ISA(FmFilterItems)) - pString = new FmFilterItemsString(pEntry, 0, rStr ); + pString.reset(new FmFilterItemsString(pEntry, 0, rStr)); if (pString) - pEntry->ReplaceItem( pString, 1 ); + pEntry->ReplaceItem(std::move(pString), 1 ); } |