summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-03-21 15:25:27 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-03-21 16:00:49 +0000
commit034bc34ddc1bac817a6ef51bba19675551a461f4 (patch)
treed9cc3355e7febee2f78e9614ff71b1d43bdc861e /sw
parent067eaf954dfa4da6e72bc0f8c779d5b711678385 (diff)
convert SwTOXSources to a std::vector
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/doctxm.cxx19
-rw-r--r--sw/source/core/inc/txmsrt.hxx6
-rw-r--r--sw/source/core/tox/txmsrt.cxx5
3 files changed, 13 insertions, 17 deletions
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index b1c91998e651..c8dd37945a3c 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -1563,7 +1563,7 @@ String lcl_GetNumString( const SwTOXSortTabBase& rBase, sal_Bool bUsePrefix, sal
{
String sRet;
- if( !rBase.pTxtMark && rBase.aTOXSources.Count() > 0 )
+ if( !rBase.pTxtMark && !rBase.aTOXSources.empty() )
{ // only if it's not a Mark
const SwTxtNode* pNd = rBase.aTOXSources[0].pNd->GetTxtNode();
if( pNd )
@@ -1721,11 +1721,11 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
// Place holder for the PageNumber; we only respect the first one
{
// The count of similiar entries gives the PagerNumber pattern
- sal_uInt16 nSize = rBase.aTOXSources.Count();
- if( nSize > 0 )
+ size_t nSize = rBase.aTOXSources.size();
+ if (nSize > 0)
{
String aInsStr( cNumRepl );
- for(sal_uInt16 i=1; i < nSize; ++i)
+ for (size_t i = 1; i < nSize; ++i)
{
aInsStr.AppendAscii( sPageDeli );
aInsStr += cNumRepl;
@@ -1740,7 +1740,7 @@ void SwTOXBaseSection::GenerateText( sal_uInt16 nArrayIdx,
{
// A bit tricky: Find a random Frame
const SwTOXSource* pTOXSource = 0;
- if(rBase.aTOXSources.Count())
+ if (!rBase.aTOXSources.empty())
pTOXSource = &rBase.aTOXSources[0];
// #i53420#
@@ -1906,9 +1906,8 @@ void SwTOXBaseSection::UpdatePageNum()
for(sal_uInt16 nRunInEntry = nCnt; nRunInEntry < nCnt + nRange; nRunInEntry++)
{
SwTOXSortTabBase* pSortBase = aSortArr[nRunInEntry];
- sal_uInt16 nSize = pSortBase->aTOXSources.Count();
- sal_uInt16 i;
- for( sal_uInt16 j = 0; j < nSize; ++j )
+ size_t nSize = pSortBase->aTOXSources.size();
+ for (size_t j = 0; j < nSize; ++j)
{
::SetProgressState( 0, pDoc->GetDocShell() );
@@ -1936,6 +1935,7 @@ void SwTOXBaseSection::UpdatePageNum()
}
// Insert as sorted
+ sal_uInt16 i;
for( i = 0; i < aNums.size() && aNums[i] < nPage; ++i )
;
@@ -2220,8 +2220,7 @@ void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew)
return;
}
// If the own entry is already present, add it to the references list
- pOld->aTOXSources.Insert( pNew->aTOXSources[0],
- pOld->aTOXSources.Count() );
+ pOld->aTOXSources.push_back(pNew->aTOXSources[0]);
delete pNew;
return;
diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx
index 5b3e79d3e793..e707741cadec 100644
--- a/sw/source/core/inc/txmsrt.hxx
+++ b/sw/source/core/inc/txmsrt.hxx
@@ -58,13 +58,13 @@ struct SwTOXSource
xub_StrLen nPos;
sal_Bool bMainEntry;
- SwTOXSource() : pNd(0), nPos(0), bMainEntry(sal_False) {}
SwTOXSource( const SwCntntNode* pNode, xub_StrLen n, sal_Bool bMain )
: pNd(pNode), nPos(n), bMainEntry(bMain)
- {}
+ {
+ }
};
-SV_DECL_VARARR( SwTOXSources, SwTOXSource, 0 )
+typedef std::vector<SwTOXSource> SwTOXSources;
class SwTOXInternational
{
diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx
index 13e51e8d6daa..e6f18c1bcae8 100644
--- a/sw/source/core/tox/txmsrt.cxx
+++ b/sw/source/core/tox/txmsrt.cxx
@@ -64,9 +64,6 @@ using ::rtl::OUString;
sal_uInt16 SwTOXSortTabBase::nOpt = 0;
-SV_IMPL_VARARR( SwTOXSources, SwTOXSource )
-
-
SwTOXInternational::SwTOXInternational( LanguageType nLang, sal_uInt16 nOpt,
const String& rSortAlgorithm ) :
eLang( nLang ),
@@ -164,7 +161,7 @@ SwTOXSortTabBase::SwTOXSortTabBase( TOXSortType nTyp, const SwCntntNode* pNd,
n = *pTxtMark->GetStart();
SwTOXSource aTmp( pNd, n,
pTxtMark ? pTxtMark->GetTOXMark().IsMainEntry() : sal_False );
- aTOXSources.Insert( aTmp, aTOXSources.Count() );
+ aTOXSources.push_back(aTmp);
nPos = pNd->GetIndex();