Kaydet (Commit) efea2241 authored tarafından Michael Stahl's avatar Michael Stahl

sw_redlinehide: trivial conversions in pormulti.cxx

Change-Id: I9f9e2aa60381f913419d06be04235486a40f0cc9
üst d8e1ef68
...@@ -199,7 +199,7 @@ SwBidiPortion::SwBidiPortion(TextFrameIndex const nEnd, sal_uInt8 nLv) ...@@ -199,7 +199,7 @@ SwBidiPortion::SwBidiPortion(TextFrameIndex const nEnd, sal_uInt8 nLv)
long SwBidiPortion::CalcSpacing( long nSpaceAdd, const SwTextSizeInfo& rInf ) const long SwBidiPortion::CalcSpacing( long nSpaceAdd, const SwTextSizeInfo& rInf ) const
{ {
return HasTabulator() ? 0 : GetSpaceCnt(rInf) * nSpaceAdd / SPACING_PRECISION_FACTOR; return HasTabulator() ? 0 : sal_Int32(GetSpaceCnt(rInf)) * nSpaceAdd / SPACING_PRECISION_FACTOR;
} }
bool SwBidiPortion::ChgSpaceAdd( SwLineLayout* pCurr, long nSpaceAdd ) const bool SwBidiPortion::ChgSpaceAdd( SwLineLayout* pCurr, long nSpaceAdd ) const
...@@ -217,12 +217,11 @@ bool SwBidiPortion::ChgSpaceAdd( SwLineLayout* pCurr, long nSpaceAdd ) const ...@@ -217,12 +217,11 @@ bool SwBidiPortion::ChgSpaceAdd( SwLineLayout* pCurr, long nSpaceAdd ) const
TextFrameIndex SwBidiPortion::GetSpaceCnt(const SwTextSizeInfo &rInf) const TextFrameIndex SwBidiPortion::GetSpaceCnt(const SwTextSizeInfo &rInf) const
{ {
// Calculate number of blanks for justified alignment // Calculate number of blanks for justified alignment
SwLinePortion* pPor = GetRoot().GetFirstPortion(); TextFrameIndex nTmpStart = rInf.GetIdx();
sal_Int32 nTmpStart = rInf.GetIdx(); TextFrameIndex nNull(0);
sal_Int32 nNull = 0; TextFrameIndex nBlanks(0);
sal_Int32 nBlanks;
for( nBlanks = 0; pPor; pPor = pPor->GetPortion() ) for (SwLinePortion* pPor = GetRoot().GetFirstPortion(); pPor; pPor = pPor->GetPortion())
{ {
if( pPor->InTextGrp() ) if( pPor->InTextGrp() )
nBlanks = nBlanks + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull ); nBlanks = nBlanks + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull );
...@@ -283,7 +282,7 @@ SwDoubleLinePortion::SwDoubleLinePortion( ...@@ -283,7 +282,7 @@ SwDoubleLinePortion::SwDoubleLinePortion(
SetDouble(); SetDouble();
const SvxTwoLinesItem* pTwo = static_cast<const SvxTwoLinesItem*>(rCreate.pItem); const SvxTwoLinesItem* pTwo = static_cast<const SvxTwoLinesItem*>(rCreate.pItem);
if( pTwo ) if( pTwo )
pBracket->nStart = 0; pBracket->nStart = TextFrameIndex(0);
else else
{ {
const SwTextAttr& rAttr = *rCreate.pAttr; const SwTextAttr& rAttr = *rCreate.pAttr;
...@@ -456,11 +455,11 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW ...@@ -456,11 +455,11 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf ) void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf )
{ {
SwLinePortion* pPor = GetRoot().GetFirstPortion(); SwLinePortion* pPor = GetRoot().GetFirstPortion();
sal_Int32 nNull = 0; TextFrameIndex nNull(0);
sal_Int32 nStart = rInf.GetIdx(); TextFrameIndex nStart = rInf.GetIdx();
SetTab1( false ); SetTab1( false );
SetTab2( false ); SetTab2( false );
for( nBlank1 = 0; pPor; pPor = pPor->GetPortion() ) for (nBlank1 = TextFrameIndex(0); pPor; pPor = pPor->GetPortion())
{ {
if( pPor->InTextGrp() ) if( pPor->InTextGrp() )
nBlank1 = nBlank1 + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull ); nBlank1 = nBlank1 + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull );
...@@ -474,7 +473,7 @@ void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf ) ...@@ -474,7 +473,7 @@ void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf )
pPor = GetRoot().GetNext()->GetFirstPortion(); pPor = GetRoot().GetNext()->GetFirstPortion();
nLineDiff -= GetRoot().GetNext()->Width(); nLineDiff -= GetRoot().GetNext()->Width();
} }
for( nBlank2 = 0; pPor; pPor = pPor->GetPortion() ) for (nBlank2 = TextFrameIndex(0); pPor; pPor = pPor->GetPortion())
{ {
if( pPor->InTextGrp() ) if( pPor->InTextGrp() )
nBlank2 = nBlank2 + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull ); nBlank2 = nBlank2 + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull );
...@@ -487,7 +486,7 @@ void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf ) ...@@ -487,7 +486,7 @@ void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf )
long SwDoubleLinePortion::CalcSpacing( long nSpaceAdd, const SwTextSizeInfo & ) const long SwDoubleLinePortion::CalcSpacing( long nSpaceAdd, const SwTextSizeInfo & ) const
{ {
return HasTabulator() ? 0 : GetSpaceCnt() * nSpaceAdd / SPACING_PRECISION_FACTOR; return HasTabulator() ? 0 : sal_Int32(GetSpaceCnt()) * nSpaceAdd / SPACING_PRECISION_FACTOR;
} }
// Merges the spaces for text adjustment from the inner and outer part. // Merges the spaces for text adjustment from the inner and outer part.
...@@ -511,12 +510,12 @@ bool SwDoubleLinePortion::ChgSpaceAdd( SwLineLayout* pCurr, ...@@ -511,12 +510,12 @@ bool SwDoubleLinePortion::ChgSpaceAdd( SwLineLayout* pCurr,
} }
else else
{ {
sal_Int32 nMyBlank = GetSmallerSpaceCnt(); sal_Int32 const nMyBlank = sal_Int32(GetSmallerSpaceCnt());
sal_Int32 nOther = GetSpaceCnt(); sal_Int32 const nOther = sal_Int32(GetSpaceCnt());
SwTwips nMultiSpace = pCurr->GetLLSpaceAdd( 0 ) * nMyBlank + nOther * nSpaceAdd; SwTwips nMultiSpace = pCurr->GetLLSpaceAdd( 0 ) * nMyBlank + nOther * nSpaceAdd;
if( nMyBlank ) if( nMyBlank )
nMultiSpace /= nMyBlank; nMultiSpace /= sal_Int32(nMyBlank);
// pCurr->SetLLSpaceAdd( nMultiSpace, 0 ); // pCurr->SetLLSpaceAdd( nMultiSpace, 0 );
// #i65711# SetLLSpaceAdd replaces the first value, // #i65711# SetLLSpaceAdd replaces the first value,
...@@ -599,7 +598,7 @@ SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt, ...@@ -599,7 +598,7 @@ SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt,
else else
pRubyFont = nullptr; pRubyFont = nullptr;
OUString aStr = rRuby.GetText().copy( nOffs ); OUString aStr = rRuby.GetText().copy( sal_Int32(nOffs) );
SwFieldPortion *pField = new SwFieldPortion( aStr, pRubyFont ); SwFieldPortion *pField = new SwFieldPortion( aStr, pRubyFont );
pField->SetNextOffset( nOffs ); pField->SetNextOffset( nOffs );
pField->SetFollow( true ); pField->SetFollow( true );
...@@ -639,7 +638,7 @@ SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt, ...@@ -639,7 +638,7 @@ SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt,
void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf ) void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
{ {
SwTwips nLineDiff = GetRoot().Width() - GetRoot().GetNext()->Width(); SwTwips nLineDiff = GetRoot().Width() - GetRoot().GetNext()->Width();
sal_Int32 nOldIdx = rInf.GetIdx(); TextFrameIndex const nOldIdx = rInf.GetIdx();
if( !nLineDiff ) if( !nLineDiff )
return; return;
SwLineLayout *pCurr; SwLineLayout *pCurr;
...@@ -659,17 +658,17 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf ) ...@@ -659,17 +658,17 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
} }
sal_uInt16 nLeft = 0; // the space in front of the first letter sal_uInt16 nLeft = 0; // the space in front of the first letter
sal_uInt16 nRight = 0; // the space at the end of the last letter sal_uInt16 nRight = 0; // the space at the end of the last letter
sal_Int32 nSub = 0; TextFrameIndex nSub(0);
switch ( nAdjustment ) switch ( nAdjustment )
{ {
case css::text::RubyAdjust_CENTER: nRight = static_cast<sal_uInt16>(nLineDiff / 2); case css::text::RubyAdjust_CENTER: nRight = static_cast<sal_uInt16>(nLineDiff / 2);
SAL_FALLTHROUGH; SAL_FALLTHROUGH;
case css::text::RubyAdjust_RIGHT: nLeft = static_cast<sal_uInt16>(nLineDiff - nRight); break; case css::text::RubyAdjust_RIGHT: nLeft = static_cast<sal_uInt16>(nLineDiff - nRight); break;
case css::text::RubyAdjust_BLOCK: nSub = 1; case css::text::RubyAdjust_BLOCK: nSub = TextFrameIndex(1);
SAL_FALLTHROUGH; SAL_FALLTHROUGH;
case css::text::RubyAdjust_INDENT_BLOCK: case css::text::RubyAdjust_INDENT_BLOCK:
{ {
sal_Int32 nCharCnt = 0; TextFrameIndex nCharCnt(0);
SwLinePortion *pPor; SwLinePortion *pPor;
for( pPor = pCurr->GetFirstPortion(); pPor; pPor = pPor->GetPortion() ) for( pPor = pCurr->GetFirstPortion(); pPor; pPor = pPor->GetPortion() )
{ {
...@@ -679,7 +678,7 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf ) ...@@ -679,7 +678,7 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
} }
if( nCharCnt > nSub ) if( nCharCnt > nSub )
{ {
SwTwips nCalc = nLineDiff / ( nCharCnt - nSub ); SwTwips nCalc = nLineDiff / sal_Int32(nCharCnt - nSub);
short nTmp; short nTmp;
if( nCalc < SHRT_MAX ) if( nCalc < SHRT_MAX )
nTmp = -short(nCalc); nTmp = -short(nCalc);
...@@ -687,7 +686,7 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf ) ...@@ -687,7 +686,7 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
nTmp = SHRT_MIN; nTmp = SHRT_MIN;
pCurr->CreateSpaceAdd( SPACING_PRECISION_FACTOR * nTmp ); pCurr->CreateSpaceAdd( SPACING_PRECISION_FACTOR * nTmp );
nLineDiff -= nCalc * ( nCharCnt - 1 ); nLineDiff -= nCalc * (sal_Int32(nCharCnt) - 1);
} }
if( nLineDiff > 1 ) if( nLineDiff > 1 )
{ {
...@@ -747,7 +746,7 @@ void SwRubyPortion::CalcRubyOffset() ...@@ -747,7 +746,7 @@ void SwRubyPortion::CalcRubyOffset()
if( pField->HasFollow() ) if( pField->HasFollow() )
nRubyOffset = pField->GetNextOffset(); nRubyOffset = pField->GetNextOffset();
else else
nRubyOffset = COMPLETE_STRING; nRubyOffset = TextFrameIndex(COMPLETE_STRING);
} }
} }
...@@ -831,17 +830,17 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos, ...@@ -831,17 +830,17 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
sal_uInt8 nNextLevel = nCurrLevel; sal_uInt8 nNextLevel = nCurrLevel;
bool bFieldBidi = false; bool bFieldBidi = false;
if ( rPos < GetText().getLength() && CH_TXTATR_BREAKWORD == GetChar( rPos ) ) if (rPos < TextFrameIndex(GetText().getLength()) && CH_TXTATR_BREAKWORD == GetChar(rPos))
{ {
bFieldBidi = true; bFieldBidi = true;
} }
else else
nNextLevel = rSI.DirType( rPos ); nNextLevel = rSI.DirType( rPos );
if ( GetText().getLength() != rPos && nNextLevel > nCurrLevel ) if (TextFrameIndex(GetText().getLength()) != rPos && nNextLevel > nCurrLevel)
{ {
rPos = bFieldBidi ? rPos + 1 : rSI.NextDirChg( rPos, &nCurrLevel ); rPos = bFieldBidi ? rPos + TextFrameIndex(1) : rSI.NextDirChg(rPos, &nCurrLevel);
if ( COMPLETE_STRING == rPos ) if (TextFrameIndex(COMPLETE_STRING) == rPos)
return nullptr; return nullptr;
SwMultiCreator *pRet = new SwMultiCreator; SwMultiCreator *pRet = new SwMultiCreator;
pRet->pItem = nullptr; pRet->pItem = nullptr;
...@@ -923,7 +922,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos, ...@@ -923,7 +922,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
return pRet; return pRet;
} }
if( n2Lines < nCount || ( pItem && pItem == p2Lines && if( n2Lines < nCount || ( pItem && pItem == p2Lines &&
rPos < GetText().getLength() ) ) rPos < TextFrameIndex(GetText().getLength())))
{ // The winner is a 2-line-attribute, { // The winner is a 2-line-attribute,
// the end of the multiportion depends on the following attributes... // the end of the multiportion depends on the following attributes...
SwMultiCreator *pRet = new SwMultiCreator; SwMultiCreator *pRet = new SwMultiCreator;
...@@ -1038,8 +1037,8 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos, ...@@ -1038,8 +1037,8 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
rPos = aEnd.back(); rPos = aEnd.back();
return pRet; return pRet;
} }
if( nRotate < nCount || ( pRotItem && pRotItem == pRotate && if (nRotate < nCount || ( pRotItem && pRotItem == pRotate &&
rPos < GetText().getLength() ) ) rPos < TextFrameIndex(GetText().getLength())))
{ // The winner is a rotate-attribute, { // The winner is a rotate-attribute,
// the end of the multiportion depends on the following attributes... // the end of the multiportion depends on the following attributes...
SwMultiCreator *pRet = new SwMultiCreator; SwMultiCreator *pRet = new SwMultiCreator;
...@@ -1328,10 +1327,10 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, ...@@ -1328,10 +1327,10 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
rMulti.GetPortion()->PrePaint( GetInfo(), &rMulti ); rMulti.GetPortion()->PrePaint( GetInfo(), &rMulti );
// old values must be saved and restored at the end // old values must be saved and restored at the end
sal_Int32 nOldLen = GetInfo().GetLen(); TextFrameIndex const nOldLen = GetInfo().GetLen();
const SwTwips nOldX = GetInfo().X(); const SwTwips nOldX = GetInfo().X();
const SwTwips nOldY = GetInfo().Y(); const SwTwips nOldY = GetInfo().Y();
sal_Int32 nOldIdx = GetInfo().GetIdx(); TextFrameIndex const nOldIdx = GetInfo().GetIdx();
SwSpaceManipulator aManip( GetInfo(), rMulti ); SwSpaceManipulator aManip( GetInfo(), rMulti );
...@@ -1356,7 +1355,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, ...@@ -1356,7 +1355,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
if( rMulti.HasBrackets() ) if( rMulti.HasBrackets() )
{ {
sal_Int32 nTmpOldIdx = GetInfo().GetIdx(); TextFrameIndex const nTmpOldIdx = GetInfo().GetIdx();
GetInfo().SetIdx(static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart); GetInfo().SetIdx(static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart);
SeekAndChg( GetInfo() ); SeekAndChg( GetInfo() );
static_cast<SwDoubleLinePortion&>(rMulti).PaintBracket( GetInfo(), 0, true ); static_cast<SwDoubleLinePortion&>(rMulti).PaintBracket( GetInfo(), 0, true );
...@@ -1595,7 +1594,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint, ...@@ -1595,7 +1594,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
if( rMulti.HasBrackets() ) if( rMulti.HasBrackets() )
{ {
sal_Int32 nTmpOldIdx = GetInfo().GetIdx(); TextFrameIndex const nTmpOldIdx = GetInfo().GetIdx();
GetInfo().SetIdx(static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart); GetInfo().SetIdx(static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart);
SeekAndChg( GetInfo() ); SeekAndChg( GetInfo() );
GetInfo().X( nOldX ); GetInfo().X( nOldX );
...@@ -1639,20 +1638,20 @@ static bool lcl_ExtractFieldFollow( SwLineLayout* pLine, SwLinePortion* &rpField ...@@ -1639,20 +1638,20 @@ static bool lcl_ExtractFieldFollow( SwLineLayout* pLine, SwLinePortion* &rpField
// next line, this function is called to truncate // next line, this function is called to truncate
// the rest of the remaining multi portion // the rest of the remaining multi portion
static void lcl_TruncateMultiPortion( SwMultiPortion& rMulti, SwTextFormatInfo& rInf, static void lcl_TruncateMultiPortion( SwMultiPortion& rMulti, SwTextFormatInfo& rInf,
sal_Int32 nStartIdx ) TextFrameIndex const nStartIdx)
{ {
rMulti.GetRoot().Truncate(); rMulti.GetRoot().Truncate();
rMulti.GetRoot().SetLen(0); rMulti.GetRoot().SetLen(TextFrameIndex(0));
rMulti.GetRoot().Width(0); rMulti.GetRoot().Width(0);
// rMulti.CalcSize( *this, aInf ); // rMulti.CalcSize( *this, aInf );
if ( rMulti.GetRoot().GetNext() ) if ( rMulti.GetRoot().GetNext() )
{ {
rMulti.GetRoot().GetNext()->Truncate(); rMulti.GetRoot().GetNext()->Truncate();
rMulti.GetRoot().GetNext()->SetLen( 0 ); rMulti.GetRoot().GetNext()->SetLen(TextFrameIndex(0));
rMulti.GetRoot().GetNext()->Width( 0 ); rMulti.GetRoot().GetNext()->Width( 0 );
} }
rMulti.Width( 0 ); rMulti.Width( 0 );
rMulti.SetLen(0); rMulti.SetLen(TextFrameIndex(0));
rInf.SetIdx( nStartIdx ); rInf.SetIdx( nStartIdx );
} }
...@@ -1667,7 +1666,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, ...@@ -1667,7 +1666,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
if( rMulti.HasBrackets() ) if( rMulti.HasBrackets() )
{ {
sal_Int32 nOldIdx = rInf.GetIdx(); TextFrameIndex const nOldIdx = rInf.GetIdx();
rInf.SetIdx( static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart ); rInf.SetIdx( static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart );
SeekAndChg( rInf ); SeekAndChg( rInf );
nOldX = GetInfo().X(); nOldX = GetInfo().X();
...@@ -1739,11 +1738,11 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, ...@@ -1739,11 +1738,11 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
pMulti = &rMulti; pMulti = &rMulti;
SwLineLayout *pOldCurr = m_pCurr; SwLineLayout *pOldCurr = m_pCurr;
sal_Int32 nOldStart = GetStart(); TextFrameIndex const nOldStart = GetStart();
SwTwips nMinWidth = nTmpX + 1; SwTwips nMinWidth = nTmpX + 1;
SwTwips nActWidth = nMaxWidth; SwTwips nActWidth = nMaxWidth;
const sal_Int32 nStartIdx = rInf.GetIdx(); const TextFrameIndex nStartIdx = rInf.GetIdx();
sal_Int32 nMultiLen = rMulti.GetLen(); TextFrameIndex nMultiLen = rMulti.GetLen();
SwLinePortion *pFirstRest; SwLinePortion *pFirstRest;
SwLinePortion *pSecondRest; SwLinePortion *pSecondRest;
...@@ -1776,7 +1775,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, ...@@ -1776,7 +1775,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
std::shared_ptr<vcl::TextLayoutCache> const pOldCachedVclData(rInf.GetCachedVclData()); std::shared_ptr<vcl::TextLayoutCache> const pOldCachedVclData(rInf.GetCachedVclData());
rInf.SetCachedVclData(nullptr); rInf.SetCachedVclData(nullptr);
OUString const aMultiStr( rInf.GetText().copy(0, nMultiLen + rInf.GetIdx()) ); OUString const aMultiStr( rInf.GetText().copy(0, sal_Int32(nMultiLen + rInf.GetIdx())) );
rInf.SetText( aMultiStr ); rInf.SetText( aMultiStr );
SwTextFormatInfo aInf( rInf, rMulti.GetRoot(), nActWidth ); SwTextFormatInfo aInf( rInf, rMulti.GetRoot(), nActWidth );
// Do we allow break cuts? The FirstMulti-Flag is evaluated during // Do we allow break cuts? The FirstMulti-Flag is evaluated during
...@@ -1844,7 +1843,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, ...@@ -1844,7 +1843,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
// second line has to be formatted // second line has to be formatted
else if( m_pCurr->GetLen()<nMultiLen || rMulti.IsRuby() || aInf.GetRest()) else if( m_pCurr->GetLen()<nMultiLen || rMulti.IsRuby() || aInf.GetRest())
{ {
sal_Int32 nFirstLen = m_pCurr->GetLen(); TextFrameIndex const nFirstLen = m_pCurr->GetLen();
delete m_pCurr->GetNext(); delete m_pCurr->GetNext();
m_pCurr->SetNext( new SwLineLayout() ); m_pCurr->SetNext( new SwLineLayout() );
m_pCurr = m_pCurr->GetNext(); m_pCurr = m_pCurr->GetNext();
...@@ -1945,7 +1944,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf, ...@@ -1945,7 +1944,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
SetPropFont( 0 ); SetPropFont( 0 );
rMulti.SetLen( rMulti.GetRoot().GetLen() + ( rMulti.GetRoot().GetNext() ? rMulti.SetLen( rMulti.GetRoot().GetLen() + ( rMulti.GetRoot().GetNext() ?
rMulti.GetRoot().GetNext()->GetLen() : 0 ) ); rMulti.GetRoot().GetNext()->GetLen() : TextFrameIndex(0) ) );
if( rMulti.IsDouble() ) if( rMulti.IsDouble() )
{ {
...@@ -2132,7 +2131,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine, ...@@ -2132,7 +2131,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
{ {
if( !nPosition ) if( !nPosition )
return nullptr; return nullptr;
sal_Int32 nMultiPos = nPosition - pLine->GetLen(); TextFrameIndex nMultiPos = nPosition - pLine->GetLen();
const SwMultiPortion *pTmpMulti = nullptr; const SwMultiPortion *pTmpMulti = nullptr;
const SwMultiPortion *pHelpMulti = nullptr; const SwMultiPortion *pHelpMulti = nullptr;
const SwLinePortion* pPor = pLine->GetFirstPortion(); const SwLinePortion* pPor = pLine->GetFirstPortion();
...@@ -2194,7 +2193,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine, ...@@ -2194,7 +2193,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
SwLinePortion *pRest = nullptr; SwLinePortion *pRest = nullptr;
if( pField ) if( pField )
{ {
const SwTextAttr *pHint = GetAttr( nPosition - 1 ); const SwTextAttr *pHint = GetAttr(nPosition - TextFrameIndex(1));
if ( pHint if ( pHint
&& ( pHint->Which() == RES_TXTATR_FIELD && ( pHint->Which() == RES_TXTATR_FIELD
|| pHint->Which() == RES_TXTATR_ANNOTATION ) ) || pHint->Which() == RES_TXTATR_ANNOTATION ) )
...@@ -2227,7 +2226,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine, ...@@ -2227,7 +2226,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
return pRest; return pRest;
if( pRest || nMultiPos > nPosition || ( pHelpMulti->IsRuby() && if( pRest || nMultiPos > nPosition || ( pHelpMulti->IsRuby() &&
static_cast<const SwRubyPortion*>(pHelpMulti)->GetRubyOffset() < COMPLETE_STRING ) ) static_cast<const SwRubyPortion*>(pHelpMulti)->GetRubyOffset() < TextFrameIndex(COMPLETE_STRING)))
{ {
SwMultiPortion* pTmp; SwMultiPortion* pTmp;
if( pHelpMulti->IsDouble() ) if( pHelpMulti->IsDouble() )
...@@ -2237,7 +2236,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine, ...@@ -2237,7 +2236,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
else if( pHelpMulti->IsRuby() ) else if( pHelpMulti->IsRuby() )
{ {
pTmp = new SwRubyPortion( *pCreate, *GetInfo().GetFont(), pTmp = new SwRubyPortion( *pCreate, *GetInfo().GetFont(),
*m_pFrame->GetTextNode()->getIDocumentSettingAccess(), m_pFrame->GetDoc().getIDocumentSettingAccess(),
nMultiPos, static_cast<const SwRubyPortion*>(pHelpMulti)->GetRubyOffset(), nMultiPos, static_cast<const SwRubyPortion*>(pHelpMulti)->GetRubyOffset(),
GetInfo() ); GetInfo() );
} }
...@@ -2291,7 +2290,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor, ...@@ -2291,7 +2290,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
{ {
bSpaceChg = pMulti->ChgSpaceAdd( pCursor->m_pCurr, nSpaceAdd ); bSpaceChg = pMulti->ChgSpaceAdd( pCursor->m_pCurr, nSpaceAdd );
sal_Int32 nSpaceCnt; TextFrameIndex nSpaceCnt;
if ( pMulti->IsDouble() ) if ( pMulti->IsDouble() )
{ {
pCursor->SetPropFont( 50 ); pCursor->SetPropFont( 50 );
...@@ -2299,14 +2298,14 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor, ...@@ -2299,14 +2298,14 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
} }
else else
{ {
const sal_Int32 nOldIdx = pCursor->GetInfo().GetIdx(); TextFrameIndex const nOldIdx = pCursor->GetInfo().GetIdx();
pCursor->GetInfo().SetIdx ( nCurrStart ); pCursor->GetInfo().SetIdx ( nCurrStart );
nSpaceCnt = static_cast<SwBidiPortion*>(pMulti)->GetSpaceCnt(pCursor->GetInfo()); nSpaceCnt = static_cast<SwBidiPortion*>(pMulti)->GetSpaceCnt(pCursor->GetInfo());
pCursor->GetInfo().SetIdx ( nOldIdx ); pCursor->GetInfo().SetIdx ( nOldIdx );
} }
if( nSpaceAdd > 0 && !pMulti->HasTabulator() ) if( nSpaceAdd > 0 && !pMulti->HasTabulator() )
pCursor->m_pCurr->Width( static_cast<sal_uInt16>(nWidth + nSpaceAdd * nSpaceCnt / SPACING_PRECISION_FACTOR ) ); pCursor->m_pCurr->Width( static_cast<sal_uInt16>(nWidth + nSpaceAdd * sal_Int32(nSpaceCnt) / SPACING_PRECISION_FACTOR) );
// For a BidiPortion we have to calculate the offset from the // For a BidiPortion we have to calculate the offset from the
// end of the portion // end of the portion
......
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