summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-07-20 17:33:40 +0200
committerMichael Stahl <mstahl@redhat.com>2015-07-20 22:43:27 +0200
commit1fc105cec523a081f18ca78fff43e58e3a881232 (patch)
tree6e6030e44e51668f55c6977131733c25129601a0
parentsvtools: replace boost::ptr_vector with std::vector<std::unique_ptr> (diff)
downloadcore-1fc105cec523a081f18ca78fff43e58e3a881232.tar.gz
core-1fc105cec523a081f18ca78fff43e58e3a881232.zip
svtools: change these SvTreeListEntry functions to unique_ptr
... parameters to make it clear that they take ownership. Change-Id: I572c5fa6268438a86d0a4fa1d2aef15382cb5607
-rw-r--r--basctl/source/basicide/moduldl2.cxx5
-rw-r--r--cui/source/customize/acccfg.cxx10
-rw-r--r--cui/source/customize/cfg.cxx2
-rw-r--r--cui/source/customize/macropg.cxx10
-rw-r--r--cui/source/dialogs/thesdlg.cxx9
-rw-r--r--cui/source/options/fontsubs.cxx23
-rw-r--r--cui/source/options/optHeaderTabListbox.cxx5
-rw-r--r--cui/source/options/optaboutconfig.cxx52
-rw-r--r--cui/source/options/optfltr.cxx19
-rw-r--r--cui/source/options/optlingu.cxx20
-rw-r--r--cui/source/tabpages/autocdlg.cxx27
-rw-r--r--cui/source/tabpages/macroass.cxx5
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx4
-rw-r--r--dbaccess/source/ui/control/tabletree.cxx3
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx4
-rw-r--r--include/svtools/treelistentry.hxx4
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx22
-rw-r--r--sc/source/ui/navipi/content.cxx4
-rw-r--r--sd/source/ui/animations/CustomAnimationList.cxx12
-rw-r--r--sd/source/ui/dlg/dlgassim.cxx19
-rw-r--r--sd/source/ui/dlg/sdtreelb.cxx4
-rw-r--r--sfx2/source/dialog/templdlg.cxx10
-rw-r--r--svtools/source/contnr/svtabbx.cxx4
-rw-r--r--svtools/source/contnr/treelistbox.cxx18
-rw-r--r--svtools/source/contnr/treelistentry.cxx10
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx11
-rw-r--r--svx/source/dialog/ctredlin.cxx15
-rw-r--r--svx/source/dialog/docrecovery.cxx5
-rw-r--r--svx/source/dialog/fontlb.cxx10
-rw-r--r--svx/source/form/filtnav.cxx9
-rw-r--r--sw/source/uibase/utlui/content.cxx5
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx5
32 files changed, 215 insertions, 150 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 25bee8a36814..af0e8d3a0c55 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -253,8 +253,9 @@ void CheckBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rTxt,
for ( sal_uInt16 nCol = 1; nCol < nCount; ++nCol )
{
SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nCol ));
- LibLBoxString* pStr = new LibLBoxString( pEntry, 0, rCol.GetText() );
- pEntry->ReplaceItem( pStr, nCol );
+ std::unique_ptr<LibLBoxString> pStr(
+ new LibLBoxString( pEntry, 0, rCol.GetText()));
+ pEntry->ReplaceItem(std::move(pStr), nCol);
}
}
}
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 6db36dc1bb29..aed91331eee1 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -911,11 +911,13 @@ void SfxAcceleratorConfigPage::CreateCustomItems(SvTreeListEntry* pEntry,
const OUString& sCol1 ,
const OUString& sCol2)
{
- SfxAccCfgLBoxString_Impl* pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1);
- pEntry->ReplaceItem(pStringItem, 1);
+ std::unique_ptr<SfxAccCfgLBoxString_Impl> pStringItem1(
+ new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol1));
+ pEntry->ReplaceItem(std::move(pStringItem1), 1);
- pStringItem = new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2);
- pEntry->ReplaceItem(pStringItem, 2);
+ std::unique_ptr<SfxAccCfgLBoxString_Impl> pStringItem2(
+ new SfxAccCfgLBoxString_Impl(pEntry, 0, sCol2));
+ pEntry->ReplaceItem(std::move(pStringItem2), 2);
}
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 8e9f09476684..6ad019326631 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2105,7 +2105,7 @@ SvTreeListEntry* SvxConfigPage::InsertEntryIntoUI(
{
// add new popup painter, it gets destructed by the entry
pNewEntry->ReplaceItem(
- new PopupPainter( pNewEntry, aName ),
+ std::unique_ptr<PopupPainter>(new PopupPainter(pNewEntry, aName)),
pNewEntry->ItemCount() - 1 );
}
}
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index 0e14b0fc2397..812f5fd97cad 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -554,8 +554,9 @@ void _SvxMacroTabPage::DisplayAppEvents( bool appEvents)
OUString* pEventName = new OUString( sEventName );
_pE->SetUserData( static_cast<void*>(pEventName) );
OUString sNew( eventURL );
- _pE->ReplaceItem( new IconLBoxString( _pE, 0, sNew,
- &mpImpl->aMacroImg, &mpImpl->aComponentImg ), LB_MACROS_ITEMPOS );
+ _pE->ReplaceItem(std::unique_ptr<IconLBoxString>(new IconLBoxString(
+ _pE, 0, sNew, &mpImpl->aMacroImg, &mpImpl->aComponentImg)),
+ LB_MACROS_ITEMPOS );
rListBox.GetModel()->InvalidateEntry( _pE );
rListBox.Select( _pE );
rListBox.MakeVisible( _pE );
@@ -701,8 +702,9 @@ long _SvxMacroTabPage::GenericHandler_Impl( _SvxMacroTabPage* pThis, PushButton*
// update the listbox entry
pImpl->pEventLB->SetUpdateMode( false );
- pE->ReplaceItem( new IconLBoxString( pE, 0, sEventURL,
- &pImpl->aMacroImg, &pImpl->aComponentImg ), LB_MACROS_ITEMPOS );
+ pE->ReplaceItem(std::unique_ptr<IconLBoxString>(new IconLBoxString(
+ pE, 0, sEventURL, &pImpl->aMacroImg, &pImpl->aComponentImg)),
+ LB_MACROS_ITEMPOS );
rListBox.GetModel()->InvalidateEntry( pE );
rListBox.Select( pE );
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index c346935c2c79..21c9323c4e27 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -230,10 +230,13 @@ SvTreeListEntry * ThesaurusAlternativesCtrl::AddEntry( sal_Int32 nVal, const OUS
{
aText = OUString::number( nVal ) + ". ";
}
- pEntry->AddItem( new SvLBoxString( pEntry, 0, OUString() ) ); // add empty column
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString(pEntry, 0, OUString()))); // add empty column
aText += rText;
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false ) ); // otherwise crash
- pEntry->AddItem( new AlternativesString( *this, pEntry, 0, aText ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+ new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false))); // otherwise crash
+ pEntry->AddItem(std::unique_ptr<AlternativesString>(
+ new AlternativesString( *this, pEntry, 0, aText)));
SetExtraData( pEntry, AlternativesExtraData( rText, bIsHeader ) );
GetModel()->Insert( pEntry );
diff --git a/cui/source/options/fontsubs.cxx b/cui/source/options/fontsubs.cxx
index f3888b6474bb..7874a065a23e 100644
--- a/cui/source/options/fontsubs.cxx
+++ b/cui/source/options/fontsubs.cxx
@@ -121,17 +121,18 @@ SvTreeListEntry* SvxFontSubstTabPage::CreateEntry(OUString& rFont1, OUString& rF
if( !pCheckButtonData )
pCheckButtonData = new SvLBoxButtonData( m_pCheckLB );
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false)); // Sonst Puff!
-
- pEntry->AddItem( new SvLBoxButton( pEntry,
- SvLBoxButtonKind_enabledCheckbox, 0,
- pCheckButtonData ) );
- pEntry->AddItem( new SvLBoxButton( pEntry,
- SvLBoxButtonKind_enabledCheckbox, 0,
- pCheckButtonData ) );
-
- pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont1 ) );
- pEntry->AddItem( new SvLBoxString( pEntry, 0, rFont2 ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+ pEntry, 0, Image(), Image(), false))); // otherwise boom!
+
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry,
+ SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry,
+ SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
+
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+ pEntry, 0, rFont1)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+ pEntry, 0, rFont2)));
return pEntry;
}
diff --git a/cui/source/options/optHeaderTabListbox.cxx b/cui/source/options/optHeaderTabListbox.cxx
index 09c8e7e17c16..11eacd707df1 100644
--- a/cui/source/options/optHeaderTabListbox.cxx
+++ b/cui/source/options/optHeaderTabListbox.cxx
@@ -71,8 +71,9 @@ void OptHeaderTabListBox::InitEntry( SvTreeListEntry* pEntry, const OUString& rT
{
// initialize all columns with own class (column 0 == Bitmap)
SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nCol ));
- OptLBoxString_Impl* pStr = new OptLBoxString_Impl( pEntry, 0, rCol.GetText() );
- pEntry->ReplaceItem( pStr, nCol );
+ std::unique_ptr<OptLBoxString_Impl> pStr(
+ new OptLBoxString_Impl(pEntry, 0, rCol.GetText()));
+ pEntry->ReplaceItem(std::move(pStr), nCol);
}
}
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index 2d74ce25c4d2..a87d8098509a 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -202,11 +202,12 @@ void CuiAboutConfigTabPage::InsertEntry(const OUString& rPropertyPath, const OUS
bool bInsertToPrefBox)
{
SvTreeListEntry* pEntry = new SvTreeListEntry;
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false)); //It is needed, otherwise causes crash
- pEntry->AddItem( new SvLBoxString( pEntry, 0, rProp));
- pEntry->AddItem( new SvLBoxString( pEntry, 0, rStatus));
- pEntry->AddItem( new SvLBoxString( pEntry, 0, rType));
- pEntry->AddItem( new SvLBoxString( pEntry, 0, rValue));
+ pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+ new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false))); //It is needed, otherwise causes crash
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, rProp)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, rStatus)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, rType)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, rValue)));
pEntry->SetUserData( new UserData(rPropertyPath) );
if(bInsertToPrefBox)
@@ -284,13 +285,18 @@ void CuiAboutConfigTabPage::FillItems(const Reference< XNameAccess >& xNameAcces
{
// not leaf node
SvTreeListEntry* pEntry = new SvTreeListEntry;
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(),
- SvTreeListBox::GetDefaultCollapsedNodeImage(), false));
- pEntry->AddItem( new SvLBoxString( pEntry, 0, seqItems[i]));
+ pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+ new SvLBoxContextBmp(pEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(),
+ SvTreeListBox::GetDefaultCollapsedNodeImage(), false)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString( pEntry, 0, seqItems[i])));
//It is needed, without this the selection line will be truncated.
- pEntry->AddItem( new SvLBoxString( pEntry, 0, ""));
- pEntry->AddItem( new SvLBoxString( pEntry, 0, ""));
- pEntry->AddItem( new SvLBoxString( pEntry, 0, ""));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString( pEntry, 0, "")));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString( pEntry, 0, "")));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString( pEntry, 0, "")));
pEntry->SetUserData( new UserData(xNextNameAccess, lineage + 1) );
pEntry->EnableChildrenOnDemand();
@@ -774,7 +780,8 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
);
if (it != m_prefBoxEntries.end())
{
- it->ReplaceItem( new SvLBoxString( &(*it), 0, sDialogValue ), 4 );
+ it->ReplaceItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString( &(*it), 0, sDialogValue)), 4);
SvTreeListEntries::iterator modifiedIt = std::find_if(
m_modifiedPrefBoxEntries.begin(), m_modifiedPrefBoxEntries.end(),
@@ -786,7 +793,9 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl )
);
if( modifiedIt != m_modifiedPrefBoxEntries.end())
- modifiedIt->ReplaceItem( new SvLBoxString( &(*modifiedIt), 0, sDialogValue ), 4 );
+ modifiedIt->ReplaceItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString(&(*modifiedIt), 0, sDialogValue)),
+ 4);
else
{
SvTreeListEntry *pCloneEntry = new SvTreeListEntry;
@@ -883,13 +892,18 @@ void CuiAboutConfigTabPage::InsertEntry( SvTreeListEntry *pEntry)
if(!hasEntry)
{
pParentEntry = new SvTreeListEntry;
- pParentEntry->AddItem( new SvLBoxContextBmp( pParentEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(),
- SvTreeListBox::GetDefaultCollapsedNodeImage(), false));
- pParentEntry->AddItem( new SvLBoxString( pParentEntry, 0, sParentName));
+ pParentEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+ new SvLBoxContextBmp(pParentEntry, 0, SvTreeListBox::GetDefaultExpandedNodeImage(),
+ SvTreeListBox::GetDefaultCollapsedNodeImage(), false)));
+ pParentEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString(pParentEntry, 0, sParentName)));
//It is needed, without this the selection line will be truncated.
- pParentEntry->AddItem( new SvLBoxString( pParentEntry, 0, ""));
- pParentEntry->AddItem( new SvLBoxString( pParentEntry, 0, ""));
- pParentEntry->AddItem( new SvLBoxString( pParentEntry, 0, ""));
+ pParentEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString(pParentEntry, 0, "")));
+ pParentEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString(pParentEntry, 0, "")));
+ pParentEntry->AddItem(std::unique_ptr<SvLBoxString>(
+ new SvLBoxString( pParentEntry, 0, "")));
pParentEntry->EnableChildrenOnDemand(false);
m_pPrefBox->Insert( pParentEntry, pGrandParentEntry );
}
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index 6ee34bf30f4b..5ede579184e7 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -339,14 +339,17 @@ void OfaMSFilterTabPage2::InsertEntry( const OUString& _rTxt, sal_IntPtr _nType,
if( !pCheckButtonData )
pCheckButtonData = new SvLBoxButtonData( m_pCheckLB );
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
- pEntry->AddItem( new SvLBoxButton( pEntry, loadEnabled? SvLBoxButtonKind_enabledCheckbox :
- SvLBoxButtonKind_disabledCheckbox,
- 0, pCheckButtonData ) );
- pEntry->AddItem( new SvLBoxButton( pEntry, saveEnabled? SvLBoxButtonKind_enabledCheckbox :
- SvLBoxButtonKind_disabledCheckbox,
- 0, pCheckButtonData ) );
- pEntry->AddItem( new SvLBoxString( pEntry, 0, _rTxt ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+ new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(
+ new SvLBoxButton(pEntry, loadEnabled ? SvLBoxButtonKind_enabledCheckbox
+ : SvLBoxButtonKind_disabledCheckbox,
+ 0, pCheckButtonData)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(
+ new SvLBoxButton(pEntry, saveEnabled ? SvLBoxButtonKind_enabledCheckbox
+ : SvLBoxButtonKind_disabledCheckbox,
+ 0, pCheckButtonData)));
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, _rTxt)));
pEntry->SetUserData( reinterpret_cast<void*>(_nType) );
m_pCheckLB->Insert( pEntry );
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index ab5bea68f699..1de1d71b2efc 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1813,11 +1813,15 @@ SvTreeListEntry* SvxLinguTabPage::CreateEntry( OUString& rTxt, sal_uInt16 nCol )
OUString sEmpty;
if (CBCOL_FIRST == nCol)
- pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(
+ pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
if (CBCOL_SECOND == nCol)
- pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // empty column
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
- pEntry->AddItem( new BrwString_Impl( pEntry, 0, rTxt ) );
+ 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)));
+ pEntry->AddItem(std::unique_ptr<BrwString_Impl>(new BrwString_Impl(
+ pEntry, 0, rTxt)));
return pEntry;
}
@@ -1944,11 +1948,11 @@ SvTreeListEntry* SvxEditModulesDlg::CreateEntry( OUString& rTxt, sal_uInt16 nCol
OUString sEmpty;
if (CBCOL_FIRST == nCol)
- pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
if (CBCOL_SECOND == nCol)
- pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) ); // empty column
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
- pEntry->AddItem( new BrwStringDic_Impl( pEntry, 0, rTxt ) );
+ 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)));
+ pEntry->AddItem(std::unique_ptr<BrwStringDic_Impl>(new BrwStringDic_Impl(pEntry, 0, rTxt)));
return pEntry;
}
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index ca6f66834a74..600f5a481758 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -474,19 +474,20 @@ SvTreeListEntry* OfaSwAutoFmtOptionsPage::CreateEntry(OUString& rTxt, sal_uInt16
m_pCheckLB->SetCheckButtonData( pCheckButtonData );
}
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
+ pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(new SvLBoxContextBmp(
+ pEntry, 0, Image(), Image(), false)));
OUString sEmpty;
if (nCol == CBCOL_SECOND)
- pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));
else
- pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
if (nCol == CBCOL_FIRST)
- pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));
else
- pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
- pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
+ pEntry->AddItem(std::unique_ptr<OfaImpBrwString>(new OfaImpBrwString( pEntry, 0, rTxt)));
return pEntry;
}
@@ -1781,20 +1782,22 @@ SvTreeListEntry* OfaQuoteTabPage::CreateEntry(OUString& rTxt, sal_uInt16 nCol)
m_pSwCheckLB->SetCheckButtonData(pCheckButtonData);
}
- pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), false));
+ pEntry->AddItem(std::unique_ptr<SvLBoxContextBmp>(
+ new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false)));
OUString sEmpty;
if (nCol == CBCOL_SECOND)
- pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));
else
- pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
if (nCol == CBCOL_FIRST)
- pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pEntry, 0, sEmpty)));
else
- pEntry->AddItem( new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData ) );
+ pEntry->AddItem(std::unique_ptr<SvLBoxButton>(new SvLBoxButton(
+ pEntry, SvLBoxButtonKind_enabledCheckbox, 0, pCheckButtonData)));
- pEntry->AddItem( new OfaImpBrwString( pEntry, 0, rTxt ) );
+ pEntry->AddItem(std::unique_ptr<OfaImpBrwString>(new OfaImpBrwString(pEntry, 0, rTxt)));
return pEntry;
}
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index 5bc3697056f6..3d56dbd72d72 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -333,7 +333,7 @@ IMPL_LINK( _SfxMacroTabPage, AssignDeleteHdl_Impl, PushButton*, pBtn )
}
mpImpl->pEventLB->SetUpdateMode( false );
- pE->ReplaceItem( new SvLBoxString( pE, 0, sScriptURI ), LB_MACROS_ITEMPOS );
+ pE->ReplaceItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(pE, 0, sScriptURI)), LB_MACROS_ITEMPOS);
rListBox.GetModel()->InvalidateEntry( pE );
rListBox.Select( pE );
rListBox.MakeVisible( pE );
@@ -426,7 +426,8 @@ void _SfxMacroTabPage::FillEvents()
if( sOld != sNew )
{
- pE->ReplaceItem( new SvLBoxString( pE, 0, sNew ), LB_MACROS_ITEMPOS );
+ pE->ReplaceItem(std::unique_ptr<SvLBoxString>(new SvLBoxString(
+ pE, 0, sNew)), LB_MACROS_ITEMPOS);
rListBox.GetModel()->InvalidateEntry( pE );
}
}
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 191984d33a03..1944410d72f6 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -142,8 +142,8 @@ void DBTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& aStr, co
{
SvTreeListBox::InitEntry( _pEntry, aStr, _rCollEntryBmp,_rExpEntryBmp, eButtonKind);
SvLBoxItem* pTextItem(_pEntry->GetFirstItem(SV_ITEM_ID_LBOXSTRING));
- SvLBoxString* pString = new OBoldListboxString( _pEntry, 0, aStr );
- _pEntry->ReplaceItem( pString,_pEntry->GetPos(pTextItem));
+ std::unique_ptr<SvLBoxString> pString(new OBoldListboxString(_pEntry, 0, aStr));
+ _pEntry->ReplaceItem(std::move(pString), _pEntry->GetPos(pTextItem));
}
void DBTreeListBox::implStopSelectionTimer()
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 352b85c945ba..d2434126c177 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -409,7 +409,8 @@ void OTableTreeListBox::InitEntry(SvTreeListEntry* _pEntry, const OUString& _rSt
size_t nTextPos = _pEntry->GetPos(pTextItem);
OSL_ENSURE(SvTreeListEntry::ITEM_NOT_FOUND != nTextPos, "OTableTreeListBox::InitEntry: no text item pos!");
- _pEntry->ReplaceItem(new OBoldListboxString(_pEntry, 0, _rString), nTextPos);
+ _pEntry->ReplaceItem(std::unique_ptr<OBoldListboxString>(
+ new OBoldListboxString(_pEntry, 0, _rString)), nTextPos);
}
SvTreeListEntry* OTableTreeListBox::implAddEntry(
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index aa1ba97bf273..f005583b8761 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -382,8 +382,8 @@ VCL_BUILDER_FACTORY(OColumnTreeBox)
void OColumnTreeBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind)
{
DBTreeListBox::InitEntry(pEntry, rStr, rImg1, rImg2, eButtonKind);
- SvLBoxString* pString = new OColumnString(pEntry, 0, rStr,false);
- pEntry->ReplaceItem( pString, pEntry->ItemCount() - 1 );
+ std::unique_ptr<SvLBoxString> pString(new OColumnString(pEntry, 0, rStr,false));
+ pEntry->ReplaceItem(std::move(pString), pEntry->ItemCount() - 1);
}
bool OColumnTreeBox::Select( SvTreeListEntry* pEntry, bool bSelect )
diff --git a/include/svtools/treelistentry.hxx b/include/svtools/treelistentry.hxx
index a7083de27d2c..2fcd6282673a 100644
--- a/include/svtools/treelistentry.hxx
+++ b/include/svtools/treelistentry.hxx
@@ -92,8 +92,8 @@ public:
// MAY ONLY BE CALLED IF THE ENTRY HAS NOT YET BEEN INSERTED INTO
// THE MODEL, AS OTHERWISE NO VIEW-DEPENDENT DATA ARE ALLOCATED
// FOR THE ITEM!
- void AddItem( SvLBoxItem* pItem );
- void ReplaceItem( SvLBoxItem* pNewItem, size_t nPos );
+ void AddItem(std::unique_ptr<SvLBoxItem> pItem);
+ void ReplaceItem(std::unique_ptr<SvLBoxItem> pNewItem, size_t nPos);
const SvLBoxItem& GetItem( size_t nPos ) const;
SvLBoxItem& GetItem( size_t nPos );
const SvLBoxItem* GetFirstItem( sal_uInt16 nId ) const;
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: */
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)
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index c0d53ad9a26c..608a573a6a6c 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -643,8 +643,9 @@ SvTreeListEntry* FillBox_Impl(SvTreeListBox* pBox,
if (officecfg::Office::Common::StylesAndFormatting::Preview::get())
{
- StyleLBoxString* pStyleLBoxString = new StyleLBoxString(pTreeListEntry, 0, pEntry->getName(), eStyleFamily);
- pTreeListEntry->ReplaceItem(pStyleLBoxString, 1);
+ std::unique_ptr<StyleLBoxString> pStyleLBoxString(
+ new StyleLBoxString(pTreeListEntry, 0, pEntry->getName(), eStyleFamily));
+ pTreeListEntry->ReplaceItem(std::move(pStyleLBoxString), 1);
}
pBox->GetModel()->InvalidateEntry(pTreeListEntry);
@@ -1263,8 +1264,9 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags)
SvTreeListEntry* pTreeListEntry = aFmtLb->InsertEntry(aStrings[nPos], 0, false, nPos);
if (officecfg::Office::Common::StylesAndFormatting::Preview::get())
{
- StyleLBoxString* pStyleLBoxString = new StyleLBoxString(pTreeListEntry, 0, aStrings[nPos], eFam);
- pTreeListEntry->ReplaceItem(pStyleLBoxString, 1);
+ std::unique_ptr<StyleLBoxString> pStyleLBoxString(
+ new StyleLBoxString(pTreeListEntry, 0, aStrings[nPos], eFam));
+ pTreeListEntry->ReplaceItem(std::move(pStyleLBoxString), 1);
}
aFmtLb->GetModel()->InvalidateEntry(pTreeListEntry);
}
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index a1459b90b241..d15253ee52cd 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -83,8 +83,8 @@ void SvTabListBox::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr,
for( sal_uInt16 nToken = 0; nToken < nCount; nToken++ )
{
const OUString aToken = GetToken(aCurEntry, nIndex);
- SvLBoxString* pStr = new SvLBoxString( pEntry, 0, aToken );
- pEntry->AddItem( pStr );
+ std::unique_ptr<SvLBoxString> pStr(new SvLBoxString(pEntry, 0, aToken));
+ pEntry->AddItem(std::move(pStr));
}
}
SvTabListBox::SvTabListBox( vcl::Window* pParent, WinBits nBits )
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 3ee959abae7e..24e043a59972 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -1758,21 +1758,19 @@ void SvTreeListBox::InitEntry(SvTreeListEntry* pEntry,
const OUString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp,
SvLBoxButtonKind eButtonKind)
{
- SvLBoxString* pString;
- SvLBoxContextBmp* pContextBmp;
-
if( nTreeFlags & SvTreeFlags::CHKBTN )
{
- SvLBoxButton* pButton= new SvLBoxButton( pEntry,eButtonKind,0,pCheckButtonData );
- pEntry->AddItem( pButton );
+ std::unique_ptr<SvLBoxButton> pButton(
+ new SvLBoxButton(pEntry, eButtonKind, 0, pCheckButtonData));
+ pEntry->AddItem(std::move(pButton));
}
- pContextBmp= new SvLBoxContextBmp(
- pEntry,0, aCollEntryBmp,aExpEntryBmp, mbContextBmpExpanded);
- pEntry->AddItem( pContextBmp );
+ std::unique_ptr<SvLBoxContextBmp> pContextBmp(new SvLBoxContextBmp(
+ pEntry,0, aCollEntryBmp,aExpEntryBmp, mbContextBmpExpanded));
+ pEntry->AddItem(std::move(pContextBmp));
- pString = new SvLBoxString( pEntry, 0, aStr );
- pEntry->AddItem( pString );
+ std::unique_ptr<SvLBoxString> pString(new SvLBoxString(pEntry, 0, aStr));
+ pEntry->AddItem(std::move(pString));
}
OUString SvTreeListBox::GetEntryText(SvTreeListEntry* pEntry) const
diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx
index 12931578e300..29f597669859 100644
--- a/svtools/source/contnr/treelistentry.cxx
+++ b/svtools/source/contnr/treelistentry.cxx
@@ -130,9 +130,9 @@ size_t SvTreeListEntry::ItemCount() const
return m_Items.size();
}
-void SvTreeListEntry::AddItem( SvLBoxItem* pItem )
+void SvTreeListEntry::AddItem(std::unique_ptr<SvLBoxItem> pItem)
{
- m_Items.push_back(std::unique_ptr<SvLBoxItem>(pItem));
+ m_Items.push_back(std::move(pItem));
}
void SvTreeListEntry::EnableChildrenOnDemand( bool bEnable )
@@ -143,18 +143,18 @@ void SvTreeListEntry::EnableChildrenOnDemand( bool bEnable )
nEntryFlags &= (~SvTLEntryFlags::CHILDREN_ON_DEMAND);
}
-void SvTreeListEntry::ReplaceItem( SvLBoxItem* pNewItem, size_t nPos )
+void SvTreeListEntry::ReplaceItem(std::unique_ptr<SvLBoxItem> pNewItem, size_t const nPos)
{
DBG_ASSERT(pNewItem,"ReplaceItem:No Item");
if (nPos >= m_Items.size())
{
// Out of bound. Bail out.
- delete pNewItem;
+ pNewItem.reset();
return;
}
m_Items.erase(m_Items.begin()+nPos);
- m_Items.insert(m_Items.begin()+nPos, std::unique_ptr<SvLBoxItem>(pNewItem));
+ m_Items.insert(m_Items.begin()+nPos, std::move(pNewItem));
}
const SvLBoxItem& SvTreeListEntry::GetItem( size_t nPos ) const
diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx
index 26cc5b4ebd6e..4d02dd5508df 100644
--- a/svtools/source/uno/treecontrolpeer.cxx
+++ b/svtools/source/uno/treecontrolpeer.cxx
@@ -237,11 +237,14 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN
{
Image aImage;
pEntry = new UnoTreeListEntry( xNode, this );
- ImplContextGraphicItem* pContextBmp= new ImplContextGraphicItem(pEntry, 0, aImage, aImage, true);
+ {
+ std::unique_ptr<ImplContextGraphicItem> pContextBmp(
+ new ImplContextGraphicItem(pEntry, 0, aImage, aImage, true));
- pEntry->AddItem( pContextBmp );
+ pEntry->AddItem(std::move(pContextBmp));
+ }
- UnoTreeListItem * pUnoItem = new UnoTreeListItem( pEntry );
+ std::unique_ptr<UnoTreeListItem> pUnoItem(new UnoTreeListItem(pEntry));
if( !xNode->getNodeGraphicURL().isEmpty() )
{
@@ -252,7 +255,7 @@ UnoTreeListEntry* TreeControlPeer::createEntry( const Reference< XTreeNode >& xN
mpTreeImpl->AdjustEntryHeight( aNodeImage );
}
- pEntry->AddItem( pUnoItem );
+ pEntry->AddItem(std::move(pUnoItem));
mpTreeImpl->insert( pEntry, pParent, nPos );
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 );
}
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 388b8101bd35..adae6c2f805a 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -3461,8 +3461,9 @@ void SwContentTree::InitEntry(SvTreeListEntry* pEntry,
const size_t nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2"
SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite ));
- SwContentLBoxString* pStr = new SwContentLBoxString( pEntry, 0, rCol.GetText() );
- pEntry->ReplaceItem( pStr, nColToHilite );
+ std::unique_ptr<SwContentLBoxString> pStr(
+ new SwContentLBoxString(pEntry, 0, rCol.GetText()));
+ pEntry->ReplaceItem(std::move(pStr), nColToHilite);
}
void SwContentLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index c8c9e0af2407..0f4e6d6f127f 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1233,8 +1233,9 @@ void SwGlobalTree::InitEntry(SvTreeListEntry* pEntry,
const size_t nColToHilite = 1; //0==Bitmap;1=="Column1";2=="Column2"
SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem( nColToHilite ));
- SwLBoxString* pStr = new SwLBoxString( pEntry, 0, rCol.GetText() );
- pEntry->ReplaceItem( pStr, nColToHilite );
+ std::unique_ptr<SwLBoxString> pStr(
+ new SwLBoxString(pEntry, 0, rCol.GetText()));
+ pEntry->ReplaceItem(std::move(pStr), nColToHilite);
}
void SwLBoxString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext,