[Libreoffice-commits] core.git: Branch 'private/mst/sw_redlinehide' - 2 commits - sw/source
Michael Stahl
Michael.Stahl at cib.de
Thu May 17 16:54:25 UTC 2018
sw/source/core/text/frmform.cxx | 24 +++++++--------
sw/source/core/text/txtfrm.cxx | 63 ++++++++++++++++++++--------------------
2 files changed, 44 insertions(+), 43 deletions(-)
New commits:
commit 0fa12be08239e79566467c4efc3a99b1eb7d3f4e
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Thu May 17 18:52:09 2018 +0200
sw_redlinehide: more trivial conversions in txtfrm.cxx
Change-Id: Ib83f46bf9bb3acb03e5e5537686385fd398cdc3d
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 1308009bf15c..7bcd56a5efd1 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -866,7 +866,7 @@ bool sw_HideObj( const SwTextFrame& _rFrame,
if (_eAnchorType == RndStdIds::FLY_AT_CHAR)
{
- const IDocumentSettingAccess* pIDSA = _rFrame.GetTextNode()->getIDocumentSettingAccess();
+ const IDocumentSettingAccess *const pIDSA = &_rFrame.GetDoc().getIDocumentSettingAccess();
if ( !pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) &&
!pIDSA->get(DocumentSettingId::OLD_LINE_SPACING) &&
!pIDSA->get(DocumentSettingId::USE_FORMER_OBJECT_POS) &&
@@ -1100,7 +1100,7 @@ void SwTextFrame::CalcLineSpace()
return;
if( GetDrawObjs() ||
- GetTextNode()->GetSwAttrSet().GetLRSpace().IsAutoFirst())
+ GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace().IsAutoFirst())
{
Init();
return;
@@ -1232,14 +1232,14 @@ static void lcl_SetScriptInval( SwTextFrame& rFrame, sal_Int32 nPos )
rFrame.GetPara()->GetScriptInfo().SetInvalidityA( nPos );
}
-static void lcl_ModifyOfst( SwTextFrame* pFrame, sal_Int32 nPos, sal_Int32 nLen )
+static void lcl_ModifyOfst(SwTextFrame* pFrame, TextFrameIndex const nPos, TextFrameIndex const nLen)
{
while( pFrame && pFrame->GetOfst() <= nPos )
pFrame = pFrame->GetFollow();
while( pFrame )
{
- if (nLen == COMPLETE_STRING)
- pFrame->ManipOfst( pFrame->GetTextNode()->GetText().getLength() );
+ if (nLen == TextFrameIndex(COMPLETE_STRING))
+ pFrame->ManipOfst(TextFrameIndex(pFrame->GetText().getLength()));
else
pFrame->ManipOfst( pFrame->GetOfst() + nLen );
pFrame = pFrame->GetFollow();
@@ -1756,7 +1756,7 @@ void SwTextFrame::PrepWidows( const sal_uInt16 nNeed, bool bNotify )
}
}
-static bool lcl_ErgoVadis( SwTextFrame* pFrame, sal_Int32 &rPos, const PrepareHint ePrep )
+static bool lcl_ErgoVadis(SwTextFrame* pFrame, TextFrameIndex & rPos, const PrepareHint ePrep)
{
const SwFootnoteInfo &rFootnoteInfo = pFrame->GetNode()->GetDoc()->GetFootnoteInfo();
if( ePrep == PREP_ERGOSUM )
@@ -1772,7 +1772,7 @@ static bool lcl_ErgoVadis( SwTextFrame* pFrame, sal_Int32 &rPos, const PrepareHi
if( pFrame->HasFollow() )
rPos = pFrame->GetFollow()->GetOfst();
else
- rPos = pFrame->GetText().getLength();
+ rPos = TextFrameIndex(pFrame->GetText().getLength());
if( rPos )
--rPos; // our last character
}
@@ -1821,11 +1821,11 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
if ( aTextFly.Relax() || IsUndersized() )
break;
}
- if( GetTextNode()->GetSwAttrSet().GetRegister().GetValue())
+ if (GetTextNodeForParaProps()->GetSwAttrSet().GetRegister().GetValue())
break;
SwTextGridItem const*const pGrid(GetGridItem(FindPageFrame()));
- if ( pGrid && GetTextNode()->GetSwAttrSet().GetParaGrid().GetValue() )
+ if (pGrid && GetTextNodeForParaProps()->GetSwAttrSet().GetParaGrid().GetValue())
break;
// i#28701 - consider anchored objects
@@ -1912,7 +1912,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
const SwFootnoteInfo &rFootnoteInfo = GetNode()->GetDoc()->GetFootnoteInfo();
if( !pPara->UpdateQuoVadis( rFootnoteInfo.aQuoVadis ) )
{
- sal_Int32 nPos = pPara->GetParLen();
+ TextFrameIndex nPos = pPara->GetParLen();
if( nPos )
--nPos;
InvalidateRange( SwCharRange(nPos, TextFrameIndex(1)), 1);
@@ -1940,14 +1940,14 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
if( HasFollow() )
{
- sal_Int32 nNxtOfst = GetFollow()->GetOfst();
+ TextFrameIndex nNxtOfst = GetFollow()->GetOfst();
if( nNxtOfst )
--nNxtOfst;
InvalidateRange(SwCharRange( nNxtOfst, TextFrameIndex(1)), 1);
}
if( IsInFootnote() )
{
- sal_Int32 nPos;
+ TextFrameIndex nPos;
if( lcl_ErgoVadis( this, nPos, PREP_QUOVADIS ) )
InvalidateRange( SwCharRange( nPos, TextFrameIndex(1)) );
if( lcl_ErgoVadis( this, nPos, PREP_ERGOSUM ) )
@@ -1957,7 +1957,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
SwTextNode const* pNode(nullptr);
sw::MergedAttrIter iter(*this);
TextFrameIndex const nEnd = GetFollow()
- ? GetFollow()->GetOfst() : COMPLETE_STRING;
+ ? GetFollow()->GetOfst() : TextFrameIndex(COMPLETE_STRING);
for (SwTextAttr const* pHt = iter.NextAttr(&pNode); pHt; pHt = iter.NextAttr(&pNode))
{
TextFrameIndex const nStart(MapModelToView(pNode, pHt->GetStart()));
@@ -1990,7 +1990,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
if ( isFramePrintAreaValid() )
{
SwTextGridItem const*const pGrid(GetGridItem(FindPageFrame()));
- if ( pGrid && GetTextNode()->GetSwAttrSet().GetParaGrid().GetValue() )
+ if (pGrid && GetTextNodeForParaProps()->GetSwAttrSet().GetParaGrid().GetValue())
InvalidatePrt();
}
@@ -2050,7 +2050,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
}
else
{
- if( GetTextNode()->GetSwAttrSet().GetRegister().GetValue() )
+ if (GetTextNodeForParaProps()->GetSwAttrSet().GetRegister().GetValue())
bParaPossiblyInvalid = Prepare( PREP_REGISTER, nullptr, bNotify );
// The Frames need to be readjusted, which caused by changes
// in position
@@ -2072,7 +2072,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
break;
}
case PREP_REGISTER:
- if( GetTextNode()->GetSwAttrSet().GetRegister().GetValue() )
+ if (GetTextNodeForParaProps()->GetSwAttrSet().GetRegister().GetValue())
{
pPara->SetPrepAdjust();
CalcLineSpace();
@@ -2100,7 +2100,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
// Which had flowed to the next page to be together with the footnote (this is
// especially true for areas with columns)
OSL_ENSURE( GetFollow(), "PREP_FTN_GONE may only be called by Follow" );
- sal_Int32 nPos = GetFollow()->GetOfst();
+ TextFrameIndex nPos = GetFollow()->GetOfst();
if( IsFollow() && GetOfst() == nPos ) // If we don't have a mass of text, we call our
FindMaster()->Prepare( PREP_FTN_GONE ); // Master's Prepare
if( nPos )
@@ -2111,7 +2111,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
case PREP_ERGOSUM:
case PREP_QUOVADIS:
{
- sal_Int32 nPos;
+ TextFrameIndex nPos;
if( lcl_ErgoVadis( this, nPos, ePrep ) )
InvalidateRange(SwCharRange(nPos, TextFrameIndex(1)));
}
@@ -2120,8 +2120,8 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
{
if( pVoid )
{
- sal_Int32 nWhere = CalcFlyPos( static_cast<SwFrameFormat const *>(pVoid) );
- OSL_ENSURE( COMPLETE_STRING != nWhere, "Prepare: Why me?" );
+ TextFrameIndex const nWhere = CalcFlyPos( static_cast<SwFrameFormat const *>(pVoid) );
+ OSL_ENSURE( TextFrameIndex(COMPLETE_STRING) != nWhere, "Prepare: Why me?" );
InvalidateRange(SwCharRange(nWhere, TextFrameIndex(1)));
return bParaPossiblyInvalid;
}
@@ -2134,8 +2134,10 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
{
if( PREP_FLY_ARRIVE == ePrep || PREP_FLY_LEAVE == ePrep )
{
- sal_Int32 nLen = ( GetFollow() ? GetFollow()->GetOfst() :
- COMPLETE_STRING ) - GetOfst();
+ TextFrameIndex const nLen = (GetFollow()
+ ? GetFollow()->GetOfst()
+ : TextFrameIndex(COMPLETE_STRING))
+ - GetOfst();
InvalidateRange( SwCharRange( GetOfst(), nLen ) );
}
}
@@ -2146,7 +2148,7 @@ bool SwTextFrame::Prepare( const PrepareHint ePrep, const void* pVoid,
Init();
pPara = nullptr;
if( GetOfst() && !IsFollow() )
- SetOfst_( 0 );
+ SetOfst_( TextFrameIndex(0) );
if ( bNotify )
InvalidateSize();
else
@@ -2530,7 +2532,7 @@ void SwTextFrame::CalcAdditionalFirstLineOffset()
// reset additional first line offset
mnAdditionalFirstLineOffset = 0;
- const SwTextNode* pTextNode( GetTextNode() );
+ const SwTextNode* pTextNode( GetTextNodeForParaProps() );
if ( pTextNode && pTextNode->IsNumbered() && pTextNode->IsCountedInList() &&
pTextNode->GetNumRule() )
{
@@ -2624,11 +2626,11 @@ void SwTextFrame::CalcHeightOfLastLine( const bool _bUseFont )
return;
}
OutputDevice* pOut = pVsh->GetOut();
- const IDocumentSettingAccess* pIDSA = GetTextNode()->getIDocumentSettingAccess();
+ const IDocumentSettingAccess *const pIDSA = &GetDoc().getIDocumentSettingAccess();
if ( !pVsh->GetViewOptions()->getBrowseMode() ||
pVsh->GetViewOptions()->IsPrtFormat() )
{
- pOut = GetTextNode()->getIDocumentDeviceAccess().getReferenceDevice( true );
+ pOut = GetDoc().getIDocumentDeviceAccess().getReferenceDevice( true );
}
OSL_ENSURE( pOut, "<SwTextFrame::_GetHeightOfLastLineForPropLineSpacing()> - no OutputDevice" );
@@ -2812,7 +2814,7 @@ sal_uInt16 SwTextFrame::GetLineCount(TextFrameIndex const nPos)
break;
SwTextSizeInfo aInf( pFrame );
SwTextMargin aLine( pFrame, &aInf );
- if( COMPLETE_STRING == nPos )
+ if (TextFrameIndex(COMPLETE_STRING) == nPos)
aLine.Bottom();
else
aLine.CharToLine( nPos );
@@ -2888,7 +2890,7 @@ void SwTextFrame::RecalcAllLines()
const sal_uLong nOld = GetAllLines();
const SwFormatLineNumber &rLineNum = pAttrSet->GetLineNumber();
sal_uLong nNewNum;
- const bool bRestart = GetTextNode()->GetDoc()->GetLineNumberInfo().IsRestartEachPage();
+ const bool bRestart = GetDoc().GetLineNumberInfo().IsRestartEachPage();
if ( !IsFollow() && rLineNum.GetStartValue() && rLineNum.IsCount() )
nNewNum = rLineNum.GetStartValue() - 1;
@@ -3020,8 +3022,7 @@ void SwTextFrame::CalcBaseOfstForFly()
OSL_ENSURE( !IsVertical() || !IsSwapped(),
"SwTextFrame::CalcBasePosForFly with swapped frame!" );
- const SwNode* pNode = GetTextNode();
- if ( !pNode->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_FLY_OFFSETS) )
+ if (!GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_FLY_OFFSETS))
return;
SwRectFnSet aRectFnSet(this);
@@ -3067,7 +3068,7 @@ void SwTextFrame::CalcBaseOfstForFly()
mnFlyAnchorOfst = nRet1 - nLeft;
mnFlyAnchorOfstNoWrap = nRet2 - nLeft;
- if (!pNode->getIDocumentSettingAccess()->get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
+ if (!GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::ADD_VERTICAL_FLY_OFFSETS))
return;
mnFlyAnchorVertOfstNoWrap = nFlyAnchorVertOfstNoWrap;
commit 2d20cf658466173f09046e9b65a7acd8eb12afc5
Author: Michael Stahl <Michael.Stahl at cib.de>
Date: Thu May 17 18:13:55 2018 +0200
sw_redlinehide: trivial node conversions in frmform.cxx
Change-Id: Ie92995ca729f394c5d332626591021918ff9db72
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index e9c2e4730aae..f6cb776baf15 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -694,7 +694,7 @@ void SwTextFrame::SplitFrame(TextFrameIndex const nTextPos)
// The Paste sends a Modify() to me
// I lock myself, so that my data does not disappear
TextFrameLockGuard aLock( this );
- SwTextFrame *pNew = static_cast<SwTextFrame *>(GetTextNode()->MakeFrame( this ));
+ SwTextFrame *const pNew = static_cast<SwTextFrame *>(GetTextNodeFirst()->MakeFrame(this));
pNew->SetFollow( GetFollow() );
SetFollow( pNew );
@@ -1092,7 +1092,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
// the numbering and must stay.
if ( GetFollow()->GetOfst() != nEnd ||
GetFollow()->IsFieldFollow() ||
- (nStrLen == TextFrameIndex(0) && GetTextNode()->GetNumRule()))
+ (nStrLen == TextFrameIndex(0) && GetTextNodeForParaProps()->GetNumRule()))
{
nNew |= 3;
}
@@ -1116,7 +1116,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
// as-character anchored object.
if ( !bOnlyContainsAsCharAnchoredObj &&
(nStrLen > TextFrameIndex(0) ||
- (nStrLen == TextFrameIndex(0) && GetTextNode()->GetNumRule()))
+ (nStrLen == TextFrameIndex(0) && GetTextNodeForParaProps()->GetNumRule()))
)
{
SplitFrame( nEnd );
@@ -1215,7 +1215,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
SwRepaint &rRepaint = pPara->GetRepaint();
if( bUnChg && rRepaint.Top() == rLine.Y()
&& (bPrev || nNewStart <= pPara->GetReformat().Start())
- && (nNewStart < GetTextNode()->GetText().getLength()))
+ && (nNewStart < TextFrameIndex(GetText().getLength())))
{
rRepaint.Top( nBottom );
rRepaint.Height( 0 );
@@ -1286,7 +1286,7 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, const bool bPrev )
return true;
// Until the String's end?
- if (nNewStart >= GetTextNode()->GetText().getLength())
+ if (nNewStart >= TextFrameIndex(GetText().getLength()))
return false;
if( rLine.GetInfo().IsShift() )
@@ -1310,8 +1310,8 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
SwParaPortion *pPara = rLine.GetInfo().GetParaPortion();
rLine.SetUnclipped( false );
- const OUString &rString = GetTextNode()->GetText();
- const sal_Int32 nStrLen = rString.getLength();
+ const OUString & rString = GetText();
+ const TextFrameIndex nStrLen(rString.getLength());
SwCharRange &rReformat = pPara->GetReformat();
SwRepaint &rRepaint = pPara->GetRepaint();
@@ -1354,7 +1354,7 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
bool bPrev = rLine.GetPrev() &&
(FindBrk(rString, rLine.GetStart(), rReformat.Start() + TextFrameIndex(1))
// i#46560
- + 1
+ + TextFrameIndex(1)
>= rReformat.Start() ||
rLine.GetCurr()->IsRest() );
if( bPrev )
@@ -1440,7 +1440,7 @@ void SwTextFrame::Format_( SwTextFormatter &rLine, SwTextFormatInfo &rInf,
bool bJumpMidHyph = false;
bool bWatchMidHyph = false;
- const SwAttrSet& rAttrSet = GetTextNode()->GetSwAttrSet();
+ const SwAttrSet& rAttrSet = GetTextNodeForParaProps()->GetSwAttrSet();
bool bMaxHyph = ( 0 !=
( rInf.MaxHyph() = rAttrSet.GetHyphenZone().GetMaxHyphens() ) );
if ( bMaxHyph )
@@ -1794,7 +1794,7 @@ void SwTextFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderAttr
return;
}
- const sal_Int32 nStrLen = GetTextNode()->GetText().getLength();
+ const TextFrameIndex nStrLen(GetText().getLength());
if ( nStrLen || !FormatEmpty() )
{
@@ -1833,7 +1833,7 @@ void SwTextFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderAttr
SwTextLineAccess aAccess( this );
const bool bNew = !aAccess.IsAvailable();
const bool bSetOfst =
- (GetOfst() && GetOfst() > GetTextNode()->GetText().getLength());
+ (GetOfst() && GetOfst() > TextFrameIndex(GetText().getLength()));
if( CalcPreps() )
; // nothing
@@ -1841,7 +1841,7 @@ void SwTextFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderAttr
// and does not have any format information
else if( !bNew && !aAccess.GetPara()->GetReformat().Len() )
{
- if( GetTextNode()->GetSwAttrSet().GetRegister().GetValue() )
+ if (GetTextNodeForParaProps()->GetSwAttrSet().GetRegister().GetValue())
{
aAccess.GetPara()->SetPrepAdjust();
aAccess.GetPara()->SetPrep();
More information about the Libreoffice-commits
mailing list