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

sw_redlinehide: trivial conversions in itrform2.cxx

Change-Id: I83c0dd85f2f6c68edb7a48928db68fb4e84e5387
üst 8a9d95f1
...@@ -68,10 +68,10 @@ namespace { ...@@ -68,10 +68,10 @@ namespace {
//! Calculates and sets optimal repaint offset for the current line //! Calculates and sets optimal repaint offset for the current line
long lcl_CalcOptRepaint( SwTextFormatter &rThis, long lcl_CalcOptRepaint( SwTextFormatter &rThis,
SwLineLayout const &rCurr, SwLineLayout const &rCurr,
const sal_Int32 nOldLineEnd, TextFrameIndex nOldLineEnd,
const std::vector<long> &rFlyStarts ); const std::vector<long> &rFlyStarts );
//! Determine if we need to build hidden portions //! Determine if we need to build hidden portions
bool lcl_BuildHiddenPortion( const SwTextSizeInfo& rInf, sal_Int32 &rPos ); bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex &rPos);
// Check whether the two font has the same border // Check whether the two font has the same border
bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond); bool lcl_HasSameBorder(const SwFont& rFirst, const SwFont& rSecond);
...@@ -95,15 +95,15 @@ void SwTextFormatter::CtorInitTextFormatter( SwTextFrame *pNewFrame, SwTextForma ...@@ -95,15 +95,15 @@ void SwTextFormatter::CtorInitTextFormatter( SwTextFrame *pNewFrame, SwTextForma
bTruncLines = false; bTruncLines = false;
nCntEndHyph = 0; nCntEndHyph = 0;
nCntMidHyph = 0; nCntMidHyph = 0;
nLeftScanIdx = COMPLETE_STRING; nLeftScanIdx = TextFrameIndex(COMPLETE_STRING);
nRightScanIdx = 0; nRightScanIdx = TextFrameIndex(0);
m_nHintEndIndex = 0; m_nHintEndIndex = 0;
m_pFirstOfBorderMerge = nullptr; m_pFirstOfBorderMerge = nullptr;
if( m_nStart > GetInfo().GetText().getLength() ) if (m_nStart > TextFrameIndex(GetInfo().GetText().getLength()))
{ {
OSL_ENSURE( false, "+SwTextFormatter::CTOR: bad offset" ); OSL_ENSURE( false, "+SwTextFormatter::CTOR: bad offset" );
m_nStart = GetInfo().GetText().getLength(); m_nStart = TextFrameIndex(GetInfo().GetText().getLength());
} }
} }
...@@ -159,8 +159,8 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf ) ...@@ -159,8 +159,8 @@ SwLinePortion *SwTextFormatter::Underflow( SwTextFormatInfo &rInf )
// line again. // line again.
// Can be seen in 8081.sdw, if you enter text in the first line // Can be seen in 8081.sdw, if you enter text in the first line
const sal_Int32 nSoftHyphPos = rInf.GetSoftHyphPos(); TextFrameIndex const nSoftHyphPos = rInf.GetSoftHyphPos();
const sal_Int32 nUnderScorePos = rInf.GetUnderScorePos(); TextFrameIndex const nUnderScorePos = rInf.GetUnderScorePos();
// Save flys and set to 0, or else segmentation fault // Save flys and set to 0, or else segmentation fault
// Not ClearFly(rInf) ! // Not ClearFly(rInf) !
...@@ -398,8 +398,8 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) ...@@ -398,8 +398,8 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
while( pPor && !rInf.IsStop() ) while( pPor && !rInf.IsStop() )
{ {
OSL_ENSURE( rInf.GetLen() < COMPLETE_STRING && OSL_ENSURE(rInf.GetLen() < TextFrameIndex(COMPLETE_STRING) &&
rInf.GetIdx() <= rInf.GetText().getLength(), rInf.GetIdx() <= TextFrameIndex(rInf.GetText().getLength()),
"SwTextFormatter::BuildPortions: bad length in info" ); "SwTextFormatter::BuildPortions: bad length in info" );
// We have to check the script for fields in order to set the // We have to check the script for fields in order to set the
...@@ -435,7 +435,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) ...@@ -435,7 +435,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
else else
{ {
const OUString& rText = rInf.GetText(); const OUString& rText = rInf.GetText();
sal_Int32 nIdx = rInf.GetIdx(); sal_Int32 nIdx = sal_Int32(rInf.GetIdx());
bAllowBehind = nIdx < rText.getLength() && rCC.isLetterNumeric(rText, nIdx); bAllowBehind = nIdx < rText.getLength() && rCC.isLetterNumeric(rText, nIdx);
} }
...@@ -462,10 +462,10 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf ) ...@@ -462,10 +462,10 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
} }
else if ( rInf.GetIdx() ) else if ( rInf.GetIdx() )
{ {
bAllowBefore = rCC.isLetterNumeric( rInf.GetText(), rInf.GetIdx() - 1 ); bAllowBefore = rCC.isLetterNumeric(rInf.GetText(), sal_Int32(rInf.GetIdx()) - 1);
// Note: ScriptType returns values in [1,4] // Note: ScriptType returns values in [1,4]
if ( bAllowBefore ) if ( bAllowBefore )
nLstActual = SwFontScript(m_pScriptInfo->ScriptType( rInf.GetIdx() - 1 ) - 1); nLstActual = SwFontScript(m_pScriptInfo->ScriptType(rInf.GetIdx() - TextFrameIndex(1)) - 1);
} }
nLstHeight /= 5; nLstHeight /= 5;
...@@ -758,7 +758,7 @@ void SwTextFormatter::CalcAscent( SwTextFormatInfo &rInf, SwLinePortion *pPor ) ...@@ -758,7 +758,7 @@ void SwTextFormatter::CalcAscent( SwTextFormatInfo &rInf, SwLinePortion *pPor )
// i#89179 // i#89179
// tab portion representing the list tab of a list label gets the // tab portion representing the list tab of a list label gets the
// same height and ascent as the corresponding number portion // same height and ascent as the corresponding number portion
else if ( pPor->InTabGrp() && pPor->GetLen() == 0 && else if ( pPor->InTabGrp() && pPor->GetLen() == TextFrameIndex(0) &&
rInf.GetLast() && rInf.GetLast()->InNumberGrp() && rInf.GetLast() && rInf.GetLast()->InNumberGrp() &&
static_cast<const SwNumberPortion*>(rInf.GetLast())->HasFont() ) static_cast<const SwNumberPortion*>(rInf.GetLast())->HasFont() )
{ {
...@@ -886,17 +886,16 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const ...@@ -886,17 +886,16 @@ SwTextPortion *SwTextFormatter::WhichTextPor( SwTextFormatInfo &rInf ) const
// Only at the End! // Only at the End!
// If pCurr does not have a width, it can however already have content. // If pCurr does not have a width, it can however already have content.
// E.g. for non-displayable characters // E.g. for non-displayable characters
if (rInf.GetText()[rInf.GetIdx()]==CH_TXT_ATR_FIELDSTART) auto const ch(rInf.GetText()[sal_Int32(rInf.GetIdx())]);
if (ch == CH_TXT_ATR_FIELDSTART)
pPor = new SwFieldMarkPortion(); pPor = new SwFieldMarkPortion();
else if (rInf.GetText()[rInf.GetIdx()]==CH_TXT_ATR_FIELDEND) else if (ch == CH_TXT_ATR_FIELDEND)
pPor = new SwFieldMarkPortion(); pPor = new SwFieldMarkPortion();
else if (rInf.GetText()[rInf.GetIdx()]==CH_TXT_ATR_FORMELEMENT) else if (ch == CH_TXT_ATR_FORMELEMENT)
{ {
SwTextNode *pNd = rInf.GetTextFrame()->GetTextNode(); SwTextFrame const*const pFrame(rInf.GetTextFrame());
const SwDoc *doc = pNd->GetDoc(); SwPosition aPosition(pFrame->MapViewToModelPos(rInf.GetIdx()));
SwIndex aIndex(pNd, rInf.GetIdx()); sw::mark::IFieldmark *pBM = pFrame->GetDoc().getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
SwPosition aPosition(*pNd, aIndex);
sw::mark::IFieldmark *pBM = doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
OSL_ENSURE(pBM != nullptr, "Where is my form field bookmark???"); OSL_ENSURE(pBM != nullptr, "Where is my form field bookmark???");
if (pBM != nullptr) if (pBM != nullptr)
{ {
...@@ -947,8 +946,8 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf ) ...@@ -947,8 +946,8 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
SwTextPortion *pPor = WhichTextPor( rInf ); SwTextPortion *pPor = WhichTextPor( rInf );
// until next attribute change: // until next attribute change:
const sal_Int32 nNextAttr = GetNextAttr(); const TextFrameIndex nNextAttr = GetNextAttr();
sal_Int32 nNextChg = std::min( nNextAttr, rInf.GetText().getLength() ); TextFrameIndex nNextChg = std::min(nNextAttr, TextFrameIndex(rInf.GetText().getLength()));
// end of script type: // end of script type:
const sal_Int32 nNextScript = m_pScriptInfo->NextScriptChg( rInf.GetIdx() ); const sal_Int32 nNextScript = m_pScriptInfo->NextScriptChg( rInf.GetIdx() );
...@@ -971,7 +970,7 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf ) ...@@ -971,7 +970,7 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
// It follows that a line with a lot of blanks is processed incorrectly. // It follows that a line with a lot of blanks is processed incorrectly.
// Therefore we increase from factor 2 to 8 (due to negative kerning). // Therefore we increase from factor 2 to 8 (due to negative kerning).
pPor->SetLen(1); pPor->SetLen(TextFrameIndex(1));
CalcAscent( rInf, pPor ); CalcAscent( rInf, pPor );
const SwFont* pTmpFnt = rInf.GetFont(); const SwFont* pTmpFnt = rInf.GetFont();
...@@ -979,9 +978,9 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf ) ...@@ -979,9 +978,9 @@ SwTextPortion *SwTextFormatter::NewTextPortion( SwTextFormatInfo &rInf )
sal_Int32( pPor->GetAscent() ) ) / 8; sal_Int32( pPor->GetAscent() ) ) / 8;
if ( !nExpect ) if ( !nExpect )
nExpect = 1; nExpect = 1;
nExpect = rInf.GetIdx() + (rInf.GetLineWidth() / nExpect); nExpect = sal_Int32(rInf.GetIdx()) + (rInf.GetLineWidth() / nExpect);
if( nExpect > rInf.GetIdx() && nNextChg > nExpect ) if (TextFrameIndex(nExpect) > rInf.GetIdx() && nNextChg > TextFrameIndex(nExpect))
nNextChg = std::min( nExpect, rInf.GetText().getLength() ); nNextChg = TextFrameIndex(std::min(nExpect, rInf.GetText().getLength()));
// we keep an invariant during method calls: // we keep an invariant during method calls:
// there are no portion ending characters like hard spaces // there are no portion ending characters like hard spaces
...@@ -1231,7 +1230,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) ...@@ -1231,7 +1230,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
// Check for Hidden Portion: // Check for Hidden Portion:
if ( !pPor ) if ( !pPor )
{ {
sal_Int32 nEnd = rInf.GetIdx(); TextFrameIndex nEnd = rInf.GetIdx();
if ( ::lcl_BuildHiddenPortion( rInf, nEnd ) ) if ( ::lcl_BuildHiddenPortion( rInf, nEnd ) )
pPor = new SwHiddenTextPortion( nEnd - rInf.GetIdx() ); pPor = new SwHiddenTextPortion( nEnd - rInf.GetIdx() );
} }
...@@ -1245,7 +1244,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) ...@@ -1245,7 +1244,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
{ {
// We open a multiportion part, if we enter a multi-line part // We open a multiportion part, if we enter a multi-line part
// of the paragraph. // of the paragraph.
sal_Int32 nEnd = rInf.GetIdx(); TextFrameIndex nEnd = rInf.GetIdx();
SwMultiCreator* pCreate = rInf.GetMultiCreator( nEnd, pMulti ); SwMultiCreator* pCreate = rInf.GetMultiCreator( nEnd, pMulti );
if( pCreate ) if( pCreate )
{ {
...@@ -1257,7 +1256,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) ...@@ -1257,7 +1256,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
{ {
pTmp = new SwRubyPortion( *pCreate, *rInf.GetFont(), pTmp = new SwRubyPortion( *pCreate, *rInf.GetFont(),
*GetTextFrame()->GetTextNode()->getIDocumentSettingAccess(), *GetTextFrame()->GetTextNode()->getIDocumentSettingAccess(),
nEnd, 0, rInf ); nEnd, TextFrameIndex(0), rInf );
} }
else if( SwMultiCreatorId::Rotate == pCreate->nId ) else if( SwMultiCreatorId::Rotate == pCreate->nId )
pTmp = new SwRotatedPortion( *pCreate, nEnd, pTmp = new SwRotatedPortion( *pCreate, nEnd,
...@@ -1287,7 +1286,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) ...@@ -1287,7 +1286,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
} }
else else
{ {
if( rInf.GetIdx() >= rInf.GetText().getLength() ) if (rInf.GetIdx() >= TextFrameIndex(rInf.GetText().getLength()))
{ {
rInf.SetFull(true); rInf.SetFull(true);
CalcFlyWidth( rInf ); CalcFlyWidth( rInf );
...@@ -1370,7 +1369,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) ...@@ -1370,7 +1369,7 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
// if a portion is created despite there being a pending RestPortion, // if a portion is created despite there being a pending RestPortion,
// then it is a field which has been split (e.g. because it contains a Tab) // then it is a field which has been split (e.g. because it contains a Tab)
if( pPor && rInf.GetRest() ) if( pPor && rInf.GetRest() )
pPor->SetLen( 0 ); pPor->SetLen(TextFrameIndex(0));
// robust: // robust:
if( !pPor || rInf.IsStop() ) if( !pPor || rInf.IsStop() )
...@@ -1409,9 +1408,10 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) ...@@ -1409,9 +1408,10 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
if ( 0 != nDir ) if ( 0 != nDir )
{ {
delete pPor; delete pPor;
pPor = new SwRotatedPortion( rInf.GetIdx() + 1, 900 == nDir ? pPor = new SwRotatedPortion(rInf.GetIdx() + TextFrameIndex(1),
DIR_BOTTOM2TOP : 900 == nDir
DIR_TOP2BOTTOM ); ? DIR_BOTTOM2TOP
: DIR_TOP2BOTTOM );
} }
} }
} }
...@@ -1425,9 +1425,9 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) ...@@ -1425,9 +1425,9 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf )
if ( 0 != nDir ) if ( 0 != nDir )
{ {
delete pPor; delete pPor;
pPor = new SwRotatedPortion( 0, 900 == nDir ? pPor = new SwRotatedPortion(TextFrameIndex(0), 900 == nDir
DIR_BOTTOM2TOP : ? DIR_BOTTOM2TOP
DIR_TOP2BOTTOM ); : DIR_TOP2BOTTOM );
rInf.SetNumDone( false ); rInf.SetNumDone( false );
rInf.SetFootnoteDone( false ); rInf.SetFootnoteDone( false );
...@@ -1470,8 +1470,8 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos) ...@@ -1470,8 +1470,8 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
// For the formatting routines, we set pOut to the reference device. // For the formatting routines, we set pOut to the reference device.
SwHookOut aHook( GetInfo() ); SwHookOut aHook( GetInfo() );
if( GetInfo().GetLen() < GetInfo().GetText().getLength() ) if (GetInfo().GetLen() < TextFrameIndex(GetInfo().GetText().getLength()))
GetInfo().SetLen( GetInfo().GetText().getLength() ); GetInfo().SetLen(TextFrameIndex(GetInfo().GetText().getLength()));
bool bBuild = true; bool bBuild = true;
SetFlyInCntBase( false ); SetFlyInCntBase( false );
...@@ -1497,7 +1497,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos) ...@@ -1497,7 +1497,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
// for an optimal repaint rectangle, we want to compare fly portions // for an optimal repaint rectangle, we want to compare fly portions
// before and after the BuildPortions call // before and after the BuildPortions call
const bool bOptimizeRepaint = AllowRepaintOpt(); const bool bOptimizeRepaint = AllowRepaintOpt();
const sal_Int32 nOldLineEnd = nStartPos + m_pCurr->GetLen(); TextFrameIndex const nOldLineEnd = nStartPos + m_pCurr->GetLen();
std::vector<long> flyStarts; std::vector<long> flyStarts;
// these are the conditions for a fly position comparison // these are the conditions for a fly position comparison
...@@ -1539,7 +1539,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos) ...@@ -1539,7 +1539,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
if( GetInfo().IsStop() ) if( GetInfo().IsStop() )
{ {
m_pCurr->SetLen( 0 ); m_pCurr->SetLen(TextFrameIndex(0));
m_pCurr->Height( GetFrameRstHeight() + 1 ); m_pCurr->Height( GetFrameRstHeight() + 1 );
m_pCurr->SetRealHeight( GetFrameRstHeight() + 1 ); m_pCurr->SetRealHeight( GetFrameRstHeight() + 1 );
m_pCurr->Width(0); m_pCurr->Width(0);
...@@ -1594,7 +1594,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos) ...@@ -1594,7 +1594,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
if ( xSaveField ) if ( xSaveField )
GetInfo().SetRest( new SwFieldPortion( *xSaveField ) ); GetInfo().SetRest( new SwFieldPortion( *xSaveField ) );
m_pCurr->SetLen( 0 ); m_pCurr->SetLen(TextFrameIndex(0));
m_pCurr->Width(0); m_pCurr->Width(0);
m_pCurr->Truncate(); m_pCurr->Truncate();
} }
...@@ -1639,7 +1639,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos) ...@@ -1639,7 +1639,7 @@ TextFrameIndex SwTextFormatter::FormatLine(TextFrameIndex const nStartPos)
// delete master copy of rest portion // delete master copy of rest portion
xSaveField.reset(); xSaveField.reset();
sal_Int32 nNewStart = nStartPos + m_pCurr->GetLen(); TextFrameIndex const nNewStart = nStartPos + m_pCurr->GetLen();
// adjust text if kana compression is enabled // adjust text if kana compression is enabled
if ( GetInfo().CompressLine() ) if ( GetInfo().CompressLine() )
...@@ -1723,8 +1723,9 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine ) ...@@ -1723,8 +1723,9 @@ void SwTextFormatter::CalcRealHeight( bool bNewLine )
// consider register-true and so on. Unfortunately an empty line can be at // consider register-true and so on. Unfortunately an empty line can be at
// the end of a paragraph (empty paragraphs or behind a Shift-Return), // the end of a paragraph (empty paragraphs or behind a Shift-Return),
// which should consider the register. // which should consider the register.
if( !m_pCurr->IsDummy() || ( !m_pCurr->GetNext() && if (!m_pCurr->IsDummy() || (!m_pCurr->GetNext()
GetStart() >= GetTextFrame()->GetText().getLength() && !bNewLine ) ) && GetStart() >= TextFrameIndex(GetTextFrame()->GetText().getLength())
&& !bNewLine))
{ {
const SvxLineSpacingItem *pSpace = m_aLineInf.GetLineSpacing(); const SvxLineSpacingItem *pSpace = m_aLineInf.GetLineSpacing();
if( pSpace ) if( pSpace )
...@@ -1953,10 +1954,12 @@ bool SwTextFormatter::AllowRepaintOpt() const ...@@ -1953,10 +1954,12 @@ bool SwTextFormatter::AllowRepaintOpt() const
} }
// Again another special case: invisible SoftHyphs // Again another special case: invisible SoftHyphs
const sal_Int32 nReformat = GetInfo().GetReformatStart(); const TextFrameIndex nReformat = GetInfo().GetReformatStart();
if( bOptimizeRepaint && COMPLETE_STRING != nReformat ) if (bOptimizeRepaint && TextFrameIndex(COMPLETE_STRING) != nReformat)
{ {
const sal_Unicode cCh = nReformat >= GetInfo().GetText().getLength() ? 0 : GetInfo().GetText()[ nReformat ]; const sal_Unicode cCh = nReformat >= TextFrameIndex(GetInfo().GetText().getLength())
? 0
: GetInfo().GetText()[ sal_Int32(nReformat) ];
bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh ) bOptimizeRepaint = ( CH_TXTATR_BREAKWORD != cCh && CH_TXTATR_INWORD != cCh )
|| ! GetInfo().HasHint( nReformat ); || ! GetInfo().HasHint( nReformat );
} }
...@@ -2083,7 +2086,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart, ...@@ -2083,7 +2086,7 @@ void SwTextFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
// jump to end of the bidi portion // jump to end of the bidi portion
aSt.AdjustX(pLay->Width() ); aSt.AdjustX(pLay->Width() );
sal_Int32 nStIdx = aTmpInf.GetIdx(); TextFrameIndex nStIdx = aTmpInf.GetIdx();
do do
{ {
UpdatePos( pLay, aSt, nStIdx, bAlways ); UpdatePos( pLay, aSt, nStIdx, bAlways );
...@@ -2343,7 +2346,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) ...@@ -2343,7 +2346,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
// Although no text is left, we need to format another line, // Although no text is left, we need to format another line,
// because also empty lines need to avoid a Fly with no wrapping. // because also empty lines need to avoid a Fly with no wrapping.
if( bFullLine && rInf.GetIdx() == rInf.GetText().getLength() ) if (bFullLine && rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
{ {
rInf.SetNewLine( true ); rInf.SetNewLine( true );
// We know that for dummies, it holds ascent == height // We know that for dummies, it holds ascent == height
...@@ -2394,7 +2397,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) ...@@ -2394,7 +2397,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
} }
else else
{ {
if( rInf.GetIdx() == rInf.GetText().getLength() ) if (rInf.GetIdx() == TextFrameIndex(rInf.GetText().getLength()))
{ {
// Don't use nHeight, or we have a huge descent // Don't use nHeight, or we have a huge descent
pFly->Height( pLast->Height() ); pFly->Height( pLast->Height() );
...@@ -2590,9 +2593,11 @@ void SwTextFormatter::MergeCharacterBorder( SwLinePortion& rPortion, SwLinePorti ...@@ -2590,9 +2593,11 @@ void SwTextFormatter::MergeCharacterBorder( SwLinePortion& rPortion, SwLinePorti
// Get next portion's font // Get next portion's font
bool bSeek = false; bool bSeek = false;
if( !rInf.IsFull() && // Not the last portion of the line (in case of line break) if (!rInf.IsFull() && // Not the last portion of the line (in case of line break)
rInf.GetIdx() + rPortion.GetLen() != rInf.GetText().getLength() ) // Not the last portion of the paragraph rInf.GetIdx() + rPortion.GetLen() != TextFrameIndex(rInf.GetText().getLength())) // Not the last portion of the paragraph
{
bSeek = Seek(rInf.GetIdx() + rPortion.GetLen()); bSeek = Seek(rInf.GetIdx() + rPortion.GetLen());
}
// Don't join the next portion if SwKernPortion sits between two different boxes. // Don't join the next portion if SwKernPortion sits between two different boxes.
bool bDisconnect = rPortion.IsKernPortion() && !rPortion.GetJoinBorderWithPrev(); bool bDisconnect = rPortion.IsKernPortion() && !rPortion.GetJoinBorderWithPrev();
// If next portion has the same border then merge // If next portion has the same border then merge
...@@ -2660,7 +2665,7 @@ namespace { ...@@ -2660,7 +2665,7 @@ namespace {
// calculates and sets optimal repaint offset for the current line // calculates and sets optimal repaint offset for the current line
long lcl_CalcOptRepaint( SwTextFormatter &rThis, long lcl_CalcOptRepaint( SwTextFormatter &rThis,
SwLineLayout const &rCurr, SwLineLayout const &rCurr,
const sal_Int32 nOldLineEnd, TextFrameIndex const nOldLineEnd,
const std::vector<long> &rFlyStarts ) const std::vector<long> &rFlyStarts )
{ {
SwTextFormatInfo& txtFormatInfo = rThis.GetInfo(); SwTextFormatInfo& txtFormatInfo = rThis.GetInfo();
...@@ -2669,7 +2674,7 @@ namespace { ...@@ -2669,7 +2674,7 @@ namespace {
// something of our text has moved to the next line // something of our text has moved to the next line
return 0; return 0;
sal_Int32 nReformat = std::min<sal_Int32>( txtFormatInfo.GetReformatStart(), nOldLineEnd ); TextFrameIndex nReformat = std::min(txtFormatInfo.GetReformatStart(), nOldLineEnd);
// in case we do not have any fly in our line, our repaint position // in case we do not have any fly in our line, our repaint position
// is the changed position - 1 // is the changed position - 1
...@@ -2681,16 +2686,16 @@ namespace { ...@@ -2681,16 +2686,16 @@ namespace {
// limit for the repaint offset // limit for the repaint offset
const long nFormatRepaint = txtFormatInfo.GetPaintOfst(); const long nFormatRepaint = txtFormatInfo.GetPaintOfst();
if ( nReformat < txtFormatInfo.GetLineStart() + 3 ) if (nReformat < txtFormatInfo.GetLineStart() + TextFrameIndex(3))
return 0; return 0;
// step back two positions for smoother repaint // step back two positions for smoother repaint
nReformat -= 2; nReformat -= TextFrameIndex(2);
// i#28795, i#34607, i#38388 // i#28795, i#34607, i#38388
// step back more characters, this is required by complex scripts // step back more characters, this is required by complex scripts
// e.g., for Khmer (thank you, Javier!) // e.g., for Khmer (thank you, Javier!)
static const sal_Int32 nMaxContext = 10; static const TextFrameIndex nMaxContext(10);
if (nReformat > txtFormatInfo.GetLineStart() + nMaxContext) if (nReformat > txtFormatInfo.GetLineStart() + nMaxContext)
nReformat = nReformat - nMaxContext; nReformat = nReformat - nMaxContext;
else else
...@@ -2729,7 +2734,7 @@ namespace { ...@@ -2729,7 +2734,7 @@ namespace {
long nPOfst = 0; long nPOfst = 0;
size_t nCnt = 0; size_t nCnt = 0;
long nX = 0; long nX = 0;
sal_Int32 nIdx = rThis.GetInfo().GetLineStart(); TextFrameIndex nIdx = rThis.GetInfo().GetLineStart();
SwLinePortion* pPor = rCurr.GetFirstPortion(); SwLinePortion* pPor = rCurr.GetFirstPortion();
while ( pPor ) while ( pPor )
...@@ -2758,7 +2763,7 @@ namespace { ...@@ -2758,7 +2763,7 @@ namespace {
} }
// Determine if we need to build hidden portions // Determine if we need to build hidden portions
bool lcl_BuildHiddenPortion( const SwTextSizeInfo& rInf, sal_Int32 &rPos ) bool lcl_BuildHiddenPortion(const SwTextSizeInfo& rInf, TextFrameIndex & rPos)
{ {
// Only if hidden text should not be shown: // Only if hidden text should not be shown:
// if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() ) // if ( rInf.GetVsh() && rInf.GetVsh()->GetWin() && rInf.GetOpt().IsShowHiddenChar() )
...@@ -2768,8 +2773,8 @@ namespace { ...@@ -2768,8 +2773,8 @@ namespace {
return false; return false;
const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo(); const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
sal_Int32 nHiddenStart; TextFrameIndex nHiddenStart;
sal_Int32 nHiddenEnd; TextFrameIndex nHiddenEnd;
rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd ); rSI.GetBoundsOfHiddenRange( rPos, nHiddenStart, nHiddenEnd );
if ( nHiddenEnd ) if ( nHiddenEnd )
{ {
......
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