[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide' - 50 commits - include/o3tl sw/source
Michael Stahl
Michael.Stahl at cib.de
Fri May 4 16:51:05 UTC 2018
Rebased ref, commits from common ancestor:
commit e280e0f16f33bc4552c556ef2cde409b037333e5
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 18:47:38 2018 +0200
sw_redlinehide: trivial conversions in pormulti.cxx
Change-Id: I9f9e2aa60381f913419d06be04235486a40f0cc9
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index a8a64f49de01..2e4cbf836ccd 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -199,7 +199,7 @@ SwBidiPortion::SwBidiPortion(TextFrameIndex const nEnd, sal_uInt8 nLv)
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
@@ -217,12 +217,11 @@ bool SwBidiPortion::ChgSpaceAdd( SwLineLayout* pCurr, long nSpaceAdd ) const
TextFrameIndex SwBidiPortion::GetSpaceCnt(const SwTextSizeInfo &rInf) const
{
// Calculate number of blanks for justified alignment
- SwLinePortion* pPor = GetRoot().GetFirstPortion();
- sal_Int32 nTmpStart = rInf.GetIdx();
- sal_Int32 nNull = 0;
- sal_Int32 nBlanks;
+ TextFrameIndex nTmpStart = rInf.GetIdx();
+ TextFrameIndex nNull(0);
+ TextFrameIndex nBlanks(0);
- for( nBlanks = 0; pPor; pPor = pPor->GetPortion() )
+ for (SwLinePortion* pPor = GetRoot().GetFirstPortion(); pPor; pPor = pPor->GetPortion())
{
if( pPor->InTextGrp() )
nBlanks = nBlanks + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull );
@@ -283,7 +282,7 @@ SwDoubleLinePortion::SwDoubleLinePortion(
SetDouble();
const SvxTwoLinesItem* pTwo = static_cast<const SvxTwoLinesItem*>(rCreate.pItem);
if( pTwo )
- pBracket->nStart = 0;
+ pBracket->nStart = TextFrameIndex(0);
else
{
const SwTextAttr& rAttr = *rCreate.pAttr;
@@ -456,11 +455,11 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf )
{
SwLinePortion* pPor = GetRoot().GetFirstPortion();
- sal_Int32 nNull = 0;
- sal_Int32 nStart = rInf.GetIdx();
+ TextFrameIndex nNull(0);
+ TextFrameIndex nStart = rInf.GetIdx();
SetTab1( false );
SetTab2( false );
- for( nBlank1 = 0; pPor; pPor = pPor->GetPortion() )
+ for (nBlank1 = TextFrameIndex(0); pPor; pPor = pPor->GetPortion())
{
if( pPor->InTextGrp() )
nBlank1 = nBlank1 + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull );
@@ -474,7 +473,7 @@ void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf )
pPor = GetRoot().GetNext()->GetFirstPortion();
nLineDiff -= GetRoot().GetNext()->Width();
}
- for( nBlank2 = 0; pPor; pPor = pPor->GetPortion() )
+ for (nBlank2 = TextFrameIndex(0); pPor; pPor = pPor->GetPortion())
{
if( pPor->InTextGrp() )
nBlank2 = nBlank2 + static_cast<SwTextPortion*>(pPor)->GetSpaceCnt( rInf, nNull );
@@ -487,7 +486,7 @@ void SwDoubleLinePortion::CalcBlanks( SwTextFormatInfo &rInf )
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.
@@ -511,12 +510,12 @@ bool SwDoubleLinePortion::ChgSpaceAdd( SwLineLayout* pCurr,
}
else
{
- sal_Int32 nMyBlank = GetSmallerSpaceCnt();
- sal_Int32 nOther = GetSpaceCnt();
+ sal_Int32 const nMyBlank = sal_Int32(GetSmallerSpaceCnt());
+ sal_Int32 const nOther = sal_Int32(GetSpaceCnt());
SwTwips nMultiSpace = pCurr->GetLLSpaceAdd( 0 ) * nMyBlank + nOther * nSpaceAdd;
if( nMyBlank )
- nMultiSpace /= nMyBlank;
+ nMultiSpace /= sal_Int32(nMyBlank);
// pCurr->SetLLSpaceAdd( nMultiSpace, 0 );
// #i65711# SetLLSpaceAdd replaces the first value,
@@ -599,7 +598,7 @@ SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt,
else
pRubyFont = nullptr;
- OUString aStr = rRuby.GetText().copy( nOffs );
+ OUString aStr = rRuby.GetText().copy( sal_Int32(nOffs) );
SwFieldPortion *pField = new SwFieldPortion( aStr, pRubyFont );
pField->SetNextOffset( nOffs );
pField->SetFollow( true );
@@ -639,7 +638,7 @@ SwRubyPortion::SwRubyPortion( const SwMultiCreator& rCreate, const SwFont& rFnt,
void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
{
SwTwips nLineDiff = GetRoot().Width() - GetRoot().GetNext()->Width();
- sal_Int32 nOldIdx = rInf.GetIdx();
+ TextFrameIndex const nOldIdx = rInf.GetIdx();
if( !nLineDiff )
return;
SwLineLayout *pCurr;
@@ -659,17 +658,17 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
}
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_Int32 nSub = 0;
+ TextFrameIndex nSub(0);
switch ( nAdjustment )
{
case css::text::RubyAdjust_CENTER: nRight = static_cast<sal_uInt16>(nLineDiff / 2);
SAL_FALLTHROUGH;
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;
case css::text::RubyAdjust_INDENT_BLOCK:
{
- sal_Int32 nCharCnt = 0;
+ TextFrameIndex nCharCnt(0);
SwLinePortion *pPor;
for( pPor = pCurr->GetFirstPortion(); pPor; pPor = pPor->GetPortion() )
{
@@ -679,7 +678,7 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
}
if( nCharCnt > nSub )
{
- SwTwips nCalc = nLineDiff / ( nCharCnt - nSub );
+ SwTwips nCalc = nLineDiff / sal_Int32(nCharCnt - nSub);
short nTmp;
if( nCalc < SHRT_MAX )
nTmp = -short(nCalc);
@@ -687,7 +686,7 @@ void SwRubyPortion::Adjust_( SwTextFormatInfo &rInf )
nTmp = SHRT_MIN;
pCurr->CreateSpaceAdd( SPACING_PRECISION_FACTOR * nTmp );
- nLineDiff -= nCalc * ( nCharCnt - 1 );
+ nLineDiff -= nCalc * (sal_Int32(nCharCnt) - 1);
}
if( nLineDiff > 1 )
{
@@ -747,7 +746,7 @@ void SwRubyPortion::CalcRubyOffset()
if( pField->HasFollow() )
nRubyOffset = pField->GetNextOffset();
else
- nRubyOffset = COMPLETE_STRING;
+ nRubyOffset = TextFrameIndex(COMPLETE_STRING);
}
}
@@ -831,17 +830,17 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
sal_uInt8 nNextLevel = nCurrLevel;
bool bFieldBidi = false;
- if ( rPos < GetText().getLength() && CH_TXTATR_BREAKWORD == GetChar( rPos ) )
+ if (rPos < TextFrameIndex(GetText().getLength()) && CH_TXTATR_BREAKWORD == GetChar(rPos))
{
bFieldBidi = true;
}
else
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 );
- if ( COMPLETE_STRING == rPos )
+ rPos = bFieldBidi ? rPos + TextFrameIndex(1) : rSI.NextDirChg(rPos, &nCurrLevel);
+ if (TextFrameIndex(COMPLETE_STRING) == rPos)
return nullptr;
SwMultiCreator *pRet = new SwMultiCreator;
pRet->pItem = nullptr;
@@ -923,7 +922,7 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
return pRet;
}
if( n2Lines < nCount || ( pItem && pItem == p2Lines &&
- rPos < GetText().getLength() ) )
+ rPos < TextFrameIndex(GetText().getLength())))
{ // The winner is a 2-line-attribute,
// the end of the multiportion depends on the following attributes...
SwMultiCreator *pRet = new SwMultiCreator;
@@ -1038,8 +1037,8 @@ SwMultiCreator* SwTextSizeInfo::GetMultiCreator(TextFrameIndex &rPos,
rPos = aEnd.back();
return pRet;
}
- if( nRotate < nCount || ( pRotItem && pRotItem == pRotate &&
- rPos < GetText().getLength() ) )
+ if (nRotate < nCount || ( pRotItem && pRotItem == pRotate &&
+ rPos < TextFrameIndex(GetText().getLength())))
{ // The winner is a rotate-attribute,
// the end of the multiportion depends on the following attributes...
SwMultiCreator *pRet = new SwMultiCreator;
@@ -1328,10 +1327,10 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
rMulti.GetPortion()->PrePaint( GetInfo(), &rMulti );
// 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 nOldY = GetInfo().Y();
- sal_Int32 nOldIdx = GetInfo().GetIdx();
+ TextFrameIndex const nOldIdx = GetInfo().GetIdx();
SwSpaceManipulator aManip( GetInfo(), rMulti );
@@ -1356,7 +1355,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
if( rMulti.HasBrackets() )
{
- sal_Int32 nTmpOldIdx = GetInfo().GetIdx();
+ TextFrameIndex const nTmpOldIdx = GetInfo().GetIdx();
GetInfo().SetIdx(static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart);
SeekAndChg( GetInfo() );
static_cast<SwDoubleLinePortion&>(rMulti).PaintBracket( GetInfo(), 0, true );
@@ -1595,7 +1594,7 @@ void SwTextPainter::PaintMultiPortion( const SwRect &rPaint,
if( rMulti.HasBrackets() )
{
- sal_Int32 nTmpOldIdx = GetInfo().GetIdx();
+ TextFrameIndex const nTmpOldIdx = GetInfo().GetIdx();
GetInfo().SetIdx(static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart);
SeekAndChg( GetInfo() );
GetInfo().X( nOldX );
@@ -1639,20 +1638,20 @@ static bool lcl_ExtractFieldFollow( SwLineLayout* pLine, SwLinePortion* &rpField
// next line, this function is called to truncate
// the rest of the remaining multi portion
static void lcl_TruncateMultiPortion( SwMultiPortion& rMulti, SwTextFormatInfo& rInf,
- sal_Int32 nStartIdx )
+ TextFrameIndex const nStartIdx)
{
rMulti.GetRoot().Truncate();
- rMulti.GetRoot().SetLen(0);
+ rMulti.GetRoot().SetLen(TextFrameIndex(0));
rMulti.GetRoot().Width(0);
// rMulti.CalcSize( *this, aInf );
if ( rMulti.GetRoot().GetNext() )
{
rMulti.GetRoot().GetNext()->Truncate();
- rMulti.GetRoot().GetNext()->SetLen( 0 );
+ rMulti.GetRoot().GetNext()->SetLen(TextFrameIndex(0));
rMulti.GetRoot().GetNext()->Width( 0 );
}
rMulti.Width( 0 );
- rMulti.SetLen(0);
+ rMulti.SetLen(TextFrameIndex(0));
rInf.SetIdx( nStartIdx );
}
@@ -1667,7 +1666,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
if( rMulti.HasBrackets() )
{
- sal_Int32 nOldIdx = rInf.GetIdx();
+ TextFrameIndex const nOldIdx = rInf.GetIdx();
rInf.SetIdx( static_cast<SwDoubleLinePortion&>(rMulti).GetBrackets()->nStart );
SeekAndChg( rInf );
nOldX = GetInfo().X();
@@ -1739,11 +1738,11 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
pMulti = &rMulti;
SwLineLayout *pOldCurr = m_pCurr;
- sal_Int32 nOldStart = GetStart();
+ TextFrameIndex const nOldStart = GetStart();
SwTwips nMinWidth = nTmpX + 1;
SwTwips nActWidth = nMaxWidth;
- const sal_Int32 nStartIdx = rInf.GetIdx();
- sal_Int32 nMultiLen = rMulti.GetLen();
+ const TextFrameIndex nStartIdx = rInf.GetIdx();
+ TextFrameIndex nMultiLen = rMulti.GetLen();
SwLinePortion *pFirstRest;
SwLinePortion *pSecondRest;
@@ -1776,7 +1775,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
std::shared_ptr<vcl::TextLayoutCache> const pOldCachedVclData(rInf.GetCachedVclData());
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 );
SwTextFormatInfo aInf( rInf, rMulti.GetRoot(), nActWidth );
// Do we allow break cuts? The FirstMulti-Flag is evaluated during
@@ -1844,7 +1843,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
// second line has to be formatted
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();
m_pCurr->SetNext( new SwLineLayout() );
m_pCurr = m_pCurr->GetNext();
@@ -1945,7 +1944,7 @@ bool SwTextFormatter::BuildMultiPortion( SwTextFormatInfo &rInf,
SetPropFont( 0 );
rMulti.SetLen( rMulti.GetRoot().GetLen() + ( rMulti.GetRoot().GetNext() ?
- rMulti.GetRoot().GetNext()->GetLen() : 0 ) );
+ rMulti.GetRoot().GetNext()->GetLen() : TextFrameIndex(0) ) );
if( rMulti.IsDouble() )
{
@@ -2132,7 +2131,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
{
if( !nPosition )
return nullptr;
- sal_Int32 nMultiPos = nPosition - pLine->GetLen();
+ TextFrameIndex nMultiPos = nPosition - pLine->GetLen();
const SwMultiPortion *pTmpMulti = nullptr;
const SwMultiPortion *pHelpMulti = nullptr;
const SwLinePortion* pPor = pLine->GetFirstPortion();
@@ -2194,7 +2193,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
SwLinePortion *pRest = nullptr;
if( pField )
{
- const SwTextAttr *pHint = GetAttr( nPosition - 1 );
+ const SwTextAttr *pHint = GetAttr(nPosition - TextFrameIndex(1));
if ( pHint
&& ( pHint->Which() == RES_TXTATR_FIELD
|| pHint->Which() == RES_TXTATR_ANNOTATION ) )
@@ -2227,7 +2226,7 @@ SwLinePortion* SwTextFormatter::MakeRestPortion( const SwLineLayout* pLine,
return pRest;
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;
if( pHelpMulti->IsDouble() )
@@ -2291,7 +2290,7 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
{
bSpaceChg = pMulti->ChgSpaceAdd( pCursor->m_pCurr, nSpaceAdd );
- sal_Int32 nSpaceCnt;
+ TextFrameIndex nSpaceCnt;
if ( pMulti->IsDouble() )
{
pCursor->SetPropFont( 50 );
@@ -2299,14 +2298,14 @@ SwTextCursorSave::SwTextCursorSave( SwTextCursor* pCursor,
}
else
{
- const sal_Int32 nOldIdx = pCursor->GetInfo().GetIdx();
+ TextFrameIndex const nOldIdx = pCursor->GetInfo().GetIdx();
pCursor->GetInfo().SetIdx ( nCurrStart );
nSpaceCnt = static_cast<SwBidiPortion*>(pMulti)->GetSpaceCnt(pCursor->GetInfo());
pCursor->GetInfo().SetIdx ( nOldIdx );
}
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
// end of the portion
commit ef616e21e90ef80ad63e839b03099ceafe82d79f
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 18:15:00 2018 +0200
sw_redlinehide: trivial conversions in porlin.cxx
Change-Id: Iac5e40c045a7a71c446c2eb1181f375e88df2011
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 670209ee4d5e..ca4080becbac 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -227,7 +227,7 @@ TextFrameIndex SwLinePortion::GetCursorOfst(const sal_uInt16 nOfst) const
if( nOfst > ( PrtWidth() / 2 ) )
return GetLen();
else
- return 0;
+ return TextFrameIndex(0);
}
SwPosSize SwLinePortion::GetTextSize( const SwTextSizeInfo & ) const
commit bcf9b1926222e477b25f5a215acf8677c1fa9de8
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 18:12:38 2018 +0200
sw_redlinehide: trivial conversions in porlay.cxx
Change-Id: Ica73ca5c1bd36454c69cb391882be5783357d81a
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 0fa81d77cfb8..e8fb45c23b86 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -247,7 +247,7 @@ SwMarginPortion *SwLineLayout::CalcLeftMargin()
{
pLeft->Height( 0 );
pLeft->Width( 0 );
- pLeft->SetLen( 0 );
+ pLeft->SetLen(TextFrameIndex(0));
pLeft->SetAscent( 0 );
pLeft->SetPortion( nullptr );
pLeft->SetFixWidth(0);
@@ -285,12 +285,12 @@ void SwLineLayout::CreateSpaceAdd( const long nInit )
}
// Returns true if there are only blanks in [nStt, nEnd[
-static bool lcl_HasOnlyBlanks( const OUString& rText, sal_Int32 nStt, sal_Int32 nEnd )
+static bool lcl_HasOnlyBlanks(const OUString& rText, TextFrameIndex nStt, TextFrameIndex nEnd)
{
bool bBlankOnly = true;
while ( nStt < nEnd )
{
- const sal_Unicode cChar = rText[ nStt++ ];
+ const sal_Unicode cChar = rText[ sal_Int32(nStt++) ];
if ( ' ' != cChar && 0x3000 != cChar )
{
bBlankOnly = false;
@@ -369,7 +369,7 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf )
continue;
}
- const sal_Int32 nPorSttIdx = rInf.GetLineStart() + nLineLength;
+ TextFrameIndex const nPorSttIdx = rInf.GetLineStart() + nLineLength;
nLineLength += pPos->GetLen();
AddPrtWidth( pPos->Width() );
@@ -644,8 +644,9 @@ SwLinePortion *SwLineLayout::GetFirstPortion() const
SwCharRange &SwCharRange::operator+=(const SwCharRange &rRange)
{
- if(0 != rRange.nLen ) {
- if(0 == nLen) {
+ if (TextFrameIndex(0) != rRange.nLen)
+ {
+ if (TextFrameIndex(0) == nLen) {
nStart = rRange.nStart;
nLen = rRange.nLen ;
}
@@ -2055,7 +2056,7 @@ void SwLineLayout::Init( SwLinePortion* pNextPortion )
{
Height( 0 );
Width( 0 );
- SetLen( 0 );
+ SetLen(TextFrameIndex(0));
SetAscent( 0 );
SetRealHeight( 0 );
SetPortion( pNextPortion );
commit 4b2ea2ded0270f57b0a2816496b137d5031b2d54
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 18:03:14 2018 +0200
sw_redlinehide: trivial conversions in porglue.cxx
Change-Id: Id8ddc1abaa68448ab8445550ce38dbbfd208a380
diff --git a/sw/source/core/text/porglue.cxx b/sw/source/core/text/porglue.cxx
index 38092d79a3fc..888596ac60be 100644
--- a/sw/source/core/text/porglue.cxx
+++ b/sw/source/core/text/porglue.cxx
@@ -36,18 +36,19 @@ SwGluePortion::SwGluePortion( const sal_uInt16 nInitFixWidth )
TextFrameIndex SwGluePortion::GetCursorOfst(const sal_uInt16 nOfst) const
{
- if( !GetLen() || nOfst > GetLen() || !Width() )
+ // FIXME why nOfst > GetLen() ? is that supposed to be > Width() ?
+ if( !GetLen() || nOfst > sal_Int32(GetLen()) || !Width() )
return SwLinePortion::GetCursorOfst( nOfst );
else
- return nOfst / (Width() / GetLen());
+ return TextFrameIndex(nOfst / (Width() / sal_Int32(GetLen())));
}
SwPosSize SwGluePortion::GetTextSize( const SwTextSizeInfo &rInf ) const
{
- if( 1 >= GetLen() || rInf.GetLen() > GetLen() || !Width() || !GetLen() )
+ if (TextFrameIndex(1) >= GetLen() || rInf.GetLen() > GetLen() || !Width() || !GetLen())
return SwPosSize(*this);
else
- return SwPosSize( (Width() / GetLen()) * rInf.GetLen(), Height() );
+ return SwPosSize((Width() / sal_Int32(GetLen())) * sal_Int32(rInf.GetLen()), Height());
}
bool SwGluePortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const
@@ -56,7 +57,7 @@ bool SwGluePortion::GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) co
rInf.GetOpt().IsBlank() && rInf.IsNoSymbol() )
{
OUStringBuffer aBuf;
- comphelper::string::padToLength(aBuf, GetLen(), CH_BULLET);
+ comphelper::string::padToLength(aBuf, sal_Int32(GetLen()), CH_BULLET);
rText = aBuf.makeStringAndClear();
return true;
}
@@ -71,10 +72,10 @@ void SwGluePortion::Paint( const SwTextPaintInfo &rInf ) const
if( rInf.GetFont()->IsPaintBlank() )
{
OUStringBuffer aBuf;
- comphelper::string::padToLength(aBuf, GetFixWidth() / GetLen(), ' ');
+ comphelper::string::padToLength(aBuf, GetFixWidth() / sal_Int32(GetLen()), ' ');
OUString aText(aBuf.makeStringAndClear());
SwTextPaintInfo aInf( rInf, &aText );
- aInf.DrawText( *this, aText.getLength(), true );
+ aInf.DrawText(*this, TextFrameIndex(aText.getLength()), true);
}
if( rInf.OnWin() && rInf.GetOpt().IsBlank() && rInf.IsNoSymbol() )
@@ -84,7 +85,7 @@ void SwGluePortion::Paint( const SwTextPaintInfo &rInf ) const
OSL_ENSURE( CH_BLANK == cChar || CH_BULLET == cChar,
"SwGluePortion::Paint: blank expected" );
#endif
- if( 1 == GetLen() )
+ if (TextFrameIndex(1) == GetLen())
{
OUString aBullet( CH_BULLET );
SwPosSize aBulletSize( rInf.GetTextSize( aBullet ) );
@@ -96,7 +97,7 @@ void SwGluePortion::Paint( const SwTextPaintInfo &rInf ) const
aBulletPor.Width( aBulletSize.Width() );
aBulletPor.Height( aBulletSize.Height() );
aBulletPor.SetAscent( GetAscent() );
- aInf.DrawText( aBulletPor, aBullet.getLength(), true );
+ aInf.DrawText(aBulletPor, TextFrameIndex(aBullet.getLength()), true);
}
else
{
@@ -204,9 +205,9 @@ void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr )
// Blank previously swallowed by the Fly.
nRightGlue = nRightGlue - pFly->GetBlankWidth();
pFly->SubPrtWidth( pFly->GetBlankWidth() );
- pFly->SetLen( 0 );
+ pFly->SetLen(TextFrameIndex(0));
SwTextPortion *pNewPor = new SwTextPortion;
- pNewPor->SetLen( 1 );
+ pNewPor->SetLen(TextFrameIndex(1));
pNewPor->Height( pFly->Height() );
pNewPor->Width( pFly->GetBlankWidth() );
pFly->Insert( pNewPor );
@@ -244,7 +245,7 @@ void SwMarginPortion::AdjustRight( const SwLineLayout *pCurr )
!pHolePor->GetPortion()->InFixMargGrp() )
{
pPrev->AddPrtWidth( pHolePor->GetBlankWidth() );
- pPrev->SetLen( pPrev->GetLen() + 1 );
+ pPrev->SetLen(pPrev->GetLen() + TextFrameIndex(1));
pPrev->SetPortion( pHolePor->GetPortion() );
delete pHolePor;
}
commit fd02d29afbe8a4936b2bd14f3288044117237ca6
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 17:14:39 2018 +0200
sw_redlinehide: trivial conversions in porfld.cxx
Change-Id: Id4a80bcd6b530db0d27101397cebe06f26cba1e9
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 59591f67b343..bd1ebe840ef5 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -68,7 +68,7 @@ void SwFieldPortion::TakeNextOffset( const SwFieldPortion* pField )
{
OSL_ENSURE( pField, "TakeNextOffset: Missing Source" );
m_nNextOffset = pField->GetNextOffset();
- m_aExpand = m_aExpand.replaceAt( 0, m_nNextOffset, "" );
+ m_aExpand = m_aExpand.replaceAt(0, sal_Int32(m_nNextOffset), "");
m_bFollow = true;
}
@@ -140,8 +140,8 @@ class SwFieldSlot
std::shared_ptr<vcl::TextLayoutCache> m_pOldCachedVclData;
const OUString *pOldText;
OUString aText;
- sal_Int32 nIdx;
- sal_Int32 nLen;
+ TextFrameIndex nIdx;
+ TextFrameIndex nLen;
SwTextFormatInfo *pInf;
bool bOn;
public:
@@ -165,16 +165,16 @@ SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, const SwFieldPortion *pP
nLen = pInf->GetLen();
pOldText = &(pInf->GetText());
m_pOldCachedVclData = pInf->GetCachedVclData();
- pInf->SetLen( aText.getLength() );
+ pInf->SetLen(TextFrameIndex(aText.getLength()));
pInf->SetCachedVclData(nullptr);
if( pPor->IsFollow() )
{
pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() );
- pInf->SetIdx( 0 );
+ pInf->SetIdx(TextFrameIndex(0));
}
else
{
- aText = (*pOldText).replaceAt(nIdx, 1, aText);
+ aText = (*pOldText).replaceAt(sal_Int32(nIdx), 1, aText);
}
pInf->SetText( aText );
}
@@ -226,9 +226,9 @@ void SwFieldPortion::CheckScript( const SwTextSizeInfo &rInf )
// #i16354# Change script type for RTL text to CTL.
const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
// #i98418#
- const sal_uInt8 nFieldDir = ( IsNumberPortion() || IsFootnoteNumPortion() ) ?
- rSI.GetDefaultDir() :
- rSI.DirType( IsFollow() ? rInf.GetIdx() - 1 : rInf.GetIdx() );
+ const sal_uInt8 nFieldDir = (IsNumberPortion() || IsFootnoteNumPortion())
+ ? rSI.GetDefaultDir()
+ : rSI.DirType(IsFollow() ? rInf.GetIdx() - TextFrameIndex(1) : rInf.GetIdx());
{
UErrorCode nError = U_ZERO_ERROR;
@@ -291,10 +291,10 @@ void SwFieldPortion::CheckScript( const SwTextSizeInfo &rInf )
bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
{
// Scope wegen aDiffText::DTOR!
- sal_Int32 nRest;
+ TextFrameIndex nRest;
bool bFull = false;
bool bEOL = false;
- const sal_Int32 nTextRest = rInf.GetText().getLength() - rInf.GetIdx();
+ TextFrameIndex const nTextRest = TextFrameIndex(rInf.GetText().getLength()) - rInf.GetIdx();
{
SwFieldSlot aDiffText( &rInf, this );
SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() );
@@ -303,8 +303,8 @@ bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
// Field portion has to be split in several parts if
// 1. There are script/direction changes inside the field
// 2. There are portion breaks (tab, break) inside the field:
- const sal_Int32 nOldFullLen = rInf.GetLen();
- sal_Int32 nFullLen = rInf.ScanPortionEnd( rInf.GetIdx(), rInf.GetIdx() + nOldFullLen ) - rInf.GetIdx();
+ const TextFrameIndex nOldFullLen = rInf.GetLen();
+ TextFrameIndex nFullLen = rInf.ScanPortionEnd(rInf.GetIdx(), rInf.GetIdx() + nOldFullLen) - rInf.GetIdx();
if ( m_nNextScriptChg < nFullLen )
{
nFullLen = m_nNextScriptChg;
@@ -312,7 +312,7 @@ bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
}
rInf.SetLen( nFullLen );
- if ( COMPLETE_STRING != rInf.GetUnderScorePos() &&
+ if (TextFrameIndex(COMPLETE_STRING) != rInf.GetUnderScorePos() &&
rInf.GetUnderScorePos() > rInf.GetIdx() )
rInf.SetUnderScorePos( rInf.GetIdx() );
@@ -324,8 +324,8 @@ bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
// Length must be 0: the length is set for bFull after format
// and passed along in nRest. Or else the old length would be
// retained and be used for nRest!
- SetLen(0);
- const sal_Int32 nFollow = IsFollow() ? 0 : 1;
+ SetLen(TextFrameIndex(0));
+ TextFrameIndex const nFollow(IsFollow() ? 0 : 1);
// As odd is may seem: the query for GetLen() must return false due
// to the ExpandPortions _after_ aDiffText (see SoftHyphs), caused
@@ -338,9 +338,9 @@ bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
}
else
{
- sal_Int32 nOldLineStart = rInf.GetLineStart();
+ TextFrameIndex const nOldLineStart = rInf.GetLineStart();
if( IsFollow() )
- rInf.SetLineStart( 0 );
+ rInf.SetLineStart(TextFrameIndex(0));
rInf.SetNotEOL( nFullLen == nOldFullLen && nTextRest > nFollow );
// the height depending on the fields font is set,
@@ -354,13 +354,13 @@ bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
rInf.SetNotEOL( false );
rInf.SetLineStart( nOldLineStart );
}
- sal_Int32 nTmpLen = GetLen();
+ TextFrameIndex const nTmpLen = GetLen();
bEOL = !nTmpLen && nFollow && bFull;
nRest = nOldFullLen - nTmpLen;
// The char is held in the first position
// Unconditionally after format!
- SetLen( (m_bNoLength) ? 0 : nFollow );
+ SetLen( (m_bNoLength) ? TextFrameIndex(0) : nFollow );
if( nRest )
{
@@ -429,7 +429,7 @@ void SwFieldPortion::Paint( const SwTextPaintInfo &rInf ) const
{
SwFontSave aSave( rInf, m_pFont );
- OSL_ENSURE( GetLen() <= 1, "SwFieldPortion::Paint: rest-portion pollution?" );
+ OSL_ENSURE(GetLen() <= TextFrameIndex(1), "SwFieldPortion::Paint: rest-portion pollution?");
if( Width() && ( !m_bPlaceHolder || rInf.GetOpt().IsShowPlaceHolderFields() ) )
{
// A very liberal use of the background
@@ -515,7 +515,7 @@ SwNumberPortion::SwNumberPortion( const OUString &rExpand,
TextFrameIndex SwNumberPortion::GetCursorOfst(const sal_uInt16) const
{
- return 0;
+ return TextFrameIndex(0);
}
SwFieldPortion *SwNumberPortion::Clone( const OUString &rExpand ) const
@@ -538,7 +538,7 @@ bool SwNumberPortion::Format( SwTextFormatInfo &rInf )
{
SetHide( false );
const bool bFull = SwFieldPortion::Format( rInf );
- SetLen( 0 );
+ SetLen(TextFrameIndex(0));
// a numbering portion can be contained in a rotated portion!!!
nFixWidth = rInf.IsMulti() ? Height() : Width();
rInf.SetNumDone( !rInf.GetRest() );
@@ -823,7 +823,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
{
SwFieldPortion::Format( rInf );
nFollowedByWidth = Width();
- SetLen( 0 );
+ SetLen(TextFrameIndex(0));
}
Width( nFixWidth + nFollowedByWidth );
const bool bFull = rInf.Width() < rInf.X() + Width();
@@ -838,7 +838,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
Width( rInf.Width() - static_cast<sal_uInt16>(rInf.X()) );
if( bFly )
{
- SetLen( 0 );
+ SetLen(TextFrameIndex(0));
m_bNoPaint = true;
rInf.SetNumDone( false );
return true;
@@ -1067,7 +1067,7 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rText )
, nLowPos(0)
, nProportion(55)
{
- SetLen(1);
+ SetLen(TextFrameIndex(1));
SetWhichPor( POR_COMBINED );
if( m_aExpand.getLength() > 6 )
m_aExpand = m_aExpand.copy( 0, 6 );
@@ -1092,7 +1092,7 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rText )
void SwCombinedPortion::Paint( const SwTextPaintInfo &rInf ) const
{
- OSL_ENSURE( GetLen() <= 1, "SwFieldPortion::Paint: rest-portion pollution?" );
+ OSL_ENSURE(GetLen() <= TextFrameIndex(1), "SwFieldPortion::Paint: rest-portion pollution?");
if( !Width() )
return;
@@ -1137,7 +1137,7 @@ void SwCombinedPortion::Paint( const SwTextPaintInfo &rInf ) const
}
}
const_cast<SwTextPaintInfo&>(rInf).SetPos( aOutPos );
- rInf.DrawText( m_aExpand, *this, i, 1 );
+ rInf.DrawText( m_aExpand, *this, i, TextFrameIndex(1) );
}
// rInf is const, so we have to take back our manipulations
const_cast<SwTextPaintInfo&>(rInf).SetPos( aOldPos );
@@ -1299,7 +1299,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
{
Truncate();
Width( 0 );
- SetLen( 0 );
+ SetLen(TextFrameIndex(0));
if( rInf.GetLast() )
rInf.GetLast()->FormatEOL( rInf );
}
commit 1df5d290f8e7cbe1c4ee2e32aac953b366ff3a72
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 16:58:10 2018 +0200
sw: add back this OSL_ENSURE for now, it was checking the wrong variable
Change-Id: I4dc8eed525b891ade9951f92d497069ca5e335a7
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 1a345f92afd3..084652baa9bf 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -196,6 +196,7 @@ TextFrameIndex SwTextFrame::CalcFlyPos( SwFrameFormat const * pSearch )
}
}
}
+ OSL_ENSURE(false, "CalcFlyPos: Not Found!");
return TextFrameIndex(COMPLETE_STRING);
}
commit 243276e5a875c8e668e5d4629e6500ab752cc14f
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 16:55:06 2018 +0200
sw_redlinehide: convert SwTextFrame::CalcFlyPos with MergedAttrIter
Change-Id: Ib3a954763f8aa901ea487019b006b16c27dd4e90
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index b641b8352607..1a345f92afd3 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -184,25 +184,19 @@ void SwTextFrame::MoveFlyInCnt(SwTextFrame *pNew,
TextFrameIndex SwTextFrame::CalcFlyPos( SwFrameFormat const * pSearch )
{
- SwpHints* pHints = GetTextNode()->GetpSwpHints();
- OSL_ENSURE( pHints, "CalcFlyPos: Why me?" );
- if( !pHints )
- return TextFrameIndex(COMPLETE_STRING);
- SwTextAttr* pFound = nullptr;
- for ( size_t i = 0; i < pHints->Count(); ++i )
+ sw::MergedAttrIter iter(this);
+ for (SwTextAttr const* pHt = iter.NextAttr(); pHt; pHt = iter.NextAttr())
{
- SwTextAttr *pHt = pHints->Get( i );
if( RES_TXTATR_FLYCNT == pHt->Which() )
{
SwFrameFormat* pFrameFormat = pHt->GetFlyCnt().GetFrameFormat();
if( pFrameFormat == pSearch )
- pFound = pHt;
+ {
+ return TextFrameIndex(pHt->GetStart());
+ }
}
}
- OSL_ENSURE( pHints, "CalcFlyPos: Not Found!" );
- if( !pFound )
- return TextFrameIndex(COMPLETE_STRING);
- return pFound->GetStart();
+ return TextFrameIndex(COMPLETE_STRING);
}
void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const
commit bb45a16f153916e95ce54d31b15a0c25430413e2
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 16:47:19 2018 +0200
sw_redlinehide: add a iterator for all the text attributes in merged
paragraph, because one SwAttrIter isn't enough for everyone.
Change-Id: Iceff5c26a98bdcc09c0a810b9ac8ca77aa750c17
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index cf0ebe4d05da..e96c1d15c538 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -831,6 +831,24 @@ public:
~SwDigitModeModifier();
};
+namespace sw {
+
+struct MergedPara;
+
+/// iterate SwTextAttr in potentially merged text frame
+class MergedAttrIter
+{
+ sw::MergedPara const* m_pMerged;
+ SwTextNode const* m_pNode;
+ size_t m_CurrentExtent;
+ size_t m_CurrentHint;
+public:
+ MergedAttrIter(SwTextFrame const*const pFrame);
+ SwTextAttr const* NextAttr();
+};
+
+} // namespace sw
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 73ff2c1b88c4..9507e36805e9 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -80,6 +80,73 @@
#include <ftnidx.hxx>
+namespace sw {
+
+ MergedAttrIter::MergedAttrIter(SwTextFrame const*const pFrame)
+ : m_CurrentExtent(0)
+ , m_CurrentHint(0)
+ {
+ SwParaPortion const*const pPara(pFrame->GetPara());
+ assert(pPara);
+ m_pMerged = pPara->GetMergedPara();
+ if (!m_pMerged)
+ {
+ m_pNode = pFrame->GetTextNode();
+ }
+ }
+
+ SwTextAttr const* MergedAttrIter::NextAttr()
+ {
+ if (m_pMerged)
+ {
+ while (m_CurrentExtent < m_pMerged->extents.size())
+ {
+ sw::Extent const& rExtent(m_pMerged->extents[m_CurrentExtent]);
+ if (0 < m_CurrentExtent &&
+ rExtent.pNode != m_pMerged->extents[m_CurrentExtent-1].pNode)
+ {
+ m_CurrentHint = 0; //reset
+ }
+ SwpHints const*const pHints(rExtent.pNode->GetpSwpHints());
+ if (pHints)
+ {
+ while (m_CurrentHint < pHints->Count())
+ {
+ SwTextAttr const*const pHint(pHints->Get(m_CurrentHint));
+ if (rExtent.nEnd < pHint->GetStart())
+ {
+ break;
+ }
+ ++m_CurrentHint;
+ if (rExtent.nStart <= pHint->GetStart())
+ {
+ return pHint;
+ }
+ }
+ }
+ ++m_CurrentExtent;
+ }
+ return nullptr;
+ }
+ else
+ {
+ SwpHints const*const pHints(m_pNode->GetpSwpHints());
+ if (pHints)
+ {
+ while (m_CurrentHint < pHints->Count())
+ {
+ SwTextAttr const*const pHint(pHints->Get(m_CurrentHint));
+ ++m_CurrentHint;
+ return pHint;
+ }
+ }
+ return nullptr;
+ }
+ }
+
+
+} // namespace sw
+
/// Switches width and height of the text frame
void SwTextFrame::SwapWidthAndHeight()
{
commit 00e72f6a72bb39a9b211c8c1c51546a02666de23
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 15:37:27 2018 +0200
sw_redlinehide: trivial conversions in porfly.cxx
Change-Id: I129eaabeb173ccf8d5530bf3afc9f1cb1b749f9e
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index e383181d7fd3..b641b8352607 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -72,14 +72,15 @@ bool SwFlyPortion::Format( SwTextFormatInfo &rInf )
rInf.GetParaPortion()->SetFly();
// trailing blank:
- if( rInf.GetIdx() < rInf.GetText().getLength() && 1 < rInf.GetIdx()
+ if( rInf.GetIdx() < TextFrameIndex(rInf.GetText().getLength())
+ && TextFrameIndex(1) < rInf.GetIdx()
&& !rInf.GetRest()
&& ' ' == rInf.GetChar( rInf.GetIdx() )
- && ' ' != rInf.GetChar( rInf.GetIdx() - 1 )
+ && ' ' != rInf.GetChar(rInf.GetIdx() - TextFrameIndex(1))
&& ( !rInf.GetLast() || !rInf.GetLast()->IsBreakPortion() ) )
{
SetBlankWidth( rInf.GetTextSize(OUString(' ')).Width() );
- SetLen( 1 );
+ SetLen(TextFrameIndex(1));
}
const sal_uInt16 nNewWidth = static_cast<sal_uInt16>(rInf.X() + PrtWidth());
@@ -126,7 +127,7 @@ bool SwFlyCntPortion::Format( SwTextFormatInfo &rInf )
rInf.SetNewLine( true );
Width(0);
SetAscent(0);
- SetLen(0);
+ SetLen(TextFrameIndex(0));
if( rInf.GetLast() )
rInf.GetLast()->FormatEOL( rInf );
@@ -161,8 +162,8 @@ void SwTextFrame::MoveFlyInCnt(SwTextFrame *pNew,
if (rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
{
const SwPosition* pPos = rAnch.GetContentAnchor();
- const sal_Int32 nIdx = pPos->nContent.GetIndex();
- if ( nIdx >= nStart && nEnd > nIdx )
+ TextFrameIndex const nIndex(MapModelToViewPos(*pPos));
+ if (nStart <= nIndex && nIndex < nEnd)
{
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) != nullptr )
{
@@ -186,7 +187,7 @@ TextFrameIndex SwTextFrame::CalcFlyPos( SwFrameFormat const * pSearch )
SwpHints* pHints = GetTextNode()->GetpSwpHints();
OSL_ENSURE( pHints, "CalcFlyPos: Why me?" );
if( !pHints )
- return COMPLETE_STRING;
+ return TextFrameIndex(COMPLETE_STRING);
SwTextAttr* pFound = nullptr;
for ( size_t i = 0; i < pHints->Count(); ++i )
{
@@ -200,7 +201,7 @@ TextFrameIndex SwTextFrame::CalcFlyPos( SwFrameFormat const * pSearch )
}
OSL_ENSURE( pHints, "CalcFlyPos: Not Found!" );
if( !pFound )
- return COMPLETE_STRING;
+ return TextFrameIndex(COMPLETE_STRING);
return pFound->GetStart();
}
@@ -258,7 +259,7 @@ SwFlyCntPortion::SwFlyCntPortion()
: m_bMax(false)
, m_eAlign(sw::LineAlign::NONE)
{
- nLineLength = 1;
+ nLineLength = TextFrameIndex(1);
SetWhichPor(POR_FLYCNT);
}
commit 3794ca752ac0fa434f53ea69bcf4ba202b41b73d
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 14:59:58 2018 +0200
sw_redlinehide: trivial conversions in porexp.cxx
Change-Id: I203b3c0655a3bab47b5f272d8af2658a3d350315
diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index 874ab368804a..aa9f1f62f576 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -47,7 +47,7 @@ SwPosSize SwExpandPortion::GetTextSize( const SwTextSizeInfo &rInf ) const
bool SwExpandPortion::Format( SwTextFormatInfo &rInf )
{
SwTextSlot aDiffText( &rInf, this, true, false );
- const sal_Int32 nFullLen = rInf.GetLen();
+ TextFrameIndex const nFullLen = rInf.GetLen();
// As odd as it may seem: the query for GetLen() must return
// false due to the ExpandPortions _after_ the aDiffText (see SoftHyphs)
@@ -116,8 +116,12 @@ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTextFormatInfo &rInf,
// If a Blank is preceding us, we do not need to trigger underflow
// If a Blank is succeeding us, we do not need to pass on the underflow
- if (bUnderflow && nIdx + 1 < rInf.GetText().getLength() && CH_BLANK == rInf.GetText()[nIdx + 1])
+ if (bUnderflow
+ && nIdx + TextFrameIndex(1) < TextFrameIndex(rInf.GetText().getLength())
+ && CH_BLANK == rInf.GetText()[sal_Int32(nIdx) + 1])
+ {
return 0;
+ }
if( nIdx && !const_cast<SwTextFormatInfo&>(rInf).GetFly() )
{
while( pPos && !pPos->IsFlyPortion() )
@@ -127,7 +131,7 @@ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTextFormatInfo &rInf,
// We check to see if there are useful line breaks, blanks or fields etc. left
// In case there still are some, no underflow
// If there are Flys, we still allow the underflow
- sal_Int32 nBlank = nIdx;
+ TextFrameIndex nBlank = nIdx;
while( --nBlank > rInf.GetLineStart() )
{
const sal_Unicode cCh = rInf.GetChar( nBlank );
@@ -140,8 +144,10 @@ sal_uInt16 SwBlankPortion::MayUnderflow( const SwTextFormatInfo &rInf,
return 0;
}
}
- sal_Unicode cCh;
- if( nIdx < 2 || CH_BLANK == (cCh = rInf.GetChar( nIdx - 1 )) )
+ if (nIdx < TextFrameIndex(2))
+ return 1;
+ sal_Unicode const cCh(rInf.GetChar(nIdx - TextFrameIndex(1)));
+ if (CH_BLANK == cCh)
return 1;
if( CH_BREAK == cCh )
return 0;
@@ -207,7 +213,7 @@ void SwBlankPortion::HandlePortion( SwPortionHandler& rPH ) const
SwPostItsPortion::SwPostItsPortion( bool bScrpt )
: bScript( bScrpt )
{
- nLineLength = 1;
+ nLineLength = TextFrameIndex(1);
SetWhichPor( POR_POSTITS );
}
commit d7c07d0b1109d71f4bfe329605923a3c679790b4
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 14:37:38 2018 +0200
sw_redlinehide: convert header SwPortionHandler.hxx
Change-Id: Iff9eae2410a9a2497a78a51a9165ab8ace09ee46
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 48be5185f308..14b00e1b3dd4 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -96,7 +96,8 @@ SwAccessiblePortionData::~SwAccessiblePortionData()
{
}
-void SwAccessiblePortionData::Text(sal_Int32 nLength, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/)
+void SwAccessiblePortionData::Text(TextFrameIndex const nLength,
+ sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/)
{
OSL_ENSURE( (m_nModelPosition + nLength) <= m_pTextNode->GetText().getLength(),
"portion exceeds model string!" );
@@ -126,7 +127,8 @@ void SwAccessiblePortionData::SetAttrFieldType( sal_uInt16 nAttrFieldType )
}
void SwAccessiblePortionData::Special(
- sal_Int32 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/, const SwFont* /*pFont*/)
+ TextFrameIndex const nLength, const OUString& rText, sal_uInt16 nType,
+ sal_Int32 /*nHeight*/, sal_Int32 /*nWidth*/, const SwFont* /*pFont*/)
{
OSL_ENSURE( m_nModelPosition >= 0, "illegal position" );
OSL_ENSURE( (m_nModelPosition + nLength) <= m_pTextNode->GetText().getLength(),
@@ -215,7 +217,7 @@ void SwAccessiblePortionData::LineBreak(sal_Int32 /*nWidth*/)
m_aLineBreaks.push_back( m_aBuffer.getLength() );
}
-void SwAccessiblePortionData::Skip(sal_Int32 nLength)
+void SwAccessiblePortionData::Skip(TextFrameIndex const nLength)
{
OSL_ENSURE( !m_bFinished, "We are already done!" );
OSL_ENSURE( m_aModelPositions.empty(), "Never Skip() after portions" );
diff --git a/sw/source/core/access/accportions.hxx b/sw/source/core/access/accportions.hxx
index 69d0259f760e..d104728da5ad 100644
--- a/sw/source/core/access/accportions.hxx
+++ b/sw/source/core/access/accportions.hxx
@@ -96,10 +96,10 @@ public:
virtual ~SwAccessiblePortionData() override;
// SwPortionHandler methods
- virtual void Text(sal_Int32 nLength, sal_uInt16 nType, sal_Int32 nHeight = 0, sal_Int32 nWidth = 0) override;
- virtual void Special(sal_Int32 nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 nHeight = 0, sal_Int32 nWidth = 0, const SwFont* pFont = nullptr) override;
+ virtual void Text(TextFrameIndex nLength, sal_uInt16 nType, sal_Int32 nHeight = 0, sal_Int32 nWidth = 0) override;
+ virtual void Special(TextFrameIndex nLength, const OUString& rText, sal_uInt16 nType, sal_Int32 nHeight = 0, sal_Int32 nWidth = 0, const SwFont* pFont = nullptr) override;
virtual void LineBreak(sal_Int32 nWidth) override;
- virtual void Skip(sal_Int32 nLength) override;
+ virtual void Skip(TextFrameIndex nLength) override;
virtual void Finish() override;
virtual void SetAttrFieldType( sal_uInt16 nAttrFieldType ) override;
diff --git a/sw/source/core/inc/SwPortionHandler.hxx b/sw/source/core/inc/SwPortionHandler.hxx
index 7f8882071b9c..ec3c5d4de392 100644
--- a/sw/source/core/inc/SwPortionHandler.hxx
+++ b/sw/source/core/inc/SwPortionHandler.hxx
@@ -21,6 +21,7 @@
#define INCLUDED_SW_SOURCE_CORE_INC_SWPORTIONHANDLER_HXX
#include <swtypes.hxx>
+#include "TextFrameIndex.hxx"
class SwFont;
@@ -33,8 +34,8 @@ class SwFont;
* any other portion. Additionally, the linebreak() method is called
* once at the end of every on-screen line.
*
- * All parameters relate to the 'model string', which is the text string
- * held by the corresponding SwTextNode.
+ * All parameters relate to the 'view string', which is the text string
+ * held by the sequence of all corresponding SwTextFrames.
*
* The SwPortionHandler can be used with the
* SwTextFrame::VisitPortions(...) method.
@@ -47,14 +48,14 @@ public:
virtual ~SwPortionHandler() {} /// (empty) destructor
- /** text portion. A run of nLength characters from the model
+ /** text portion. A run of nLength characters from the view
* string, that contains no special characters like embedded
* fields, etc. Thus, the on-screen text of this portion
* corresponds exactly to the corresponding characters in the
- * model string.
+ * view string.
*/
virtual void Text(
- sal_Int32 nLength, /// length of this portion in the model string
+ TextFrameIndex nLength, ///< length of this portion in the view string
sal_uInt16 nType, /// type of this portion
sal_Int32 nHeight = 0, /// height of this portion
sal_Int32 nWidth = 0 /// width of this portion
@@ -62,11 +63,11 @@ public:
/** special portion. This method is called for every non-text
* portion. The parameters describe the length of the
- * corresponding characters in the model string (often 0 or 1),
+ * corresponding characters in the view string (often 0 or 1),
* the text which is displayed, and the type of the portion.
*/
virtual void Special(
- sal_Int32 nLength, /// length of this portion in the model string
+ TextFrameIndex nLength, ///< length of this portion in the view string
const OUString& rText, /// text which is painted on-screen
sal_uInt16 nType, /// type of this portion
sal_Int32 nHeight = 0, /// font height of the painted text
@@ -83,12 +84,12 @@ public:
* display a certain paragraph (e.g. when the paragraph is split
* across multiple pages). In this case, the Skip() method must be
* called to inform the portion handler to ignore a certain run of
- * characters in the 'model string'. Skip(), if used at all, must
+ * characters in the 'view string'. Skip(), if used at all, must
* be called before any of the other methods is called. Calling
* Skip() between portions is not allowed.
*/
virtual void Skip(
- sal_Int32 nLength /// number of 'model string' characters to be skipped
+ TextFrameIndex nLength /// number of 'view string' characters to be skipped
) = 0;
/** end of paragraph. This method is to be called when all the
commit 8fdcd441f2c86a9d6285bdd6326f4620ed3235f1
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 14:28:09 2018 +0200
sw_redlinehide: trivial conversions in EnhancedPDFExportHelper.cxx
Change-Id: I0f6c0842988f49e293c56c105f3eae13c21f0024
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 8c6c5d7e8b21..a8d460ad3f9e 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -760,7 +760,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
if (pPor->GetWhichPor() == POR_SOFTHYPH || pPor->GetWhichPor() == POR_HYPH)
aActualText = OUString(u'\x00ad'); // soft hyphen
else
- aActualText = rInf.GetText().copy(rInf.GetIdx(), sal_Int32(pPor->GetLen()));
+ aActualText = rInf.GetText().copy(sal_Int32(rInf.GetIdx()), sal_Int32(pPor->GetLen()));
mpPDFExtOutDevData->SetActualText( aActualText );
}
@@ -1335,15 +1335,16 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
case POR_TXT :
case POR_PARA :
{
- SwTextNode* pNd = const_cast<SwTextNode*>(pFrame->GetTextNode());
+ std::pair<SwTextNode const*, sal_Int32> const pos(
+ pFrame->MapViewToModel(rInf.GetIdx()));
SwTextAttr const*const pInetFormatAttr =
- pNd->GetTextAttrAt(rInf.GetIdx(), RES_TXTATR_INETFMT);
+ pos.first->GetTextAttrAt(pos.second, RES_TXTATR_INETFMT);
OUString sStyleName;
if ( !pInetFormatAttr )
{
std::vector<SwTextAttr *> const charAttrs(
- pNd->GetTextAttrsAt(rInf.GetIdx(), RES_TXTATR_CHARFMT));
+ pos.first->GetTextAttrsAt(pos.second, RES_TXTATR_CHARFMT));
// TODO: handle more than 1 char style?
const SwCharFormat* pCharFormat = (charAttrs.size())
? (*charAttrs.begin())->GetCharFormat().GetCharFormat() : nullptr;
@@ -1401,9 +1402,9 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
case POR_FLD :
{
// check field type:
- const sal_Int32 nIdx = static_cast<const SwFieldPortion*>(pPor)->IsFollow() ?
- rInf.GetIdx() - 1 :
- rInf.GetIdx();
+ TextFrameIndex const nIdx = static_cast<const SwFieldPortion*>(pPor)->IsFollow()
+ ? rInf.GetIdx() - TextFrameIndex(1)
+ : rInf.GetIdx();
const SwTextAttr* pHint = mpPorInfo->mrTextPainter.GetAttr( nIdx );
if ( pHint && RES_TXTATR_FIELD == pHint->Which() )
{
commit 99e449bcb1e3fb3e43ed9f45c8d889751c606cc9
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 14:10:35 2018 +0200
sw_redlinehide: trivial conversions in parachangetrackinginfo.cxx
This case is trivial because of the early return in the !Show case.
Change-Id: Id9891dfa13db4d0e33f28dd9e50a64f1b17fafaa
diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx
index 4939ec6f23b3..c2112e0b624e 100644
--- a/sw/source/core/access/parachangetrackinginfo.cxx
+++ b/sw/source/core/access/parachangetrackinginfo.cxx
@@ -40,12 +40,14 @@ namespace {
opChangeTrackDeletionTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
opChangeTrackFormatChangeTextMarkupList = new SwWrongList( WRONGLIST_CHANGETRACKING );
- if ( !rTextFrame.GetTextNode() )
+ if (!rTextFrame.GetTextNodeFirst())
{
OSL_FAIL( "<initChangeTrackTextMarkupLists(..) - missing <SwTextNode> instance!" );
return;
}
- const SwTextNode& rTextNode( *(rTextFrame.GetTextNode()) );
+ // sw_redlinehide: the first node is sufficient - there are only
+ // multiple ones in !Show case and the code below returns early then
+ const SwTextNode& rTextNode(*(rTextFrame.GetTextNodeFirst()));
const IDocumentRedlineAccess& rIDocChangeTrack( rTextNode.getIDocumentRedlineAccess() );
@@ -64,12 +66,14 @@ namespace {
return;
}
+ // sw_redlinehide: rely on the !Show early return above & cast
+ // TextFrameIndex to SwIndex directly
const sal_Int32 nTextFrameTextStartPos = rTextFrame.IsFollow()
- ? rTextFrame.GetOfst()
- : 0;
+ ? sal_Int32(rTextFrame.GetOfst())
+ : 0;
const sal_Int32 nTextFrameTextEndPos = rTextFrame.HasFollow()
- ? rTextFrame.GetFollow()->GetOfst()
- : rTextFrame.GetText().getLength();
+ ? sal_Int32(rTextFrame.GetFollow()->GetOfst())
+ : rTextFrame.GetText().getLength();
// iteration over the redlines which overlap with the text node.
const SwRedlineTable& rRedlineTable = rIDocChangeTrack.GetRedlineTable();
commit ca2a13d0c5c97f80f1bd6d4514dceda105d41c4e
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:56:14 2018 +0200
sw_redlinehide: trivial node conversions in inftxt.cxx
Change-Id: Ia3f6038679afe7d85eeaa31c79870a481cfb9f0b
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index d115c860002a..143e2ce33cfe 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -251,7 +251,7 @@ void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextF
m_nKanaIdx = 0;
m_pFrame = pFrame;
CtorInitTextInfo( m_pFrame );
- const SwTextNode *pNd = m_pFrame->GetTextNode();
+ SwDoc const& rDoc(m_pFrame->GetDoc());
m_pVsh = m_pFrame->getRootFrame()->GetCurrShell();
// Get the output and reference device
@@ -264,13 +264,13 @@ void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextF
else
{
// Access via StarONE. We do not need a Shell or an active one.
- if ( pNd->getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE) )
+ if (rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE))
{
// We can only pick the AppWin here? (there's nothing better to pick?)
m_pOut = Application::GetDefaultDevice();
}
else
- m_pOut = pNd->getIDocumentDeviceAccess().getPrinter( false );
+ m_pOut = rDoc.getIDocumentDeviceAccess().getPrinter(false);
m_pRef = m_pOut;
}
@@ -297,18 +297,18 @@ void SwTextSizeInfo::CtorInitTextSizeInfo( OutputDevice* pRenderContext, SwTextF
m_pOpt = m_pVsh ?
m_pVsh->GetViewOptions() :
- SW_MOD()->GetViewOption( pNd->getIDocumentSettingAccess()->get(DocumentSettingId::HTML_MODE) ); // Options from Module, due to StarONE
+ SW_MOD()->GetViewOption(rDoc.getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE)); // Options from Module, due to StarONE
// bURLNotify is set if MakeGraphic prepares it
// TODO: Unwind
m_bURLNotify = pNoteURL && !m_bOnWin;
- SetSnapToGrid( pNd->GetSwAttrSet().GetParaGrid().GetValue() &&
+ SetSnapToGrid( m_pFrame->GetTextNodeForParaProps()->GetSwAttrSet().GetParaGrid().GetValue() &&
m_pFrame->IsInDocBody() );
m_pFnt = nullptr;
m_pUnderFnt = nullptr;
- m_pText = &pNd->GetText();
+ m_pText = &m_pFrame->GetText();
m_nIdx = nNewIdx;
m_nLen = COMPLETE_STRING;
@@ -474,7 +474,8 @@ TextFrameIndex SwTextSizeInfo::GetTextBreak( const long nLineWidth,
bool SwTextSizeInfo::HasHint(TextFrameIndex const nPos) const
{
- return m_pFrame->GetTextNode()->GetTextAttrForCharAt(nPos);
+ std::pair<SwTextNode const*, sal_Int32> const pos(m_pFrame->MapViewToModel(nPos));
+ return pos.first->GetTextAttrForCharAt(pos.second);
}
void SwTextPaintInfo::CtorInitTextPaintInfo( OutputDevice* pRenderContext, SwTextFrame *pFrame, const SwRect &rPaint )
commit 96bc5eb144c910d3a103a90701e874c823026167
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:54:07 2018 +0200
sw_redlinehide: trivial node conversions in EnhancedPDFExportHelper.cxx
Change-Id: Iac478d0ed1325e03694cd231e4a7074d34566d6b
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 85b5e787e0b5..8c6c5d7e8b21 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -170,7 +170,7 @@ bool lcl_IsHeadlineCell( const SwCellFrame& rCellFrame )
const SwContentFrame *pCnt = rCellFrame.ContainsContent();
if ( pCnt && pCnt->IsTextFrame() )
{
- const SwTextNode* pTextNode = static_cast<const SwTextFrame*>(pCnt)->GetTextNode();
+ SwTextNode const*const pTextNode = static_cast<const SwTextFrame*>(pCnt)->GetTextNodeForParaProps();
const SwFormat* pTextFormat = pTextNode->GetFormatColl();
OUString sStyleName;
@@ -210,7 +210,7 @@ void* lcl_GetKeyFromFrame( const SwFrame& rFrame )
if ( rFrame.IsPageFrame() )
pKey = const_cast<void*>(static_cast<void const *>(&(static_cast<const SwPageFrame&>(rFrame).GetFormat()->getIDocumentSettingAccess())));
else if ( rFrame.IsTextFrame() )
- pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwTextFrame&>(rFrame).GetTextNode()));
+ pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwTextFrame&>(rFrame).GetTextNodeFirst()));
else if ( rFrame.IsSctFrame() )
pKey = const_cast<void*>(static_cast<void const *>(static_cast<const SwSectionFrame&>(rFrame).GetSection()));
else if ( rFrame.IsTabFrame() )
@@ -418,7 +418,7 @@ void SwTaggedPDFHelper::BeginTag( vcl::PDFWriter::StructElement eType, const OUS
if ( mpNumInfo )
{
const SwTextFrame& rTextFrame = static_cast<const SwTextFrame&>(mpNumInfo->mrFrame);
- const SwTextNode* pTextNd = rTextFrame.GetTextNode();
+ SwTextNode const*const pTextNd = rTextFrame.GetTextNodeForParaProps();
const SwNodeNum* pNodeNum = pTextNd->GetNum();
if ( vcl::PDFWriter::List == eType )
@@ -836,7 +836,7 @@ void SwTaggedPDFHelper::BeginNumberedListStructureElements()
if ( lcl_IsInNonStructEnv( rTextFrame ) || rTextFrame.IsFollow() )
return;
- const SwTextNode* pTextNd = rTextFrame.GetTextNode();
+ const SwTextNode *const pTextNd = rTextFrame.GetTextNodeForParaProps();
const SwNumRule* pNumRule = pTextNd->GetNumRule();
const SwNodeNum* pNodeNum = pTextNd->GetNum();
@@ -1054,7 +1054,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements()
case SwFrameType::Txt :
{
const SwTextNode* pTextNd =
- static_cast<const SwTextFrame*>(pFrame)->GetTextNode();
+ static_cast<const SwTextFrame*>(pFrame)->GetTextNodeForParaProps();
const SwFormat* pTextFormat = pTextNd->GetFormatColl();
const SwFormat* pParentTextFormat = pTextFormat ? pTextFormat->DerivedFrom() : nullptr;
commit 7fc5ece99602044befeed16c6fb6c69cdfbc6087
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:52:49 2018 +0200
sw_redlinehide: trivial node conversions in guess.cxx
Change-Id: I112579701af651020dd0dcb7fb465179ce3719fe
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 8d3e4f14d42a..ff754d902c75 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -32,6 +32,7 @@
#include <unotools/charclass.hxx>
#include "porfld.hxx"
#include <paratr.hxx>
+#include <doc.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -73,7 +74,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
SwTwips nLineWidth = rInf.Width() - rInf.X();
TextFrameIndex nMaxLen = TextFrameIndex(rInf.GetText().getLength()) - rInf.GetIdx();
- const SvxAdjust& rAdjust = rInf.GetTextFrame()->GetTextNode()->GetSwAttrSet().GetAdjust().GetAdjust();
+ const SvxAdjust& rAdjust = rInf.GetTextFrame()->GetTextNodeForParaProps()->GetSwAttrSet().GetAdjust().GetAdjust();
// tdf#104668 space chars at the end should be cut if the compatibility option is enabled
// for LTR mode only
@@ -143,8 +144,8 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
nLineWidth -= nLeftRightBorderSpace;
- const bool bUnbreakableNumberings = rInf.GetTextFrame()->GetTextNode()->
- getIDocumentSettingAccess()->get(DocumentSettingId::UNBREAKABLE_NUMBERINGS);
+ const bool bUnbreakableNumberings = rInf.GetTextFrame()->GetDoc()
+ .getIDocumentSettingAccess().get(DocumentSettingId::UNBREAKABLE_NUMBERINGS);
// first check if everything fits to line
if ( ( long ( nLineWidth ) * 2 > sal_Int32(nMaxLen) * nPorHeight ) ||
commit d9c44b308615403dbc0b1d2fa1d1ac45023fd3a6
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:46:17 2018 +0200
sw_redlinehide: trivial node conversions in tabfrm.cxx
Change-Id: I392fa355d8f9d765ae912c03b1c85b2fb14e1f7d
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 31c5ae3f6250..96612798d990 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4612,7 +4612,7 @@ bool SwRowFrame::ShouldRowKeepWithNext() const
const SwFrame* pText = pCell->Lower();
return pText && pText->IsTextFrame() &&
- static_cast<const SwTextFrame*>(pText)->GetTextNode()->GetSwAttrSet().GetKeep().GetValue();
+ static_cast<const SwTextFrame*>(pText)->GetTextNodeForParaProps()->GetSwAttrSet().GetKeep().GetValue();
}
SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertContent)
commit 29ee391771a17936c1ef9dbd346f9d92d30baca7
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:45:09 2018 +0200
sw_redlinehide: anchoredobjectposition.cxx: assume that...
... this can use the first text node too.
Change-Id: I8e1ef593d95be92b3a20a9ad1fc682159f394436
diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
index e0d58f0b01e3..81c645ec326f 100644
--- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx
@@ -947,7 +947,7 @@ SwTwips SwAnchoredObjectPosition::AdjustHoriRelPosForDrawAside(
const sal_uInt32 nObjOrdNum = GetObject().GetOrdNum();
const SwPageFrame* pObjPage = rFlyAtContentFrame.FindPageFrame();
const SwFrame* pObjContext = ::FindContext( &rAnchorTextFrame, SwFrameType::Column );
- sal_uLong nObjIndex = rAnchorTextFrame.GetTextNode()->GetIndex();
+ sal_uLong nObjIndex = rAnchorTextFrame.GetTextNodeFirst()->GetIndex();
SwOrderIter aIter( pObjPage );
const SwFlyFrame* pFly = static_cast<const SwVirtFlyDrawObj*>(aIter.Bottom())->GetFlyFrame();
while ( pFly && nObjOrdNum > pFly->GetVirtDrawObj()->GetOrdNumDirect() )
@@ -1058,7 +1058,8 @@ bool SwAnchoredObjectPosition::DrawAsideFly( const SwFlyFrame* _pFly,
::FindContext( _pFly->GetAnchorFrame(), SwFrameType::Column ) == _pObjContext )
{
sal_uLong nOtherIndex =
- static_cast<const SwTextFrame*>(_pFly->GetAnchorFrame())->GetTextNode()->GetIndex();
+ static_cast<const SwTextFrame*>(_pFly->GetAnchorFrame())->GetTextNodeFirst()->GetIndex();
+ // sw_redlinehide: this is used for comparing, so just use the first
if( _nObjIndex >= nOtherIndex )
{
const SwFormatHoriOrient& rHori = _pFly->GetFormat()->GetHoriOrient();
commit ec613713260a3698723b65d98ea00a0f3c152eba
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:43:22 2018 +0200
sw_redlinehide: movedfwdfrmsbyobjpos.cxx: assume that...
... this map wants to identify all text frames belonging to the same
paragraph, so use the first text node.
Change-Id: I465551f0e9836e7f7e4bd2d21127ad07c2c65a34
diff --git a/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx b/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx
index 56c8780c2352..3f1dbe34e0cf 100644
--- a/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx
+++ b/sw/source/core/layout/movedfwdfrmsbyobjpos.cxx
@@ -36,22 +36,24 @@ void SwMovedFwdFramesByObjPos::Insert( const SwTextFrame& _rMovedFwdFrameByObjPo
const sal_uInt32 _nToPageNum )
{
if ( maMovedFwdFrames.end() ==
- maMovedFwdFrames.find( _rMovedFwdFrameByObjPos.GetTextNode() ) )
+ maMovedFwdFrames.find(_rMovedFwdFrameByObjPos.GetTextNodeFirst()) )
{
- const NodeMapEntry aEntry( _rMovedFwdFrameByObjPos.GetTextNode(), _nToPageNum );
+ const NodeMapEntry aEntry(_rMovedFwdFrameByObjPos.GetTextNodeFirst(), _nToPageNum);
maMovedFwdFrames.insert( aEntry );
}
}
void SwMovedFwdFramesByObjPos::Remove( const SwTextFrame& _rTextFrame )
{
- maMovedFwdFrames.erase( _rTextFrame.GetTextNode() );
+ maMovedFwdFrames.erase(_rTextFrame.GetTextNodeFirst());
}
bool SwMovedFwdFramesByObjPos::FrameMovedFwdByObjPos( const SwTextFrame& _rTextFrame,
sal_uInt32& _ornToPageNum ) const
{
- NodeMapIter aIter = maMovedFwdFrames.find( _rTextFrame.GetTextNode() );
+ // sw_redlinehide: assumption: this wants to uniquely identify all
+ // SwTextFrame belonging to the same paragraph, so just use first one as key
+ NodeMapIter aIter = maMovedFwdFrames.find( _rTextFrame.GetTextNodeFirst() );
if ( maMovedFwdFrames.end() != aIter )
{
_ornToPageNum = (*aIter).second;
commit 1ff2b4090121bf2ae63480be2b6174a2e0dc5c1f
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:42:46 2018 +0200
sw_redlinehide: trivial node conversions in frmtool.cxx
Change-Id: Ia5ebc9bbfd8d8892e78fcf1308aeb97114778dd9
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 0df9ee9c5900..de435a0224d1 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -735,7 +735,7 @@ SwContentNotify::SwContentNotify( SwContentFrame *pContentFrame ) :
if ( pContentFrame->IsTextFrame() )
{
SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pContentFrame);
- if ( !pTextFrame->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::OLD_LINE_SPACING) )
+ if (!pTextFrame->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::OLD_LINE_SPACING))
{
const SwAttrSet* pSet = pTextFrame->GetAttrSet();
const SvxLineSpacingItem &rSpace = pSet->GetLineSpacing();
@@ -1765,7 +1765,7 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor)
const SwTextFrame* pTextFrame = dynamic_cast<const SwTextFrame*>(pConstructor);
if ( pTextFrame )
{
- pTextFrame->GetTextNode()->ClearLRSpaceItemDueToListLevelIndents( m_rLR );
+ pTextFrame->GetTextNodeForParaProps()->ClearLRSpaceItemDueToListLevelIndents( m_rLR );
}
else if ( pConstructor->IsNoTextFrame() )
{
@@ -1813,7 +1813,7 @@ long SwBorderAttrs::CalcRight( const SwFrame* pCaller ) const
{
long nRight=0;
- if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetTextNode()->GetDoc()->GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING)) {
+ if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING)) {
// OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
// and right border are painted on the right respectively left.
if ( pCaller->IsCellFrame() && pCaller->IsRightToLeft() )
@@ -1831,7 +1831,7 @@ long SwBorderAttrs::CalcRight( const SwFrame* pCaller ) const
// correction: retrieve left margin for numbering in R2L-layout
if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
{
- nRight += static_cast<const SwTextFrame*>(pCaller)->GetTextNode()->GetLeftMarginWithNum();
+ nRight += static_cast<const SwTextFrame*>(pCaller)->GetTextNodeForParaProps()->GetLeftMarginWithNum();
}
return nRight;
@@ -1861,7 +1861,8 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
{
long nLeft=0;
- if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetTextNode()->GetDoc()->GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING)) {
+ if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING))
+ {
// OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
// and right border are painted on the right respectively left.
if ( pCaller->IsCellFrame() && pCaller->IsRightToLeft() )
@@ -1879,7 +1880,7 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
if (pCaller->IsTextFrame())
{
const SwTextFrame* pTextFrame = static_cast<const SwTextFrame*>(pCaller);
- if (pTextFrame->GetTextNode()->GetDoc()->GetDocumentSettingManager().get(DocumentSettingId::FLOATTABLE_NOMARGINS))
+ if (pTextFrame->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::FLOATTABLE_NOMARGINS))
{
// If this is explicitly requested, ignore the margins next to the floating table.
if (lcl_hasTabFrame(pTextFrame))
@@ -1896,7 +1897,7 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
// correction: do not retrieve left margin for numbering in R2L-layout
if ( pCaller->IsTextFrame() && !pCaller->IsRightToLeft() )
{
- nLeft += static_cast<const SwTextFrame*>(pCaller)->GetTextNode()->GetLeftMarginWithNum();
+ nLeft += static_cast<const SwTextFrame*>(pCaller)->GetTextNodeForParaProps()->GetLeftMarginWithNum();
}
return nLeft;
commit 07bccc26f45053cf1f413fa1a634e33d8648706f
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:41:56 2018 +0200
sw_redlinehide: trivial node conv. in calcmove.cxx,flowfrm.cxx,fly.cxx
Change-Id: Ied51cc903e024c6db510c55fd364562115e58157
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 4062c55ea1f6..d4df9db6d843 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -998,7 +998,7 @@ bool SwFrame::IsCollapse() const
return false;
const SwTextFrame *pTextFrame = static_cast<const SwTextFrame*>(this);
- const SwTextNode *pTextNode = pTextFrame->GetTextNode();
+ const SwTextNode *pTextNode = pTextFrame->GetTextNodeForParaProps();
return pTextNode && pTextNode->IsCollapse();
}
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 75a064fa6e55..952708ae0342 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1342,14 +1342,16 @@ static bool lcl_IdenticalStyles(const SwFrame* pPrevFrame, const SwFrame* pFrame
if (pPrevFrame && pPrevFrame->IsTextFrame())
{
const SwTextFrame *pTextFrame = static_cast< const SwTextFrame * >( pPrevFrame );
- pPrevFormatColl = dynamic_cast<SwTextFormatColl*>(pTextFrame->GetTextNode()->GetFormatColl());
+ pPrevFormatColl = dynamic_cast<SwTextFormatColl*>(
+ pTextFrame->GetTextNodeForParaProps()->GetFormatColl());
}
bool bIdenticalStyles = false;
if (pFrame && pFrame->IsTextFrame())
{
const SwTextFrame *pTextFrame = static_cast< const SwTextFrame * >( pFrame );
- SwTextFormatColl *pFormatColl = dynamic_cast<SwTextFormatColl*>(pTextFrame->GetTextNode()->GetFormatColl());
+ SwTextFormatColl *const pFormatColl = dynamic_cast<SwTextFormatColl*>(
+ pTextFrame->GetTextNodeForParaProps()->GetFormatColl());
bIdenticalStyles = pPrevFormatColl == pFormatColl;
}
return bIdenticalStyles;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 90cf8c5ae5d1..47ca08c9ef72 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -2418,7 +2418,7 @@ static SwTwips lcl_CalcAutoWidth( const SwLayoutFrame& rFrame )
{
nMin = const_cast<SwTextFrame*>(static_cast<const SwTextFrame*>(pFrame))->CalcFitToContent();
const SvxLRSpaceItem &rSpace =
- static_cast<const SwTextFrame*>(pFrame)->GetTextNode()->GetSwAttrSet().GetLRSpace();
+ static_cast<const SwTextFrame*>(pFrame)->GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace();
if (!static_cast<const SwTextFrame*>(pFrame)->IsLocked())
nMin += rSpace.GetRight() + rSpace.GetTextLeft() + rSpace.GetTextFirstLineOfst();
}
commit 4cd8cb6ba48d64b45c7a169b6c9e472251eff619
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:39:58 2018 +0200
sw_redlinehide: trivial in anchoreddrawobject.cxx: no need to check
... if hints exist.
Change-Id: I50ad322d7de800d24135ea8e168ef3488c39f0ba
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index e1afbd3feb3a..aaf96027e7aa 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -572,8 +572,7 @@ void SwAnchoredDrawObject::InvalidateObjPos()
(GetFrameFormat().GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR) )
{
SwTextFrame* pAnchorTextFrame( static_cast<SwTextFrame*>(AnchorFrame()) );
- if ( pAnchorTextFrame->GetTextNode()->GetpSwpHints() &&
- pAnchorTextFrame->CalcFlyPos( &GetFrameFormat() ) != COMPLETE_STRING )
+ if (pAnchorTextFrame->CalcFlyPos(&GetFrameFormat()) != COMPLETE_STRING)
{
AnchorFrame()->Prepare( PREP_FLY_ATTR_CHG, &GetFrameFormat() );
}
commit 27404f7e4f43bdb3ca8fbf9a13797c8b8c9fc8b1
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:38:26 2018 +0200
sw_redlinehide: trivial conversions in fews.cxx
Change-Id: I97008fe1669f5bc0538b5810cd62abd9d46551eb
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 8265610e695f..4d5743a2a957 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -1004,7 +1004,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
else
{
// No content position provided. Thus, use a default one.
- SwPosition aDefaultContentPos( *(pTextFrame->GetTextNode()) );
+ SwPosition aDefaultContentPos(*(pTextFrame->GetTextNodeFirst()));
pTextFrame->GetAutoPos( aChRect, aDefaultContentPos );
}
nTop = aRectFnSet.GetBottom(aChRect);
@@ -1018,7 +1018,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
else
{
// No content position provided. Thus, use a default one.
- SwPosition aDefaultContentPos( *(pTextFrame->GetTextNode()) );
+ SwPosition aDefaultContentPos(*(pTextFrame->GetTextNodeFirst()));
pTextFrame->GetTopOfLine( nTop, aDefaultContentPos );
}
}
@@ -1048,7 +1048,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
else
{
// No content position provided. Thus, use a default one.
- SwPosition aDefaultContentPos( *(pTextFrame->GetTextNode()) );
+ SwPosition aDefaultContentPos(*(pTextFrame->GetTextNodeFirst()));
pTextFrame->GetAutoPos( aChRect, aDefaultContentPos );
}
nLeft = aRectFnSet.GetLeft(aChRect);
commit cda289bb74e56a48c47e6669a344acc8e984c6f2
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:37:18 2018 +0200
sw_redlinehide: trivial conversions in ndtbl.cxx
Change-Id: I87363524385cb6ade77b459656c3d5825a8424dc
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 3edfcdf51310..f84a61142e10 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2555,7 +2555,7 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCellFrame* pBoxFrame )
const SwContentFrame* pContent = ::GetCellContent( *pBoxFrame );
if ( pContent && pContent->IsTextFrame() )
{
- const SwPosition aPos( *static_cast<const SwTextFrame*>(pContent)->GetTextNode() );
+ const SwPosition aPos(*static_cast<const SwTextFrame*>(pContent)->GetTextNodeFirst());
const SwCursor aTmpCursor( aPos, nullptr );
::GetTableSel( aTmpCursor, aBoxes, SwTableSearchType::Col );
}
@@ -2835,7 +2835,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly,
if ( ATT_VAR_SIZE == aNew.GetHeightSizeType() )
aNew.SetHeightSizeType( ATT_MIN_SIZE );
// This position must not be in an overlapped box
- const SwPosition aPos( *static_cast<const SwTextFrame*>(pContent)->GetTextNode() );
+ const SwPosition aPos(*static_cast<const SwTextFrame*>(pContent)->GetTextNodeFirst());
const SwCursor aTmpCursor( aPos, nullptr );
SetRowHeight( aTmpCursor, aNew );
// For the new table model we're done, for the old one
commit bf89c6206d2371f41c0535cf37a4b11a4f49ba6c
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:12:16 2018 +0200
sw_redlinehide: convert and add an assert in acccontext.cxx
Change-Id: I9b5c1bb02011c15d527ca66ec85227b6e87fee62
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index ba217a027a79..093b61c05116 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -952,7 +952,8 @@ void SAL_CALL SwAccessibleContext::grabFocus()
if( pCFrame && pCFrame->IsTextFrame() )
{
const SwTextFrame *pTextFrame = static_cast< const SwTextFrame * >( pCFrame );
- const SwTextNode *pTextNd = pTextFrame->GetTextNode();
+ const SwTextNode *pTextNd = pTextFrame->GetTextNodeFirst();
+ assert(pTextNd); // can it actually be null? probably not=>simplify
if( pTextNd )
{
// create pam for selection
commit 615d34d339ac0e0975775d4e1bd46cc765e587dc
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 13:10:55 2018 +0200
trivial node itrtxt.hxx
Change-Id: I6654bab24ee9a8598d94aecd79139b90a6148e8d
diff --git a/sw/source/core/text/itrtxt.hxx b/sw/source/core/text/itrtxt.hxx
index bf750c169da1..5acf472bed77 100644
--- a/sw/source/core/text/itrtxt.hxx
+++ b/sw/source/core/text/itrtxt.hxx
@@ -74,7 +74,7 @@ protected:
}
public:
SwTextIter(SwTextFrame *pTextFrame, SwTextInfo *pTextInf)
- : SwAttrIter(pTextFrame->GetTextNode())
+ : SwAttrIter(pTextFrame->GetTextNodeFirst())
, m_bOneBlock(false)
, m_bLastBlock(false)
, m_bLastCenter(false)
@@ -173,7 +173,7 @@ protected:
}
public:
SwTextMargin(SwTextFrame *pTextFrame, SwTextSizeInfo *pTextSizeInf)
- : SwTextIter(pTextFrame->GetTextNode())
+ : SwTextIter(pTextFrame->GetTextNodeFirst())
{
CtorInitTextMargin( pTextFrame, pTextSizeInf );
}
@@ -273,7 +273,7 @@ protected:
explicit SwTextCursor(SwTextNode const * pTextNode) : SwTextAdjuster(pTextNode) { }
public:
SwTextCursor( SwTextFrame *pTextFrame, SwTextSizeInfo *pTextSizeInf )
- : SwTextAdjuster(pTextFrame->GetTextNode())
+ : SwTextAdjuster(pTextFrame->GetTextNodeFirst())
{
CtorInitTextCursor(pTextFrame, pTextSizeInf);
}
commit 8b7c1a2f43c26c736d17163bcae0a99f2e6b9d2d
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 12:56:30 2018 +0200
sw_redlinehide: trivial conversion in feshview.cxx
Change-Id: I02087c2e51ed26c73e5b768f504b7f359acc0c71
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 828e77f52c79..bbc5456fea92 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1351,7 +1351,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt)
dynamic_cast<const SwTextFrame*>(pContentFrame);
if ( pTextFrame )
{
- SwPosition aPos( *(pTextFrame->GetTextNode()) );
+ SwPosition aPos(GetDoc()->GetNodes());
Point aTmpPt( rPt );
if (pTextFrame->GetKeyCursorOfst(&aPos, aTmpPt))
{
commit ee3a26f67ab64f28d866778de36e346ab1818616
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Fri May 4 12:43:22 2018 +0200
sw_redlinehide: convert SwFEShell::MoveAnchor(), not entirely trivial
Change-Id: I9aa8e0f9a6e0ee21d740f95e0fbee337f468f876
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 6c0c63197a22..828e77f52c79 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -406,26 +406,25 @@ bool SwFEShell::MoveAnchor( SwMove nDir )
if( SwMove::LEFT == nDir || SwMove::RIGHT == nDir )
{
SwPosition pos = *aAnch.GetContentAnchor();
- SwTextNode* pTextNd = static_cast<SwTextFrame*>(pOld)->GetTextNode();
- const sal_Int32 nAct = pos.nContent.GetIndex();
+ SwTextFrame *const pOldFrame(static_cast<SwTextFrame*>(pOld));
+ TextFrameIndex const nAct(pOldFrame->MapModelToViewPos(pos));
if( SwMove::LEFT == nDir )
{
bRet = true;
if( nAct )
{
- pos.nContent.Assign( pTextNd, nAct-1 );
+ pos = pOldFrame->MapViewToModelPos(nAct - TextFrameIndex(1));
}
else
nDir = SwMove::UP;
}
else
{
- const sal_Int32 nMax =
- static_cast<SwTextFrame*>(pOld)->GetTextNode()->GetText().getLength();
+ TextFrameIndex const nMax(pOldFrame->GetText().getLength());
if( nAct < nMax )
{
bRet = true;
- pos.nContent.Assign( pTextNd, nAct+1 );
+ pos = pOldFrame->MapViewToModelPos(nAct + TextFrameIndex(1));
}
else
nDir = SwMove::DOWN;
@@ -444,17 +443,12 @@ bool SwFEShell::MoveAnchor( SwMove nDir )
pNew = pOld->FindNext();
if( pNew && pNew != pOld && pNew->IsContentFrame() )
{
- SwPosition pos = *aAnch.GetContentAnchor();
- SwTextNode* pTextNd = static_cast<SwTextFrame*>(pNew)->GetTextNode();
- pos.nNode = *pTextNd;
- sal_Int32 nTmp = 0;
- if( bRet )
- {
- nTmp = static_cast<SwTextFrame*>(pNew)->GetTextNode()->GetText().getLength();
- if( nTmp )
- --nTmp;
- }
- pos.nContent.Assign( pTextNd, nTmp );
+ SwTextFrame *const pNewFrame(static_cast<SwTextFrame*>(pNew));
+ SwPosition const pos = pNewFrame->MapViewToModelPos(
+ TextFrameIndex(
+ (bRet && pNewFrame->GetText().getLength() != 0)
+ ? pNewFrame->GetText().getLength() - 1
+ : 0));
aAnch.SetAnchor( &pos );
bRet = true;
}
commit 0151333c18e9331b2d7ff68e08a8000f61dce06e
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Thu May 3 19:01:57 2018 +0200
EnhancedPDFExportHelper.cxx
Change-Id: Id41c8cdd567f3fdf688338a17bc513553a8b2b71
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 7d18ac32c423..85b5e787e0b5 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -760,7 +760,7 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType )
if (pPor->GetWhichPor() == POR_SOFTHYPH || pPor->GetWhichPor() == POR_HYPH)
aActualText = OUString(u'\x00ad'); // soft hyphen
else
- aActualText = rInf.GetText().copy(rInf.GetIdx(), pPor->GetLen());
+ aActualText = rInf.GetText().copy(rInf.GetIdx(), sal_Int32(pPor->GetLen()));
mpPDFExtOutDevData->SetActualText( aActualText );
}
commit c1dea49f1c3628160f215b68debb4a89c72a10fd
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Thu May 3 19:01:46 2018 +0200
accpara.cxx
Change-Id: I76a39b81c6770dea1905a0fb20691cd33e8be130
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 238fcfa62f83..d144127be4f7 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -961,12 +961,10 @@ void SAL_CALL SwAccessibleParagraph::grabFocus()
if( pCursorSh != nullptr && pTextNd != nullptr &&
( pCursor == nullptr ||
pCursor->GetPoint()->nNode.GetIndex() != pTextNd->GetIndex() ||
- !pTextFrame->IsInside( pCursor->GetPoint()->nContent.GetIndex()) ) )
+ !pTextFrame->IsInside(pTextFrame->MapModelToViewPos(*pCursor->GetPoint()))))
{
// create pam for selection
- SwIndex aIndex( const_cast< SwTextNode * >( pTextNd ),
- pTextFrame->GetOfst() );
- SwPosition aStartPos( *pTextNd, aIndex );
+ SwPosition const aStartPos(pTextFrame->MapViewToModelPos(pTextFrame->GetOfst()));
SwPaM aPaM( aStartPos );
// set PaM at cursor shell
@@ -2966,7 +2964,7 @@ SwHyperlinkIter_Impl::SwHyperlinkIter_Impl( const SwTextFrame *pTextFrame ) :
nPos( 0 )
{
const SwTextFrame *pFollFrame = pTextFrame->GetFollow();
- nEnd = pFollFrame ? pFollFrame->GetOfst() : pTextFrame->GetTextNode()->Len();
+ nEnd = pFollFrame ? pFollFrame->GetOfst() : TextFrameIndex(pTextFrame->GetText().getLength());
}
const SwTextAttr *SwHyperlinkIter_Impl::next()
commit 75dde160277216d38c783b4678a0a374691f456a
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Thu May 3 19:01:19 2018 +0200
acccontext.cxx
Change-Id: I537d218afbd7d2832461e24fd98cc1d63304e17a
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 628ad727dc47..ba217a027a79 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -956,9 +956,7 @@ void SAL_CALL SwAccessibleContext::grabFocus()
if( pTextNd )
{
// create pam for selection
- SwIndex aIndex( const_cast< SwTextNode * >( pTextNd ),
- pTextFrame->GetOfst() );
- SwPosition aStartPos( *pTextNd, aIndex );
+ SwPosition const aStartPos(pTextFrame->MapViewToModelPos(pTextFrame->GetOfst()));
SwPaM aPaM( aStartPos );
// set PaM at cursor shell
commit 92b803b0e5194726e8e7b82f1a28b9fef6b50766
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Thu May 3 18:46:10 2018 +0200
sw: do all trivial conversions in txtftn.cxx
Change-Id: I80a7303d73ff1e5f2d6496add4a31121f3fbfd8e
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index e5815623dab0..655e10346123 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -97,10 +97,13 @@ void SwTextFrame::CalcFootnoteFlag()
const size_t nSize = pHints->Count();
#ifdef DBG_UTIL
- const sal_Int32 nEnd = nStop != COMPLETE_STRING ? nStop
- : GetFollow() ? GetFollow()->GetOfst() : COMPLETE_STRING;
+ const TextFrameIndex nEnd = nStop != TextFrameIndex(COMPLETE_STRING)
+ ? nStop
+ : GetFollow() ? GetFollow()->GetOfst() : TextFrameIndex(COMPLETE_STRING);
#else
- const sal_Int32 nEnd = GetFollow() ? GetFollow()->GetOfst() : COMPLETE_STRING;
+ const TextFrameIndex nEnd = GetFollow()
+ ? GetFollow()->GetOfst()
+ : TextFrameIndex(COMPLETE_STRING);
#endif
for ( size_t i = 0; i < nSize; ++i )
@@ -396,9 +399,9 @@ void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex con
if( !pHints )
return;
- bool bRollBack = nLen != COMPLETE_STRING;
+ bool bRollBack = nLen != TextFrameIndex(COMPLETE_STRING);
const size_t nSize = pHints->Count();
- sal_Int32 nEnd;
+ TextFrameIndex nEnd;
SwTextFrame* pSource;
if( bRollBack )
{
@@ -409,7 +412,7 @@ void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex con
}
else
{
- nEnd = COMPLETE_STRING;
+ nEnd = TextFrameIndex(COMPLETE_STRING);
pSource = this;
}
@@ -549,14 +552,14 @@ void SwTextFrame::RemoveFootnote(TextFrameIndex const nStart, TextFrameIndex con
// to be passed to the Follow. The Offset of the Follow is, however, outdated;
// it'll be set soon. CalcFntFlag depends on a correctly set Follow Offset.
// Therefore we temporarily calculate the Follow Offset here
- sal_Int32 nOldOfst = COMPLETE_STRING;
+ TextFrameIndex nOldOfst(COMPLETE_STRING);
if( HasFollow() && nStart > GetOfst() )
{
nOldOfst = GetFollow()->GetOfst();
- GetFollow()->ManipOfst( nStart + ( bRollBack ? nLen : 0 ) );
+ GetFollow()->ManipOfst(nStart + (bRollBack ? nLen : TextFrameIndex(0)));
}
pSource->CalcFootnoteFlag();
- if( nOldOfst < COMPLETE_STRING )
+ if (nOldOfst < TextFrameIndex(COMPLETE_STRING))
GetFollow()->ManipOfst( nOldOfst );
}
@@ -1088,7 +1091,7 @@ TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset)
Right( Right() - nQuoWidth );
- sal_Int32 nRet;
+ TextFrameIndex nRet;
{
SwSwapIfNotSwapped swap(m_pFrame);
@@ -1108,7 +1111,7 @@ TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset)
{
pGlue->Height( 0 );
pGlue->Width( 0 );
- pGlue->SetLen( 0 );
+ pGlue->SetLen(TextFrameIndex(0));
pGlue->SetAscent( 0 );
pGlue->SetPortion( nullptr );
pGlue->SetFixWidth(0);
@@ -1126,7 +1129,7 @@ TextFrameIndex SwTextFormatter::FormatQuoVadis(TextFrameIndex const nOffset)
case SvxAdjust::Block:
{
if( !m_pCurr->GetLen() ||
- CH_BREAK != GetInfo().GetChar(m_nStart+m_pCurr->GetLen()-1))
+ CH_BREAK != GetInfo().GetChar(m_nStart + m_pCurr->GetLen() - TextFrameIndex(1)))
nLastLeft = pQuo->GetAscent();
nQuoWidth = nQuoWidth + nLastLeft;
break;
@@ -1313,7 +1316,7 @@ SwFootnotePortion::SwFootnotePortion( const OUString &rExpand,
, mbPreferredScriptTypeSet( false )
, mnPreferredScriptType( SwFontScript::Latin )
{
- SetLen(1);
+ SetLen(TextFrameIndex(1));
SetWhichPor( POR_FTN );
}
@@ -1374,7 +1377,7 @@ SwFieldPortion *SwQuoVadisPortion::Clone( const OUString &rExpand ) const
SwQuoVadisPortion::SwQuoVadisPortion( const OUString &rExp, const OUString& rStr )
: SwFieldPortion( rExp ), aErgo(rStr)
{
- SetLen(0);
+ SetLen(TextFrameIndex(0));
SetWhichPor( POR_QUOVADIS );
}
@@ -1383,14 +1386,14 @@ bool SwQuoVadisPortion::Format( SwTextFormatInfo &rInf )
// First try; maybe the Text fits
CheckScript( rInf );
bool bFull = SwFieldPortion::Format( rInf );
- SetLen( 0 );
+ SetLen(TextFrameIndex(0));
if( bFull )
{
// Second try; we make the String shorter
m_aExpand = "...";
bFull = SwFieldPortion::Format( rInf );
- SetLen( 0 );
+ SetLen(TextFrameIndex(0));
if( bFull )
// Third try; we're done: we crush
Width( sal_uInt16(rInf.Width() - rInf.X()) );
@@ -1441,7 +1444,7 @@ SwFieldPortion *SwErgoSumPortion::Clone( const OUString &rExpand ) const
SwErgoSumPortion::SwErgoSumPortion(const OUString &rExp, const OUString& rStr)
: SwFieldPortion( rExp )
{
- SetLen(0);
+ SetLen(TextFrameIndex(0));
m_aExpand += rStr;
// One blank distance to the text
@@ -1451,13 +1454,13 @@ SwErgoSumPortion::SwErgoSumPortion(const OUString &rExp, const OUString& rStr)
TextFrameIndex SwErgoSumPortion::GetCursorOfst(const sal_uInt16) const
{
- return 0;
+ return TextFrameIndex(0);
}
bool SwErgoSumPortion::Format( SwTextFormatInfo &rInf )
{
const bool bFull = SwFieldPortion::Format( rInf );
- SetLen( 0 );
+ SetLen(TextFrameIndex(0));
rInf.SetErgoDone( true );
// No multiline Fields for QuoVadis and ErgoSum
commit d648499475f64d506891b626b1c8210368542490
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Thu May 3 18:30:07 2018 +0200
sw: some trivial conversions in txtfrm.cxx
Change-Id: I3c5392370b36c30ad86062c72402049ef294a4a4
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 8dff0a00cdd8..73ff2c1b88c4 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -589,8 +589,7 @@ void SwTextFrame::HideHidden()
OSL_ENSURE( !GetFollow() && IsHiddenNow(),
"HideHidden on visible frame of hidden frame has follow" );
- const sal_Int32 nEnd = COMPLETE_STRING;
- HideFootnotes( GetOfst(), nEnd );
+ HideFootnotes(GetOfst(), TextFrameIndex(COMPLETE_STRING));
HideAndShowObjects();
// format information is obsolete
@@ -778,8 +777,8 @@ TextFrameIndex SwTextFrame::FindBrk(const OUString &rText,
const TextFrameIndex nStart,
const TextFrameIndex nEnd)
{
- sal_Int32 nFound = nStart;
- const sal_Int32 nEndLine = std::min( nEnd, rText.getLength() - 1 );
+ sal_Int32 nFound = sal_Int32(nStart);
+ const sal_Int32 nEndLine = std::min(sal_Int32(nEnd), rText.getLength() - 1);
// Skip all leading blanks.
while( nFound <= nEndLine && ' ' == rText[nFound] )
@@ -796,7 +795,7 @@ TextFrameIndex SwTextFrame::FindBrk(const OUString &rText,
nFound++;
}
- return nFound;
+ return TextFrameIndex(nFound);
}
bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nLen) const
@@ -806,7 +805,7 @@ bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nL
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#endif
- if( nLen != COMPLETE_STRING && GetOfst() > nPos + nLen ) // the range preceded us
+ if (nLen != TextFrameIndex(COMPLETE_STRING) && GetOfst() > nPos + nLen) // the range preceded us
#if defined __GNUC__ && !defined __clang__
#pragma GCC diagnostic pop
#endif
@@ -815,7 +814,7 @@ bool SwTextFrame::IsIdxInside(TextFrameIndex const nPos, TextFrameIndex const nL
if( !GetFollow() ) // the range doesn't precede us,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list