[Libreoffice-commits] .: 2 commits - sw/source
Nigel Hawkins
nhawkins at kemper.freedesktop.org
Wed Jun 15 05:40:37 PDT 2011
sw/source/core/crsr/findtxt.cxx | 26 ++++++++++----------------
sw/source/core/doc/doc.cxx | 4 ++--
sw/source/core/doc/docbm.cxx | 22 +++++++++++-----------
sw/source/core/doc/docedt.cxx | 8 ++++----
sw/source/core/docnode/ndtbl.cxx | 10 +++++-----
sw/source/core/inc/mvsave.hxx | 7 +++----
sw/source/core/txtnode/ndtxt.cxx | 9 ++++-----
sw/source/core/undo/untbl.cxx | 7 +++----
8 files changed, 42 insertions(+), 51 deletions(-)
New commits:
commit 8096f76cc1bd7c2e705b72ab2b9e62bc405ad5c8
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Wed Jun 15 13:38:45 2011 +0100
Replace SvULongs with std::vector in mvsave.hxx
Also cascaded changes due to this. LGPLv3+/MPL
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index b456ed5..28f5bc4 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -796,7 +796,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
}
}
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
aBkmkArr, SAVEFLY_SPLIT );
// FIXME: only SwTxtNode has a valid implementation of SplitCntntNode!
@@ -805,7 +805,7 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
if (pNode)
{
// verschiebe noch alle Bookmarks/TOXMarks/FlyAtCnt
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index d029881..88282b8 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -904,15 +904,15 @@ namespace
SetTypeAndCount( nType, 0 );
nContent = 0;
}
- _SwSaveTypeCountContent( const SvULongs& rArr, sal_uInt16& rPos )
+ _SwSaveTypeCountContent( const std::vector<sal_uLong> &rArr, sal_uInt16& rPos )
{
TYPECOUNT.nTypeCount = rArr[ rPos++ ];
nContent = static_cast<xub_StrLen>(rArr[ rPos++ ]);
}
- void Add( SvULongs& rArr )
+ void Add( std::vector<sal_uLong> &rArr )
{
- rArr.Insert( TYPECOUNT.nTypeCount, rArr.Count() );
- rArr.Insert( nContent, rArr.Count() );
+ rArr.push_back( TYPECOUNT.nTypeCount );
+ rArr.push_back( nContent );
}
void SetType( sal_uInt16 n ) { TYPECOUNT.TC.nType = n; }
@@ -966,7 +966,7 @@ namespace
return rPos.nNode > rNdIdx || ( pIdx && rPos.nNode == rNdIdx && rPos.nContent > pIdx->GetIndex() );
}
- static void lcl_ChkPaM( SvULongs& rSaveArr, sal_uLong nNode, xub_StrLen nCntnt,
+ static void lcl_ChkPaM( std::vector<sal_uLong> &rSaveArr, sal_uLong nNode, xub_StrLen nCntnt,
const SwPaM& rPam, _SwSaveTypeCountContent& rSave,
sal_Bool bChkSelDirection )
{
@@ -1213,7 +1213,7 @@ void _DelBookmarks(
void _SaveCntntIdx(SwDoc* pDoc,
sal_uLong nNode,
xub_StrLen nCntnt,
- SvULongs& rSaveArr,
+ std::vector<sal_uLong> &rSaveArr,
sal_uInt8 nSaveFly)
{
// 1. Bookmarks
@@ -1429,7 +1429,7 @@ void _SaveCntntIdx(SwDoc* pDoc,
void _RestoreCntntIdx(SwDoc* pDoc,
- SvULongs& rSaveArr,
+ std::vector<sal_uLong> &rSaveArr,
sal_uLong nNode,
xub_StrLen nOffset,
sal_Bool bAuto)
@@ -1439,7 +1439,7 @@ void _RestoreCntntIdx(SwDoc* pDoc,
SwSpzFrmFmts* pSpz = pDoc->GetSpzFrmFmts();
IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
sal_uInt16 n = 0;
- while( n < rSaveArr.Count() )
+ while( n < rSaveArr.size() )
{
_SwSaveTypeCountContent aSave( rSaveArr, n );
SwPosition* pPos = 0;
@@ -1590,7 +1590,7 @@ void _RestoreCntntIdx(SwDoc* pDoc,
}
}
-void _RestoreCntntIdx(SvULongs& rSaveArr,
+void _RestoreCntntIdx(std::vector<sal_uLong> &rSaveArr,
const SwNode& rNd,
xub_StrLen nLen,
xub_StrLen nChkLen)
@@ -1602,7 +1602,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr,
SwCntntNode* pCNd = (SwCntntNode*)rNd.GetCntntNode();
sal_uInt16 n = 0;
- while( n < rSaveArr.Count() )
+ while( n < rSaveArr.size() )
{
_SwSaveTypeCountContent aSave( rSaveArr, n );
if( aSave.GetContent() >= nChkLen )
@@ -1748,7 +1748,7 @@ void _RestoreCntntIdx(SvULongs& rSaveArr,
pPos->nContent.Assign( pCNd, Min( aSave.GetContent(), nLen ) );
}
n -= 2;
- rSaveArr.Remove( n, 2 );
+ rSaveArr.erase( rSaveArr.begin() + n, rSaveArr.begin() + n + 2);
}
}
}
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 786ae19..7f6a5f3 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -949,13 +949,13 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
bSplit = sal_True;
xub_StrLen nMkCntnt = rPaM.GetMark()->nContent.GetIndex();
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( this, rPos.nNode.GetIndex(), rPos.nContent.GetIndex(),
aBkmkArr, SAVEFLY_SPLIT );
pTNd = static_cast<SwTxtNode*>(pTNd->SplitCntntNode( rPos ));
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( this, aBkmkArr, rPos.nNode.GetIndex()-1, 0, sal_True );
// jetzt noch den Pam berichtigen !!
@@ -1381,7 +1381,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
}
pOldTxtNd->FmtToTxtAttr( pTxtNd );
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
::_SaveCntntIdx( pDoc, aOldIdx.GetIndex(),
pOldTxtNd->Len(), aBkmkArr );
@@ -1392,7 +1392,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
pDoc->CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, sal_True );
// verschiebe noch alle Bookmarks/TOXMarks
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() );
// falls der uebergebene PaM nicht im Crsr-Ring steht,
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 60ee732..1925953 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -977,7 +977,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
SwStartNode* pSttNd;
SwPosition aCntPos( aSttIdx, SwIndex( pTxtNd ));
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( pDoc, aSttIdx.GetIndex(), pTxtNd->GetTxt().Len(), aBkmkArr );
const sal_Unicode* pTxt = pTxtNd->GetTxt().GetBuffer();
@@ -989,7 +989,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
aCntPos.nContent = nChPos;
SwCntntNode* pNewNd = pTxtNd->SplitCntntNode( aCntPos );
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( aBkmkArr, *pNewNd, nChPos,
nChPos + 1 );
@@ -1013,7 +1013,7 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
}
// und jetzt den letzten Teil-String
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( aBkmkArr, *pTxtNd, pTxtNd->GetTxt().Len(),
pTxtNd->GetTxt().Len()+1 );
@@ -1508,14 +1508,14 @@ sal_Bool lcl_DelBox( const SwTableBox*& rpBox, void* pPara )
pDelPara->pUndo->AddBoxPos( *pDoc, nNdIdx, aDelRg.aEnd.GetIndex(),
aCntIdx.GetIndex() );
- SvULongs aBkmkArr( 4, 4 );
+ std::vector<sal_uLong> aBkmkArr;
xub_StrLen nOldTxtLen = aCntIdx.GetIndex();
_SaveCntntIdx( pDoc, nNdIdx, pCurTxtNd->GetTxt().Len(),
aBkmkArr );
pDelPara->pLastNd->JoinNext();
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( pDoc, aBkmkArr,
pDelPara->pLastNd->GetIndex(),
nOldTxtLen );
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index 30453d5..ae263ac 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -39,7 +39,6 @@ namespace sfx2 {
}
class SvNumberFormatter;
-class SvULongs;
class SwDoc;
class SwFmtAnchor;
class SwFrmFmt;
@@ -92,11 +91,11 @@ void _DelBookmarks(const SwNodeIndex& rStt,
const SwIndex* pSttIdx =0,
const SwIndex* pEndIdx =0);
void _SaveCntntIdx( SwDoc* pDoc, sal_uLong nNode, xub_StrLen nCntnt,
- SvULongs& rSaveArr, sal_uInt8 nSaveFly = 0 );
-void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr,
+ std::vector<sal_uLong>& rSaveArr, sal_uInt8 nSaveFly = 0 );
+void _RestoreCntntIdx( SwDoc* pDoc, std::vector<sal_uLong>& rSaveArr,
sal_uLong nNode, xub_StrLen nOffset = 0,
sal_Bool bAuto = sal_False );
-void _RestoreCntntIdx( SvULongs& rSaveArr, const SwNode& rNd,
+void _RestoreCntntIdx( std::vector<sal_uLong>& rSaveArr, const SwNode& rNd,
xub_StrLen nLen, xub_StrLen nCorrLen );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index a1de18f..4151c66 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -38,7 +38,6 @@
#include <editeng/tstpitem.hxx>
#include <svl/urihelper.hxx>
#ifndef _SVSTDARR_HXX
-#define _SVSTDARR_ULONGS
#include <svl/svstdarr.hxx>
#endif
#include <svl/ctloptions.hxx>
@@ -633,7 +632,7 @@ SwCntntNode *SwTxtNode::JoinNext()
if( SwCntntNode::CanJoinNext( &aIdx ) )
{
SwDoc* pDoc = rNds.GetDoc();
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( pDoc, aIdx.GetIndex(), USHRT_MAX, aBkmkArr, SAVEFLY );
SwTxtNode *pTxtNode = aIdx.GetNode().GetTxtNode();
xub_StrLen nOldLen = m_Text.Len();
@@ -700,7 +699,7 @@ SwCntntNode *SwTxtNode::JoinNext()
pTxtNode->CutText( this, SwIndex(pTxtNode), pTxtNode->Len() );
}
// verschiebe noch alle Bookmarks/TOXMarks
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( pDoc, aBkmkArr, GetIndex(), nOldLen );
if( pTxtNode->HasAnyIndex() )
@@ -728,7 +727,7 @@ SwCntntNode *SwTxtNode::JoinPrev()
if( SwCntntNode::CanJoinPrev( &aIdx ) )
{
SwDoc* pDoc = rNds.GetDoc();
- SvULongs aBkmkArr( 15, 15 );
+ std::vector<sal_uLong> aBkmkArr;
_SaveCntntIdx( pDoc, aIdx.GetIndex(), USHRT_MAX, aBkmkArr, SAVEFLY );
SwTxtNode *pTxtNode = aIdx.GetNode().GetTxtNode();
xub_StrLen nLen = pTxtNode->Len();
@@ -795,7 +794,7 @@ SwCntntNode *SwTxtNode::JoinPrev()
pTxtNode->CutText( this, SwIndex(this), SwIndex(pTxtNode), nLen );
}
// verschiebe noch alle Bookmarks/TOXMarks
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( pDoc, aBkmkArr, GetIndex() );
if( pTxtNode->HasAnyIndex() )
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index f26f2a1..0d2bc9b 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -570,7 +570,7 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd,
SwTableLine* pLine = new SwTableLine( pLineFmt, rSavedData.Count(), 0 );
pTblNd->GetTable().GetTabLines().C40_INSERT( SwTableLine, pLine, 0 );
- SvULongs aBkmkArr( 0, 4 );
+ std::vector<sal_uLong> aBkmkArr;
for( sal_uInt16 n = rSavedData.Count(); n; )
{
SwTblToTxtSave* pSave = rSavedData[ --n ];
@@ -589,14 +589,13 @@ SwTableNode* SwNodes::UndoTableToText( sal_uLong nSttNd, sal_uLong nEndNd,
pTxtNd->EraseText( aCntPos, 1 );
SwCntntNode* pNewNd = pTxtNd->SplitCntntNode(
SwPosition( aSttIdx, aCntPos ));
- if( aBkmkArr.Count() )
+ if( !aBkmkArr.empty() )
_RestoreCntntIdx( aBkmkArr, *pNewNd, pSave->m_nCntnt,
pSave->m_nCntnt + 1 );
}
else
{
- if( aBkmkArr.Count() )
- aBkmkArr.Remove( 0, aBkmkArr.Count() );
+ aBkmkArr.clear();
if( pTxtNd )
_SaveCntntIdx( GetDoc(), aSttIdx.GetIndex(),
pTxtNd->GetTxt().Len(), aBkmkArr );
commit 875232bc88eb3c6de42a4295458122b91b5981c4
Author: Nigel Hawkins <n.hawkins at gmx.com>
Date: Wed Jun 15 12:15:41 2011 +0100
Replace SvULongs with std::vector in findtxt.cxx. LGPLv3+/MPL
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index c2faef3..b16ca3f 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -33,7 +33,6 @@
#include <com/sun/star/util/SearchFlags.hpp>
#define _SVSTDARR_USHORTS
-#define _SVSTDARR_ULONGS
#include <svl/svstdarr.hxx>
#include <vcl/svapp.hxx>
@@ -63,12 +62,11 @@ using namespace util;
String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam );
String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
- xub_StrLen& rEnde, SvULongs& rArr, String& rRet,
+ xub_StrLen& rEnde, std::vector<sal_uLong> &rArr, String& rRet,
bool bRemoveSoftHyphen )
{
rRet = rNd.GetTxt();
- if( rArr.Count() )
- rArr.Remove( 0, rArr.Count() );
+ rArr.clear();
const SwpHints *pHts = rNd.GetpSwpHints();
@@ -119,7 +117,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
else
break;
- const xub_StrLen nAkt = nStt - rArr.Count();
+ const xub_StrLen nAkt = nStt - rArr.size();
if ( bNewHint )
{
@@ -150,7 +148,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
->GetFld().GetFld()->ExpandField(true).Len());
if ( bEmpty && nStart == nAkt )
{
- rArr.Insert( nAkt, rArr.Count() );
+ rArr.push_back( nAkt );
--rEnde;
rRet.Erase( nAkt, 1 );
}
@@ -172,7 +170,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
if ( bNewSoftHyphen )
{
- rArr.Insert( nAkt, rArr.Count() );
+ rArr.push_back( nAkt );
--rEnde;
rRet.Erase( nAkt, 1 );
++nSoftHyphen;
@@ -186,7 +184,7 @@ String& lcl_CleanStr( const SwTxtNode& rNd, xub_StrLen nStart,
if( nTmp == rRet.Len() - 1 )
{
rRet.Erase( nTmp );
- rArr.Insert( nTmp, rArr.Count() );
+ rArr.push_back( nTmp );
--rEnde;
}
}
@@ -265,10 +263,6 @@ sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes
*/
sal_Bool bFirst = sal_True;
SwCntntNode * pNode;
- //testarea
- //String sCleanStr;
- //SvULongs aFltArr;
- //const SwNode* pSttNd = &rNdIdx.GetNode();
xub_StrLen nStart, nEnde, nTxtLen;
@@ -429,7 +423,7 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
SwNodeIndex& rNdIdx = pPam->GetPoint()->nNode;
const SwNode* pSttNd = &rNdIdx.GetNode();
String sCleanStr;
- SvULongs aFltArr;
+ std::vector<sal_uLong> aFltArr;
LanguageType eLastLang = 0;
// if the search string contains a soft hypen, we don't strip them from the text:
bool bRemoveSoftHyphens = true;
@@ -501,19 +495,19 @@ bool SwPaM::DoSearch( const SearchOptions& rSearchOpt, utl::TextSearch& rSTxt,
SetMark();
// Start und Ende wieder korrigieren !!
- if( aFltArr.Count() )
+ if( !aFltArr.empty() )
{
xub_StrLen n, nNew;
// bei Rueckwaertssuche die Positionen temp. vertauschen
if( !bSrchForward ) { n = nStart; nStart = nEnde; nEnde = n; }
for( n = 0, nNew = nStart;
- n < aFltArr.Count() && aFltArr[ n ] <= nStart;
+ n < aFltArr.size() && aFltArr[ n ] <= nStart;
++n, ++nNew )
;
nStart = nNew;
for( n = 0, nNew = nEnde;
- n < aFltArr.Count() && aFltArr[ n ] < nEnde;
+ n < aFltArr.size() && aFltArr[ n ] < nEnde;
++n, ++nNew )
;
nEnde = nNew;
More information about the Libreoffice-commits
mailing list