diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-08-15 19:35:32 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-08-16 09:10:21 +0200 |
commit | 98244c3cb47824babc746ebc14a199977e9768d1 (patch) | |
tree | 0077631b678997f61a1fae245e32467bd7afbe00 | |
parent | Avoid unnecessary OUString copies (diff) | |
download | core-98244c3cb47824babc746ebc14a199977e9768d1.tar.gz core-98244c3cb47824babc746ebc14a199977e9768d1.zip |
sal_uLong to sal_Int32/long
Change-Id: Ia4ae190da37351b8c2b7ee9fc953508c5b1ab062
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 6 | ||||
-rw-r--r-- | desktop/source/deployment/gui/license_dialog.cxx | 4 | ||||
-rw-r--r-- | include/vcl/texteng.hxx | 36 | ||||
-rw-r--r-- | sw/source/uibase/docvw/srcedtw.cxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/textdoc.cxx | 4 | ||||
-rw-r--r-- | vcl/source/edit/textdoc.hxx | 2 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 82 | ||||
-rw-r--r-- | vcl/source/edit/textview.cxx | 15 | ||||
-rw-r--r-- | vcl/source/edit/vclmedit.cxx | 12 |
10 files changed, 83 insertions, 86 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 65b6bf491351..1aa1aa65a790 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 106e923a47d5..d1a29ae6f003 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 f37082e443ab..cc1621aebc8b 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 9227e4b202a3..8d8e7f7de8b5 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 b67fb36dd8ca..4665d844507e 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 10315efe00e3..2398fffc9482 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 25095b1d096b..8f19ee5021f0 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 90343f19b02d..abacae29b8ed 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 8ad8bd573b8b..487ee388ebf6 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 846ac1f0820d..de1c67525316 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; |