summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-06-01 22:33:56 +0200
committerMichael Stahl <mstahl@redhat.com>2012-06-08 22:52:29 +0200
commite2a2d14d3932267e2f73d47b7990bf1cef599a92 (patch)
treee4e1f8f94fde72fc1a2470290b9860495e96266b /sfx2
parent1e921f777433a5fcf37bb2933bfd803210c4625d (diff)
Convert SV_DECL_PTRARR_DEL(StyleTreeArr_Impl) to std::vector
Change-Id: I22b42fea3f46b76769ff64d496e1bb6864451247
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/templdlg.cxx42
1 files changed, 24 insertions, 18 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 26f4cdb87f42..3c471d782bc7 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -624,7 +624,6 @@ StyleTreeListBox_Impl::StyleTreeListBox_Impl(
class StyleTreeArr_Impl;
-
/* [Description]
Internal structure for the establishment of the hierarchical view
@@ -645,14 +644,20 @@ struct StyleTree_Impl
sal_uIntPtr Count();
};
-typedef StyleTree_Impl* StyleTree_ImplPtr;
-SV_DECL_PTRARR_DEL(StyleTreeArr_Impl, StyleTree_ImplPtr, 16)
-SV_IMPL_PTRARR(StyleTreeArr_Impl, StyleTree_ImplPtr)
+class StyleTreeArr_Impl : public std::vector<StyleTree_Impl*>
+{
+public:
+ ~StyleTreeArr_Impl()
+ {
+ for(const_iterator it = begin(); it != end(); ++it)
+ delete *it;
+ }
+};
sal_uIntPtr StyleTree_Impl::Count()
{
- return pChildren ? pChildren->Count() : 0L;
+ return pChildren ? pChildren->size() : 0L;
}
//-------------------------------------------------------------------------
@@ -670,15 +675,16 @@ void StyleTree_Impl::Put(StyleTree_Impl* pIns, sal_uIntPtr lPos)
pChildren = new StyleTreeArr_Impl;
if ( ULONG_MAX == lPos )
- lPos = pChildren->Count();
- pChildren->Insert( pIns, (sal_uInt16)lPos );
+ pChildren->push_back( pIns );
+ else
+ pChildren->insert( pChildren->begin() + (sal_uInt16)lPos, pIns );
}
//-------------------------------------------------------------------------
StyleTreeArr_Impl &MakeTree_Impl(StyleTreeArr_Impl &rArr)
{
- const sal_uInt16 nCount = rArr.Count();
+ const sal_uInt16 nCount = rArr.size();
comphelper::string::NaturalStringSorter aSorter(
::comphelper::getProcessComponentContext(),
@@ -688,12 +694,12 @@ StyleTreeArr_Impl &MakeTree_Impl(StyleTreeArr_Impl &rArr)
sal_uInt16 i;
for(i = 0; i < nCount; ++i)
{
- StyleTree_ImplPtr pEntry = rArr[i];
+ StyleTree_Impl* pEntry = rArr[i];
if(pEntry->HasParent())
{
for(sal_uInt16 j = 0; j < nCount; ++j)
{
- StyleTree_ImplPtr pCmp = rArr[j];
+ StyleTree_Impl* pCmp = rArr[j];
if(pCmp->aName == pEntry->aParent)
{
// Paste initial filter
@@ -708,10 +714,10 @@ StyleTreeArr_Impl &MakeTree_Impl(StyleTreeArr_Impl &rArr)
}
}
- for(i = 0; i < rArr.Count(); )
+ for(i = 0; i < rArr.size(); )
{
if(rArr[i]->HasParent())
- rArr.Remove(i);
+ rArr.erase(rArr.begin() + i);
else
++i;
}
@@ -734,12 +740,12 @@ inline sal_Bool IsExpanded_Impl( const ExpandedEntries& rEntries,
SvLBoxEntry* FillBox_Impl(SvTreeListBox *pBox,
- StyleTree_ImplPtr pEntry,
+ StyleTree_Impl* pEntry,
const ExpandedEntries& rEntries,
SvLBoxEntry* pParent = 0)
{
SvLBoxEntry* pNewEntry = pBox->InsertEntry(pEntry->aName, pParent);
- const sal_uInt16 nCount = pEntry->pChildren? pEntry->pChildren->Count(): 0;
+ const sal_uInt16 nCount = pEntry->pChildren ? pEntry->pChildren->size() : 0;
for(sal_uInt16 i = 0; i < nCount; ++i)
FillBox_Impl(pBox, (*pEntry->pChildren)[i], rEntries, pNewEntry);
return pNewEntry;
@@ -1184,9 +1190,9 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
pTreeBox->SetDragDropMode(SV_DRAGDROP_NONE);
while(pStyle)
{
- StyleTree_ImplPtr pNew =
+ StyleTree_Impl* pNew =
new StyleTree_Impl(pStyle->GetName(), pStyle->GetParent());
- aArr.Insert(pNew, aArr.Count());
+ aArr.push_back(pNew);
pStyle = pStyleSheetPool->Next();
}
MakeTree_Impl(aArr);
@@ -1196,10 +1202,10 @@ void SfxCommonTemplateDialog_Impl::FillTreeBox()
MakeExpanded_Impl( aEntries);
pTreeBox->SetUpdateMode( sal_False );
pTreeBox->Clear();
- const sal_uInt16 nCount = aArr.Count();
+ const sal_uInt16 nCount = aArr.size();
for(sal_uInt16 i = 0; i < nCount; ++i)
FillBox_Impl(pTreeBox, aArr[i], aEntries);
-;
+
EnableItem(SID_STYLE_WATERCAN,sal_False);
SfxTemplateItem* pState = pFamilyState[nActFamily-1];