summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-08-27 16:38:21 +0200
committerNoel Grandin <noel@peralex.com>2015-09-08 11:35:59 +0200
commit42b0440d55a522806cbb36ea448b61749188ae6b (patch)
tree98efa3fe9d16c81adf9cf75a72a8d6f47467e76b /sw/source
parentb359064463fffab69425ad960bbf9f9984b32aaa (diff)
loplugin:mergeclasses merge SwpHintsArray with SwpHints
and clean up the API a little, there were multiple versions of the same accessor with different names. Change-Id: I01e44a7a81c0d67cbb6135a6d196ee106cbf994a
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/access/acchyperlink.cxx2
-rw-r--r--sw/source/core/access/accpara.cxx4
-rw-r--r--sw/source/core/crsr/callnk.cxx2
-rw-r--r--sw/source/core/crsr/crstrvl.cxx2
-rw-r--r--sw/source/core/crsr/findattr.cxx16
-rw-r--r--sw/source/core/crsr/findtxt.cxx22
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx4
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx2
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx2
-rw-r--r--sw/source/core/doc/docruby.cxx2
-rw-r--r--sw/source/core/doc/doctxm.cxx6
-rw-r--r--sw/source/core/docnode/nodes.cxx4
-rw-r--r--sw/source/core/edit/acorrect.cxx2
-rw-r--r--sw/source/core/edit/edattr.cxx2
-rw-r--r--sw/source/core/frmedt/fefly1.cxx2
-rw-r--r--sw/source/core/table/swtable.cxx2
-rw-r--r--sw/source/core/text/frmform.cxx4
-rw-r--r--sw/source/core/text/itratr.cxx24
-rw-r--r--sw/source/core/text/itrpaint.cxx4
-rw-r--r--sw/source/core/text/itrtxt.cxx2
-rw-r--r--sw/source/core/text/porfly.cxx2
-rw-r--r--sw/source/core/text/porlay.cxx4
-rw-r--r--sw/source/core/text/pormulti.cxx12
-rw-r--r--sw/source/core/text/txtfld.cxx6
-rw-r--r--sw/source/core/text/txtfrm.cxx4
-rw-r--r--sw/source/core/text/txtftn.cxx4
-rw-r--r--sw/source/core/tox/ToxTextGenerator.cxx2
-rw-r--r--sw/source/core/txtnode/modeltoviewhelper.cxx2
-rw-r--r--sw/source/core/txtnode/ndhints.cxx67
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx44
-rw-r--r--sw/source/core/txtnode/thints.cxx69
-rw-r--r--sw/source/core/txtnode/txatritr.cxx2
-rw-r--r--sw/source/core/txtnode/txtedt.cxx6
-rw-r--r--sw/source/core/undo/rolbck.cxx2
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx4
-rw-r--r--sw/source/core/unocore/unoportenum.cxx26
-rw-r--r--sw/source/filter/ascii/ascatr.cxx4
-rw-r--r--sw/source/filter/html/htmlatr.cxx6
-rw-r--r--sw/source/filter/html/swhtml.cxx4
-rw-r--r--sw/source/filter/html/wrthtml.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx16
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
42 files changed, 199 insertions, 201 deletions
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
index 7b9e25b94382..cd1430802256 100644
--- a/sw/source/core/access/acchyperlink.cxx
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -53,7 +53,7 @@ const SwTextAttr *SwAccessibleHyperlink::GetTextAttr() const
const SwpHints *pHints = pTextNd->GetpSwpHints();
if( pHints && nHintPos < pHints->Count() )
{
- const SwTextAttr *pHt = (*pHints)[nHintPos];
+ const SwTextAttr *pHt = pHints->Get(nHintPos);
if( RES_TXTATR_INETFMT == pHt->Which() )
pTextAttr = pHt;
}
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 950611ce32ed..b96dcdf7574e 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1445,7 +1445,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
const size_t nSize = pSwpHints->Count();
for( size_t i = 0; i < nSize; ++i )
{
- const SwTextAttr* pHt = (*pSwpHints)[i];
+ const SwTextAttr* pHt = pSwpHints->Get(i);
if ( ( pHt->Which() == RES_TXTATR_FIELD
|| pHt->Which() == RES_TXTATR_ANNOTATION
|| pHt->Which() == RES_TXTATR_INPUTFIELD )
@@ -3113,7 +3113,7 @@ const SwTextAttr *SwHyperlinkIter_Impl::next()
{
while( !pAttr && nPos < pHints->Count() )
{
- const SwTextAttr *pHt = (*pHints)[nPos];
+ const SwTextAttr *pHt = pHints->Get(nPos);
if( RES_TXTATR_INETFMT == pHt->Which() )
{
const sal_Int32 nHtStt = pHt->GetStart();
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index 1db2c606c746..9daa0fed5a48 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -165,7 +165,7 @@ SwCallLink::~SwCallLink()
for( size_t n = 0; n < rHts.Count(); ++n )
{
- const SwTextAttr* pHt = rHts[ n ];
+ const SwTextAttr* pHt = rHts.Get( n );
const sal_Int32 *pEnd = pHt->End();
const sal_Int32 nStart = pHt->GetStart();
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 6e2db3f3d905..675b35ee12fe 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1548,7 +1548,7 @@ bool SwCrsrShell::GetContentAtPos( const Point& rPt,
{
for( size_t i = 0; i < pTextNd->GetSwpHints().Count(); ++i )
{
- const SwTextAttr* pHt = pTextNd->GetSwpHints()[i];
+ const SwTextAttr* pHt = pTextNd->GetSwpHints().Get(i);
const sal_Int32 nAttrStart = pHt->GetStart();
if( nAttrStart > n ) // over the section
break;
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index c8bb015c1a7b..a357a6164543 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -95,7 +95,7 @@ const SwTextAttr* GetFrwrdTextHint( const SwpHints& rHtsArr, sal_uInt16& rPos,
{
while( rPos < rHtsArr.Count() )
{
- const SwTextAttr *pTextHt = rHtsArr.GetStart( rPos++ );
+ const SwTextAttr *pTextHt = rHtsArr.Get( rPos++ );
// the start of an attribute has to be in the section
if( pTextHt->GetStart() >= nContentPos )
return pTextHt; // valid text attribute
@@ -108,7 +108,7 @@ const SwTextAttr* GetBkwrdTextHint( const SwpHints& rHtsArr, sal_uInt16& rPos,
{
while( rPos > 0 )
{
- const SwTextAttr *pTextHt = rHtsArr.GetStart( --rPos );
+ const SwTextAttr *pTextHt = rHtsArr.Get( --rPos );
// the start of an attribute has to be in the section
if( pTextHt->GetStart() < nContentPos )
return pTextHt; // valid text attribute
@@ -715,7 +715,7 @@ static bool lcl_SearchForward( const SwTextNode& rTextNd, SwAttrCheckArr& rCmpAr
if( rCmpArr.Found() )
{
for( ; nPos < rHtArr.Count(); ++nPos )
- if( !rCmpArr.SetAttrFwd( *( pAttr = rHtArr.GetStart( nPos )) ) )
+ if( !rCmpArr.SetAttrFwd( *( pAttr = rHtArr.Get( nPos )) ) )
{
if( rCmpArr.GetNdStt() < pAttr->GetStart() )
{
@@ -739,12 +739,12 @@ static bool lcl_SearchForward( const SwTextNode& rTextNd, SwAttrCheckArr& rCmpAr
sal_Int32 nSttPos;
for( ; nPos < rHtArr.Count(); ++nPos )
- if( rCmpArr.SetAttrFwd( *( pAttr = rHtArr.GetStart( nPos )) ) )
+ if( rCmpArr.SetAttrFwd( *( pAttr = rHtArr.Get( nPos )) ) )
{
// Do multiple start at that position? Do also check those:
nSttPos = pAttr->GetStart();
while( ++nPos < rHtArr.Count() && nSttPos ==
- ( pAttr = rHtArr.GetStart( nPos ))->GetStart() &&
+ ( pAttr = rHtArr.Get( nPos ))->GetStart() &&
rCmpArr.SetAttrFwd( *pAttr ) )
;
@@ -790,7 +790,7 @@ static bool lcl_SearchBackward( const SwTextNode& rTextNd, SwAttrCheckArr& rCmpA
if( rCmpArr.Found() )
{
while( nPos )
- if( !rCmpArr.SetAttrBwd( *( pAttr = rHtArr.GetEnd( --nPos )) ) )
+ if( !rCmpArr.SetAttrBwd( *( pAttr = rHtArr.GetSortedByEnd( --nPos )) ) )
{
nSttPos = *pAttr->GetAnyEnd();
if( nSttPos < rCmpArr.GetNdEnd() )
@@ -815,14 +815,14 @@ static bool lcl_SearchBackward( const SwTextNode& rTextNd, SwAttrCheckArr& rCmpA
}
while( nPos )
- if( rCmpArr.SetAttrBwd( *( pAttr = rHtArr.GetEnd( --nPos )) ) )
+ if( rCmpArr.SetAttrBwd( *( pAttr = rHtArr.GetSortedByEnd( --nPos )) ) )
{
// Do multiple start at that position? Do also check those:
if( nPos )
{
nEndPos = *pAttr->GetAnyEnd();
while( --nPos && nEndPos ==
- *( pAttr = rHtArr.GetEnd( nPos ))->GetAnyEnd() &&
+ *( pAttr = rHtArr.GetSortedByEnd( nPos ))->GetAnyEnd() &&
rCmpArr.SetAttrBwd( *pAttr ) )
;
}
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 33a4c86f7ae1..e859a995b06d 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -74,7 +74,7 @@ lcl_CleanStr(const SwTextNode& rNd, sal_Int32 const nStart, sal_Int32& rEnd,
{
if ( bNewHint )
nHintStart = pHts && n < pHts->Count() ?
- (*pHts)[n]->GetStart() :
+ pHts->Get(n)->GetStart() :
-1;
if ( bNewSoftHyphen )
@@ -118,7 +118,7 @@ lcl_CleanStr(const SwTextNode& rNd, sal_Int32 const nStart, sal_Int32& rEnd,
if ( bNewHint )
{
- const SwTextAttr* pHt = (*pHts)[n];
+ const SwTextAttr* pHt = pHts->Get(n);
if ( pHt->HasDummyChar() && (nStt >= nStart) )
{
switch( pHt->Which() )
@@ -198,7 +198,7 @@ size_t GetPostIt(sal_Int32 aCount,const SwpHints *pHts)
for (size_t i = 0; i < pHts->Count(); ++i )
{
aIndex++;
- const SwTextAttr* pTextAttr = (*pHts)[i];
+ const SwTextAttr* pTextAttr = pHts->Get(i);
if ( pTextAttr->Which() == RES_TXTATR_ANNOTATION )
{
aCount--;
@@ -210,7 +210,7 @@ size_t GetPostIt(sal_Int32 aCount,const SwpHints *pHts)
// throw away all following non postits
for( size_t i = aIndex; i < pHts->Count(); ++i )
{
- const SwTextAttr* pTextAttr = (*pHts)[i];
+ const SwTextAttr* pTextAttr = pHts->Get(i);
if ( pTextAttr->Which() == RES_TXTATR_ANNOTATION )
break;
else
@@ -275,7 +275,7 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
for( size_t i = 0; i < pHts->Count(); ++i )
{
- const SwTextAttr* pTextAttr = (*pHts)[i];
+ const SwTextAttr* pTextAttr = pHts->Get(i);
if ( pTextAttr->Which()==RES_TXTATR_ANNOTATION )
{
const sal_Int32 aPos = pTextAttr->GetStart();
@@ -410,14 +410,14 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
{
if (bSrchForward)
{
- nStartInside = aLoop==0 ? nStart : (*pHts)[GetPostIt(aLoop+aIgnore-1,pHts)]->GetStart()+1;
- nEndInside = aLoop==aNumberPostits ? nEnd : (*pHts)[GetPostIt(aLoop+aIgnore,pHts)]->GetStart();
+ nStartInside = aLoop==0 ? nStart : pHts->Get(GetPostIt(aLoop+aIgnore-1,pHts))->GetStart()+1;
+ nEndInside = aLoop==aNumberPostits ? nEnd : pHts->Get(GetPostIt(aLoop+aIgnore,pHts))->GetStart();
nTextLen = nEndInside - nStartInside;
}
else
{
- nStartInside = aLoop==aNumberPostits ? nStart : (*pHts)[GetPostIt(aLoop+aIgnore,pHts)]->GetStart();
- nEndInside = aLoop==0 ? nEnd : (*pHts)[GetPostIt(aLoop+aIgnore-1,pHts)]->GetStart()+1;
+ nStartInside = aLoop==aNumberPostits ? nStart : pHts->Get(GetPostIt(aLoop+aIgnore,pHts))->GetStart();
+ nEndInside = aLoop==0 ? nEnd : pHts->Get(GetPostIt(aLoop+aIgnore-1,pHts))->GetStart()+1;
nTextLen = nStartInside - nEndInside;
}
// search inside the text between a note
@@ -432,7 +432,9 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
// we should now be right in front of a note, search inside
if ( (bSrchForward && (GetPostIt(aLoop + aIgnore,pHts) < pHts->Count()) ) || ( !bSrchForward && (aLoop!=0) ))
{
- const SwTextAttr* pTextAttr = bSrchForward ? (*pHts)[GetPostIt(aLoop+aIgnore,pHts)] : (*pHts)[GetPostIt(aLoop+aIgnore-1,pHts)];
+ const SwTextAttr* pTextAttr = bSrchForward
+ ? pHts->Get(GetPostIt(aLoop+aIgnore,pHts))
+ : pHts->Get(GetPostIt(aLoop+aIgnore-1,pHts));
if (pPostItMgr && pPostItMgr->SearchReplace(
static_txtattr_cast<SwTextField const*>(pTextAttr)->GetFormatField(),rSearchOpt,bSrchForward))
{
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 32ece3e5d929..cfb297636335 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -901,7 +901,7 @@ namespace
const size_t nCount = pHints->Count();
for( size_t i = 0; i < nCount; ++i )
{
- SwTextAttr *pAttr = pHints->GetTextHint( i );
+ SwTextAttr *pAttr = pHints->Get( i );
if ( pAttr->Which() == RES_TXTATR_FTN )
{
rSaveArr.insert( static_cast<SwTextFootnote*>(pAttr) );
@@ -3620,7 +3620,7 @@ bool DocumentContentOperationsManager::DeleteRangeImplImpl(SwPaM & rPam)
const sal_Int32 nMkCntPos = rPam.GetMark()->nContent.GetIndex();
for( size_t n = pHts->Count(); n; )
{
- const SwTextAttr* pAttr = (*pHts)[ --n ];
+ const SwTextAttr* pAttr = pHts->Get( --n );
if( nMkCntPos > pAttr->GetStart() )
break;
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 0672cd082a80..44b16d3ec3a8 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -1257,7 +1257,7 @@ bool DocumentFieldsManager::SetFieldsDirty( bool b, const SwNode* pChk, sal_uLon
const size_t nEnd = pTNd->GetSwpHints().Count();
for( size_t n = 0 ; n < nEnd; ++n )
{
- const SwTextAttr* pAttr = pTNd->GetSwpHints()[ n ];
+ const SwTextAttr* pAttr = pTNd->GetSwpHints().Get(n);
if ( pAttr->Which() == RES_TXTATR_FIELD )
{
b = true;
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index d88be7b78c35..0f18087366a6 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -324,7 +324,7 @@ static const OUString lcl_dbg_out(const SwpHints & rHints)
for (size_t i = 0; i < rHints.Count(); ++i)
{
aStr += " ";
- aStr += lcl_dbg_out(*rHints[i]);
+ aStr += lcl_dbg_out(*rHints.Get(i));
aStr += "\n";
}
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index b3372f00cf1f..10d87d7bdd25 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -210,7 +210,7 @@ bool SwDoc::_SelectNextRubyChars( SwPaM& rPam, SwRubyListEntry& rEntry, sal_uInt
{
for( size_t nHtIdx = 0; nHtIdx < pHts->Count(); ++nHtIdx )
{
- const SwTextAttr* pHt = (*pHts)[ nHtIdx ];
+ const SwTextAttr* pHt = pHts->Get(nHtIdx);
if( RES_TXTATR_CJK_RUBY == pHt->Which() &&
*pHt->GetAnyEnd() > nStart )
{
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 0f53a03812d9..3effff722447 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -126,7 +126,7 @@ sal_uInt16 SwDoc::GetCurTOXMark( const SwPosition& rPos,
for( size_t n = 0; n < rHts.Count(); ++n )
{
- const SwTextAttr* pHt = rHts[n];
+ const SwTextAttr* pHt = rHts.Get(n);
if( RES_TXTATR_TOXMARK != pHt->Which() )
continue;
if( ( nSttIdx = pHt->GetStart() ) < nAktPos )
@@ -1700,9 +1700,9 @@ void SwTOXBaseSection::_UpdatePageNum( SwTextNode* pNd,
SwCharFormat* pPageNoCharFormat = 0;
SwpHints* pHints = pNd->GetpSwpHints();
if(pHints)
- for(size_t nHintIdx = 0; nHintIdx < pHints->GetStartCount(); ++nHintIdx)
+ for(size_t nHintIdx = 0; nHintIdx < pHints->Count(); ++nHintIdx)
{
- SwTextAttr* pAttr = pHints->GetStart(nHintIdx);
+ const SwTextAttr* pAttr = pHints->Get(nHintIdx);
const sal_Int32 nTmpEnd = pAttr->End() ? *pAttr->End() : 0;
if( nStartPos >= pAttr->GetStart() &&
(nStartPos + 2) <= nTmpEnd &&
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 7cf97fcfa04b..6c7620e19aa2 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -264,7 +264,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds);
for( size_t i = pHts->Count(); i; )
{
- SwTextAttr * const pAttr = pHts->GetTextHint( --i );
+ SwTextAttr * const pAttr = pHts->Get( --i );
switch ( pAttr->Which() )
{
case RES_TXTATR_FIELD:
@@ -2232,7 +2232,7 @@ void SwNodes::RemoveNode( sal_uLong nDelPos, sal_uLong nSz, bool bDel )
std::vector<SwTextAttr*> flys;
for (size_t i = 0; i < pHints->Count(); ++i)
{
- SwTextAttr *const pHint(pHints->GetTextHint(i));
+ SwTextAttr *const pHint(pHints->Get(i));
if (RES_TXTATR_FLYCNT == pHint->Which())
{
flys.push_back(pHint);
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index be1167eddf31..18c1d19b93f4 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -491,7 +491,7 @@ void SwDontExpandItem::RestoreDontExpandItems( const SwPosition& rPos )
for( size_t n = 0; n < nSize; ++n )
{
- SwTextAttr* pHt = pTextNd->GetpSwpHints()->GetTextHint( n );
+ SwTextAttr* pHt = pTextNd->GetpSwpHints()->Get( n );
nAttrStart = pHt->GetStart();
if( nAttrStart > nStart ) // beyond the area
break;
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 759cfc84b104..c9be0fb9b98a 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -325,7 +325,7 @@ std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> SwEditShell
const size_t nSize = pTextNd->GetpSwpHints()->Count();
for( size_t m = 0; m < nSize; m++ )
{
- const SwTextAttr* pHt = (*pTextNd->GetpSwpHints())[m];
+ const SwTextAttr* pHt = pTextNd->GetpSwpHints()->Get(m);
if( pHt->Which() == RES_TXTATR_AUTOFMT ||
pHt->Which() == RES_TXTATR_CHARFMT ||
pHt->Which() == RES_TXTATR_INETFMT )
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index e31a3f087493..1738defe6732 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1303,7 +1303,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference <
const size_t nEnd = pHts->Count();
for( size_t n = 0; n < nEnd; ++n )
{
- const SfxPoolItem* pItem = &(*pHts)[ n ]->GetAttr();
+ const SfxPoolItem* pItem = &pHts->Get(n)->GetAttr();
if( RES_TXTATR_FIELD == pItem->Which()
&& TYP_SEQFLD == static_cast<const SwFormatField*>(pItem)->GetField()->GetTypeId() )
{
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 9422b1c4dcc9..93abe09df994 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2509,7 +2509,7 @@ sal_uLong SwTableBox::IsValidNumTextNd( bool bCheckAttr ) const
sal_Int32 nNextSetField = 0;
for( size_t n = 0; n < pHts->Count(); ++n )
{
- const SwTextAttr* pAttr = (*pHts)[ n ];
+ const SwTextAttr* pAttr = pHts->Get(n);
if( RES_TXTATR_NOEND_BEGIN <= pAttr->Which() )
{
if ( (pAttr->GetStart() == nNextSetField)
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 43a9589507f6..2a17ffa80eb7 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -610,7 +610,7 @@ SwContentFrm *SwTextFrm::JoinFrm()
SwFootnoteBossFrm *pEndBoss = 0;
for ( size_t i = 0; i < pHints->Count(); ++i )
{
- const SwTextAttr *pHt = (*pHints)[i];
+ const SwTextAttr *pHt = pHints->Get(i);
if( RES_TXTATR_FTN==pHt->Which() && pHt->GetStart()>=nStart )
{
if( pHt->GetFootnote().IsEndNote() )
@@ -703,7 +703,7 @@ SwContentFrm *SwTextFrm::SplitFrm( const sal_Int32 nTextPos )
SwFootnoteBossFrm *pEndBoss = 0;
for ( size_t i = 0; i < pHints->Count(); ++i )
{
- const SwTextAttr *pHt = (*pHints)[i];
+ const SwTextAttr *pHt = pHints->Get(i);
if( RES_TXTATR_FTN==pHt->Which() && pHt->GetStart()>=nTextPos )
{
if( pHt->GetFootnote().IsEndNote() )
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index d4347bd2efe3..71425ae5c068 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -164,8 +164,8 @@ bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFo
{
SwTextAttr *pTextAttr;
// While we've not reached the end of the StartArray && the TextAttribute starts at position 0...
- while ( ( nStartIndex < pHints->GetStartCount() ) &&
- !((pTextAttr=pHints->GetStart(nStartIndex))->GetStart()) )
+ while ( ( nStartIndex < pHints->Count() ) &&
+ !((pTextAttr = pHints->Get(nStartIndex))->GetStart()) )
{
// open the TextAttributes
Chg( pTextAttr );
@@ -202,8 +202,8 @@ void SwAttrIter::SeekFwd( const sal_Int32 nNewPos )
// As long as we've not yet reached the end of EndArray and the
// TextAttribute ends before or at the new position ...
- while ( ( nEndIndex < pHints->GetEndCount() ) &&
- (*(pTextAttr=pHints->GetEnd(nEndIndex))->GetAnyEnd()<=nNewPos))
+ while ( ( nEndIndex < pHints->Count() ) &&
+ (*(pTextAttr=pHints->GetSortedByEnd(nEndIndex))->GetAnyEnd()<=nNewPos))
{
// Close the TextAttributes, whose StartPos were before or at
// the old nPos and are currently open
@@ -213,8 +213,8 @@ void SwAttrIter::SeekFwd( const sal_Int32 nNewPos )
}
else // skip the not opended ends
{
- while ( (nEndIndex < pHints->GetEndCount()) &&
- (*pHints->GetEnd(nEndIndex)->GetAnyEnd() <= nNewPos) )
+ while ( (nEndIndex < pHints->Count()) &&
+ (*pHints->GetSortedByEnd(nEndIndex)->GetAnyEnd() <= nNewPos) )
{
nEndIndex++;
}
@@ -222,8 +222,8 @@ void SwAttrIter::SeekFwd( const sal_Int32 nNewPos )
// As long as we've not yet reached the end of EndArray and the
// TextAttribute ends before or at the new position ...
- while ( ( nStartIndex < pHints->GetStartCount() ) &&
- ((pTextAttr=pHints->GetStart(nStartIndex))->GetStart()<=nNewPos) )
+ while ( ( nStartIndex < pHints->Count() ) &&
+ ((pTextAttr=pHints->Get(nStartIndex))->GetStart()<=nNewPos) )
{
// open the TextAttributes, whose ends lie behind the new position
@@ -286,9 +286,9 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const
if( pHints )
{
// are there attribute starts left?
- for (size_t i = nStartIndex; i < pHints->GetStartCount(); ++i)
+ for (size_t i = nStartIndex; i < pHints->Count(); ++i)
{
- SwTextAttr *const pAttr(pHints->GetStart(i));
+ SwTextAttr *const pAttr(pHints->Get(i));
if (!pAttr->IsFormatIgnoreStart())
{
nNext = pAttr->GetStart();
@@ -296,9 +296,9 @@ sal_Int32 SwAttrIter::GetNextAttr( ) const
}
}
// are there attribute ends left?
- for (size_t i = nEndIndex; i < pHints->GetEndCount(); ++i)
+ for (size_t i = nEndIndex; i < pHints->Count(); ++i)
{
- SwTextAttr *const pAttr(pHints->GetEnd(i));
+ SwTextAttr *const pAttr(pHints->GetSortedByEnd(i));
if (!pAttr->IsFormatIgnoreEnd())
{
sal_Int32 const nNextEnd = *pAttr->GetAnyEnd();
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 56d155bfeda1..2b46d0cc98d6 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -494,9 +494,9 @@ void SwTextPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
if( HasHints() )
{
- for ( size_t nTmp = 0; nTmp < pHints->GetStartCount(); ++nTmp )
+ for ( size_t nTmp = 0; nTmp < pHints->Count(); ++nTmp )
{
- SwTextAttr* const pTextAttr = pHints->GetStart( nTmp );
+ SwTextAttr* const pTextAttr = pHints->Get( nTmp );
const SvxUnderlineItem* pItem =
static_cast<const SvxUnderlineItem*>(CharFormat::GetItem( *pTextAttr, RES_CHRATR_UNDERLINE ));
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index 8f4f709250b9..149a506bab4e 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -347,7 +347,7 @@ void SwTextIter::TruncLines( bool bNoteFollow )
// examine hints in range nEnd - (nEnd + nRangeChar)
for( size_t i = 0; i < pTmpHints->Count(); ++i )
{
- const SwTextAttr* pHt = pTmpHints->GetTextHint( i );
+ const SwTextAttr* pHt = pTmpHints->Get( i );
if( RES_TXTATR_FLYCNT == pHt->Which() )
{
// check, if hint is in our range
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index bd626427b77f..065777d29275 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -189,7 +189,7 @@ sal_Int32 SwTextFrm::CalcFlyPos( SwFrameFormat* pSearch )
SwTextAttr* pFound = NULL;
for ( size_t i = 0; i < pHints->Count(); ++i )
{
- SwTextAttr *pHt = pHints->GetTextHint( i );
+ SwTextAttr *pHt = pHints->Get( i );
if( RES_TXTATR_FLYCNT == pHt->Which() )
{
SwFrameFormat* pFrameFormat = pHt->GetFlyCnt().GetFrameFormat();
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 93d4162d507e..d7c217dc31d3 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2067,9 +2067,9 @@ void SwScriptInfo::selectHiddenTextProperty(const SwTextNode& rNode, MultiSelect
if( pHints )
{
- for( size_t nTmp = 0; nTmp < pHints->GetStartCount(); ++nTmp )
+ for( size_t nTmp = 0; nTmp < pHints->Count(); ++nTmp )
{
- const SwTextAttr* pTextAttr = pHints->GetStart( nTmp );
+ const SwTextAttr* pTextAttr = pHints->Get( nTmp );
const SvxCharHiddenItem* pHiddenItem =
static_cast<const SvxCharHiddenItem*>( CharFormat::GetItem( *pTextAttr, RES_CHRATR_HIDDEN ) );
if( pHiddenItem )
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index d66702e0ab7e..800f09744122 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -865,7 +865,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator( sal_Int32 &rPos,
const size_t nCount = pHints ? pHints->Count() : 0;
for( size_t i = 0; i < nCount; ++i )
{
- const SwTextAttr *pTmp = (*pHints)[i];
+ const SwTextAttr *pTmp = pHints->Get(i);
sal_Int32 nStart = pTmp->GetStart();
if( rPos < nStart )
break;
@@ -918,7 +918,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator( sal_Int32 &rPos,
if( n2Lines < nCount )
{
pRet->pItem = NULL;
- pRet->pAttr = (*pHints)[n2Lines];
+ pRet->pAttr = pHints->Get(n2Lines);
aEnd.push_front( *pRet->pAttr->End() );
if( pItem )
{
@@ -957,7 +957,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator( sal_Int32 &rPos,
// continuity attribute.
for( size_t i = 0; i < nCount; ++i )
{
- const SwTextAttr *pTmp = (*pHints)[i];
+ const SwTextAttr *pTmp = pHints->Get(i);
if( *pTmp->GetAnyEnd() <= rPos )
continue;
if( rPos < pTmp->GetStart() )
@@ -1035,7 +1035,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator( sal_Int32 &rPos,
sal_Int32 n2Start = rPos;
for( size_t i = 0; i < nCount; ++i )
{
- const SwTextAttr *pTmp = (*pHints)[i];
+ const SwTextAttr *pTmp = pHints->Get(i);
if( *pTmp->GetAnyEnd() <= n2Start )
continue;
if( n2Start < pTmp->GetStart() )
@@ -1090,7 +1090,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator( sal_Int32 &rPos,
if( nRotate < nCount )
{
pRet->pItem = NULL;
- pRet->pAttr = (*pHints)[nRotate];
+ pRet->pAttr = pHints->Get(nRotate);
aEnd.push_front( *pRet->pAttr->End() );
if( pRotItem )
{
@@ -1107,7 +1107,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator( sal_Int32 &rPos,
}
for( size_t i = 0; i < nCount; ++i )
{
- const SwTextAttr *pTmp = (*pHints)[i];
+ const SwTextAttr *pTmp = pHints->Get(i);
if( *pTmp->GetAnyEnd() <= rPos )
continue;
if( rPos < pTmp->GetStart() )
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 98fc3c98158c..b09fad211a1d 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -319,9 +319,9 @@ SwExpandPortion * SwTextFormatter::TryNewNoLengthPortion(SwTextFormatInfo & rInf
if (pHints)
{
const sal_Int32 nIdx(rInfo.GetIdx());
- while (m_nHintEndIndex < pHints->GetEndCount())
+ while (m_nHintEndIndex < pHints->Count())
{
- SwTextAttr & rHint( *pHints->GetEnd(m_nHintEndIndex) );
+ SwTextAttr & rHint( *pHints->GetSortedByEnd(m_nHintEndIndex) );
sal_Int32 const nEnd( *rHint.GetAnyEnd() );
if (nEnd > nIdx)
{
@@ -413,7 +413,7 @@ static void checkApplyParagraphMarkFormatToNumbering( SwFont* pNumFnt, SwTextFor
{
for( size_t i = 0; i < hints->Count(); ++i )
{
- SwTextAttr* hint = hints->GetTextHint( i );
+ SwTextAttr* hint = hints->Get( i );
// Formatting for the paragraph mark is set to apply only to the (non-existent) extra character
// the at end of the txt node.
if( hint->Which() == RES_TXTATR_AUTOFMT && hint->GetEnd() != NULL
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index e931f5ae6afb..b240c63fc3c2 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -483,7 +483,7 @@ void SwTextFrm::HideFootnotes( sal_Int32 nStart, sal_Int32 nEnd )
SwPageFrm *pPage = 0;
for ( size_t i = 0; i < nSize; ++i )
{
- const SwTextAttr *pHt = (*pHints)[i];
+ const SwTextAttr *pHt = pHints->Get(i);
if ( pHt->Which() == RES_TXTATR_FTN )
{
const sal_Int32 nIdx = pHt->GetStart();
@@ -1616,7 +1616,7 @@ bool SwTextFrm::Prepare( const PrepareHint ePrep, const void* pVoid,
GetFollow()->GetOfst() : COMPLETE_STRING;
for ( size_t i = 0; i < nSize; ++i )
{
- const SwTextAttr *pHt = (*pHints)[i];
+ const SwTextAttr *pHt = pHints->Get(i);
const sal_Int32 nStart = pHt->GetStart();
if( nStart >= GetOfst() )
{
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 0b965860a705..4a85368a1f6c 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -103,7 +103,7 @@ void SwTextFrm::CalcFootnoteFlag()
for ( size_t i = 0; i < nSize; ++i )
{
- const SwTextAttr *pHt = (*pHints)[i];
+ const SwTextAttr *pHt = pHints->Get(i);
if ( pHt->Which() == RES_TXTATR_FTN )
{
const sal_Int32 nIdx = pHt->GetStart();
@@ -422,7 +422,7 @@ void SwTextFrm::RemoveFootnote( const sal_Int32 nStart, const sal_Int32 nLen )
= FTNPOS_CHAPTER == GetNode()->GetDoc()->GetFootnoteInfo().ePos;
for ( size_t i = nSize; i; )
{
- SwTextAttr *pHt = pHints->GetTextHint(--i);
+ SwTextAttr *pHt = pHints->Get(--i);
if ( RES_TXTATR_FTN != pHt->Which() )
continue;
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx
index 11eab33dc5d8..3fc431d48321 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -303,7 +303,7 @@ ToxTextGenerator::HandleTextToken(const SwTOXSortTabBase& source, SwAttrPool& po
}
const SwpHints& hints = pSrc->GetSwpHints();
for (size_t i = 0; i < hints.Count(); ++i) {
- const SwTextAttr* hint = hints[i];
+ const SwTextAttr* hint = hints.Get(i);
std::shared_ptr<SfxItemSet> attributesToClone = CollectAttributesForTox(*hint, pool);
if (attributesToClone->Count() <= 0) {
continue;
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index 7a8e4fe52581..5d5cd6db54e5 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -130,7 +130,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode, ExpandMode eMode)
const SwpHints* pSwpHints2 = rNode.GetpSwpHints();
for ( size_t i = 0; pSwpHints2 && i < pSwpHints2->Count(); ++i )
{
- const SwTextAttr* pAttr = (*pSwpHints2)[i];
+ const SwTextAttr* pAttr = pSwpHints2->Get(i);
if (pAttr->HasDummyChar())
{
const sal_Int32 nDummyCharPos = pAttr->GetStart();
diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index 24f52d865039..72c5946d8e77 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -106,38 +106,25 @@ bool CompareSwpHtEnd::operator()(SwTextAttr* const lhs, SwTextAttr* const rhs) c
return lcl_IsLessEnd( *lhs, *rhs );
}
-void SwpHintsArray::Insert( const SwTextAttr *pHt )
+void SwpHints::Insert( const SwTextAttr *pHt )
{
Resort();
- assert(m_HintStarts.find(const_cast<SwTextAttr*>(pHt))
- == m_HintStarts.end()); // "Insert: hint already in HtStart"
- assert(m_HintEnds.find(const_cast<SwTextAttr*>(pHt))
- == m_HintEnds.end()); // "Insert: hint already in HtEnd"
- m_HintStarts.insert( const_cast<SwTextAttr*>(pHt) );
- m_HintEnds .insert( const_cast<SwTextAttr*>(pHt) );
+ assert(m_HintsByStart.find(const_cast<SwTextAttr*>(pHt))
+ == m_HintsByStart.end()); // "Insert: hint already in HtStart"
+ assert(m_HintsByEnd.find(const_cast<SwTextAttr*>(pHt))
+ == m_HintsByEnd.end()); // "Insert: hint already in HtEnd"
+ m_HintsByStart.insert( const_cast<SwTextAttr*>(pHt) );
+ m_HintsByEnd .insert( const_cast<SwTextAttr*>(pHt) );
}
-void SwpHintsArray::DeleteAtPos( const size_t nPos )
-{
- // optimization: nPos is the position in the Starts array
- SwTextAttr *pHt = m_HintStarts[ nPos ];
- m_HintStarts.erase( m_HintStarts.begin() + nPos );
-
- Resort();
-
- bool const done = m_HintEnds.erase(pHt);
- assert(done);
- (void) done; // unused in NDEBUG
-}
-
-bool SwpHintsArray::Contains( const SwTextAttr *pHt ) const
+bool SwpHints::Contains( const SwTextAttr *pHt ) const
{
// DO NOT use find() or CHECK here!
// if called from SwTextNode::InsertItem, pHt has already been deleted,
// so it cannot be dereferenced
- for (size_t i = 0; i < m_HintStarts.size(); ++i)
+ for (size_t i = 0; i < m_HintsByStart.size(); ++i)
{
- if (m_HintStarts[i] == pHt)
+ if (m_HintsByStart[i] == pHt)
{
return true;
}
@@ -151,14 +138,14 @@ bool SwpHintsArray::Contains( const SwTextAttr *pHt ) const
if(!(cond)) \
{ \
SAL_WARN("sw.core", text); \
- (const_cast<SwpHintsArray*>(this))->Resort(); \
+ (const_cast<SwpHints*>(this))->Resort(); \
return false; \
}
-bool SwpHintsArray::Check(bool bPortionsMerged) const
+bool SwpHints::Check(bool bPortionsMerged) const
{
// 1) gleiche Anzahl in beiden Arrays
- CHECK_ERR( m_HintStarts.size() == m_HintEnds.size(),
+ CHECK_ERR( m_HintsByStart.size() == m_HintsByEnd.size(),
"HintsCheck: wrong sizes" );
sal_Int32 nLastStart = 0;
sal_Int32 nLastEnd = 0;
@@ -170,7 +157,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
{
for (size_t i = 0; i < Count(); ++i)
{
- SwTextAttr const*const pHint(m_HintStarts[i]);
+ SwTextAttr const*const pHint(m_HintsByStart[i]);
if (RES_TXTATR_AUTOFMT == pHint->Which())
{
std::shared_ptr<SfxItemSet> const pSet(
@@ -188,7 +175,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
// --- Start-Kontrolle ---
// 2a) gueltiger Pointer? vgl. DELETEFF
- const SwTextAttr *pHt = m_HintStarts[i];
+ const SwTextAttr *pHt = m_HintsByStart[i];
CHECK_ERR( 0xFF != *reinterpret_cast<unsigned char const *>(pHt), "HintsCheck: start ptr was deleted" );
// 3a) Stimmt die Start-Sortierung?
@@ -205,7 +192,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
// --- End-Kontrolle ---
// 2b) gueltiger Pointer? vgl. DELETEFF
- const SwTextAttr *pHtEnd = m_HintEnds[i];
+ const SwTextAttr *pHtEnd = m_HintsByEnd[i];
CHECK_ERR( 0xFF != *reinterpret_cast<unsigned char const *>(pHtEnd), "HintsCheck: end ptr was deleted" );
// 3b) Stimmt die End-Sortierung?
@@ -223,13 +210,13 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
// --- Ueberkreuzungen ---
// 5) gleiche Pointer in beiden Arrays
- if (m_HintStarts.find(const_cast<SwTextAttr*>(pHt)) == m_HintStarts.end())
+ if (m_HintsByStart.find(const_cast<SwTextAttr*>(pHt)) == m_HintsByStart.end())
nIdx = COMPLETE_STRING;
CHECK_ERR( COMPLETE_STRING != nIdx, "HintsCheck: no GetStartOf" );
// 6) gleiche Pointer in beiden Arrays
- if (m_HintEnds.find(const_cast<SwTextAttr*>(pHt)) == m_HintEnds.end())
+ if (m_HintsByEnd.find(const_cast<SwTextAttr*>(pHt)) == m_HintsByEnd.end())
nIdx = COMPLETE_STRING;
CHECK_ERR( COMPLETE_STRING != nIdx, "HintsCheck: no GetEndOf" );
@@ -245,8 +232,8 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
"HintsCheck: Character attribute in end array" );
// 8) style portion check
- const SwTextAttr* pHtThis = m_HintStarts[i];
- const SwTextAttr* pHtLast = i > 0 ? m_HintStarts[i-1] : 0;
+ const SwTextAttr* pHtThis = m_HintsByStart[i];
+ const SwTextAttr* pHtLast = i > 0 ? m_HintsByStart[i-1] : 0;
CHECK_ERR( (0 == i)
|| ( (RES_TXTATR_CHARFMT != pHtLast->Which())
&& (RES_TXTATR_AUTOFMT != pHtLast->Which()))
@@ -297,7 +284,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
bool bFound(false);
for (size_t j = i + 1; j < Count(); ++j)
{
- SwTextAttr *const pOther(m_HintStarts[j]);
+ SwTextAttr *const pOther(m_HintsByStart[j]);
if (pOther->GetStart() > *pHt->End())
{
break; // done
@@ -343,7 +330,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
{
for ( size_t j = 0; j < Count(); ++j )
{
- SwTextAttr const * const pOther( m_HintStarts[j] );
+ SwTextAttr const * const pOther( m_HintsByStart[j] );
if ( pOther->IsNesting() && (i != j) )
{
SwComparePosition cmp = ComparePosition(
@@ -361,7 +348,7 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
{
for ( size_t j = 0; j < i; ++j )
{
- SwTextAttr const * const pOther( m_HintStarts[j] );
+ SwTextAttr const * const pOther( m_HintsByStart[j] );
if (pOther->HasDummyChar())
{
CHECK_ERR( (pOther->GetStart() != pHtThis->GetStart()),
@@ -377,13 +364,13 @@ bool SwpHintsArray::Check(bool bPortionsMerged) const
// Resort() is called before every Insert and Delete.
// Various SwTextNode methods modify hints in a way that violates the
-// sort order of the m_HintStarts, m_HintEnds arrays, so this method is needed
+// sort order of the m_HintsByStart, m_HintsByEnd arrays, so this method is needed
// to restore the order.
-void SwpHintsArray::Resort()
+void SwpHints::Resort()
{
- m_HintStarts.Resort();
- m_HintEnds.Resort();
+ m_HintsByStart.Resort();
+ m_HintsByEnd.Resort();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 331736926478..aa374587d594 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -254,7 +254,7 @@ SwTextNode::~SwTextNode()
{
// first remove the attribute from the array otherwise
// if would delete itself
- DestroyAttr( pTmpHints->GetTextHint( --j ) );
+ DestroyAttr( pTmpHints->Get( --j ) );
}
delete pTmpHints;
@@ -311,7 +311,7 @@ static void lcl_ChangeFootnoteRef( SwTextNode &rNode )
SwFootnoteFrm* pFirstFootnoteOfNode = 0;
for( size_t j = pSwpHints->Count(); j; )
{
- SwTextAttr* pHt = pSwpHints->GetTextHint(--j);
+ SwTextAttr* pHt = pSwpHints->Get(--j);
if (RES_TXTATR_FTN == pHt->Which())
{
if( !pFrm )
@@ -464,7 +464,7 @@ SwContentNode *SwTextNode::SplitContentNode( const SwPosition &rPos )
{
for ( size_t j = m_pSwpHints->Count(); j; )
{
- SwTextAttr* const pHt = m_pSwpHints->GetTextHint( --j );
+ SwTextAttr* const pHt = m_pSwpHints->Get( --j );
if ( RES_TXTATR_FLYCNT == pHt ->Which() )
{
pHt->GetFlyCnt().GetFrameFormat()->DelFrms();
@@ -552,7 +552,7 @@ SwContentNode *SwTextNode::SplitContentNode( const SwPosition &rPos )
{
for ( size_t j = m_pSwpHints->Count(); j; )
{
- SwTextAttr* const pHt = m_pSwpHints->GetTextHint( --j );
+ SwTextAttr* const pHt = m_pSwpHints->Get( --j );
const sal_Int32* const pEnd = pHt->GetEnd();
if ( pHt->DontExpand() && pEnd && (pHt->GetStart() == *pEnd) )
{
@@ -609,7 +609,7 @@ void SwTextNode::MoveTextAttr_To_AttrSet()
OSL_ENSURE( m_pSwpHints, "MoveTextAttr_To_AttrSet without SwpHints?" );
for ( size_t i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
- SwTextAttr *pHt = m_pSwpHints->GetTextHint(i);
+ SwTextAttr *pHt = m_pSwpHints->Get(i);
if( pHt->GetStart() )
break;
@@ -866,7 +866,7 @@ void SwTextNode::Update(
{
bool bTextAttrChanged = false;
bool bStartOfTextAttrChanged = false;
- SwTextAttr * const pHint = m_pSwpHints->GetTextHint(n);
+ SwTextAttr * const pHint = m_pSwpHints->Get(n);
sal_Int32 & rStart = pHint->GetStart();
if ( rStart > nChangePos )
{
@@ -930,7 +930,7 @@ void SwTextNode::Update(
for ( size_t n = 0; n < m_pSwpHints->Count(); ++n )
{
bool bTextAttrChanged = false;
- SwTextAttr * const pHint = m_pSwpHints->GetTextHint(n);
+ SwTextAttr * const pHint = m_pSwpHints->Get(n);
sal_Int32 & rStart = pHint->GetStart();
sal_Int32 * const pEnd = pHint->GetEnd();
if ( rStart >= nChangePos )
@@ -1244,11 +1244,11 @@ bool SwTextNode::DontExpandFormat( const SwIndex& rIdx, bool bFlag,
bool bRet = false;
if ( HasHints() )
{
- const size_t nEndCnt = m_pSwpHints->GetEndCount();
+ const size_t nEndCnt = m_pSwpHints->Count();
size_t nPos = nEndCnt;
while( nPos )
{
- SwTextAttr *pTmp = m_pSwpHints->GetEnd( --nPos );
+ SwTextAttr *pTmp = m_pSwpHints->GetSortedByEnd( --nPos );
sal_Int32 *pEnd = pTmp->GetEnd();
if( !pEnd || *pEnd > nIdx )
continue;
@@ -1300,7 +1300,7 @@ lcl_GetTextAttrs(
for( size_t i = 0; i < nSize; ++i )
{
- SwTextAttr *const pHint = pSwpHints->GetTextHint(i);
+ SwTextAttr *const pHint = pSwpHints->Get(i);
sal_Int32 const nHintStart = pHint->GetStart();
if (nIndex < nHintStart)
{
@@ -1580,7 +1580,7 @@ void SwTextNode::CopyAttr( SwTextNode *pDest, const sal_Int32 nTextStartIdx,
for ( size_t i = 0; i < m_pSwpHints->Count(); ++i )
{
- SwTextAttr *const pHt = m_pSwpHints->GetTextHint(i);
+ SwTextAttr *const pHt = m_pSwpHints->Get(i);
sal_Int32 const nAttrStartIdx = pHt->GetStart();
if ( nTextStartIdx < nAttrStartIdx )
break; // ueber das Textende, da nLen == 0
@@ -1764,11 +1764,11 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
//Achtung: kann ungueltig sein!!
for (size_t n = 0; n < nSize; ++n)
{
- const sal_Int32 nAttrStartIdx = (*m_pSwpHints)[n]->GetStart();
+ const sal_Int32 nAttrStartIdx = m_pSwpHints->Get(n)->GetStart();
if (!( nAttrStartIdx < nEnd))
break;
- SwTextAttr * const pHt = m_pSwpHints->GetTextHint(n);
+ SwTextAttr * const pHt = m_pSwpHints->Get(n);
const sal_Int32 * const pEndIdx = pHt->GetEnd();
const sal_uInt16 nWhich = pHt->Which();
@@ -1948,9 +1948,9 @@ OUString SwTextNode::InsertText( const OUString & rStr, const SwIndex & rIdx,
{
bool bMergePortionsNeeded(false);
for ( size_t i = 0; i < m_pSwpHints->Count() &&
- rIdx >= (*m_pSwpHints)[i]->GetStart(); ++i )
+ rIdx >= m_pSwpHints->Get(i)->GetStart(); ++i )
{
- SwTextAttr * const pHt = m_pSwpHints->GetTextHint( i );
+ SwTextAttr * const pHt = m_pSwpHints->Get( i );
sal_Int32 * const pEndIdx = pHt->GetEnd();
if( !pEndIdx )
continue;
@@ -2110,7 +2110,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
size_t nAttrCnt = 0;
while (m_pSwpHints && (nAttrCnt < m_pSwpHints->Count()))
{
- SwTextAttr * const pHt = m_pSwpHints->GetTextHint(nAttrCnt);
+ SwTextAttr * const pHt = m_pSwpHints->Get(nAttrCnt);
const sal_Int32 nAttrStartIdx = pHt->GetStart();
if (!( nAttrStartIdx < nEnd ))
break;
@@ -2204,7 +2204,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
SwpHts aArr;
while (nAttrCnt < m_pSwpHints->Count())
{
- SwTextAttr * const pHt = m_pSwpHints->GetTextHint(nAttrCnt);
+ SwTextAttr * const pHt = m_pSwpHints->Get(nAttrCnt);
if (nEnd != pHt->GetStart())
break;
const sal_Int32 * const pEndIdx = pHt->GetEnd();
@@ -2266,7 +2266,7 @@ void SwTextNode::EraseText(const SwIndex &rIdx, const sal_Int32 nCount,
for ( size_t i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
- SwTextAttr *pHt = m_pSwpHints->GetTextHint(i);
+ SwTextAttr *pHt = m_pSwpHints->Get(i);
const sal_Int32 nHintStart = pHt->GetStart();
@@ -2362,7 +2362,7 @@ void SwTextNode::GCAttr()
for ( size_t i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
- SwTextAttr * const pHt = m_pSwpHints->GetTextHint(i);
+ SwTextAttr * const pHt = m_pSwpHints->Get(i);
// wenn Ende und Start gleich sind --> loeschen
const sal_Int32 * const pEndIdx = pHt->GetEnd();
@@ -2653,7 +2653,7 @@ SwTextAttr * SwTextNode::GetTextAttrForCharAt(
{
for ( size_t i = 0; i < m_pSwpHints->Count(); ++i )
{
- SwTextAttr * const pHint = m_pSwpHints->GetTextHint(i);
+ SwTextAttr * const pHint = m_pSwpHints->Get(i);
const sal_Int32 nStartPos = pHint->GetStart();
if ( nIndex < nStartPos )
{
@@ -3080,7 +3080,7 @@ bool SwTextNode::GetExpandText( SwTextNode& rDestNd, const SwIndex* pDestIdx,
sal_Int32 nInsPos = nDestStt - nIdx;
for ( size_t i = 0; i < m_pSwpHints->Count(); ++i )
{
- const SwTextAttr* pHt = (*m_pSwpHints)[i];
+ const SwTextAttr* pHt = m_pSwpHints->Get(i);
const sal_Int32 nAttrStartIdx = pHt->GetStart();
const sal_uInt16 nWhich = pHt->Which();
if (nIdx + nLen <= nAttrStartIdx)
@@ -4862,7 +4862,7 @@ void SwTextNode::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterStartElement(pWriter, BAD_CAST("swpHints"));
const SwpHints& rHints = GetSwpHints();
for (size_t i = 0; i < rHints.Count(); ++i)
- rHints.GetTextHint(i)->dumpAsXml(pWriter);
+ rHints.Get(i)->dumpAsXml(pWriter);
xmlTextWriterEndElement(pWriter);
}
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 3da268ea6ad6..f13c1d48d80c 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -282,7 +282,7 @@ lcl_DoSplitNew(NestList_t & rSplits, SwTextNode & rNode,
*/
void SwpHints::InsertNesting(SwTextAttrNesting & rNewHint)
{
- SwpHintsArray::Insert(& rNewHint);
+ Insert(& rNewHint);
NoteInHistory( & rNewHint, true );
}
@@ -375,9 +375,9 @@ SwpHints::TryInsertNesting( SwTextNode & rNode, SwTextAttrNesting & rNewHint )
SplitNew.push_back(& rNewHint);
// pass 1: split the inserted hint into fragments if necessary
- for ( size_t i = 0; i < GetEndCount(); ++i )
+ for ( size_t i = 0; i < Count(); ++i )
{
- SwTextAttr * const pOther = GetEnd(i);
+ SwTextAttr * const pOther = GetSortedByEnd(i);
if (pOther->IsNesting())
{
@@ -610,7 +610,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
{
for ( size_t i = 0; i < Count(); ++i )
{
- SwTextAttr* pOther = GetTextHint(i);
+ SwTextAttr* pOther = Get(i);
if ( RES_TXTATR_CHARFMT != pOther->Which() &&
RES_TXTATR_AUTOFMT != pOther->Which() )
@@ -661,7 +661,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// Insert the newly created attributes:
for ( aIter = aInsDelHints.begin(); aIter != aInsDelHints.end(); ++aIter )
{
- SwpHintsArray::Insert( *aIter );
+ Insert( *aIter );
NoteInHistory( *aIter, true );
}
}
@@ -681,7 +681,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
{
for ( size_t i = 0; i < Count(); ++i )
{
- const SwTextAttr* pOther = GetTextHint(i);
+ const SwTextAttr* pOther = Get(i);
if ( RES_TXTATR_CHARFMT != pOther->Which() &&
RES_TXTATR_AUTOFMT != pOther->Which() )
@@ -713,7 +713,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
// Get all hints that are in [nPorStart, nPorEnd[:
for ( size_t i = 0; i < Count(); ++i )
{
- SwTextAttr *pOther = GetTextHint(i);
+ SwTextAttr *pOther = Get(i);
if ( RES_TXTATR_CHARFMT != pOther->Which() &&
RES_TXTATR_AUTOFMT != pOther->Which() )
@@ -798,7 +798,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
{
pNewAttr = MakeTextAttr( *rNode.GetDoc(),
aNewSet, nPorStart, nPorEnd );
- SwpHintsArray::Insert( pNewAttr );
+ Insert( pNewAttr );
NoteInHistory( pNewAttr, true );
}
}
@@ -940,7 +940,7 @@ void SwpHints::BuildPortions( SwTextNode& rNode, SwTextAttr& rNewHint,
if ( pNewAttr )
{
- SwpHintsArray::Insert( pNewAttr );
+ Insert( pNewAttr );
// if ( bDestroyHint )
NoteInHistory( pNewAttr, true );
}
@@ -1694,7 +1694,7 @@ void SwTextNode::DeleteAttributes(
for ( size_t nPos = 0; m_pSwpHints && nPos < m_pSwpHints->Count(); ++nPos )
{
- SwTextAttr * const pTextHt = m_pSwpHints->GetTextHint( nPos );
+ SwTextAttr * const pTextHt = m_pSwpHints->Get( nPos );
const sal_Int32 nHintStart = pTextHt->GetStart();
if (nStart < nHintStart)
{
@@ -1874,7 +1874,7 @@ bool SwTextNode::SetAttr(
{
for ( size_t n = 0; n < m_pSwpHints->Count(); ++n )
{
- if ( (*m_pSwpHints)[ n ]->IsCharFormatAttr() )
+ if ( m_pSwpHints->Get( n )->IsCharFormatAttr() )
{
bHasCharFormats = true;
break;
@@ -2109,7 +2109,7 @@ bool SwTextNode::GetAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
{
for (size_t n = 0; n < nSize; ++n)
{
- const SwTextAttr* pHt = (*m_pSwpHints)[n];
+ const SwTextAttr* pHt = m_pSwpHints->Get(n);
const sal_Int32 nAttrStart = pHt->GetStart();
if( nAttrStart > nEnd ) // ueber den Bereich hinaus
break;
@@ -2135,7 +2135,7 @@ bool SwTextNode::GetAttr( SfxItemSet& rSet, sal_Int32 nStt, sal_Int32 nEnd,
for (size_t n = 0; n < nSize; ++n)
{
- const SwTextAttr* pHt = (*m_pSwpHints)[n];
+ const SwTextAttr* pHt = m_pSwpHints->Get(n);
const sal_Int32 nAttrStart = pHt->GetStart();
if( nAttrStart > nEnd ) // ueber den Bereich hinaus
break;
@@ -2359,7 +2359,7 @@ lcl_CollectHintSpans(const SwpHints& i_rHints, const sal_Int32 nLength,
for (size_t i = 0; i < i_rHints.Count(); ++i)
{
- const SwTextAttr* const pHint(i_rHints[i]);
+ const SwTextAttr* pHint = i_rHints.Get(i);
const sal_uInt16 nWhich(pHint->Which());
if (nWhich == RES_TXTATR_CHARFMT || nWhich == RES_TXTATR_AUTOFMT)
{
@@ -2580,7 +2580,7 @@ void SwpHints::CalcFlags()
const size_t nSize = Count();
for( size_t nPos = 0; nPos < nSize; ++nPos )
{
- const SwTextAttr* pAttr = (*this)[ nPos ];
+ const SwTextAttr* pAttr = Get( nPos );
switch( pAttr->Which() )
{
case RES_TXTATR_FTN:
@@ -2613,7 +2613,7 @@ bool SwpHints::CalcHiddenParaField()
for( size_t nPos = 0; nPos < nSize; ++nPos )
{
- pTextHt = (*this)[ nPos ];
+ pTextHt = Get(nPos);
const sal_uInt16 nWhich = pTextHt->Which();
if( RES_TXTATR_FIELD == nWhich )
@@ -2648,7 +2648,7 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
return false;
// sort before merging
- SwpHintsArray::Resort();
+ Resort();
bool bRet = false;
typedef std::multimap< int, std::pair<SwTextAttr*, bool> > PortionMap;
@@ -2660,7 +2660,7 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
// get portions by start position:
for ( size_t i = 0; i < Count(); ++i )
{
- SwTextAttr *pHt = GetTextHint( i );
+ SwTextAttr *pHt = Get( i );
if ( RES_TXTATR_CHARFMT != pHt->Which() &&
RES_TXTATR_AUTOFMT != pHt->Which() )
//&&
@@ -2679,7 +2679,7 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
// could be produced by ReplaceText or (maybe?) RstAttr
if (pHt->GetStart() == *pHt->GetEnd())
{
- SwpHintsArray::DeleteAtPos(i); // kill it without History!
+ DeleteAtPos(i); // kill it without History!
SwTextAttr::Destroy(pHt, rNode.GetDoc()->GetAttrPool());
--i;
continue;
@@ -2871,7 +2871,7 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
if (bRet)
{
- SwpHintsArray::Resort();
+ Resort();
}
}
else
@@ -2922,7 +2922,7 @@ static void lcl_CheckSortNumber( const SwpHints& rHints, SwTextCharFormat& rNewC
for ( size_t i = 0; i < rHints.Count(); ++i )
{
- const SwTextAttr* pOtherHt = rHints[i];
+ const SwTextAttr* pOtherHt = rHints.Get(i);
const sal_Int32 nOtherStart = pOtherHt->GetStart();
@@ -3115,7 +3115,7 @@ bool SwpHints::TryInsertHint(
sal_Int32 *pTmpHintEnd;
for( size_t n = 0, nEnd = Count(); n < nEnd; ++n )
{
- if (RES_TXTATR_REFMARK == (pTmpHt = GetTextHint(n))->Which() &&
+ if (RES_TXTATR_REFMARK == (pTmpHt = Get(n))->Which() &&
pHint->GetAttr() == pTmpHt->GetAttr() &&
0 != ( pTmpHtEnd = pTmpHt->GetEnd() ) &&
0 != ( pTmpHintEnd = pHint->GetEnd() ) )
@@ -3181,7 +3181,7 @@ bool SwpHints::TryInsertHint(
sal_Int32 nHtStart = pHint->GetStart();
if( !pHtEnd )
{
- SwpHintsArray::Insert( pHint );
+ Insert( pHint );
CalcFlags();
#ifdef DBG_UTIL
if( !rNode.GetDoc()->IsInReading() )
@@ -3266,7 +3266,7 @@ bool SwpHints::TryInsertHint(
if ( RES_TXTATR_CHARFMT == nWhich )
lcl_CheckSortNumber(*this, *static_txtattr_cast<SwTextCharFormat*>(pHint));
- SwpHintsArray::Insert( pHint );
+ Insert( pHint );
NoteInHistory( pHint, true );
}
}
@@ -3292,10 +3292,19 @@ bool SwpHints::TryInsertHint(
void SwpHints::DeleteAtPos( const size_t nPos )
{
- SwTextAttr *pHint = GetTextHint(nPos);
+ SwTextAttr *pHint = Get(nPos);
// ChainDelete( pHint );
NoteInHistory( pHint );
- SwpHintsArray::DeleteAtPos( nPos );
+
+ // optimization: nPos is the position in the Starts array
+ SwTextAttr *pHt = m_HintsByStart[ nPos ];
+ m_HintsByStart.erase( m_HintsByStart.begin() + nPos );
+
+ Resort();
+
+ bool const done = m_HintsByEnd.erase(pHt);
+ assert(done);
+ (void) done; // unused in NDEBUG
if( pHint->Which() == RES_TXTATR_FIELD )
{
@@ -3331,7 +3340,7 @@ void SwpHints::DeleteAtPos( const size_t nPos )
void SwpHints::Delete( SwTextAttr* pTextHt )
{
// Attr 2.0: SwpHintsArr::Delete( pTextHt );
- const size_t nPos = GetStartOf( pTextHt );
+ const size_t nPos = GetIndexOf( pTextHt );
OSL_ENSURE( SAL_MAX_SIZE != nPos, "Attribut nicht im Attribut-Array!" );
if( SAL_MAX_SIZE != nPos )
DeleteAtPos( nPos );
@@ -3344,7 +3353,7 @@ void SwTextNode::ClearSwpHintsArr( bool bDelFields )
size_t nPos = 0;
while ( nPos < m_pSwpHints->Count() )
{
- SwTextAttr* pDel = m_pSwpHints->GetTextHint( nPos );
+ SwTextAttr* pDel = m_pSwpHints->Get( nPos );
bool bDel = false;
switch( pDel->Which() )
@@ -3365,7 +3374,7 @@ void SwTextNode::ClearSwpHintsArr( bool bDelFields )
if( bDel )
{
- m_pSwpHints->SwpHintsArray::DeleteAtPos( nPos );
+ m_pSwpHints->DeleteAtPos( nPos );
DestroyAttr( pDel );
}
else
@@ -3394,7 +3403,7 @@ sal_uInt16 SwTextNode::GetLang( const sal_Int32 nBegin, const sal_Int32 nLen,
for ( size_t i = 0; i < nSize; ++i )
{
// ist der Attribut-Anfang schon groesser als der Idx ?
- const SwTextAttr *pHt = m_pSwpHints->operator[](i);
+ const SwTextAttr *pHt = m_pSwpHints->Get(i);
const sal_Int32 nAttrStart = pHt->GetStart();
if( nEnd < nAttrStart )
break;
diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx
index c9f7158ffe4a..37d413393811 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -202,7 +202,7 @@ void SwTextAttrIterator::SearchNextChg()
const SfxPoolItem* pItem = 0;
for( ; nAttrPos < pHts->Count(); ++nAttrPos )
{
- const SwTextAttr* pHt = (*pHts)[ nAttrPos ];
+ const SwTextAttr* pHt = pHts->Get( nAttrPos );
const sal_Int32* pEnd = pHt->End();
const sal_Int32 nHtStt = pHt->GetStart();
if( nHtStt < nStt && ( !pEnd || *pEnd <= nStt ))
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index ac22a84c1025..582c60f189a6 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -421,10 +421,10 @@ void SwTextNode::RstTextAttr(
sal_Int32 nAttrStart;
SwTextAttr *pHt = NULL;
while ( (i < m_pSwpHints->Count())
- && ( ( ( nAttrStart = (*m_pSwpHints)[i]->GetStart()) < nEnd )
+ && ( ( ( nAttrStart = m_pSwpHints->Get(i)->GetStart()) < nEnd )
|| nLen==0 ) && !bExactRange)
{
- pHt = m_pSwpHints->GetTextHint(i);
+ pHt = m_pSwpHints->Get(i);
// attributes without end stay in!
// but consider <bInclRefToxMark> used by Undo
@@ -605,7 +605,7 @@ void SwTextNode::RstTextAttr(
// Only delete the hints which start at nStt and end at nEnd.
for (i = 0; i < m_pSwpHints->Count(); ++i)
{
- SwTextAttr* pHint = m_pSwpHints->GetTextHint(i);
+ SwTextAttr* pHint = m_pSwpHints->Get(i);
if (pHint->GetStart() != nStt)
continue;
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index fc6b51e4719b..294ab3e65f13 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1244,7 +1244,7 @@ void SwHistory::CopyAttr(
for( size_t n = 0; n < pHts->Count(); ++n )
{
// nAttrStt must even be set when !pEndIdx
- pHt = pHts->GetTextHint(n);
+ pHt = pHts->Get(n);
const sal_Int32 nAttrStt = pHt->GetStart();
const sal_Int32 * pEndIdx = pHt->GetEnd();
if( 0 != pEndIdx && nAttrStt > nEnd )
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index c6dcb508c2e5..e43aeb62af54 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -675,9 +675,9 @@ bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
}
Sequence< OUString> aCharStyles;
SwpHints* pHints = pTextNode->GetpSwpHints();
- for( size_t nAttr = 0; nAttr < pHints->GetStartCount(); ++nAttr )
+ for( size_t nAttr = 0; nAttr < pHints->Count(); ++nAttr )
{
- SwTextAttr* pAttr = pHints->GetStart( nAttr );
+ SwTextAttr* pAttr = pHints->Get( nAttr );
if(pAttr->Which() != RES_TXTATR_CHARFMT)
continue;
const sal_Int32 nAttrStart = pAttr->GetStart();
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 713a5312d8f0..b90039bdc3ae 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -728,13 +728,13 @@ lcl_ExportHints(
//search for special text attributes - first some ends
size_t nEndIndex = 0;
sal_Int32 nNextEnd = 0;
- while(nEndIndex < pHints->GetEndCount() &&
- (!pHints->GetEnd(nEndIndex)->GetEnd() ||
- nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetEnd()))))
+ while(nEndIndex < pHints->Count() &&
+ (!pHints->GetSortedByEnd(nEndIndex)->GetEnd() ||
+ nCurrentIndex >= (nNextEnd = (*pHints->GetSortedByEnd(nEndIndex)->GetEnd()))))
{
- if(pHints->GetEnd(nEndIndex)->GetEnd())
+ if(pHints->GetSortedByEnd(nEndIndex)->GetEnd())
{
- SwTextAttr * const pAttr = pHints->GetEnd(nEndIndex);
+ SwTextAttr * const pAttr = pHints->GetSortedByEnd(nEndIndex);
if (nNextEnd == nCurrentIndex)
{
const sal_uInt16 nWhich( pAttr->Which() );
@@ -779,7 +779,7 @@ lcl_ExportHints(
// (necessary for SwXMeta::createEnumeration)
if (pAttr->GetStart() + 1 == i_nStartPos)
{
- nEndIndex = pHints->GetEndCount() - 1;
+ nEndIndex = pHints->Count() - 1;
}
break;
}
@@ -809,10 +809,10 @@ lcl_ExportHints(
// then some starts
size_t nStartIndex = 0;
sal_Int32 nNextStart = 0;
- while(nStartIndex < pHints->GetStartCount() &&
- nCurrentIndex >= (nNextStart = pHints->GetStart(nStartIndex)->GetStart()))
+ while(nStartIndex < pHints->Count() &&
+ nCurrentIndex >= (nNextStart = pHints->Get(nStartIndex)->GetStart()))
{
- SwTextAttr * const pAttr = pHints->GetStart(nStartIndex);
+ SwTextAttr * const pAttr = pHints->Get(nStartIndex);
sal_uInt16 nAttrWhich = pAttr->Which();
if (nNextStart == nCurrentIndex)
{
@@ -995,14 +995,14 @@ lcl_ExportHints(
nStartIndex = 0;
nNextStart = 0;
- while(nStartIndex < pHints->GetStartCount() &&
- nCurrentIndex >= (nNextStart = pHints->GetStart(nStartIndex)->GetStart()))
+ while(nStartIndex < pHints->Count() &&
+ nCurrentIndex >= (nNextStart = pHints->Get(nStartIndex)->GetStart()))
nStartIndex++;
nEndIndex = 0;
nNextEnd = 0;
- while(nEndIndex < pHints->GetEndCount() &&
- nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetAnyEnd())))
+ while(nEndIndex < pHints->Count() &&
+ nCurrentIndex >= (nNextEnd = (*pHints->GetSortedByEnd(nEndIndex)->GetAnyEnd())))
nEndIndex++;
sal_Int32 nNextPos =
diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx
index a4f32b8d2822..5ed77cef7b33 100644
--- a/sw/source/filter/ascii/ascatr.cxx
+++ b/sw/source/filter/ascii/ascatr.cxx
@@ -87,7 +87,7 @@ sal_Int32 SwASC_AttrIter::SearchNext( sal_Int32 nStartPos )
// are sorted by starting position. We would need to remember two indices, however.
for ( size_t i = 0; i < pTextAttrs->Count(); ++i )
{
- const SwTextAttr* pHt = (*pTextAttrs)[i];
+ const SwTextAttr* pHt = pTextAttrs->Get(i);
if ( pHt->HasDummyChar() )
{
sal_Int32 nPos = pHt->GetStart();
@@ -125,7 +125,7 @@ bool SwASC_AttrIter::OutAttr( sal_Int32 nSwPos )
{
for( size_t i = 0; i < pTextAttrs->Count(); ++i )
{
- const SwTextAttr* pHt = (*pTextAttrs)[i];
+ const SwTextAttr* pHt = pTextAttrs->Get(i);
if ( ( pHt->HasDummyChar()
|| pHt->HasContent() )
&& nSwPos == pHt->GetStart() )
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index f8f6d4d7e9c7..375e914eb6fd 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -2342,7 +2342,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
sal_Int32 nStrPos = rHTMLWrt.pCurPam->GetPoint()->nContent.GetIndex();
const SwTextAttr * pHt = 0;
const size_t nCntAttr = pNd->HasHints() ? pNd->GetSwpHints().Count() : 0;
- if( nCntAttr && nStrPos > ( pHt = pNd->GetSwpHints()[ 0 ] )->GetStart() )
+ if( nCntAttr && nStrPos > ( pHt = pNd->GetSwpHints().Get(0) )->GetStart() )
{
// Ok, es gibt vorher Attribute, die ausgegeben werden muessen
do {
@@ -2382,7 +2382,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
}
} while( nAttrPos < nCntAttr && nStrPos >
- ( pHt = pNd->GetSwpHints()[ nAttrPos ] )->GetStart() );
+ ( pHt = pNd->GetSwpHints().Get( nAttrPos ) )->GetStart() );
// dann gebe mal alle gesammelten Attribute von der String-Pos aus
aEndPosLst.OutEndAttrs( rHTMLWrt, nStrPos + nOffset );
@@ -2448,7 +2448,7 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode )
bOutChar = false; // keine 255 ausgeben
}
} while( ++nAttrPos < nCntAttr && nStrPos ==
- ( pHt = pNd->GetSwpHints()[ nAttrPos ] )->GetStart() );
+ ( pHt = pNd->GetSwpHints().Get( nAttrPos ) )->GetStart() );
}
// Manche Draw-Formate koennen auch noch Attribute mitbringen
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 7ad8b7b05d4f..22ede3aa4995 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -2289,7 +2289,7 @@ bool SwHTMLParser::AppendTextNode( SwHTMLAppendMode eMode, bool bUpdateNum )
SwpHints& rHints = pTextNd->GetSwpHints();
for( size_t i=0; i < nCntAttr; i++ )
{
- SwTextAttr *pHt = rHints.GetTextHint( i );
+ SwTextAttr *pHt = rHints.Get( i );
sal_uInt16 nWhich = pHt->Which();
sal_Int16 nIdx = 0;
bool bFont = false;
@@ -2429,7 +2429,7 @@ void SwHTMLParser::AddParSpace()
for(size_t i = 0; i < nCntAttr; ++i)
{
- SwTextAttr *const pHt = pTextNode->GetSwpHints().GetTextHint(i);
+ SwTextAttr *const pHt = pTextNode->GetSwpHints().Get(i);
sal_uInt16 const nWhich = pHt->Which();
if (RES_CHRATR_CJK_FONT == nWhich ||
RES_CHRATR_CJK_FONTSIZE == nWhich ||
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index ea5e12b6cf43..6a6782cd5342 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -915,7 +915,7 @@ sal_uInt16 SwHTMLWriter::OutHeaderAttrs()
sal_Int32 nOldPos = 0;
for( size_t i=0; i<nCntAttr; ++i )
{
- const SwTextAttr *pHt = pTextNd->GetSwpHints()[i];
+ const SwTextAttr *pHt = pTextNd->GetSwpHints().Get(i);
if( !pHt->End() )
{
sal_Int32 nPos = pHt->GetStart();
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 14ac38b14f06..cb2da656bd4b 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -312,7 +312,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos )
// but then we'd have to save 2 indices
for( size_t i = 0; i < pTextAttrs->Count(); ++i )
{
- const SwTextAttr* pHt = (*pTextAttrs)[i];
+ const SwTextAttr* pHt = pTextAttrs->Get(i);
sal_Int32 nPos = pHt->GetStart(); // first Attr characters
if( nPos >= nStartPos && nPos <= nMinPos )
nMinPos = nPos;
@@ -419,7 +419,7 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bRuby )
{
for( size_t i = 0; i < pTextAttrs->Count(); ++i )
{
- const SwTextAttr* pHt = (*pTextAttrs)[i];
+ const SwTextAttr* pHt = pTextAttrs->Get(i);
const sal_Int32* pEnd = pHt->End();
if (pEnd ? ( nSwPos >= pHt->GetStart() && nSwPos < *pEnd)
@@ -665,7 +665,7 @@ bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos )
{
for (size_t i = 0; i < pTextAttrs->Count(); ++i)
{
- const SwTextAttr* pHt = (*pTextAttrs)[i];
+ const SwTextAttr* pHt = pTextAttrs->Get(i);
if ( ( pHt->HasDummyChar() || pHt->HasContent() )
&& (pHt->GetStart() == nSwPos) )
{
@@ -722,7 +722,7 @@ const SfxPoolItem* SwWW8AttrIter::HasTextItem( sal_uInt16 nWhich ) const
const sal_Int32 nTmpSwPos = m_rExport.m_aCurrentCharPropStarts.top();
for (size_t i = 0; i < pTextAttrs->Count(); ++i)
{
- const SwTextAttr* pHt = (*pTextAttrs)[i];
+ const SwTextAttr* pHt = pTextAttrs->Get(i);
const SfxPoolItem* pItem = &pHt->GetAttr();
const sal_Int32 * pAtrEnd = 0;
if( 0 != ( pAtrEnd = pHt->End() ) && // only Attr with an end
@@ -1234,9 +1234,9 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos)
m_rExport.m_aCurrentCharPropStarts.push( nPos );
const sal_Int32* pEnd;
// first process ends of attributes with extent
- for (size_t i = 0; i < pTextAttrs->GetEndCount(); ++i)
+ for (size_t i = 0; i < pTextAttrs->Count(); ++i)
{
- const SwTextAttr* pHt = pTextAttrs->GetEnd(i);
+ const SwTextAttr* pHt = pTextAttrs->GetSortedByEnd(i);
const SfxPoolItem* pItem = &pHt->GetAttr();
switch ( pItem->Which() )
{
@@ -1270,7 +1270,7 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos)
}
for ( size_t i = 0; i < pTextAttrs->Count(); ++i )
{
- const SwTextAttr* pHt = (*pTextAttrs)[i];
+ const SwTextAttr* pHt = pTextAttrs->Get(i);
const SfxPoolItem* pItem = &pHt->GetAttr();
switch ( pItem->Which() )
{
@@ -2763,7 +2763,7 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode )
{
for( size_t i = 0; i < pTextAttrs->Count(); ++i )
{
- const SwTextAttr* pHt = (*pTextAttrs)[i];
+ const SwTextAttr* pHt = pTextAttrs->Get(i);
const sal_Int32 startPos = pHt->GetStart(); // first Attr characters
const sal_Int32* endPos = pHt->End(); // end Attr characters
// Check if these attributes are for the last character in the paragraph
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 1142325a4e93..07420057f9b8 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5293,7 +5293,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
const SwpHints* pHints = pTextNode->GetpSwpHints();
for( size_t nHintPos = 0; pHints && nHintPos < pHints->Count(); ++nHintPos)
{
- const SwTextAttr *pHt = (*pHints)[nHintPos];
+ const SwTextAttr *pHt = pHints->Get(nHintPos);
const sal_Int32 st = pHt->GetStart();
if( pHt
&& pHt->Which() == RES_TXTATR_FLYCNT