Kaydet (Commit) bbf64c78 authored tarafından Matteo Casalin's avatar Matteo Casalin

sal_uInt16 to more proper types, constify, avoid unneeded casts

Change-Id: I6e7d2c9861e9e004a48595d77b919c37409142f1
üst dab5d58a
...@@ -277,7 +277,7 @@ SwLinePortion *SwTxtFormatter::Underflow( SwTxtFormatInfo &rInf ) ...@@ -277,7 +277,7 @@ SwLinePortion *SwTxtFormatter::Underflow( SwTxtFormatInfo &rInf )
{ {
if( pPor->InTxtGrp() && !pPor->InExpGrp() ) if( pPor->InTxtGrp() && !pPor->InExpGrp() )
{ {
sal_uInt16 nOldWhich = pCurr->GetWhichPor(); const sal_uInt16 nOldWhich = pCurr->GetWhichPor();
*(SwLinePortion*)pCurr = *pPor; *(SwLinePortion*)pCurr = *pPor;
pCurr->SetPortion( pPor->GetPortion() ); pCurr->SetPortion( pPor->GetPortion() );
pCurr->SetWhichPor( nOldWhich ); pCurr->SetWhichPor( nOldWhich );
...@@ -600,7 +600,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf ) ...@@ -600,7 +600,7 @@ void SwTxtFormatter::BuildPortions( SwTxtFormatInfo &rInf )
if( nTmp == pScriptInfo->NextScriptChg( nTmp - 1 ) && if( nTmp == pScriptInfo->NextScriptChg( nTmp - 1 ) &&
nTmp != rInf.GetTxt().getLength() ) nTmp != rInf.GetTxt().getLength() )
{ {
sal_uInt16 nDist = (sal_uInt16)(rInf.GetFont()->GetHeight()/5); const sal_uInt16 nDist = (sal_uInt16)(rInf.GetFont()->GetHeight()/5);
if( nDist ) if( nDist )
{ {
...@@ -1699,12 +1699,12 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine ) ...@@ -1699,12 +1699,12 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
const bool bRubyTop = ! pGrid->GetRubyTextBelow(); const bool bRubyTop = ! pGrid->GetRubyTextBelow();
nLineHeight = nGridWidth + nRubyHeight; nLineHeight = nGridWidth + nRubyHeight;
sal_uInt16 nLineDist = nLineHeight; const sal_uInt16 nLineDist = nLineHeight;
while ( pCurr->Height() > nLineHeight ) while ( pCurr->Height() > nLineHeight )
nLineHeight = nLineHeight + nLineDist; nLineHeight = nLineHeight + nLineDist;
sal_uInt16 nAsc = pCurr->GetAscent() + const sal_uInt16 nAsc = pCurr->GetAscent() +
( bRubyTop ? ( bRubyTop ?
( nLineHeight - pCurr->Height() + nRubyHeight ) / 2 : ( nLineHeight - pCurr->Height() + nRubyHeight ) / 2 :
( nLineHeight - pCurr->Height() - nRubyHeight ) / 2 ); ( nLineHeight - pCurr->Height() - nRubyHeight ) / 2 );
...@@ -1776,7 +1776,7 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine ) ...@@ -1776,7 +1776,7 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
case SVX_LINE_SPACE_FIX: case SVX_LINE_SPACE_FIX:
{ {
nLineHeight = pSpace->GetLineHeight(); nLineHeight = pSpace->GetLineHeight();
sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80% const sal_uInt16 nAsc = ( 4 * nLineHeight ) / 5; // 80%
if( nAsc < pCurr->GetAscent() || if( nAsc < pCurr->GetAscent() ||
nLineHeight - nAsc < pCurr->Height() - pCurr->GetAscent() ) nLineHeight - nAsc < pCurr->Height() - pCurr->GetAscent() )
pCurr->SetClipping( true ); pCurr->SetClipping( true );
...@@ -1827,7 +1827,7 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine ) ...@@ -1827,7 +1827,7 @@ void SwTxtFormatter::CalcRealHeight( bool bNewLine )
if ( bVert ) if ( bVert )
nTmpY = pFrm->SwitchHorizontalToVertical( nTmpY ); nTmpY = pFrm->SwitchHorizontalToVertical( nTmpY );
nTmpY = (*fnRect->fnYDiff)( nTmpY, RegStart() ); nTmpY = (*fnRect->fnYDiff)( nTmpY, RegStart() );
sal_uInt16 nDiff = sal_uInt16( nTmpY % RegDiff() ); const sal_uInt16 nDiff = sal_uInt16( nTmpY % RegDiff() );
if( nDiff ) if( nDiff )
nLineHeight += RegDiff() - nDiff; nLineHeight += RegDiff() - nDiff;
} }
...@@ -1866,7 +1866,7 @@ void SwTxtFormatter::FeedInf( SwTxtFormatInfo &rInf ) const ...@@ -1866,7 +1866,7 @@ void SwTxtFormatter::FeedInf( SwTxtFormatInfo &rInf ) const
rInf.Right( nTmpRight ); rInf.Right( nTmpRight );
rInf.First( nTmpFirst ); rInf.First( nTmpFirst );
rInf.RealWidth( sal_uInt16(rInf.Right()) - sal_uInt16(GetLeftMargin()) ); rInf.RealWidth( sal_uInt16(rInf.Right() - GetLeftMargin()) );
rInf.Width( rInf.RealWidth() ); rInf.Width( rInf.RealWidth() );
if( ((SwTxtFormatter*)this)->GetRedln() ) if( ((SwTxtFormatter*)this)->GetRedln() )
{ {
...@@ -2023,7 +2023,7 @@ void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, ...@@ -2023,7 +2023,7 @@ void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc; long nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc;
pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc ); pCurrent->MaxAscentDescent( nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc );
sal_uInt16 nTmpHeight = pCurrent->GetRealHeight(); const sal_uInt16 nTmpHeight = pCurrent->GetRealHeight();
sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height(); sal_uInt16 nAscent = pCurrent->GetAscent() + nTmpHeight - pCurrent->Height();
objectpositioning::AsCharFlags nFlags = AS_CHAR_ULSPACE; objectpositioning::AsCharFlags nFlags = AS_CHAR_ULSPACE;
if( GetMulti() ) if( GetMulti() )
...@@ -2176,7 +2176,7 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const ...@@ -2176,7 +2176,7 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
{ {
// First we check, whether a fly overlaps with the line. // First we check, whether a fly overlaps with the line.
// = GetLineHeight() // = GetLineHeight()
const long nHeight = GetCurr()->GetRealHeight(); const sal_uInt16 nHeight = GetCurr()->GetRealHeight();
SwRect aLine( GetLeftMargin(), Y(), rInf.RealWidth(), nHeight ); SwRect aLine( GetLeftMargin(), Y(), rInf.RealWidth(), nHeight );
SwRect aLineVert( aLine ); SwRect aLineVert( aLine );
...@@ -2216,9 +2216,9 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const ...@@ -2216,9 +2216,9 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
{ {
// To be evaluated during reformat of this line: // To be evaluated during reformat of this line:
// RealHeight including spacing // RealHeight including spacing
rInf.SetLineHeight( sal_uInt16(nHeight) ); rInf.SetLineHeight( nHeight );
// Height without extra spacing // Height without extra spacing
rInf.SetLineNettoHeight( sal_uInt16( pCurr->Height() ) ); rInf.SetLineNettoHeight( pCurr->Height() );
return true; return true;
} }
} }
...@@ -2228,8 +2228,8 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const ...@@ -2228,8 +2228,8 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
// The fly portion is not intersected by a fly anymore // The fly portion is not intersected by a fly anymore
if ( ! aInter.IsOver( aLine ) ) if ( ! aInter.IsOver( aLine ) )
{ {
rInf.SetLineHeight( sal_uInt16(nHeight) ); rInf.SetLineHeight( nHeight );
rInf.SetLineNettoHeight( sal_uInt16( pCurr->Height() ) ); rInf.SetLineNettoHeight( pCurr->Height() );
return true; return true;
} }
else else
...@@ -2243,8 +2243,8 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const ...@@ -2243,8 +2243,8 @@ bool SwTxtFormatter::ChkFlyUnderflow( SwTxtFormatInfo &rInf ) const
if( ! aInter.HasArea() || if( ! aInter.HasArea() ||
((SwFlyPortion*)pPos)->GetFixWidth() != aInter.Width() ) ((SwFlyPortion*)pPos)->GetFixWidth() != aInter.Width() )
{ {
rInf.SetLineHeight( sal_uInt16(nHeight) ); rInf.SetLineHeight( nHeight );
rInf.SetLineNettoHeight( sal_uInt16( pCurr->Height() ) ); rInf.SetLineNettoHeight( pCurr->Height() );
return true; return true;
} }
} }
...@@ -2754,9 +2754,9 @@ namespace { ...@@ -2754,9 +2754,9 @@ namespace {
// if anything has changed, we carefully have to adjust the right // if anything has changed, we carefully have to adjust the right
// repaint position // repaint position
long nPOfst = 0; long nPOfst = 0;
sal_uInt16 nCnt = 0; size_t nCnt = 0;
sal_uInt16 nX = 0; long nX = 0;
sal_uInt16 nIdx = rThis.GetInfo().GetLineStart(); sal_Int32 nIdx = rThis.GetInfo().GetLineStart();
SwLinePortion* pPor = rCurr.GetFirstPortion(); SwLinePortion* pPor = rCurr.GetFirstPortion();
while ( pPor ) while ( pPor )
......
...@@ -558,7 +558,7 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor, ...@@ -558,7 +558,7 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
sal_uLong nSumHeight = 0; sal_uLong nSumHeight = 0;
sal_uLong nBold = 0; sal_uLong nBold = 0;
sal_uInt16 nMaxBaseLineOfst = 0; sal_uInt16 nMaxBaseLineOfst = 0;
sal_uInt16 nNumberOfPortions = 0; int nNumberOfPortions = 0;
while( nTmpIdx <= nUnderEnd && pPor ) while( nTmpIdx <= nUnderEnd && pPor )
{ {
...@@ -583,7 +583,7 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor, ...@@ -583,7 +583,7 @@ void SwTxtPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
// and the font of the lowest portion. // and the font of the lowest portion.
if ( nAdjustBaseLine ) if ( nAdjustBaseLine )
{ {
sal_uInt16 nTmpBaseLineOfst = AdjustBaseLine( *pCurr, pPor ); const sal_uInt16 nTmpBaseLineOfst = AdjustBaseLine( *pCurr, pPor );
if ( nMaxBaseLineOfst < nTmpBaseLineOfst ) if ( nMaxBaseLineOfst < nTmpBaseLineOfst )
{ {
nMaxBaseLineOfst = nTmpBaseLineOfst; nMaxBaseLineOfst = nTmpBaseLineOfst;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment