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

sw_redlinehide: more trivial conversions in txtfrm.cxx

Change-Id: Ib83f46bf9bb3acb03e5e5537686385fd398cdc3d
üst 0a7a6928
......@@ -874,7 +874,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) &&
......@@ -1108,7 +1108,7 @@ void SwTextFrame::CalcLineSpace()
return;
if( GetDrawObjs() ||
GetTextNode()->GetSwAttrSet().GetLRSpace().IsAutoFirst())
GetTextNodeForParaProps()->GetSwAttrSet().GetLRSpace().IsAutoFirst())
{
Init();
return;
......@@ -1240,14 +1240,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();
......@@ -1764,7 +1764,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 )
......@@ -1780,7 +1780,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
}
......@@ -1829,11 +1829,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
......@@ -1920,7 +1920,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);
......@@ -1948,14 +1948,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 ) )
......@@ -1965,7 +1965,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()));
......@@ -1998,7 +1998,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();
}
......@@ -2058,7 +2058,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
......@@ -2080,7 +2080,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();
......@@ -2108,7 +2108,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 )
......@@ -2119,7 +2119,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)));
}
......@@ -2128,8 +2128,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;
}
......@@ -2142,8 +2142,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 ) );
}
}
......@@ -2154,7 +2156,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
......@@ -2538,7 +2540,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() )
{
......@@ -2632,11 +2634,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" );
......@@ -2820,7 +2822,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 );
......@@ -2896,7 +2898,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;
......@@ -3028,8 +3030,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);
......@@ -3075,7 +3076,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment