summaryrefslogtreecommitdiff
path: root/vcl/source/edit/textdoc.cxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-08-15 12:54:57 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-08-16 09:10:19 +0200
commit866e287adee448c1c8b431c6c084d3fe3283649d (patch)
tree53864635bcb2832c92834678a66b7090f1181147 /vcl/source/edit/textdoc.cxx
parenta00c47afd4cf379ce2b22f3c33bb7975a5a6366a (diff)
sal_uLong to sal_uInt32 as TextPaM paragraph number
Applied also to related functions. Also fix a couple of minor issues while at it. Change-Id: I615094d047c87a0f4854054e720492d3ab25c575
Diffstat (limited to 'vcl/source/edit/textdoc.cxx')
-rw-r--r--vcl/source/edit/textdoc.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index f3d2cd19f9d0..d13c5f91a12d 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -422,18 +422,18 @@ void TextDoc::Clear()
void TextDoc::DestroyTextNodes()
{
- for ( sal_uLong nNode = 0; nNode < maTextNodes.size(); nNode++ )
- delete maTextNodes[ nNode ];
+ for ( auto pNode : maTextNodes )
+ delete pNode;
maTextNodes.clear();
}
OUString TextDoc::GetText( const sal_Unicode* pSep ) const
{
- sal_uLong nNodes = maTextNodes.size();
+ sal_uInt32 nNodes = static_cast<sal_uInt32>(maTextNodes.size());
OUString aASCIIText;
- sal_uLong nLastNode = nNodes-1;
- for ( sal_uLong nNode = 0; nNode < nNodes; nNode++ )
+ const sal_uInt32 nLastNode = nNodes-1;
+ for ( sal_uInt32 nNode = 0; nNode < nNodes; ++nNode )
{
TextNode* pNode = maTextNodes[ nNode ];
OUString aTmp( pNode->GetText() );
@@ -445,7 +445,7 @@ OUString TextDoc::GetText( const sal_Unicode* pSep ) const
return aASCIIText;
}
-OUString TextDoc::GetText( sal_uLong nPara ) const
+OUString TextDoc::GetText( sal_uInt32 nPara ) const
{
OUString aText;
@@ -459,18 +459,18 @@ OUString TextDoc::GetText( sal_uLong nPara ) const
sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const
{
sal_uLong nLen = 0;
- sal_uLong nNodes = maTextNodes.size();
+ sal_uInt32 nNodes = static_cast<sal_uInt32>(maTextNodes.size());
if ( nNodes )
{
- sal_uLong nStartNode = 0;
- sal_uLong nEndNode = nNodes-1;
+ sal_uInt32 nStartNode = 0;
+ sal_uInt32 nEndNode = nNodes-1;
if ( pSel )
{
nStartNode = pSel->GetStart().GetPara();
nEndNode = pSel->GetEnd().GetPara();
}
- for ( sal_uLong nNode = nStartNode; nNode <= nEndNode; nNode++ )
+ for ( sal_uInt32 nNode = nStartNode; nNode <= nEndNode; ++nNode )
{
TextNode* pNode = maTextNodes[ nNode ];
@@ -520,6 +520,7 @@ TextPaM TextDoc::InsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs )
TextNode* pNode = maTextNodes[ rPaM.GetPara() ];
TextNode* pNew = pNode->Split( rPaM.GetIndex(), bKeepEndingAttribs );
+ DBG_ASSERT( maTextNodes.size()<SAL_MAX_UINT32, "InsertParaBreak: more than 4Gi paragraphs!" );
maTextNodes.insert( maTextNodes.begin() + rPaM.GetPara() + 1, pNew );
TextPaM aPaM( rPaM.GetPara()+1, 0 );