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 /sc | |
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 'sc')
-rw-r--r-- | sc/source/ui/miscdlgs/solveroptions.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/navipi/content.cxx | 4 |
2 files changed, 16 insertions, 10 deletions
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 579c08c6055a..66446d5d54cd 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -264,22 +264,28 @@ void ScSolverOptionsDialog::FillListBox() { // check box entry pEntry = new SvTreeListEntry; - SvLBoxButton* pButton = new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, mpCheckButtonData ); + std::unique_ptr<SvLBoxButton> pButton(new SvLBoxButton( + pEntry, SvLBoxButtonKind_enabledCheckbox, 0, mpCheckButtonData)); if ( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ) pButton->SetStateChecked(); else pButton->SetStateUnchecked(); - pEntry->AddItem( pButton ); - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false ) ); - pEntry->AddItem( new SvLBoxString( pEntry, 0, aVisName ) ); + pEntry->AddItem(std::move(pButton)); + pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>( + new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false))); + pEntry->AddItem(std::unique_ptr<SvLBoxString>( + new SvLBoxString( pEntry, 0, aVisName))); } else { // value entry pEntry = new SvTreeListEntry; - pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty ) ); // empty column - pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false ) ); - ScSolverOptionsString* pItem = new ScSolverOptionsString( pEntry, 0, aVisName ); + pEntry->AddItem(std::unique_ptr<SvLBoxString>( + new SvLBoxString(pEntry, 0, sEmpty))); // empty column + pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>( + new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false))); + std::unique_ptr<ScSolverOptionsString> pItem( + new ScSolverOptionsString(pEntry, 0, aVisName)); if ( eClass == uno::TypeClass_DOUBLE ) { double fDoubleValue = 0.0; @@ -292,7 +298,7 @@ void ScSolverOptionsDialog::FillListBox() if ( aValue >>= nIntValue ) pItem->SetIntValue( nIntValue ); } - pEntry->AddItem( pItem ); + pEntry->AddItem(std::move(pItem)); } pModel->Insert( pEntry ); } diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index c8d8a0fa184f..106cb58f1dcd 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -1681,8 +1681,8 @@ void ScContentTree::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); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |