[Libreoffice-commits] core.git: 24 commits - accessibility/source basctl/source cui/source desktop/source include/svtools include/vcl sfx2/source svtools/source sw/source vcl/source
Matteo Casalin
matteo.casalin at yahoo.com
Sun Aug 16 00:12:04 PDT 2015
accessibility/source/extended/textwindowaccessibility.cxx | 40 -
basctl/source/basicide/baside2.cxx | 33 -
basctl/source/basicide/baside2b.cxx | 24
basctl/source/basicide/linenumberwindow.cxx | 10
cui/source/dialogs/SpellDialog.cxx | 4
desktop/source/deployment/gui/license_dialog.cxx | 4
include/svtools/svmedit2.hxx | 2
include/vcl/textdata.hxx | 15
include/vcl/texteng.hxx | 106 ++--
include/vcl/throbber.hxx | 1
sfx2/source/control/thumbnailviewitem.cxx | 4
svtools/source/edit/editsyntaxhighlighter.cxx | 11
svtools/source/edit/svmedit2.cxx | 2
sw/source/ui/dbui/mmaddressblockpage.cxx | 18
sw/source/uibase/docvw/srcedtw.cxx | 2
sw/source/uibase/uiview/srcview.cxx | 8
vcl/source/control/combobox.cxx | 6
vcl/source/control/field2.cxx | 12
vcl/source/control/ilstbox.cxx | 30 -
vcl/source/control/longcurr.cxx | 4
vcl/source/control/throbber.cxx | 10
vcl/source/edit/textdat2.hxx | 125 ++--
vcl/source/edit/textdata.cxx | 33 -
vcl/source/edit/textdoc.cxx | 44 -
vcl/source/edit/textdoc.hxx | 14
vcl/source/edit/texteng.cxx | 369 ++++++--------
vcl/source/edit/textund2.hxx | 16
vcl/source/edit/textundo.cxx | 10
vcl/source/edit/textview.cxx | 55 --
vcl/source/edit/vclmedit.cxx | 31 -
vcl/source/edit/xtextedt.cxx | 16
31 files changed, 517 insertions(+), 542 deletions(-)
New commits:
commit 98244c3cb47824babc746ebc14a199977e9768d1
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Aug 15 19:35:32 2015 +0200
sal_uLong to sal_Int32/long
Change-Id: Ia4ae190da37351b8c2b7ee9fc953508c5b1ab062
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 65b6bf4..1aa1aa6 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -743,11 +743,11 @@ void ModulWindow::EditMacro( const OUString& rMacroName )
TextView * pView = GetEditView();
// scroll if applicable so that first line is at the top
long nVisHeight = GetOutputSizePixel().Height();
- if ( (long)pView->GetTextEngine()->GetTextHeight() > nVisHeight )
+ if ( pView->GetTextEngine()->GetTextHeight() > nVisHeight )
{
- long nMaxY = (long)pView->GetTextEngine()->GetTextHeight() - nVisHeight;
+ long nMaxY = pView->GetTextEngine()->GetTextHeight() - nVisHeight;
long nOldStartY = pView->GetStartDocPos().Y();
- long nNewStartY = (long)nStart * (long)pView->GetTextEngine()->GetCharHeight();
+ long nNewStartY = (long)nStart * pView->GetTextEngine()->GetCharHeight();
nNewStartY = std::min( nNewStartY, nMaxY );
pView->Scroll( 0, -(nNewStartY-nOldStartY) );
pView->ShowCursor( false );
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 106e923..d1a29ae 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1107,11 +1107,11 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
{
if ( rModulWindow.GetHScrollBar() )
{
- sal_uLong nWidth = pEditEngine->CalcTextWidth();
- if ( (long)nWidth != nCurTextWidth )
+ const long nWidth = pEditEngine->CalcTextWidth();
+ if ( nWidth != nCurTextWidth )
{
nCurTextWidth = nWidth;
- rModulWindow.GetHScrollBar()->SetRange( Range( 0, (long)nCurTextWidth-1) );
+ rModulWindow.GetHScrollBar()->SetRange( Range( 0, nCurTextWidth-1) );
rModulWindow.GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
}
}
diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx
index f37082e..cc1621a 100644
--- a/desktop/source/deployment/gui/license_dialog.cxx
+++ b/desktop/source/deployment/gui/license_dialog.cxx
@@ -161,11 +161,11 @@ bool LicenseView::IsEndReached() const
ExtTextView* pView = GetTextView();
ExtTextEngine* pEdit = GetTextEngine();
- sal_uLong nHeight = pEdit->GetTextHeight();
+ const long nHeight = pEdit->GetTextHeight();
Size aOutSize = pView->GetWindow()->GetOutputSizePixel();
Point aBottom( 0, aOutSize.Height() );
- if ( (sal_uLong) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 )
+ if ( pView->GetDocPos( aBottom ).Y() >= nHeight - 1 )
bEndReached = true;
else
bEndReached = false;
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 9227e4b..8d8e7f7 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -118,11 +118,11 @@ private:
long mnCharHeight;
sal_uInt16 mnFixCharWidth100;
- sal_uLong mnMaxTextLen;
- sal_uLong mnMaxTextWidth;
- sal_uLong mnCurTextWidth;
- sal_uLong mnCurTextHeight;
- sal_uLong mnDefTab;
+ sal_Int32 mnMaxTextLen;
+ long mnMaxTextWidth;
+ long mnCurTextWidth;
+ long mnCurTextHeight;
+ long mnDefTab;
TxtAlign meAlign;
@@ -206,10 +206,10 @@ protected:
static void ImpInitLayoutMode( OutputDevice* pOutDev, bool bDrawingR2LPortion = false );
TxtAlign ImpGetAlign() const;
- sal_uLong CalcTextHeight();
- sal_uLong CalcParaHeight( sal_uInt32 nParagraph ) const;
- sal_uLong CalcTextWidth( sal_uInt32 nPara );
- sal_uLong CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nPortionLen, const vcl::Font* pFont = 0 );
+ long CalcTextHeight();
+ long CalcParaHeight( sal_uInt32 nParagraph ) const;
+ long CalcTextWidth( sal_uInt32 nPara );
+ long CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nPortionLen, const vcl::Font* pFont = 0 );
Range GetInvalidYOffsets( sal_uInt32 nPortion );
// for Undo/Redo
@@ -231,8 +231,8 @@ public:
OUString GetTextLines( LineEnd aSeparator = LINEEND_LF ) const;
void ReplaceText(const TextSelection& rSel, const OUString& rText);
- sal_uLong GetTextLen( LineEnd aSeparator = LINEEND_LF ) const;
- sal_uLong GetTextLen( const TextSelection& rSel, LineEnd aSeparator = LINEEND_LF ) const;
+ sal_Int32 GetTextLen( LineEnd aSeparator = LINEEND_LF ) const;
+ sal_Int32 GetTextLen( const TextSelection& rSel, LineEnd aSeparator = LINEEND_LF ) const;
void SetFont( const vcl::Font& rFont );
const vcl::Font& GetFont() const { return maFont; }
@@ -249,20 +249,20 @@ public:
TextView* GetActiveView() const { return mpActiveView;}
void SetActiveView( TextView* pView );
- void SetMaxTextLen( sal_uLong nLen );
- sal_uLong GetMaxTextLen() const { return mnMaxTextLen; }
+ void SetMaxTextLen( sal_Int32 nLen );
+ sal_Int32 GetMaxTextLen() const { return mnMaxTextLen; }
- void SetMaxTextWidth( sal_uLong nWidth );
- sal_uLong GetMaxTextWidth() const { return mnMaxTextWidth; }
+ void SetMaxTextWidth( long nWidth );
+ long GetMaxTextWidth() const { return mnMaxTextWidth; }
- sal_uLong GetTextHeight() const;
- sal_uLong CalcTextWidth();
+ long GetTextHeight() const;
+ long CalcTextWidth();
long GetCharHeight() const { return mnCharHeight; }
sal_uInt32 GetParagraphCount() const;
OUString GetText( sal_uInt32 nParagraph ) const;
sal_Int32 GetTextLen( sal_uInt32 nParagraph ) const;
- sal_uLong GetTextHeight( sal_uInt32 nParagraph ) const;
+ long GetTextHeight( sal_uInt32 nParagraph ) const;
sal_uInt16 GetLineCount( sal_uInt32 nParagraph ) const;
sal_Int32 GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) const;
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index b67fb36..4665d84 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -755,7 +755,7 @@ void SwSrcEditWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
{
- if ( (long)pTextEngine->GetTextHeight() < pOutWin->GetOutputSizePixel().Height() )
+ if ( pTextEngine->GetTextHeight() < pOutWin->GetOutputSizePixel().Height() )
pTextView->Scroll( 0, pTextView->GetStartDocPos().Y() );
pVScrollbar->SetThumbPos( pTextView->GetStartDocPos().Y() );
SetScrollBarRanges();
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index 10315ef..2398fff 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -453,9 +453,9 @@ OUString TextDoc::GetText( sal_uInt32 nPara ) const
return OUString();
}
-sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const
+sal_Int32 TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const
{
- sal_uLong nLen = 0;
+ sal_Int32 nLen = 0;
sal_uInt32 nNodes = static_cast<sal_uInt32>(maTextNodes.size());
if ( nNodes )
{
diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx
index 25095b1..8f19ee5 100644
--- a/vcl/source/edit/textdoc.hxx
+++ b/vcl/source/edit/textdoc.hxx
@@ -113,7 +113,7 @@ public:
TextPaM InsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs );
TextPaM ConnectParagraphs( TextNode* pLeft, TextNode* pRight );
- sal_uLong GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const;
+ sal_Int32 GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const;
OUString GetText( const sal_Unicode* pSep ) const;
OUString GetText( sal_uInt32 nPara ) const;
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 90343f1..abacae2 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -84,7 +84,7 @@ TextEngine::TextEngine()
mnMaxTextWidth = 0;
mnMaxTextLen = 0;
- mnCurTextWidth = 0xFFFFFFFF;
+ mnCurTextWidth = -1;
mnCurTextHeight = 0;
mpUndoManager = NULL;
@@ -199,7 +199,7 @@ void TextEngine::SetFont( const vcl::Font& rFont )
if ( !aTextSize.Width() )
aTextSize.Width() = mpRefDev->GetTextWidth(OUString("XXXX"));
- mnDefTab = (sal_uInt16)aTextSize.Width();
+ mnDefTab = aTextSize.Width();
if ( !mnDefTab )
mnDefTab = 1;
mnCharHeight = aTextSize.Height();
@@ -216,16 +216,16 @@ void TextEngine::SetFont( const vcl::Font& rFont )
}
}
-void TextEngine::SetMaxTextLen( sal_uLong nLen )
+void TextEngine::SetMaxTextLen( sal_Int32 nLen )
{
mnMaxTextLen = nLen;
}
-void TextEngine::SetMaxTextWidth( sal_uLong nMaxWidth )
+void TextEngine::SetMaxTextWidth( long nMaxWidth )
{
if ( nMaxWidth != mnMaxTextWidth )
{
- mnMaxTextWidth = std::min( nMaxWidth, (sal_uLong)0x7FFFFFFF );
+ mnMaxTextWidth = nMaxWidth;
FormatFullDoc();
UpdateViews();
}
@@ -284,12 +284,12 @@ OUString TextEngine::GetText( sal_uInt32 nPara ) const
return mpDoc->GetText( nPara );
}
-sal_uLong TextEngine::GetTextLen( LineEnd aSeparator ) const
+sal_Int32 TextEngine::GetTextLen( LineEnd aSeparator ) const
{
return mpDoc->GetTextLen( static_getLineEndText( aSeparator ) );
}
-sal_uLong TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator ) const
+sal_Int32 TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator ) const
{
TextSelection aSel( rSel );
aSel.Justify();
@@ -982,7 +982,7 @@ long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex
{
DBG_ASSERT( nIndex != pLine->GetStart(), "ImpGetXPos: Strange behavior" );
- long nPosInPortion = (long)CalcTextWidth( nPara, nTextPortionStart, nIndex-nTextPortionStart );
+ long nPosInPortion = CalcTextWidth( nPara, nTextPortionStart, nIndex-nTextPortionStart );
if ( ( !IsRightToLeft() && !pPortion->IsRightToLeft() ) ||
( IsRightToLeft() && pPortion->IsRightToLeft() ) )
@@ -1139,7 +1139,7 @@ sal_Int32 TextEngine::GetCharPos( sal_uInt32 nPortion, sal_uInt16 nLine, long nX
return nCurIndex;
}
-sal_uLong TextEngine::GetTextHeight() const
+long TextEngine::GetTextHeight() const
{
DBG_ASSERT( GetUpdateMode(), "GetTextHeight: GetUpdateMode()" );
@@ -1149,7 +1149,7 @@ sal_uLong TextEngine::GetTextHeight() const
return mnCurTextHeight;
}
-sal_uLong TextEngine::GetTextHeight( sal_uInt32 nParagraph ) const
+long TextEngine::GetTextHeight( sal_uInt32 nParagraph ) const
{
DBG_ASSERT( GetUpdateMode(), "GetTextHeight: GetUpdateMode()" );
@@ -1159,13 +1159,13 @@ sal_uLong TextEngine::GetTextHeight( sal_uInt32 nParagraph ) const
return CalcParaHeight( nParagraph );
}
-sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara )
+long TextEngine::CalcTextWidth( sal_uInt32 nPara )
{
- sal_uLong nParaWidth = 0;
+ long nParaWidth = 0;
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara );
for ( auto nLine = pPortion->GetLines().size(); nLine; )
{
- sal_uLong nLineWidth = 0;
+ long nLineWidth = 0;
TextLine& pLine = pPortion->GetLines()[ --nLine ];
for ( sal_uInt16 nTP = pLine.GetStartPortion(); nTP <= pLine.GetEndPortion(); nTP++ )
{
@@ -1178,17 +1178,17 @@ sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara )
return nParaWidth;
}
-sal_uLong TextEngine::CalcTextWidth()
+long TextEngine::CalcTextWidth()
{
if ( !IsFormatted() && !IsFormatting() )
FormatAndUpdate();
- if ( mnCurTextWidth == 0xFFFFFFFF )
+ if ( mnCurTextWidth < 0 )
{
mnCurTextWidth = 0;
for ( sal_uInt32 nPara = mpTEParaPortions->Count(); nPara; )
{
- sal_uLong nParaWidth = CalcTextWidth( --nPara );
+ const long nParaWidth = CalcTextWidth( --nPara );
if ( nParaWidth > mnCurTextWidth )
mnCurTextWidth = nParaWidth;
}
@@ -1196,17 +1196,17 @@ sal_uLong TextEngine::CalcTextWidth()
return mnCurTextWidth+1;// wider by 1, as CreateLines breaks at >=
}
-sal_uLong TextEngine::CalcTextHeight()
+long TextEngine::CalcTextHeight()
{
DBG_ASSERT( GetUpdateMode(), "CalcTextHeight: GetUpdateMode()" );
- sal_uLong nY = 0;
+ long nY = 0;
for ( auto nPortion = mpTEParaPortions->Count(); nPortion; )
nY += CalcParaHeight( --nPortion );
return nY;
}
-sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nLen, const vcl::Font* pFont )
+long TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nLen, const vcl::Font* pFont )
{
#ifdef DBG_UTIL
// within the text there must not be a Portion change (attribute/tab)!
@@ -1214,10 +1214,10 @@ sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart,
DBG_ASSERT( nTabPos == -1 || nTabPos >= (nPortionStart+nLen), "CalcTextWidth: Tab!" );
#endif
- sal_uLong nWidth;
+ long nWidth;
if ( mnFixCharWidth100 )
{
- nWidth = (sal_uLong)nLen*mnFixCharWidth100/100;
+ nWidth = static_cast<long>(nLen)*mnFixCharWidth100/100;
}
else
{
@@ -1233,7 +1233,7 @@ sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart,
mpRefDev->SetFont( aFont );
}
TextNode* pNode = mpDoc->GetNodes()[ nPara ];
- nWidth = (sal_uLong)mpRefDev->GetTextWidth( pNode->GetText(), nPortionStart, nLen );
+ nWidth = mpRefDev->GetTextWidth( pNode->GetText(), nPortionStart, nLen );
}
return nWidth;
@@ -1263,9 +1263,9 @@ sal_Int32 TextEngine::GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) cons
return 0;
}
-sal_uLong TextEngine::CalcParaHeight( sal_uInt32 nParagraph ) const
+long TextEngine::CalcParaHeight( sal_uInt32 nParagraph ) const
{
- sal_uLong nHeight = 0;
+ long nHeight = 0;
TEParaPortion* pPPortion = mpTEParaPortions->GetObject( nParagraph );
DBG_ASSERT( pPPortion, "GetParaHeight: paragraph not found" );
@@ -1545,9 +1545,7 @@ void TextEngine::FormatDoc()
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
if ( pTEParaPortion->IsInvalid() )
{
- sal_uLong nOldParaWidth = 0xFFFFFFFF;
- if ( mnCurTextWidth != 0xFFFFFFFF )
- nOldParaWidth = CalcTextWidth( nPara );
+ const long nOldParaWidth = mnCurTextWidth >= 0 ? CalcTextWidth( nPara ) : -1;
ImpFormattingParagraph( nPara );
@@ -1558,9 +1556,9 @@ void TextEngine::FormatDoc()
if ( maInvalidRect.IsEmpty() )
{
// otherwise remains Empty() for Paperwidth 0 (AutoPageSize)
- long nWidth = (long)mnMaxTextWidth;
- if ( !nWidth )
- nWidth = 0x7FFFFFFF;
+ const long nWidth = mnMaxTextWidth
+ ? mnMaxTextWidth
+ : std::numeric_limits<long>::max();
Range aInvRange( GetInvalidYOffsets( nPara ) );
maInvalidRect = Rectangle( Point( 0, nY+aInvRange.Min() ),
Size( nWidth, aInvRange.Len() ) );
@@ -1570,13 +1568,13 @@ void TextEngine::FormatDoc()
maInvalidRect.Bottom() = nY + CalcParaHeight( nPara );
}
- if ( mnCurTextWidth != 0xFFFFFFFF )
+ if ( mnCurTextWidth >= 0 )
{
- sal_uLong nNewParaWidth = CalcTextWidth( nPara );
+ const long nNewParaWidth = CalcTextWidth( nPara );
if ( nNewParaWidth >= mnCurTextWidth )
mnCurTextWidth = nNewParaWidth;
- else if ( ( nOldParaWidth != 0xFFFFFFFF ) && ( nOldParaWidth >= mnCurTextWidth ) )
- mnCurTextWidth = 0xFFFFFFFF;
+ else if ( nOldParaWidth >= mnCurTextWidth )
+ mnCurTextWidth = -1;
}
}
else if ( bGrow )
@@ -1590,11 +1588,11 @@ void TextEngine::FormatDoc()
if ( !maInvalidRect.IsEmpty() )
{
- sal_uLong nNewHeight = CalcTextHeight();
+ const long nNewHeight = CalcTextHeight();
long nDiff = nNewHeight - mnCurTextHeight;
if ( nNewHeight < mnCurTextHeight )
{
- maInvalidRect.Bottom() = (long)std::max( nNewHeight, mnCurTextHeight );
+ maInvalidRect.Bottom() = std::max( nNewHeight, mnCurTextHeight );
if ( maInvalidRect.IsEmpty() )
{
maInvalidRect.Top() = 0;
@@ -1695,7 +1693,7 @@ void TextEngine::ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion*
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
TETextPortion* pTP = pTEParaPortion->GetTextPortions()[ nEndPortion ];
DBG_ASSERT( nBreakPos > pLine->GetStart(), "ImpBreakLine: SplitTextPortion at beginning of line?" );
- pTP->GetWidth() = (long)CalcTextWidth( nPara, nBreakPos-pTP->GetLen(), pTP->GetLen()-1 );
+ pTP->GetWidth() = CalcTextWidth( nPara, nBreakPos-pTP->GetLen(), pTP->GetLen()-1 );
}
pLine->SetEndPortion( nEndPortion );
}
@@ -1731,7 +1729,7 @@ sal_uInt16 TextEngine::SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos )
pTextPortion->GetLen() -= nOverlapp;
TETextPortion* pNewPortion = new TETextPortion( nOverlapp );
pTEParaPortion->GetTextPortions().insert( pTEParaPortion->GetTextPortions().begin() + nSplitPortion + 1, pNewPortion );
- pTextPortion->GetWidth() = (long)CalcTextWidth( nPara, nPos-pTextPortion->GetLen(), pTextPortion->GetLen() );
+ pTextPortion->GetWidth() = CalcTextWidth( nPara, nPos-pTextPortion->GetLen(), pTextPortion->GetLen() );
return nSplitPortion;
}
@@ -1947,8 +1945,8 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan
if ( pPortion->IsInvalid() )
return;
- sal_uLong nParaHeight = CalcParaHeight( nPara );
- if ( ( !pPaintArea || ( ( nY + (long)nParaHeight ) > pPaintArea->Top() ) )
+ const long nParaHeight = CalcParaHeight( nPara );
+ if ( ( !pPaintArea || ( ( nY + nParaHeight ) > pPaintArea->Top() ) )
&& ( !pPaintRange || ( ( nPara >= pPaintRange->GetStart().GetPara() ) && ( nPara <= pPaintRange->GetEnd().GetPara() ) ) ) )
{
// for all lines of the paragraph
@@ -2224,7 +2222,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
sal_uInt16 nTmpPortion = pLine->GetStartPortion();
long nTmpWidth = mpDoc->GetLeftMargin();
// do not subtract margin; it is included in TmpWidth
- long nXWidth = mnMaxTextWidth ? mnMaxTextWidth : 0x7FFFFFFF;
+ long nXWidth = mnMaxTextWidth ? mnMaxTextWidth : std::numeric_limits<long>::max();
if ( nXWidth < nTmpWidth )
nXWidth = nTmpWidth;
@@ -2258,7 +2256,7 @@ bool TextEngine::CreateLines( sal_uInt32 nPara )
{
if ( bCalcPortion || !pPortion->HasValidSize() )
- pPortion->GetWidth() = (long)CalcTextWidth( nPara, nTmpPos, pPortion->GetLen() );
+ pPortion->GetWidth() = CalcTextWidth( nPara, nTmpPos, pPortion->GetLen() );
nTmpWidth += pPortion->GetWidth();
pPortion->SetRightToLeft( ImpGetRightToLeft( nPara, nTmpPos+1 ) );
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 8ad8bd5..487ee38 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -405,7 +405,7 @@ void TextView::ImpHighlight( const TextSelection& rSel )
const sal_uInt32 nEndPara = aSel.GetEnd().GetPara();
for ( sal_uInt32 nPara = 0; nPara <= nEndPara; ++nPara )
{
- long nParaHeight = (long)mpImpl->mpTextEngine->CalcParaHeight( nPara );
+ const long nParaHeight = mpImpl->mpTextEngine->CalcParaHeight( nPara );
if ( ( nPara >= nStartPara ) && ( ( nY + nParaHeight ) > aVisArea.Top() ) )
{
TEParaPortion* pTEParaPortion = mpImpl->mpTextEngine->mpTEParaPortions->GetObject( nPara );
@@ -1920,20 +1920,20 @@ bool TextView::ImplTruncateNewText( OUString& rNewText ) const
{
bool bTruncated = false;
- sal_uLong nMaxLen = mpImpl->mpTextEngine->GetMaxTextLen();
+ const sal_Int32 nMaxLen = mpImpl->mpTextEngine->GetMaxTextLen();
// 0 means unlimited
if( nMaxLen != 0 )
{
- sal_uLong nCurLen = mpImpl->mpTextEngine->GetTextLen();
+ const sal_Int32 nCurLen = mpImpl->mpTextEngine->GetTextLen();
- sal_uInt32 nNewLen = rNewText.getLength();
+ const sal_Int32 nNewLen = rNewText.getLength();
if ( nCurLen + nNewLen > nMaxLen )
{
// see how much text will be replaced
- sal_uLong nSelLen = mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection );
+ const sal_Int32 nSelLen = mpImpl->mpTextEngine->GetTextLen( mpImpl->maSelection );
if ( nCurLen + nNewLen - nSelLen > nMaxLen )
{
- sal_uInt32 nTruncatedLen = static_cast<sal_uInt32>(nMaxLen - (nCurLen - nSelLen));
+ const sal_Int32 nTruncatedLen = nMaxLen - (nCurLen - nSelLen);
rNewText = rNewText.copy( 0, nTruncatedLen );
bTruncated = true;
}
@@ -1947,8 +1947,7 @@ bool TextView::ImplCheckTextLen( const OUString& rNewText )
bool bOK = true;
if ( mpImpl->mpTextEngine->GetMaxTextLen() )
{
- sal_uLong n = mpImpl->mpTextEngine->GetTextLen();
- n += rNewText.getLength();
+ sal_Int32 n = mpImpl->mpTextEngine->GetTextLen() + rNewText.getLength();
if ( n > mpImpl->mpTextEngine->GetMaxTextLen() )
{
// calculate how much text is being deleted
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 846ac1f..de1c675 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -84,7 +84,7 @@ private:
VclPtr<ScrollBarBox> mpScrollBox;
Point maTextWindowOffset;
- sal_Int32 mnTextWidth;
+ long mnTextWidth;
mutable Selection maSelection;
protected:
@@ -172,10 +172,10 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
if ( !bNeedVScroll && bAutoVScroll )
{
TextEngine& rEngine( *mpTextWindow->GetTextEngine() );
- sal_uLong nOverallTextHeight(0);
+ long nOverallTextHeight(0);
for ( sal_uInt32 i=0; i<rEngine.GetParagraphCount(); ++i )
nOverallTextHeight += rEngine.GetTextHeight( i );
- if ( nOverallTextHeight > (sal_uLong)mpTextWindow->GetOutputSizePixel().Height() )
+ if ( nOverallTextHeight > mpTextWindow->GetOutputSizePixel().Height() )
bNeedVScroll = true;
}
@@ -269,8 +269,8 @@ void ImpVclMEdit::ImpSetScrollBarRanges()
{
if ( mpVScrollBar )
{
- sal_uLong nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
- mpVScrollBar->SetRange( Range( 0, (long)nTextHeight-1 ) );
+ const long nTextHeight = mpTextWindow->GetTextEngine()->GetTextHeight();
+ mpVScrollBar->SetRange( Range( 0, nTextHeight-1 ) );
}
if ( mpHScrollBar )
{
@@ -539,7 +539,7 @@ void ImpVclMEdit::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
if ( mpHScrollBar )
{
- sal_Int32 nWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
+ const long nWidth = mpTextWindow->GetTextEngine()->CalcTextWidth();
if ( nWidth != mnTextWidth )
{
mnTextWidth = nWidth;
commit caa828da96b120f5a3c979237081c29f8c2f3848
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Aug 15 17:26:28 2015 +0200
Avoid unnecessary OUString copies
Change-Id: Ic76c9b75bcc72d8ae6a54d6ebba49acb77073bea
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index d13c5f9..10315ef 100644
--- a/vcl/source/edit/textdoc.cxx
+++ b/vcl/source/edit/textdoc.cxx
@@ -436,8 +436,7 @@ OUString TextDoc::GetText( const sal_Unicode* pSep ) const
for ( sal_uInt32 nNode = 0; nNode < nNodes; ++nNode )
{
TextNode* pNode = maTextNodes[ nNode ];
- OUString aTmp( pNode->GetText() );
- aASCIIText += aTmp;
+ aASCIIText += pNode->GetText();
if ( pSep && ( nNode != nLastNode ) )
aASCIIText += pSep;
}
@@ -447,13 +446,11 @@ OUString TextDoc::GetText( const sal_Unicode* pSep ) const
OUString TextDoc::GetText( sal_uInt32 nPara ) const
{
- OUString aText;
-
TextNode* pNode = ( nPara < maTextNodes.size() ) ? maTextNodes[ nPara ] : 0;
if ( pNode )
- aText = pNode->GetText();
+ return pNode->GetText();
- return aText;
+ return OUString();
}
sal_uLong TextDoc::GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel ) const
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 9f2d3a7..90343f1 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -699,9 +699,9 @@ TextPaM TextEngine::ImpInsertText( sal_Unicode c, const TextSelection& rCurSel,
// the text that needs to be checked is only the one
// before the current cursor position
OUString aOldText( mpDoc->GetText( aPaM.GetPara() ).copy(0, nTmpPos) );
- OUString aNewText( aOldText );
if (aCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
{
+ OUString aNewText( aOldText );
xISC->correctInputSequence( aNewText, nTmpPos - 1, c, nCheckMode );
// find position of first character that has changed
@@ -2530,7 +2530,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
OUStringBuffer aText;
if ( !bHTML )
{
- aText = OUString( pNode->GetText().copy( nStartPos, nEndPos-nStartPos ) );
+ aText = pNode->GetText().copy( nStartPos, nEndPos-nStartPos );
}
else
{
@@ -2551,7 +2551,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
nTmpEnd = pAttr ? pAttr->GetStart() : nEndPos;
// Text before Attribute
- aText.append( OUString( pNode->GetText().copy( nTmpStart, nTmpEnd-nTmpStart ) ) );
+ aText.append( pNode->GetText().copy( nTmpStart, nTmpEnd-nTmpStart ) );
if ( pAttr )
{
commit 6917ebc39fb1c4f412ae9fea4e2d858a1b351c47
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Aug 15 17:15:29 2015 +0200
sal_uLong to sal_uInt32
Change-Id: Ifcde090747127680a9e4b810ff062d024663632c
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 4d9e832..657b4fe 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -1757,11 +1757,11 @@ void Document::init()
{
if (m_xParagraphs.get() == 0)
{
- ::sal_uLong nCount = m_rEngine.GetParagraphCount();
+ const sal_uInt32 nCount = m_rEngine.GetParagraphCount();
m_xParagraphs.reset(new Paragraphs);
m_xParagraphs->reserve(static_cast< Paragraphs::size_type >(nCount));
// numeric overflow is harmless here
- for (::sal_uLong i = 0; i < nCount; ++i)
+ for (sal_uInt32 i = 0; i < nCount; ++i)
m_xParagraphs->push_back(ParagraphInfo(static_cast< ::sal_Int32 >(
m_rEngine.GetTextHeight(i))));
// XXX numeric overflow
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index aa68f51..65b6bf4 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -848,14 +848,14 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
long nXTextWidth = pPrinter->approximate_char_width();
sal_Int32 nCharspLine = aPaperSz.Width() / (nXTextWidth > 1 ? nXTextWidth : 1);
- sal_uLong nParas = GetEditEngine()->GetParagraphCount();
+ const sal_uInt32 nParas = GetEditEngine()->GetParagraphCount();
sal_Int32 nPages = nParas/nLinespPage+1;
sal_Int32 nCurPage = 1;
lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nPrintPage == 0 );
Point aPos( Print::nLeftMargin, Print::nTopMargin );
- for ( sal_uLong nPara = 0; nPara < nParas; nPara++ )
+ for ( sal_uInt32 nPara = 0; nPara < nParas; ++nPara )
{
OUString aLine( GetEditEngine()->GetText( nPara ) );
lcl_ConvertTabsToSpaces( aLine );
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 560d569..106e923 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -767,7 +767,7 @@ void EditorWindow::HandleProcedureCompletion()
}
else
{
- for( sal_uLong i = nLine+1; i < pEditEngine->GetParagraphCount(); ++i )
+ for( sal_uInt32 i = nLine+1; i < pEditEngine->GetParagraphCount(); ++i )
{//searching forward for end token, or another sub/function definition
OUString aCurrLine = pEditEngine->GetText( i );
std::vector<HighlightPortion> aCurrPortions;
@@ -1222,8 +1222,8 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
void EditorWindow::UpdateSyntaxHighlighting ()
{
- unsigned nCount = pEditEngine->GetParagraphCount();
- for (unsigned i = 0; i < nCount; ++i)
+ const sal_uInt32 nCount = pEditEngine->GetParagraphCount();
+ for (sal_uInt32 i = 0; i < nCount; ++i)
DoDelayedSyntaxHighlight(i);
}
diff --git a/basctl/source/basicide/linenumberwindow.cxx b/basctl/source/basicide/linenumberwindow.cxx
index 2068973..d1b9610 100644
--- a/basctl/source/basicide/linenumberwindow.cxx
+++ b/basctl/source/basicide/linenumberwindow.cxx
@@ -59,10 +59,10 @@ void LineNumberWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangl
}
int startY = txtView->GetStartDocPos().Y();
- int nStartLine = startY / nLineHeight + 1;
- int nEndLine = (startY + windowHeight) / nLineHeight + 1;
+ const sal_uInt32 nStartLine = startY / nLineHeight + 1;
+ sal_uInt32 nEndLine = (startY + windowHeight) / nLineHeight + 1;
- if (txtEngine->GetParagraphCount() + 1 < (unsigned int)nEndLine)
+ if (txtEngine->GetParagraphCount() + 1 < nEndLine)
nEndLine = txtEngine->GetParagraphCount() + 1;
// FIXME: it would be best if we could get notified of a font change
@@ -71,7 +71,7 @@ void LineNumberWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangl
// reserve enough for 3 digit minimum, with a bit to spare for confort
m_nWidth = m_nBaseWidth * 3 + m_nBaseWidth / 2;
- int i = (nEndLine + 1) / 1000;
+ sal_uInt32 i = (nEndLine + 1) / 1000;
while (i)
{
i /= 10;
@@ -79,7 +79,7 @@ void LineNumberWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangl
}
sal_Int64 y = (nStartLine - 1) * (sal_Int64)nLineHeight;
- for (sal_Int32 n = nStartLine; n <= nEndLine; ++n, y += nLineHeight)
+ for (sal_uInt32 n = nStartLine; n <= nEndLine; ++n, y += nLineHeight)
rRenderContext.DrawText(Point(0, y - m_nCurYOffset), OUString::number(n));
}
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 754cb7b..9dbd044 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -1897,11 +1897,11 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions( bool bSetIgnore
// quick partly fix of #i71318. Correct fix needs to patch the TextEngine itself...
// this one will only prevent text from disappearing. It may to not have the
// correct language and will probably not spell checked...
- sal_uLong nPara = pTextEngine->GetParagraphCount();
+ const sal_uInt32 nPara = pTextEngine->GetParagraphCount();
if (nPara > 1)
{
OUString aLeftOverText;
- for (sal_uLong i = 1; i < nPara; ++i)
+ for (sal_uInt32 i = 1; i < nPara; ++i)
{
aLeftOverText += "\x0a"; // the manual line break...
aLeftOverText += pTextEngine->GetText(i);
diff --git a/include/svtools/svmedit2.hxx b/include/svtools/svmedit2.hxx
index d6c30d2..18471c9 100644
--- a/include/svtools/svmedit2.hxx
+++ b/include/svtools/svmedit2.hxx
@@ -36,7 +36,7 @@ public:
// methods of TextEngine
void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd );
void SetLeftMargin( sal_uInt16 nLeftMargin );
- sal_uLong GetParagraphCount() const;
+ sal_uInt32 GetParagraphCount() const;
};
#endif
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 2b64ccc..9227e4b 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -259,7 +259,7 @@ public:
sal_uLong CalcTextWidth();
long GetCharHeight() const { return mnCharHeight; }
- sal_uLong GetParagraphCount() const;
+ sal_uInt32 GetParagraphCount() const;
OUString GetText( sal_uInt32 nParagraph ) const;
sal_Int32 GetTextLen( sal_uInt32 nParagraph ) const;
sal_uLong GetTextHeight( sal_uInt32 nParagraph ) const;
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx
index cf734c0..894741f 100644
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ b/svtools/source/edit/editsyntaxhighlighter.cxx
@@ -161,7 +161,7 @@ void MultiLineEditSyntaxHighlight::UpdateData()
// syntax highlighting
// this must be possible improved by using notifychange correctly
bool bTempModified = GetTextEngine()->IsModified();
- for (sal_uLong nLine=0; nLine < GetTextEngine()->GetParagraphCount(); nLine++)
+ for (sal_uInt32 nLine=0; nLine < GetTextEngine()->GetParagraphCount(); ++nLine)
{
OUString aLine( GetTextEngine()->GetText( nLine ) );
GetTextEngine()->RemoveAttribs( nLine );
diff --git a/svtools/source/edit/svmedit2.cxx b/svtools/source/edit/svmedit2.cxx
index 9301c0d..65f2c0c 100644
--- a/svtools/source/edit/svmedit2.cxx
+++ b/svtools/source/edit/svmedit2.cxx
@@ -46,7 +46,7 @@ void ExtMultiLineEdit::SetLeftMargin( sal_uInt16 nLeftMargin )
GetTextEngine()->SetLeftMargin( nLeftMargin );
}
-sal_uLong ExtMultiLineEdit::GetParagraphCount() const
+sal_uInt32 ExtMultiLineEdit::GetParagraphCount() const
{
return GetTextEngine()->GetParagraphCount();
}
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 843fbe3..30aec24 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1401,8 +1401,8 @@ void AddressMultiLineEdit::SetText( const OUString& rStr )
ExtTextEngine* pTextEngine = GetTextEngine();
TextAttribProtect aProtectAttr;
- sal_uLong nParaCount = pTextEngine->GetParagraphCount();
- for(sal_uLong nPara = 0; nPara < nParaCount; ++nPara)
+ const sal_uInt32 nParaCount = pTextEngine->GetParagraphCount();
+ for(sal_uInt32 nPara = 0; nPara < nParaCount; ++nPara)
{
sal_Int32 nIndex = 0;
const OUString sPara = pTextEngine->GetText( nPara );
@@ -1638,8 +1638,8 @@ OUString AddressMultiLineEdit::GetAddress()
{
OUString sRet;
ExtTextEngine* pTextEngine = GetTextEngine();
- sal_uLong nParaCount = pTextEngine->GetParagraphCount();
- for(sal_uLong nPara = nParaCount; nPara; --nPara)
+ const sal_uInt32 nParaCount = pTextEngine->GetParagraphCount();
+ for(sal_uInt32 nPara = nParaCount; nPara; --nPara)
{
const OUString sPara = comphelper::string::stripEnd(pTextEngine->GetText(nPara - 1), ' ');
//don't add empty trailing paragraphs
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 61553bf..c928c89 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -725,7 +725,7 @@ sal_Int32 SwSrcView::PrintSource(
const long nLinespPage = nLineHeight ? aPaperSz.Height() / nLineHeight : 1;
const long nCharWidth = pOutDev->GetTextWidth("X");
const sal_Int32 nCharspLine = nCharWidth ? static_cast<sal_Int32>(aPaperSz.Width() / nCharWidth) : 1;
- const sal_uLong nParas = pTextEngine->GetParagraphCount();
+ const sal_uInt32 nParas = pTextEngine->GetParagraphCount();
const sal_Int32 nPages = static_cast<sal_Int32>(nParas / nLinespPage + 1 );
sal_Int32 nCurPage = 1;
@@ -735,7 +735,7 @@ sal_Int32 SwSrcView::PrintSource(
lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle );
const Point aStartPos( LMARGPRN, TMARGPRN );
Point aPos( aStartPos );
- for ( sal_uLong nPara = 0; nPara < nParas; ++nPara )
+ for ( sal_uInt32 nPara = 0; nPara < nParas; ++nPara )
{
const OUString aLine( lcl_ConvertTabsToSpaces(pTextEngine->GetText( nPara )) );
const sal_Int32 nLineLen = aLine.getLength();
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index e1df6d8..9f2d3a7 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -1304,9 +1304,9 @@ Range TextEngine::GetInvalidYOffsets( sal_uInt32 nPortion )
return Range( nFirstInvalid*mnCharHeight, ((nLastInvalid+1)*mnCharHeight)-1 );
}
-sal_uLong TextEngine::GetParagraphCount() const
+sal_uInt32 TextEngine::GetParagraphCount() const
{
- return mpDoc->GetNodes().size();
+ return static_cast<sal_uInt32>(mpDoc->GetNodes().size());
}
void TextEngine::EnableUndo( bool bEnable )
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index c526ffe..8ad8bd5 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -2026,7 +2026,7 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv
// Data for deleting after DROP_MOVE:
TextSelection aPrevSel( mpImpl->maSelection );
aPrevSel.Justify();
- sal_uLong nPrevParaCount = mpImpl->mpTextEngine->GetParagraphCount();
+ const sal_uInt32 nPrevParaCount = mpImpl->mpTextEngine->GetParagraphCount();
const sal_Int32 nPrevStartParaLen = mpImpl->mpTextEngine->GetTextLen( aPrevSel.GetStart().GetPara() );
bool bStarterOfDD = false;
@@ -2076,8 +2076,8 @@ void TextView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEv
( ( mpImpl->mpDDInfo->maDropPos.GetPara() == aPrevSel.GetStart().GetPara() )
&& ( mpImpl->mpDDInfo->maDropPos.GetIndex() < aPrevSel.GetStart().GetIndex() ) ) )
{
- sal_uLong nNewParasBeforeSelection =
- mpImpl->mpTextEngine->GetParagraphCount() - nPrevParaCount;
+ const sal_uInt32 nNewParasBeforeSelection =
+ mpImpl->mpTextEngine->GetParagraphCount() - nPrevParaCount;
aPrevSel.GetStart().GetPara() += nNewParasBeforeSelection;
aPrevSel.GetEnd().GetPara() += nNewParasBeforeSelection;
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 5a73070..846ac1f 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -173,7 +173,7 @@ void ImpVclMEdit::ImpUpdateSrollBarVis( WinBits nWinStyle )
{
TextEngine& rEngine( *mpTextWindow->GetTextEngine() );
sal_uLong nOverallTextHeight(0);
- for ( sal_uLong i=0; i<rEngine.GetParagraphCount(); ++i )
+ for ( sal_uInt32 i=0; i<rEngine.GetParagraphCount(); ++i )
nOverallTextHeight += rEngine.GetTextHeight( i );
if ( nOverallTextHeight > (sal_uLong)mpTextWindow->GetOutputSizePixel().Height() )
bNeedVScroll = true;
commit 8353793c94416a9a3a5af074d881624e43e5ec2f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Aug 15 15:14:47 2015 +0200
Use constants instead of (possibly wrong) magic numbers
Change-Id: I0829d271337b9fe77341c62a1c2ef4d6ae62c727
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 339f2d6..aa68f51 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -901,7 +901,7 @@ void ModulWindow::ExecuteCommand (SfxRequest& rReq)
}
case SID_SELECTALL:
{
- TextSelection aSel( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, 0xFFFF ) );
+ TextSelection aSel( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) );
TextView * pView = GetEditView();
pView->SetSelection( aSel );
pView->GetWindow()->GrabFocus();
@@ -1245,7 +1245,7 @@ sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem,
if ( !rSearchItem.GetBackward() )
pView->SetSelection( TextSelection() );
else
- pView->SetSelection( TextSelection( TextPaM( 0xFFFFFFFF, 0xFFFF ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
+ pView->SetSelection( TextSelection( TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
}
bool const bForward = !rSearchItem.GetBackward();
diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
index d206da9..b982b1e 100644
--- a/include/vcl/textdata.hxx
+++ b/include/vcl/textdata.hxx
@@ -25,7 +25,8 @@
#include <vcl/dllapi.h>
// for Notify, if all paragraphs were deleted
-#define TEXT_PARA_ALL 0xFFFFFFFF
+#define TEXT_PARA_ALL SAL_MAX_UINT32
+#define TEXT_INDEX_ALL SAL_MAX_INT32
class TextPaM
{
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 72b4de7..61553bf 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -414,7 +414,7 @@ void SwSrcView::Execute(SfxRequest& rReq)
pTextView->Paste();
break;
case SID_SELECTALL:
- pTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
+ pTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
break;
}
aEditWin->Invalidate();
@@ -580,7 +580,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
bool bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM );
if( !bForward )
- aPaM = TextPaM( TEXT_PARA_ALL, USHRT_MAX );
+ aPaM = TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL );
if( bFromStart )
{
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index ef5455c..e1df6d8 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -2707,7 +2707,7 @@ void TextEngine::ValidatePaM( TextPaM& rPaM ) const
if ( rPaM.GetPara() >= nParas )
{
rPaM.GetPara() = nParas ? nParas-1 : 0;
- rPaM.GetIndex() = 0xFFFF;
+ rPaM.GetIndex() = TEXT_INDEX_ALL;
}
const sal_Int32 nMaxIndex = GetTextLen( rPaM.GetPara() );
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 6e18ae4..5a73070 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -773,7 +773,7 @@ void TextWindow::KeyInput( const KeyEvent& rKEvent )
( (nCode == KEY_A) && rKEvent.GetKeyCode().IsMod1() && !rKEvent.GetKeyCode().IsMod2() )
)
{
- mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) );
+ mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
bDone = true;
}
else if ( (nCode == KEY_S) && rKEvent.GetKeyCode().IsShift() && rKEvent.GetKeyCode().IsMod1() )
@@ -879,7 +879,7 @@ void TextWindow::Command( const CommandEvent& rCEvt )
mpExtTextEngine->SetModified( true );
mpExtTextEngine->Broadcast( TextHint( TEXT_HINT_MODIFIED ) );
break;
- case SV_MENU_EDIT_SELECTALL: mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
+ case SV_MENU_EDIT_SELECTALL: mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
break;
case SV_MENU_EDIT_INSERTSYMBOL:
{
@@ -915,7 +915,7 @@ void TextWindow::GetFocus()
// select everything, but do not scroll
bool bAutoScroll = mpExtTextView->IsAutoScroll();
mpExtTextView->SetAutoScroll( false );
- mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFF, 0xFFFF ) ) );
+ mpExtTextView->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
mpExtTextView->SetAutoScroll( bAutoScroll );
bGotoCursor = false;
}
@@ -1516,7 +1516,7 @@ bool VclMultiLineEdit::PreNotify( NotifyEvent& rNEvt )
{
if ( rKEvent.GetKeyCode().IsMod1() )
pImpVclMEdit->GetTextWindow()->GetTextView()->
- SetSelection( TextSelection( TextPaM( 0xFFFF, 0xFFFF ) ) );
+ SetSelection( TextSelection( TextPaM( TEXT_PARA_ALL, TEXT_INDEX_ALL ) ) );
}
break;
default:
commit 9d0f86326cbf6b986176c5b5fe7660fa510c8d70
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Aug 15 15:03:35 2015 +0200
Rework loops so to have exit condition on correct unsigned value
Change-Id: I91e647d6b1aebe8342f95c88fc81bd2c5a43ce71
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index ee451cf..339f2d6 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -1113,19 +1113,18 @@ void ModulWindow::GetState( SfxItemSet &rSet )
TextView* pView = GetEditView();
if ( pView )
{
-
OUString sProcName;
- bool bFound = false;
TextSelection aSel = pView->GetSelection();
- long nLine = aSel.GetStart().GetPara();
- for (long i = nLine; i >= 0 && !bFound; --i)
+ sal_uInt32 i = aSel.GetStart().GetPara();
+ do
{
OUString aCurrLine = GetEditEngine()->GetText( i );
OUString sProcType;
- bFound = GetEditorWindow().GetProcedureName(aCurrLine, sProcType, sProcName);
- }
+ if (GetEditorWindow().GetProcedureName(aCurrLine, sProcType, sProcName))
+ break;
+ } while (i--);
OUString aTitle = CreateQualifiedName();
if (!sProcName.isEmpty())
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx
index 224017a..cf734c0 100644
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ b/svtools/source/edit/editsyntaxhighlighter.cxx
@@ -43,7 +43,7 @@ void MultiLineEditSyntaxHighlight::DoBracketHilight(sal_uInt16 nKey)
{
TextSelection aCurrentPos = GetTextView()->GetSelection();
sal_Int32 nStartPos = aCurrentPos.GetStart().GetIndex();
- sal_Int32 nStartPara = aCurrentPos.GetStart().GetPara();
+ const sal_uInt32 nStartPara = aCurrentPos.GetStart().GetPara();
sal_uInt16 nCount = 0;
int nChar = -1;
@@ -74,7 +74,8 @@ void MultiLineEditSyntaxHighlight::DoBracketHilight(sal_uInt16 nKey)
if (nChar != -1)
{
- for (sal_Int32 nPara = nStartPara; nPara >= 0; --nPara)
+ sal_uInt32 nPara = nStartPara;
+ do
{
if (nPara == nStartPara && nStartPos == 0)
continue;
@@ -102,7 +103,7 @@ void MultiLineEditSyntaxHighlight::DoBracketHilight(sal_uInt16 nKey)
if (aLine[i] == nKey)
++nCount;
}
- }
+ } while (nPara--);
}
}
commit 7d5f47aff58fbe57ff24a4e4052bc1149fc5829d
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Aug 15 14:50:28 2015 +0200
This seems to be the original purpose
Change-Id: Ie8c50324fe3d1e836967ba4de24cd740182418a6
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx
index 746bbbb..224017a 100644
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ b/svtools/source/edit/editsyntaxhighlighter.cxx
@@ -76,7 +76,7 @@ void MultiLineEditSyntaxHighlight::DoBracketHilight(sal_uInt16 nKey)
{
for (sal_Int32 nPara = nStartPara; nPara >= 0; --nPara)
{
- if (nStartPos == 0)
+ if (nPara == nStartPara && nStartPos == 0)
continue;
OUString aLine( GetTextEngine()->GetText( nPara ) );
commit 866e287adee448c1c8b431c6c084d3fe3283649d
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Sat Aug 15 12:54:57 2015 +0200
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
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 23b7b1e..4d9e832 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -928,19 +928,15 @@ Document::retrieveCharacterBounds(Paragraph const * pParagraph,
if ( nIndex == nLength )
{
aBounds = AWTRectangle(
- m_rEngine.PaMtoEditCursor(::TextPaM(nNumber,
- static_cast< ::sal_uInt16 >(nIndex))));
+ m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, nIndex)));
}
else
{
::Rectangle aLeft(
- m_rEngine.PaMtoEditCursor(::TextPaM(nNumber,
- static_cast< ::sal_uInt16 >(nIndex))));
+ m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, nIndex)));
// XXX numeric overflow
::Rectangle aRight(
- m_rEngine.PaMtoEditCursor(::TextPaM(nNumber,
- static_cast< ::sal_uInt16 >(nIndex)
- + 1)));
+ m_rEngine.PaMtoEditCursor(::TextPaM(nNumber, nIndex + 1)));
// XXX numeric overflow (2x)
// FIXME If the vertical extends of the two cursors do not match, assume
// nIndex is the last character on the line; the bounding box will then
@@ -1173,7 +1169,7 @@ void Document::retrieveRunAttributesImpl(
tPropValMap& rRunAttrSeq)
{
::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() );
- ::TextPaM aPaM( nNumber, static_cast< ::sal_uInt16 >( Index ) );
+ ::TextPaM aPaM( nNumber, Index );
// XXX numeric overflow
// FIXME TEXTATTR_HYPERLINK ignored:
::TextAttribFontColor const * pColor
@@ -1290,8 +1286,8 @@ void Document::copyParagraphText(Paragraph const * pParagraph,
" Document::copyParagraphText",
static_cast< css::uno::XWeak * >(this));
m_rView.SetSelection(
- ::TextSelection(::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nBegin)),
- ::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nEnd))));
+ ::TextSelection(::TextPaM(nNumber, nBegin),
+ ::TextPaM(nNumber, nEnd)));
// XXX numeric overflow (2x)
m_rView.Copy();
}
@@ -1345,8 +1341,8 @@ void Document::changeParagraphSelection(Paragraph * pParagraph,
" Document::changeParagraphSelection",
static_cast< css::uno::XWeak * >(this));
m_rView.SetSelection(
- ::TextSelection(::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nBegin)),
- ::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nEnd))));
+ ::TextSelection(::TextPaM(nNumber, nBegin),
+ ::TextPaM(nNumber, nEnd)));
// XXX numeric overflow (2x)
}
}
@@ -2111,10 +2107,10 @@ void Document::handleParagraphNotifications()
return -1;
::sal_Int32 Osp = m_nSelectionFirstPara, Osl = m_nSelectionFirstPos, Oep = m_nSelectionLastPara, Oel = m_nSelectionLastPos;
::sal_Int32 Nsp = nNewFirstPara, Nsl = nNewFirstPos, Nep = nNewLastPara, Nel = nNewLastPos;
- TextPaM Ns(Nsp, sal_uInt16(Nsl));
- TextPaM Ne(Nep, sal_uInt16(Nel));
- TextPaM Os(Osp, sal_uInt16(Osl));
- TextPaM Oe(Oep, sal_uInt16(Oel));
+ TextPaM Ns(Nsp, Nsl);
+ TextPaM Ne(Nep, Nel);
+ TextPaM Os(Osp, Osl);
+ TextPaM Oe(Oep, Oel);
if (Os == Oe && Ns == Ne)
{
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 88a2d64..ee451cf 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -319,10 +319,10 @@ bool ModulWindow::BasicExecute()
{
DBG_ASSERT( xModule.Is(), "Kein Modul!" );
AddStatus( BASWIN_RUNNINGBASIC );
- sal_uInt16 nStart, nEnd, nCurMethodStart = 0;
+ sal_uInt16 nStart, nEnd;
TextSelection aSel = GetEditView()->GetSelection();
// Init cursor to top
- nCurMethodStart = ( aSel.GetStart().GetPara() + 1 );
+ const sal_uInt32 nCurMethodStart = aSel.GetStart().GetPara() + 1;
SbMethod* pMethod = 0;
// first Macro, else blind "Main" (ExtSearch?)
for ( sal_uInt16 nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ )
@@ -568,7 +568,7 @@ bool ModulWindow::BasicToggleBreakPoint()
bool bNewBreakPoint = false;
- for ( sal_uLong nLine = aSel.GetStart().GetPara(); nLine <= aSel.GetEnd().GetPara(); nLine++ )
+ for ( sal_uInt32 nLine = aSel.GetStart().GetPara(); nLine <= aSel.GetEnd().GetPara(); ++nLine )
{
if ( ToggleBreakPoint( nLine ) )
bNewBreakPoint = true;
@@ -589,7 +589,7 @@ void ModulWindow::BasicToggleBreakPointEnabled()
TextSelection aSel = pView->GetSelection();
BreakPointList& rList = GetBreakPoints();
- for ( sal_uLong nLine = ++aSel.GetStart().GetPara(), nEnd = ++aSel.GetEnd().GetPara(); nLine <= nEnd; ++nLine )
+ for ( sal_uInt32 nLine = ++aSel.GetStart().GetPara(), nEnd = ++aSel.GetEnd().GetPara(); nLine <= nEnd; ++nLine )
{
BreakPoint* pBrk = rList.FindBreakPoint( nLine );
if ( pBrk )
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index f19f827..560d569 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -597,7 +597,7 @@ void EditorWindow::KeyInput( const KeyEvent& rKEvt )
void EditorWindow::HandleAutoCorrect()
{
TextSelection aSel = GetEditView()->GetSelection();
- sal_uLong nLine = aSel.GetStart().GetPara();
+ const sal_uInt32 nLine = aSel.GetStart().GetPara();
const sal_Int32 nIndex = aSel.GetStart().GetIndex();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure
@@ -674,7 +674,7 @@ void EditorWindow::HandleAutoCorrect()
TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
{//creates a text selection from the highlight portion on the cursor
- sal_uLong nLine = GetEditView()->GetSelection().GetStart().GetPara();
+ const sal_uInt32 nLine = GetEditView()->GetSelection().GetStart().GetPara();
const sal_Int32 nIndex = GetEditView()->GetSelection().GetStart().GetIndex();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
std::vector<HighlightPortion> aPortions;
@@ -707,7 +707,7 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
void EditorWindow::HandleAutoCloseParen()
{
TextSelection aSel = GetEditView()->GetSelection();
- sal_uLong nLine = aSel.GetStart().GetPara();
+ const sal_uInt32 nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
if( aLine.getLength() > 0 && aLine[aSel.GetEnd().GetIndex()-1] != '(' )
@@ -722,7 +722,7 @@ void EditorWindow::HandleAutoCloseParen()
void EditorWindow::HandleAutoCloseDoubleQuotes()
{
TextSelection aSel = GetEditView()->GetSelection();
- sal_uLong nLine = aSel.GetStart().GetPara();
+ const sal_uInt32 nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
std::vector<HighlightPortion> aPortions;
@@ -744,7 +744,7 @@ void EditorWindow::HandleProcedureCompletion()
{
TextSelection aSel = GetEditView()->GetSelection();
- sal_uLong nLine = aSel.GetStart().GetPara();
+ const sal_uInt32 nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) );
OUString sProcType;
@@ -836,7 +836,7 @@ void EditorWindow::HandleCodeCompletion()
rModulWindow.UpdateModule();
rModulWindow.GetSbModule()->GetCodeCompleteDataFromParse(aCodeCompleteCache);
TextSelection aSel = GetEditView()->GetSelection();
- sal_uLong nLine = aSel.GetStart().GetPara();
+ const sal_uInt32 nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
std::vector< OUString > aVect; //vector to hold the base variable+methods for the nested reflection
diff --git a/include/vcl/textdata.hxx b/include/vcl/textdata.hxx
index 722a94c..d206da9 100644
--- a/include/vcl/textdata.hxx
+++ b/include/vcl/textdata.hxx
@@ -30,15 +30,15 @@
class TextPaM
{
private:
- sal_uLong mnPara;
+ sal_uInt32 mnPara;
sal_Int32 mnIndex;
public:
TextPaM() : mnPara(0), mnIndex(0) {}
- TextPaM( sal_uLong nPara, sal_Int32 nIndex ) : mnPara(nPara), mnIndex(nIndex) {}
+ TextPaM( sal_uInt32 nPara, sal_Int32 nIndex ) : mnPara(nPara), mnIndex(nIndex) {}
- sal_uLong GetPara() const { return mnPara; }
- sal_uLong& GetPara() { return mnPara; }
+ sal_uInt32 GetPara() const { return mnPara; }
+ sal_uInt32& GetPara() { return mnPara; }
sal_Int32 GetIndex() const { return mnIndex; }
sal_Int32& GetIndex() { return mnIndex; }
@@ -128,8 +128,8 @@ private:
sal_uLong mnValue;
public:
- TextHint( sal_uLong nId );
- TextHint( sal_uLong nId, sal_uLong nValue );
+ TextHint( sal_uInt32 nId );
+ TextHint( sal_uInt32 nId, sal_uLong nValue );
sal_uLong GetValue() const { return mnValue; }
};
diff --git a/include/vcl/texteng.hxx b/include/vcl/texteng.hxx
index 2d8e831..2b64ccc 100644
--- a/include/vcl/texteng.hxx
+++ b/include/vcl/texteng.hxx
@@ -141,7 +141,7 @@ private:
protected:
- void CursorMoved( sal_uLong nNode );
+ void CursorMoved( sal_uInt32 nNode );
void TextModified();
void ImpInitDoc();
@@ -152,9 +152,9 @@ protected:
TextPaM ImpInsertParaBreak( const TextSelection& rTextSelection, bool bKeepEndingAttribs = true );
TextPaM ImpInsertParaBreak( const TextPaM& rPaM, bool bKeepEndingAttribs = true );
void ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars, SfxUndoAction* pCurUndo = 0 );
- TextPaM ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight );
- void ImpRemoveParagraph( sal_uLong nPara );
- void ImpInitWritingDirections( sal_uLong nPara );
+ TextPaM ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight );
+ void ImpRemoveParagraph( sal_uInt32 nPara );
+ void ImpInitWritingDirections( sal_uInt32 nPara );
LocaleDataWrapper* ImpGetLocaleDataWrapper();
// to remain compatible in the minor release we copy the above ImpInsertText
@@ -166,11 +166,11 @@ protected:
SAL_DLLPRIVATE bool IsInputSequenceCheckingRequired( sal_Unicode c, const TextSelection& rCurSel ) const;
// broadcast or adjust selections
- void ImpParagraphInserted( sal_uLong nPara );
- void ImpParagraphRemoved( sal_uLong nPara );
- void ImpCharsRemoved( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars );
- void ImpCharsInserted( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars );
- void ImpFormattingParagraph( sal_uLong nPara );
+ void ImpParagraphInserted( sal_uInt32 nPara );
+ void ImpParagraphRemoved( sal_uInt32 nPara );
+ void ImpCharsRemoved( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars );
+ void ImpCharsInserted( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars );
+ void ImpFormattingParagraph( sal_uInt32 nPara );
void ImpTextHeightChanged();
void ImpTextFormatted();
@@ -178,13 +178,13 @@ protected:
void CheckIdleFormatter();
void IdleFormatAndUpdate( TextView* pCurView = 0, sal_uInt16 nMaxTimerRestarts = 5 );
- bool CreateLines( sal_uLong nPara );
- void CreateAndInsertEmptyLine( sal_uLong nPara );
- void ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion* pPortion, sal_Int32 nPortionStart, long nRemainingWidth );
- sal_uInt16 SplitTextPortion( sal_uLong nPara, sal_Int32 nPos );
- void CreateTextPortions( sal_uLong nPara, sal_Int32 nStartPos );
- void RecalcTextPortion( sal_uLong nPara, sal_Int32 nStartPos, sal_Int32 nNewChars );
- void SeekCursor( sal_uLong nNode, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev );
+ bool CreateLines( sal_uInt32 nPara );
+ void CreateAndInsertEmptyLine( sal_uInt32 nPara );
+ void ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion* pPortion, sal_Int32 nPortionStart, long nRemainingWidth );
+ sal_uInt16 SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos );
+ void CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos );
+ void RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_Int32 nNewChars );
+ void SeekCursor( sal_uInt32 nNode, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev );
void FormatDoc();
void FormatFullDoc();
@@ -196,26 +196,26 @@ protected:
bool IsFormatted() const { return mbFormatted; }
- sal_Int32 GetCharPos( sal_uLong nPara, sal_uInt16 nLine, long nDocPosX, bool bSmart = false );
+ sal_Int32 GetCharPos( sal_uInt32 nPara, sal_uInt16 nLine, long nDocPosX, bool bSmart = false );
Rectangle GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bPreferPortionStart = false );
- sal_Int32 ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara, bool bSmart );
- long ImpGetPortionXOffset( sal_uLong nPara, TextLine* pLine, sal_uInt16 nTextPortion );
- long ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false );
- long ImpGetOutputOffset( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 );
- sal_uInt8 ImpGetRightToLeft( sal_uLong nPara, sal_Int32 nPos, sal_Int32* pStart = NULL, sal_Int32* pEnd = NULL );
+ sal_Int32 ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara, bool bSmart );
+ long ImpGetPortionXOffset( sal_uInt32 nPara, TextLine* pLine, sal_uInt16 nTextPortion );
+ long ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart = false );
+ long ImpGetOutputOffset( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, sal_Int32 nIndex2 );
+ sal_uInt8 ImpGetRightToLeft( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32* pStart = NULL, sal_Int32* pEnd = NULL );
static void ImpInitLayoutMode( OutputDevice* pOutDev, bool bDrawingR2LPortion = false );
TxtAlign ImpGetAlign() const;
sal_uLong CalcTextHeight();
- sal_uLong CalcParaHeight( sal_uLong nParagraph ) const;
- sal_uLong CalcTextWidth( sal_uLong nPara );
- sal_uLong CalcTextWidth( sal_uLong nPara, sal_Int32 nPortionStart, sal_Int32 nPortionLen, const vcl::Font* pFont = 0 );
- Range GetInvalidYOffsets( sal_uLong nPortion );
+ sal_uLong CalcParaHeight( sal_uInt32 nParagraph ) const;
+ sal_uLong CalcTextWidth( sal_uInt32 nPara );
+ sal_uLong CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nPortionLen, const vcl::Font* pFont = 0 );
+ Range GetInvalidYOffsets( sal_uInt32 nPortion );
// for Undo/Redo
- void InsertContent( TextNode* pNode, sal_uLong nPara );
- TextPaM SplitContent( sal_uLong nNode, sal_Int32 nSepPos );
- TextPaM ConnectContents( sal_uLong nLeftNode );
+ void InsertContent( TextNode* pNode, sal_uInt32 nPara );
+ TextPaM SplitContent( sal_uInt32 nNode, sal_Int32 nSepPos );
+ TextPaM ConnectContents( sal_uInt32 nLeftNode );
// adjust PaM's and selections that were transferred to the API to a valid range
void ValidateSelection( TextSelection& rSel ) const;
@@ -260,12 +260,12 @@ public:
long GetCharHeight() const { return mnCharHeight; }
sal_uLong GetParagraphCount() const;
- OUString GetText( sal_uLong nParagraph ) const;
- sal_Int32 GetTextLen( sal_uLong nParagraph ) const;
- sal_uLong GetTextHeight( sal_uLong nParagraph ) const;
+ OUString GetText( sal_uInt32 nParagraph ) const;
+ sal_Int32 GetTextLen( sal_uInt32 nParagraph ) const;
+ sal_uLong GetTextHeight( sal_uInt32 nParagraph ) const;
- sal_uInt16 GetLineCount( sal_uLong nParagraph ) const;
- sal_Int32 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const;
+ sal_uInt16 GetLineCount( sal_uInt32 nParagraph ) const;
+ sal_Int32 GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) const;
void SetRightToLeft( bool bR2L );
bool IsRightToLeft() const { return mbRightToLeft; }
@@ -298,10 +298,10 @@ public:
const TextAttrib* FindAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const;
const TextCharAttrib* FindCharAttrib( const TextPaM& rPaM, sal_uInt16 nWhich ) const;
- void RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate );
- void RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib );
- void RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate = true );
- void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate = true );
+ void RemoveAttribs( sal_uInt32 nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate );
+ void RemoveAttrib( sal_uInt32 nPara, const TextCharAttrib& rAttrib );
+ void RemoveAttribs( sal_uInt32 nPara, bool bIdleFormatAndUpdate = true );
+ void SetAttrib( const TextAttrib& rAttr, sal_uInt32 nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate = true );
TxtAlign GetTextAlign() const { return meAlign; }
void SetTextAlign( TxtAlign eAlign );
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 1bb0ec8..843fbe3 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1443,7 +1443,7 @@ void AddressMultiLineEdit::InsertNewEntry( const OUString& rStr )
// insert new entry after current selected one.
ExtTextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
- sal_uLong nPara = rSelection.GetStart().GetPara();
+ const sal_uInt32 nPara = rSelection.GetStart().GetPara();
sal_Int32 nIndex = rSelection.GetEnd().GetIndex();
ExtTextEngine *pTextEngine = GetTextEngine();
const TextCharAttrib *pAttrib;
@@ -1486,7 +1486,7 @@ void AddressMultiLineEdit::RemoveCurrentEntry()
(pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
&& pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
{
- sal_uLong nPara = rSelection.GetStart().GetPara();
+ const sal_uInt32 nPara = rSelection.GetStart().GetPara();
TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
pTextEngine->ReplaceText(aEntrySel, OUString());
//restore the attributes
@@ -1506,7 +1506,7 @@ void AddressMultiLineEdit::MoveCurrentItem(sal_uInt16 nMove)
&& pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
{
//current item has been found
- sal_uLong nPara = rSelection.GetStart().GetPara();
+ sal_uInt32 nPara = rSelection.GetStart().GetPara();
sal_Int32 nIndex = pBeginAttrib->GetStart();
TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
const OUString sCurrentItem = pTextEngine->GetText(aEntrySel);
@@ -1610,7 +1610,7 @@ OUString AddressMultiLineEdit::GetCurrentItem()
(pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
&& pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
{
- sal_uLong nPara = rSelection.GetStart().GetPara();
+ const sal_uInt32 nPara = rSelection.GetStart().GetPara();
TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
return pTextEngine->GetText( aEntrySel );
}
@@ -1627,7 +1627,7 @@ void AddressMultiLineEdit::SelectCurrentItem()
(pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
&& pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
{
- sal_uLong nPara = rSelection.GetStart().GetPara();
+ const sal_uInt32 nPara = rSelection.GetStart().GetPara();
TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
pTextView->SetSelection(aEntrySel);
Invalidate();
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 69df7cb..72b4de7 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -580,7 +580,7 @@ sal_uInt16 SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
bool bAtStart = pTextView->GetSelection() == TextSelection( aPaM, aPaM );
if( !bForward )
- aPaM = TextPaM( (sal_uLong)-1, USHRT_MAX );
+ aPaM = TextPaM( TEXT_PARA_ALL, USHRT_MAX );
if( bFromStart )
{
diff --git a/vcl/source/edit/textdat2.hxx b/vcl/source/edit/textdat2.hxx
index 6e57f90..f7d4fce 100644
--- a/vcl/source/edit/textdat2.hxx
+++ b/vcl/source/edit/textdat2.hxx
@@ -216,10 +216,10 @@ public:
TEParaPortions() : mvData() {}
~TEParaPortions();
- size_t Count() const { return mvData.size(); }
- TEParaPortion* GetObject( size_t nIndex ) { return mvData[nIndex]; }
- void Insert( TEParaPortion* pObject, size_t nPos ) { mvData.insert( mvData.begin()+nPos, pObject ); }
- void Remove( size_t nPos ) { mvData.erase( mvData.begin()+nPos ); }
+ sal_uInt32 Count() const { return static_cast<sal_uInt32>(mvData.size()); }
+ TEParaPortion* GetObject( sal_uInt32 nIndex ) { return mvData[nIndex]; }
+ void Insert( TEParaPortion* pObject, sal_uInt32 nPos ) { mvData.insert( mvData.begin()+nPos, pObject ); }
+ void Remove( sal_uInt32 nPos ) { mvData.erase( mvData.begin()+nPos ); }
};
class TextSelFunctionSet: public FunctionSet
diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx
index fe95af5..19adc7d 100644
--- a/vcl/source/edit/textdata.cxx
+++ b/vcl/source/edit/textdata.cxx
@@ -260,14 +260,12 @@ void IdleFormatter::ForceTimeout()
}
}
-TextHint::TextHint( sal_uLong Id ) : SfxSimpleHint( Id )
+TextHint::TextHint( sal_uInt32 Id ) : SfxSimpleHint( Id ), mnValue(0)
{
- mnValue = 0;
}
-TextHint::TextHint( sal_uLong Id, sal_uLong nValue ) : SfxSimpleHint( Id )
+TextHint::TextHint( sal_uInt32 Id, sal_uLong nValue ) : SfxSimpleHint( Id ), mnValue(nValue)
{
- mnValue = nValue;
}
TEIMEInfos::TEIMEInfos( const TextPaM& rPos, const OUString& rOldTextAfterStartPos )
diff --git a/vcl/source/edit/textdoc.cxx b/vcl/source/edit/textdoc.cxx
index f3d2cd1..d13c5f9 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 );
diff --git a/vcl/source/edit/textdoc.hxx b/vcl/source/edit/textdoc.hxx
index 1efecf9..25095b1 100644
--- a/vcl/source/edit/textdoc.hxx
+++ b/vcl/source/edit/textdoc.hxx
@@ -115,7 +115,7 @@ public:
sal_uLong GetTextLen( const sal_Unicode* pSep, const TextSelection* pSel = NULL ) const;
OUString GetText( const sal_Unicode* pSep ) const;
- OUString GetText( sal_uLong nPara ) const;
+ OUString GetText( sal_uInt32 nPara ) const;
void SetLeftMargin( sal_uInt16 n ) { mnLeftMargin = n; }
sal_uInt16 GetLeftMargin() const { return mnLeftMargin; }
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index f964d16..ef5455c 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -261,9 +261,9 @@ OUString TextEngine::GetText( LineEnd aSeparator ) const
OUString TextEngine::GetTextLines( LineEnd aSeparator ) const
{
OUString aText;
- sal_uLong nParas = mpTEParaPortions->Count();
+ const sal_uInt32 nParas = mpTEParaPortions->Count();
const sal_Unicode* pSep = static_getLineEndText( aSeparator );
- for ( sal_uLong nP = 0; nP < nParas; nP++ )
+ for ( sal_uInt32 nP = 0; nP < nParas; ++nP )
{
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nP );
@@ -279,7 +279,7 @@ OUString TextEngine::GetTextLines( LineEnd aSeparator ) const
return aText;
}
-OUString TextEngine::GetText( sal_uLong nPara ) const
+OUString TextEngine::GetText( sal_uInt32 nPara ) const
{
return mpDoc->GetText( nPara );
}
@@ -297,7 +297,7 @@ sal_uLong TextEngine::GetTextLen( const TextSelection& rSel, LineEnd aSeparator
return mpDoc->GetTextLen( static_getLineEndText( aSeparator ), &aSel );
}
-sal_Int32 TextEngine::GetTextLen( sal_uLong nPara ) const
+sal_Int32 TextEngine::GetTextLen( const sal_uInt32 nPara ) const
{
return mpDoc->GetNodes()[ nPara ]->GetText().getLength();
}
@@ -386,7 +386,7 @@ void TextEngine::ImpInitDoc()
mpDoc->GetNodes().insert( mpDoc->GetNodes().begin(), pNode );
TEParaPortion* pIniPortion = new TEParaPortion( pNode );
- mpTEParaPortions->Insert( pIniPortion, (sal_uLong)0 );
+ mpTEParaPortions->Insert( pIniPortion, 0 );
mbFormatted = false;
@@ -404,10 +404,10 @@ OUString TextEngine::GetText( const TextSelection& rSel, LineEnd aSeparator ) co
TextSelection aSel( rSel );
aSel.Justify();
- sal_uLong nStartPara = aSel.GetStart().GetPara();
- sal_uLong nEndPara = aSel.GetEnd().GetPara();
+ const sal_uInt32 nStartPara = aSel.GetStart().GetPara();
+ const sal_uInt32 nEndPara = aSel.GetEnd().GetPara();
const sal_Unicode* pSep = static_getLineEndText( aSeparator );
- for ( sal_uLong nNode = aSel.GetStart().GetPara(); nNode <= nEndPara; nNode++ )
+ for ( sal_uInt32 nNode = aSel.GetStart().GetPara(); nNode <= nEndPara; ++nNode )
{
TextNode* pNode = mpDoc->GetNodes()[ nNode ];
@@ -429,8 +429,7 @@ void TextEngine::ImpRemoveText()
{
ImpInitDoc();
- TextPaM aStartPaM( 0, 0 );
- TextSelection aEmptySel( aStartPaM, aStartPaM );
+ const TextSelection aEmptySel;
for ( size_t nView = 0; nView < mpViews->size(); nView++ )
{
TextView* pView = (*mpViews)[ nView ];
@@ -447,10 +446,9 @@ void TextEngine::SetText( const OUString& rText )
// the manually inserted text cannot be reversed by the user
EnableUndo( false );
- TextPaM aStartPaM( 0, 0 );
- TextSelection aEmptySel( aStartPaM, aStartPaM );
+ const TextSelection aEmptySel;
- TextPaM aPaM = aStartPaM;
+ TextPaM aPaM;
if ( !rText.isEmpty() )
aPaM = ImpInsertText( aEmptySel, rText );
@@ -473,7 +471,7 @@ void TextEngine::SetText( const OUString& rText )
DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "SetText: Undo!" );
}
-void TextEngine::CursorMoved( sal_uLong nNode )
+void TextEngine::CursorMoved( sal_uInt32 nNode )
{
// delete empty attribute; but only if paragraph is not empty!
TextNode* pNode = mpDoc->GetNodes()[ nNode ];
@@ -508,7 +506,7 @@ void TextEngine::ImpRemoveChars( const TextPaM& rPaM, sal_Int32 nChars, SfxUndoA
ImpCharsRemoved( rPaM.GetPara(), rPaM.GetIndex(), nChars );
}
-TextPaM TextEngine::ImpConnectParagraphs( sal_uLong nLeft, sal_uLong nRight )
+TextPaM TextEngine::ImpConnectParagraphs( sal_uInt32 nLeft, sal_uInt32 nRight )
{
DBG_ASSERT( nLeft != nRight, "ImpConnectParagraphs: connect the very same paragraph ?" );
@@ -552,11 +550,11 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
DBG_ASSERT( mpDoc->IsValidPaM( aStartPaM ), "ImpDeleteText(1): bad Index" );
DBG_ASSERT( mpDoc->IsValidPaM( aEndPaM ), "ImpDeleteText(2): bad Index" );
- sal_uLong nStartNode = aStartPaM.GetPara();
- sal_uLong nEndNode = aEndPaM.GetPara();
+ const sal_uInt32 nStartNode = aStartPaM.GetPara();
+ sal_uInt32 nEndNode = aEndPaM.GetPara();
// remove all Nodes inbetween
- for ( sal_uLong z = nStartNode+1; z < nEndNode; z++ )
+ for ( sal_uInt32 z = nStartNode+1; z < nEndNode; ++z )
{
// always nStartNode+1, because of Remove()!
ImpRemoveParagraph( nStartNode+1 );
@@ -605,7 +603,7 @@ TextPaM TextEngine::ImpDeleteText( const TextSelection& rSel )
return aStartPaM;
}
-void TextEngine::ImpRemoveParagraph( sal_uLong nPara )
+void TextEngine::ImpRemoveParagraph( sal_uInt32 nPara )
{
TextNode* pNode = mpDoc->GetNodes()[ nPara ];
std::unique_ptr<TEParaPortion> xPortion(mpTEParaPortions->GetObject( nPara ));
@@ -863,7 +861,7 @@ Rectangle TextEngine::PaMtoEditCursor( const TextPaM& rPaM, bool bSpecial )
}
else
{
- for ( sal_uLong nPortion = 0; nPortion < rPaM.GetPara(); nPortion++ )
+ for ( sal_uInt32 nPortion = 0; nPortion < rPaM.GetPara(); ++nPortion )
{
TEParaPortion* pPortion = mpTEParaPortions->GetObject(nPortion);
nY += pPortion->GetLines().size() * mnCharHeight;
@@ -929,7 +927,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP
return aEditCursor;
}
-long TextEngine::ImpGetXPos( sal_uLong nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart )
+long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex, bool bPreferPortionStart )
{
DBG_ASSERT( ( nIndex >= pLine->GetStart() ) && ( nIndex <= pLine->GetEnd() ) , "ImpGetXPos: Bad parameters!" );
@@ -1031,7 +1029,7 @@ const TextCharAttrib* TextEngine::FindCharAttrib( const TextPaM& rPaM, sal_uInt1
bool TextEngine::HasAttrib( sal_uInt16 nWhich ) const
{
bool bAttr = false;
- for ( sal_uLong n = mpDoc->GetNodes().size(); --n && !bAttr; )
+ for ( auto n = mpDoc->GetNodes().size(); --n && !bAttr; )
{
TextNode* pNode = mpDoc->GetNodes()[ n ];
bAttr = pNode->GetCharAttribs().HasAttrib( nWhich );
@@ -1044,7 +1042,7 @@ TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart )
DBG_ASSERT( GetUpdateMode(), "GetPaM: GetUpdateMode()" );
long nY = 0;
- for ( sal_uLong nPortion = 0; nPortion < mpTEParaPortions->Count(); nPortion++ )
+ for ( sal_uInt32 nPortion = 0; nPortion < mpTEParaPortions->Count(); ++nPortion )
{
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
long nTmpHeight = pPortion->GetLines().size() * mnCharHeight;
@@ -1062,12 +1060,12 @@ TextPaM TextEngine::GetPaM( const Point& rDocPos, bool bSmart )
}
// not found - go to last visible
- sal_uLong nLastNode = mpDoc->GetNodes().size() - 1;
+ const sal_uInt32 nLastNode = static_cast<sal_uInt32>(mpDoc->GetNodes().size() - 1);
TextNode* pLast = mpDoc->GetNodes()[ nLastNode ];
return TextPaM( nLastNode, pLast->GetText().getLength() );
}
-sal_Int32 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara, bool bSmart )
+sal_Int32 TextEngine::ImpFindIndex( sal_uInt32 nPortion, const Point& rPosInPara, bool bSmart )
{
DBG_ASSERT( IsFormatted(), "GetPaM: Not formatted" );
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
@@ -1102,7 +1100,7 @@ sal_Int32 TextEngine::ImpFindIndex( sal_uLong nPortion, const Point& rPosInPara,
return nCurIndex;
}
-sal_Int32 TextEngine::GetCharPos( sal_uLong nPortion, sal_uInt16 nLine, long nXPos, bool )
+sal_Int32 TextEngine::GetCharPos( sal_uInt32 nPortion, sal_uInt16 nLine, long nXPos, bool )
{
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPortion );
@@ -1151,7 +1149,7 @@ sal_uLong TextEngine::GetTextHeight() const
return mnCurTextHeight;
}
-sal_uLong TextEngine::GetTextHeight( sal_uLong nParagraph ) const
+sal_uLong TextEngine::GetTextHeight( sal_uInt32 nParagraph ) const
{
DBG_ASSERT( GetUpdateMode(), "GetTextHeight: GetUpdateMode()" );
@@ -1161,7 +1159,7 @@ sal_uLong TextEngine::GetTextHeight( sal_uLong nParagraph ) const
return CalcParaHeight( nParagraph );
}
-sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara )
+sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara )
{
sal_uLong nParaWidth = 0;
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara );
@@ -1188,7 +1186,7 @@ sal_uLong TextEngine::CalcTextWidth()
if ( mnCurTextWidth == 0xFFFFFFFF )
{
mnCurTextWidth = 0;
- for ( sal_uLong nPara = mpTEParaPortions->Count(); nPara; )
+ for ( sal_uInt32 nPara = mpTEParaPortions->Count(); nPara; )
{
sal_uLong nParaWidth = CalcTextWidth( --nPara );
if ( nParaWidth > mnCurTextWidth )
@@ -1203,12 +1201,12 @@ sal_uLong TextEngine::CalcTextHeight()
DBG_ASSERT( GetUpdateMode(), "CalcTextHeight: GetUpdateMode()" );
sal_uLong nY = 0;
- for ( sal_uLong nPortion = mpTEParaPortions->Count(); nPortion; )
+ for ( auto nPortion = mpTEParaPortions->Count(); nPortion; )
nY += CalcParaHeight( --nPortion );
return nY;
}
-sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_Int32 nPortionStart, sal_Int32 nLen, const vcl::Font* pFont )
+sal_uLong TextEngine::CalcTextWidth( sal_uInt32 nPara, sal_Int32 nPortionStart, sal_Int32 nLen, const vcl::Font* pFont )
{
#ifdef DBG_UTIL
// within the text there must not be a Portion change (attribute/tab)!
@@ -1241,7 +1239,7 @@ sal_uLong TextEngine::CalcTextWidth( sal_uLong nPara, sal_Int32 nPortionStart, s
return nWidth;
}
-sal_uInt16 TextEngine::GetLineCount( sal_uLong nParagraph ) const
+sal_uInt16 TextEngine::GetLineCount( sal_uInt32 nParagraph ) const
{
DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" );
@@ -1252,7 +1250,7 @@ sal_uInt16 TextEngine::GetLineCount( sal_uLong nParagraph ) const
return 0;
}
-sal_Int32 TextEngine::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const
+sal_Int32 TextEngine::GetLineLen( sal_uInt32 nParagraph, sal_uInt16 nLine ) const
{
DBG_ASSERT( nParagraph < mpTEParaPortions->Count(), "GetLineCount: Out of range" );
@@ -1265,7 +1263,7 @@ sal_Int32 TextEngine::GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const
return 0;
}
-sal_uLong TextEngine::CalcParaHeight( sal_uLong nParagraph ) const
+sal_uLong TextEngine::CalcParaHeight( sal_uInt32 nParagraph ) const
{
sal_uLong nHeight = 0;
@@ -1277,7 +1275,7 @@ sal_uLong TextEngine::CalcParaHeight( sal_uLong nParagraph ) const
return nHeight;
}
-Range TextEngine::GetInvalidYOffsets( sal_uLong nPortion )
+Range TextEngine::GetInvalidYOffsets( sal_uInt32 nPortion )
{
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion );
sal_uInt16 nLines = pTEParaPortion->GetLines().size();
@@ -1354,7 +1352,7 @@ void TextEngine::ResetUndo()
mpUndoManager->Clear();
}
-void TextEngine::InsertContent( TextNode* pNode, sal_uLong nPara )
+void TextEngine::InsertContent( TextNode* pNode, sal_uInt32 nPara )
{
DBG_ASSERT( pNode, "InsertContent: NULL-Pointer!" );
DBG_ASSERT( IsInUndo(), "InsertContent: only in Undo()!" );
@@ -1364,7 +1362,7 @@ void TextEngine::InsertContent( TextNode* pNode, sal_uLong nPara )
ImpParagraphInserted( nPara );
}
-TextPaM TextEngine::SplitContent( sal_uLong nNode, sal_Int32 nSepPos )
+TextPaM TextEngine::SplitContent( sal_uInt32 nNode, sal_Int32 nSepPos )
{
#ifdef DBG_UTIL
TextNode* pNode = mpDoc->GetNodes()[ nNode ];
@@ -1376,13 +1374,13 @@ TextPaM TextEngine::SplitContent( sal_uLong nNode, sal_Int32 nSepPos )
return ImpInsertParaBreak( aPaM );
}
-TextPaM TextEngine::ConnectContents( sal_uLong nLeftNode )
+TextPaM TextEngine::ConnectContents( sal_uInt32 nLeftNode )
{
DBG_ASSERT( IsInUndo(), "ConnectContent: only in Undo()!" );
return ImpConnectParagraphs( nLeftNode, nLeftNode+1 );
}
-void TextEngine::SeekCursor( sal_uLong nPara, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev )
+void TextEngine::SeekCursor( sal_uInt32 nPara, sal_Int32 nPos, vcl::Font& rFont, OutputDevice* pOutDev )
{
rFont = maFont;
if ( pOutDev )
@@ -1520,7 +1518,7 @@ void TextEngine::CheckIdleFormatter()
void TextEngine::FormatFullDoc()
{
- for ( sal_uLong nPortion = 0; nPortion < mpTEParaPortions->Count(); nPortion++ )
+ for ( sal_uInt32 nPortion = 0; nPortion < mpTEParaPortions->Count(); ++nPortion )
{
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPortion );
sal_Int32 nLen = pTEParaPortion->GetNode()->GetText().getLength();
@@ -1542,7 +1540,7 @@ void TextEngine::FormatDoc()
bool bGrow = false;
maInvalidRect = Rectangle(); // clear
- for ( sal_uLong nPara = 0; nPara < mpTEParaPortions->Count(); nPara++ )
+ for ( sal_uInt32 nPara = 0; nPara < mpTEParaPortions->Count(); ++nPara )
{
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
if ( pTEParaPortion->IsInvalid() )
@@ -1620,7 +1618,7 @@ void TextEngine::FormatDoc()
ImpTextFormatted();
}
-void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara )
+void TextEngine::CreateAndInsertEmptyLine( sal_uInt32 nPara )
{
TextNode* pNode = mpDoc->GetNodes()[ nPara ];
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
@@ -1652,7 +1650,7 @@ void TextEngine::CreateAndInsertEmptyLine( sal_uLong nPara )
}
}
-void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*, sal_Int32 nPortionStart, long nRemainingWidth )
+void TextEngine::ImpBreakLine( sal_uInt32 nPara, TextLine* pLine, TETextPortion*, sal_Int32 nPortionStart, long nRemainingWidth )
{
TextNode* pNode = mpDoc->GetNodes()[ nPara ];
@@ -1702,7 +1700,7 @@ void TextEngine::ImpBreakLine( sal_uLong nPara, TextLine* pLine, TETextPortion*,
pLine->SetEndPortion( nEndPortion );
}
-sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_Int32 nPos )
+sal_uInt16 TextEngine::SplitTextPortion( sal_uInt32 nPara, sal_Int32 nPos )
{
// the Portion at nPos is being split, unless there is already a switch at nPos
@@ -1738,7 +1736,7 @@ sal_uInt16 TextEngine::SplitTextPortion( sal_uLong nPara, sal_Int32 nPos )
return nSplitPortion;
}
-void TextEngine::CreateTextPortions( sal_uLong nPara, sal_Int32 nStartPos )
+void TextEngine::CreateTextPortions( sal_uInt32 nPara, sal_Int32 nStartPos )
{
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
TextNode* pNode = pTEParaPortion->GetNode();
@@ -1831,7 +1829,7 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_Int32 nStartPos )
OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), "CreateTextPortions: No Portions?!");
}
-void TextEngine::RecalcTextPortion( sal_uLong nPara, sal_Int32 nStartPos, sal_Int32 nNewChars )
+void TextEngine::RecalcTextPortion( sal_uInt32 nPara, sal_Int32 nStartPos, sal_Int32 nNewChars )
{
TEParaPortion* pTEParaPortion = mpTEParaPortions->GetObject( nPara );
OSL_ENSURE(pTEParaPortion->GetTextPortions().size(), "RecalcTextPortion: no Portions!");
@@ -1942,7 +1940,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan
const StyleSettings& rStyleSettings = pOutDev->GetSettings().GetStyleSettings();
// for all paragraphs
- for ( sal_uLong nPara = 0; nPara < mpTEParaPortions->Count(); nPara++ )
+ for ( sal_uInt32 nPara = 0; nPara < mpTEParaPortions->Count(); ++nPara )
{
TEParaPortion* pPortion = mpTEParaPortions->GetObject( nPara );
// in case while typing Idle-Formatting, asynchronous Paint
@@ -2120,7 +2118,7 @@ void TextEngine::ImpPaint( OutputDevice* pOutDev, const Point& rStartPos, Rectan
}
}
-bool TextEngine::CreateLines( sal_uLong nPara )
+bool TextEngine::CreateLines( sal_uInt32 nPara )
{
// bool: changing Height of Paragraph Yes/No - true/false
@@ -2467,7 +2465,7 @@ bool TextEngine::Read( SvStream& rInput, const TextSelection* pSel )
aSel = *pSel;
else
{
- sal_uLong nParas = mpDoc->GetNodes().size();
+ sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size());
TextNode* pNode = mpDoc->GetNodes()[ nParas - 1 ];
aSel = TextPaM( nParas-1 , pNode->GetText().getLength() );
}
@@ -2508,7 +2506,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
aSel = *pSel;
else
{
- sal_uLong nParas = mpDoc->GetNodes().size();
+ sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size());
TextNode* pNode = mpDoc->GetNodes()[ nParas - 1 ];
aSel.GetStart() = TextPaM( 0, 0 );
aSel.GetEnd() = TextPaM( nParas-1, pNode->GetText().getLength() );
@@ -2520,7 +2518,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
rOutput.WriteLine( "<BODY>" );
}
- for ( sal_uLong nPara = aSel.GetStart().GetPara(); nPara <= aSel.GetEnd().GetPara(); nPara++ )
+ for ( sal_uInt32 nPara = aSel.GetStart().GetPara(); nPara <= aSel.GetEnd().GetPara(); ++nPara )
{
TextNode* pNode = mpDoc->GetNodes()[ nPara ];
@@ -2587,7 +2585,7 @@ bool TextEngine::Write( SvStream& rOutput, const TextSelection* pSel, bool bHTML
return rOutput.GetError() == 0;
}
-void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
+void TextEngine::RemoveAttribs( sal_uInt32 nPara, bool bIdleFormatAndUpdate )
{
if ( nPara < mpDoc->GetNodes().size() )
{
@@ -2608,7 +2606,7 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, bool bIdleFormatAndUpdate )
}
}
}
-void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate )
+void TextEngine::RemoveAttribs( sal_uInt32 nPara, sal_uInt16 nWhich, bool bIdleFormatAndUpdate )
{
if ( nPara < mpDoc->GetNodes().size() )
{
@@ -2632,7 +2630,7 @@ void TextEngine::RemoveAttribs( sal_uLong nPara, sal_uInt16 nWhich, bool bIdleFo
}
}
}
-void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib )
+void TextEngine::RemoveAttrib( sal_uInt32 nPara, const TextCharAttrib& rAttrib )
{
if ( nPara < mpDoc->GetNodes().size() )
{
@@ -2657,7 +2655,7 @@ void TextEngine::RemoveAttrib( sal_uLong nPara, const TextCharAttrib& rAttrib )
}
}
-void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate )
+void TextEngine::SetAttrib( const TextAttrib& rAttr, sal_uInt32 nPara, sal_Int32 nStart, sal_Int32 nEnd, bool bIdleFormatAndUpdate )
{
// For now do not check if Attributes overlap!
@@ -2705,10 +2703,10 @@ void TextEngine::ValidateSelection( TextSelection& rSel ) const
void TextEngine::ValidatePaM( TextPaM& rPaM ) const
{
- sal_uLong nMaxPara = mpDoc->GetNodes().size() - 1;
- if ( rPaM.GetPara() > nMaxPara )
+ const sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size());
+ if ( rPaM.GetPara() >= nParas )
{
- rPaM.GetPara() = nMaxPara;
+ rPaM.GetPara() = nParas ? nParas-1 : 0;
rPaM.GetIndex() = 0xFFFF;
}
@@ -2719,7 +2717,7 @@ void TextEngine::ValidatePaM( TextPaM& rPaM ) const
// adjust State & Selection
-void TextEngine::ImpParagraphInserted( sal_uLong nPara )
+void TextEngine::ImpParagraphInserted( sal_uInt32 nPara )
{
// No adjustment needed for the active View;
// but for all passive Views the Selection needs adjusting.
@@ -2742,7 +2740,7 @@ void TextEngine::ImpParagraphInserted( sal_uLong nPara )
Broadcast( TextHint( TEXT_HINT_PARAINSERTED, nPara ) );
}
-void TextEngine::ImpParagraphRemoved( sal_uLong nPara )
+void TextEngine::ImpParagraphRemoved( sal_uInt32 nPara )
{
if ( mpViews->size() > 1 )
{
@@ -2751,7 +2749,7 @@ void TextEngine::ImpParagraphRemoved( sal_uLong nPara )
TextView* pView = (*mpViews)[ --nView ];
if ( pView != GetActiveView() )
{
- sal_uLong nParas = mpDoc->GetNodes().size();
+ const sal_uInt32 nParas = static_cast<sal_uInt32>(mpDoc->GetNodes().size());
for ( int n = 0; n <= 1; n++ )
{
TextPaM& rPaM = n ? pView->GetSelection().GetStart(): pView->GetSelection().GetEnd();
@@ -2770,7 +2768,7 @@ void TextEngine::ImpParagraphRemoved( sal_uLong nPara )
Broadcast( TextHint( TEXT_HINT_PARAREMOVED, nPara ) );
}
-void TextEngine::ImpCharsRemoved( sal_uLong nPara, sal_Int32 nPos, sal_Int32 nChars )
+void TextEngine::ImpCharsRemoved( sal_uInt32 nPara, sal_Int32 nPos, sal_Int32 nChars )
{
if ( mpViews->size() > 1 )
{
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list