summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-07-13 15:37:18 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-17 15:33:40 +0200
commit4b41b87e52007897131088e61ffff41d22122acc (patch)
treeafd562fbf8f95a067809394b19391913dba1f3f1 /sfx2
parent5a4796f78f315d8518238f4194b553f671aeadf4 (diff)
Convert SV_DECL_PTRARR_SORT(_SfxObjectList) to o3tl::sorted_vector
Change-Id: I663f03c2fdafe994b609572aa3a8b6bf2354b444
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/orgmgr.hxx8
-rw-r--r--sfx2/source/doc/docvor.cxx5
-rw-r--r--sfx2/source/view/orgmgr.cxx27
3 files changed, 18 insertions, 22 deletions
diff --git a/sfx2/inc/orgmgr.hxx b/sfx2/inc/orgmgr.hxx
index 2c8d989f9dec..48c3ae3da397 100644
--- a/sfx2/inc/orgmgr.hxx
+++ b/sfx2/inc/orgmgr.hxx
@@ -19,7 +19,7 @@
#ifndef _SFX_ORGMGR_HXX
#define _SFX_ORGMGR_HXX
-#include <svl/svarray.hxx>
+#include <o3tl/sorted_vector.hxx>
class SfxDocumentTemplates;
class SfxOrganizeListBox_Impl;
@@ -27,15 +27,13 @@ struct _FileListEntry;
//=========================================================================
-SV_DECL_PTRARR_SORT(_SfxObjectList, _FileListEntry*, 1)
-
-class SfxObjectList: public _SfxObjectList
+class SfxObjectList : public o3tl::sorted_vector<_FileListEntry*, o3tl::less_ptr_to<_FileListEntry> >
{
public:
SfxObjectList();
~SfxObjectList();
- const String& GetBaseName( sal_uInt16 nId ) const;
+ const String& GetBaseName( const _FileListEntry* p ) const;
};
class IntlWrapper;
diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index b069f17195c7..3c761460d54a 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -1378,9 +1378,8 @@ void SfxOrganizeListBox_Impl::Reset()
else
{
const SfxObjectList& rList = pMgr->GetObjectList();
- const sal_uInt16 nCount = rList.Count();
- for ( sal_uInt16 i = 0; i < nCount; ++i )
- InsertEntryByBmpType( rList.GetBaseName(i), BMPTYPE_DOC, 0, sal_True );
+ for ( SfxObjectList::const_iterator it = rList.begin(); it != rList.end(); ++it )
+ InsertEntryByBmpType( rList.GetBaseName(*it), BMPTYPE_DOC, 0, sal_True );
}
SetUpdateMode(sal_True);
diff --git a/sfx2/source/view/orgmgr.cxx b/sfx2/source/view/orgmgr.cxx
index 563c345e614f..db9937f64483 100644
--- a/sfx2/source/view/orgmgr.cxx
+++ b/sfx2/source/view/orgmgr.cxx
@@ -119,10 +119,6 @@ _FileListEntry::~_FileListEntry()
DeleteObjectShell();
}
-//-------------------------------------------------------------------------
-
-SV_IMPL_OP_PTRARR_SORT(_SfxObjectList, _FileListEntry*)
-
//=========================================================================
sal_Bool _FileListEntry::DeleteObjectShell()
@@ -191,14 +187,16 @@ SfxObjectList::SfxObjectList()
SfxObjectList::~SfxObjectList()
{
- DeleteAndDestroy(0, Count());
+ for( const_iterator it = begin(); it != end(); ++it )
+ delete *it;
+ clear();
}
//-------------------------------------------------------------------------
-const String &SfxObjectList::GetBaseName(sal_uInt16 i) const
+const String &SfxObjectList::GetBaseName(const _FileListEntry* p) const
{
- return (*this)[i]->aBaseName;
+ return p->aBaseName;
}
//-------------------------------------------------------------------------
@@ -230,7 +228,7 @@ SfxOrganizeMgr::SfxOrganizeMgr( SfxOrganizeListBox_Impl *pLeft,
String aTitle = pTmp->GetTitle( SFX_TITLE_TITLE );
pNewEntry = new _FileListEntry( pTmp->GetMedium()->GetName(), pCollator, &aTitle );
pNewEntry->aDocShell = pTmp;
- pImpl->pDocList->C40_PTR_INSERT( _FileListEntry, pNewEntry );
+ pImpl->pDocList->insert( pNewEntry );
}
}
@@ -679,14 +677,16 @@ sal_Bool SfxOrganizeMgr::InsertFile( SfxOrganizeListBox_Impl* pCaller, const Str
{
const CollatorWrapper* pCollator = pImpl->pIntlWrapper->getCaseCollator();
_FileListEntry* pEntry = new _FileListEntry( rFileName, pCollator );
- if ( pImpl->pDocList->C40_PTR_INSERT( _FileListEntry, pEntry ) )
+ std::pair<SfxObjectList::const_iterator, bool> aRes = pImpl->pDocList->insert( pEntry );
+ if ( aRes.second )
{
- sal_uInt16 nPos = 0;
- pImpl->pDocList->Seek_Entry( pEntry, &nPos );
+ sal_uInt16 nPos = aRes.first - pImpl->pDocList->begin();
pCaller->InsertEntry( pEntry->aBaseName, pCaller->GetOpenedBmp(1),
pCaller->GetClosedBmp(1), 0, sal_True, nPos );
return sal_True;
}
+ else
+ delete pEntry;
return sal_False;
}
@@ -753,10 +753,9 @@ void SfxOrganizeMgr::SaveAll(Window *pParent)
}
}
}
- nRangeCount = pImpl->pDocList->Count();
- for(i = 0; i < nRangeCount; ++i)
+ for( SfxObjectList::const_iterator it = pImpl->pDocList->begin(); it != pImpl->pDocList->end(); ++it )
{
- _FileListEntry *pEntry = (*pImpl->pDocList)[i];
+ _FileListEntry *pEntry = *it;
if(!pEntry->DeleteObjectShell())
{
String aText(SfxResId(STR_ERROR_SAVE_TEMPLATE).toString());