diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-05-23 18:35:01 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-06-14 16:18:58 +0200 |
commit | 66d3566d942c353a53e1166a520e6fe1d7040c86 (patch) | |
tree | b43b649c3170551e178824c42a798b1e50c29795 /sw/source/core/text/portxt.cxx | |
parent | a79a152db0c5426f8de3050d35f94fb38a296f58 (diff) |
sw_redlinehide: more portxt.cxx
Change-Id: I0400794e30231d98e69569306aeaf9e43a5d5907
Diffstat (limited to 'sw/source/core/text/portxt.cxx')
-rw-r--r-- | sw/source/core/text/portxt.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 1bef7cfafab0..81b6aaad6017 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -52,14 +52,14 @@ using namespace ::com::sun::star::i18n::ScriptType; static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr, const SwLinePortion& rPor ) { - sal_Int32 nPos, nEnd; + TextFrameIndex nPos, nEnd; const SwScriptInfo* pSI = nullptr; if ( pStr ) { // passing a string means we are inside a field - nPos = 0; - nEnd = pStr->getLength(); + nPos = TextFrameIndex(0); + nEnd = TextFrameIndex(pStr->getLength()); } else { @@ -78,7 +78,8 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr, if ( pSI ) nScript = pSI->ScriptType( nPos ); else - nScript = static_cast<sal_uInt8>(g_pBreakIt->GetBreakIter()->getScriptType( *pStr, nPos )); + nScript = static_cast<sal_uInt8>( + g_pBreakIt->GetBreakIter()->getScriptType(*pStr, sal_Int32(nPos))); // Note: rInf.GetIdx() can differ from nPos, // e.g., when rPor is a field portion. nPos referes to the string passed @@ -152,18 +153,18 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr, // Note: We do not want to add space to an isolated latin blank in front // of some complex characters in RTL environment const bool bDoNotAddSpace = - LATIN == nScript && ( nEnd == nPos + 1 ) && pSI && + LATIN == nScript && (nEnd == nPos + TextFrameIndex(1)) && pSI && ( i18n::ScriptType::COMPLEX == - pSI->ScriptType( nPos + 1 ) ) && + pSI->ScriptType(nPos + TextFrameIndex(1))) && rInf.GetTextFrame() && rInf.GetTextFrame()->IsRightToLeft(); if ( bDoNotAddSpace ) return nCnt; - sal_Int32 nTextEnd = std::min(nEnd, pStr->getLength()); + TextFrameIndex nTextEnd = std::min(nEnd, TextFrameIndex(pStr->getLength())); for ( ; nPos < nTextEnd; ++nPos ) { - if( CH_BLANK == (*pStr)[ nPos ] ) + if (CH_BLANK == (*pStr)[ sal_Int32(nPos) ]) ++nCnt; } @@ -173,7 +174,7 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr, // nPos referes to the original string, even if a field string has // been passed to this function nPos = rInf.GetIdx() + rPor.GetLen(); - if ( nPos < rInf.GetText().getLength() ) + if (nPos < TextFrameIndex(rInf.GetText().getLength())) { sal_uInt8 nNextScript = 0; const SwLinePortion* pPor = rPor.GetPortion(); @@ -196,7 +197,8 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr, nNextScript = static_cast<sal_uInt8>(g_pBreakIt->GetBreakIter()->getScriptType( aStr, 0 )); } else - nNextScript = static_cast<sal_uInt8>(g_pBreakIt->GetBreakIter()->getScriptType( rInf.GetText(), nPos )); + nNextScript = static_cast<sal_uInt8>( + g_pBreakIt->GetBreakIter()->getScriptType(rInf.GetText(), sal_Int32(nPos))); if( ASIAN == nNextScript ) { @@ -574,7 +576,7 @@ TextFrameIndex SwTextPortion::GetSpaceCnt(const SwTextSizeInfo &rInf, TextFrameIndex& rCharCnt) const { sal_Int32 nCnt = 0; - sal_Int32 nPos = 0; + TextFrameIndex nPos(0); if ( rInf.SnapToGrid() ) { @@ -597,7 +599,7 @@ TextFrameIndex SwTextPortion::GetSpaceCnt(const SwTextSizeInfo &rInf, const_cast<SwTextSizeInfo &>(rInf).SetOnWin( bOldOnWin ); nCnt = nCnt + lcl_AddSpace( rInf, &aStr, *this ); - nPos = aStr.getLength(); + nPos = TextFrameIndex(aStr.getLength()); } } else if( !IsDropPortion() ) |