summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2012-06-10 18:00:37 +0200
committerMichael Stahl <mstahl@redhat.com>2012-06-12 23:25:11 +0200
commitbbe2cb404a11bc68e1b94d7e0e2aaa935fe21c80 (patch)
tree99696f738e1ca30dc593dd44c0e399d80c391325
parent2110397670695991b3a5cd28a15ba0ffd2a3a611 (diff)
Convert SV_DECL_PTRARR_DEL(SfxGroupInfoArr_Impl) to boost::ptr_vector
Change-Id: I90628a60e3eb33097728e1036b22a5c000be02bc
-rw-r--r--cui/source/customize/cfgutil.cxx38
-rw-r--r--cui/source/inc/cfgutil.hxx4
2 files changed, 18 insertions, 24 deletions
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index bb3e085cf42e..dc4571adf5e2 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -262,7 +262,7 @@ void SfxStylesInfo_Impl::getLabel4Style(SfxStyleInfo_Impl& aStyle)
}
return lStyles;
}
-SV_IMPL_PTRARR(SfxGroupInfoArr_Impl, SfxGroupInfoPtr);
+
SfxConfigFunctionListBox_Impl::SfxConfigFunctionListBox_Impl( Window* pParent, const ResId& rResId)
: SvTreeListBox( pParent, rResId )
, pCurEntry( 0 )
@@ -303,10 +303,10 @@ void SfxConfigFunctionListBox_Impl::ClearAll()
possibly existing MacroInfo.
*/
{
- sal_uInt16 nCount = aArr.Count();
+ sal_uInt16 nCount = aArr.size();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- SfxGroupInfo_Impl *pData = aArr[i];
+ SfxGroupInfo_Impl *pData = &aArr[i];
if ( pData->nKind == SFX_CFGFUNCTION_SCRIPT )
{
@@ -314,8 +314,7 @@ void SfxConfigFunctionListBox_Impl::ClearAll()
delete pScriptURI;
}
- if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER
- )
+ if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER )
{
XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != NULL)
@@ -323,11 +322,9 @@ void SfxConfigFunctionListBox_Impl::ClearAll()
xi->release();
}
}
-
- delete pData;
}
- aArr.Remove( 0, nCount );
+ aArr.clear();
Clear();
}
@@ -433,12 +430,11 @@ SfxConfigGroupListBox_Impl::~SfxConfigGroupListBox_Impl()
void SfxConfigGroupListBox_Impl::ClearAll()
{
- sal_uInt16 nCount = aArr.Count();
+ sal_uInt16 nCount = aArr.size();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- SfxGroupInfo_Impl *pData = aArr[i];
- if ( pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER
- )
+ SfxGroupInfo_Impl *pData = &aArr[i];
+ if (pData->nKind == SFX_CFGGROUP_SCRIPTCONTAINER)
{
XInterface* xi = static_cast<XInterface *>(pData->pObject);
if (xi != NULL)
@@ -446,10 +442,9 @@ void SfxConfigGroupListBox_Impl::ClearAll()
xi->release();
}
}
- delete pData;
}
- aArr.Remove( 0, nCount );
+ aArr.clear();
Clear();
}
@@ -635,7 +630,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
SvLBoxEntry *pNewEntry = InsertEntry( aTitle, NULL );
pNewEntry->SetUserData( pInfo );
pNewEntry->EnableChildrenOnDemand( sal_True );
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
}
else
{
@@ -709,7 +704,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
SetCollapsedEntryBmp( pNewEntry, aImage );
pNewEntry->SetUserData( pInfo );
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
if ( children[n]->hasChildNodes() )
{
@@ -741,7 +736,7 @@ void SfxConfigGroupListBox_Impl::Init(const css::uno::Reference< css::lang::XMul
String sStyle( pImp->m_aStrGroupStyles );
SvLBoxEntry *pEntry = InsertEntry( sStyle, 0 );
SfxGroupInfo_Impl *pInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, 0 ); // TODO last parameter should contain user data
- aArr.Insert( pInfo, aArr.Count() );
+ aArr.push_back( pInfo );
pEntry->SetUserData( pInfo );
pEntry->EnableChildrenOnDemand( sal_True );
}
@@ -969,8 +964,7 @@ void SfxConfigGroupListBox_Impl::GroupSelected()
pGrpInfo->sLabel = children[n]->getName();
pNewEntry->SetUserData( pGrpInfo );
- pFunctionListBox->aArr.Insert(
- pGrpInfo, pFunctionListBox->aArr.Count() );
+ pFunctionListBox->aArr.push_back( pGrpInfo );
}
}
@@ -997,7 +991,7 @@ void SfxConfigGroupListBox_Impl::GroupSelected()
SfxStyleInfo_Impl* pStyle = new SfxStyleInfo_Impl(*pIt);
SvLBoxEntry* pFuncEntry = pFunctionListBox->InsertEntry( pStyle->sLabel, NULL );
SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pStyle );
- pFunctionListBox->aArr.Insert( pGrpInfo, pFunctionListBox->aArr.Count() );
+ pFunctionListBox->aArr.push_back( pGrpInfo );
pGrpInfo->sCommand = pStyle->sCommand;
pGrpInfo->sLabel = pStyle->sLabel;
pFuncEntry->SetUserData( pGrpInfo );
@@ -1121,7 +1115,7 @@ void SfxConfigGroupListBox_Impl::RequestingChildren( SvLBoxEntry *pEntry )
SetCollapsedEntryBmp(pNewEntry, aImage );
pNewEntry->SetUserData( pGrpInfo );
- aArr.Insert( pGrpInfo, aArr.Count() );
+ aArr.push_back( pGrpInfo );
if ( children[n]->hasChildNodes() )
{
@@ -1161,7 +1155,7 @@ void SfxConfigGroupListBox_Impl::RequestingChildren( SvLBoxEntry *pEntry )
SfxStyleInfo_Impl* pFamily = new SfxStyleInfo_Impl(*pIt);
SvLBoxEntry* pStyleEntry = InsertEntry( pFamily->sLabel, pEntry );
SfxGroupInfo_Impl *pGrpInfo = new SfxGroupInfo_Impl( SFX_CFGGROUP_STYLES, 0, pFamily );
- aArr.Insert( pGrpInfo, aArr.Count() );
+ aArr.push_back( pGrpInfo );
pStyleEntry->SetUserData( pGrpInfo );
pStyleEntry->EnableChildrenOnDemand( sal_False );
}
diff --git a/cui/source/inc/cfgutil.hxx b/cui/source/inc/cfgutil.hxx
index 4e0fd27a71c4..174bc53e9f08 100644
--- a/cui/source/inc/cfgutil.hxx
+++ b/cui/source/inc/cfgutil.hxx
@@ -29,6 +29,7 @@
#define _CFGUTIL_HXX
#include <vector>
+#include <boost/ptr_container/ptr_vector.hpp>
#include <rtl/ustring.hxx>
#include <tools/string.hxx>
@@ -115,8 +116,7 @@ struct CuiMacroInfo
{
};
-typedef SfxGroupInfo_Impl* SfxGroupInfoPtr;
-SV_DECL_PTRARR_DEL(SfxGroupInfoArr_Impl, SfxGroupInfoPtr, 5)
+typedef boost::ptr_vector<SfxGroupInfo_Impl> SfxGroupInfoArr_Impl;
class SfxConfigFunctionListBox_Impl : public SvTreeListBox
{