// clear member, which denotes the layout frame at which the vertical // position is oriented at, if it doesn't fit to the new page frame. if ( GetVertPosOrientFrame() &&
( !_pNewPageFrame ||
_pNewPageFrame != GetVertPosOrientFrame()->FindPageFrame() ) )
{
ClearVertPosOrientFrame();
}
// assign new page frame
mpPageFrame = _pNewPageFrame;
}
// #i28701# - take over functionality of deleted method // <SwFlyAtContentFrame::AssertPage()>: assure for at-paragraph and at-character // an anchored object, that it is registered at the correct page frame
RegisterAtCorrectPage();
}
// --> if requested, assure that anchor frame, // which contains the anchor character, has a paragraph portion information. // The paragraph portion information is needed to determine the // anchor character rectangle respectively the top of the line. // Thus, a format of this frame is avoided to determine the // paragraph portion information. // --> #i26945# - use new method <FindAnchorCharFrame()> const SwTextFrame& aAnchorCharFrame = *(FindAnchorCharFrame()); if ( !_bCheckForParaPorInf || aAnchorCharFrame.HasPara() )
{
CheckCharRect( rAnch, aAnchorCharFrame );
CheckTopOfLine( rAnch, aAnchorCharFrame );
}
}
// check alignment for invalidation of position if ( GetFrameFormat()->GetVertOrient().GetRelationOrient() == text::RelOrientation::TEXT_LINE )
{ // #i26945#, #i35911# - unlock position of // anchored object, if it isn't registered at the page, // where its anchor character frame is on. if ( GetPageFrame() != _rAnchorCharFrame.FindPageFrame() )
{
UnlockPosition();
}
InvalidateObjPos();
} // keep new top of line value
mnLastTopOfLine = nTopOfLine;
}
/** method to perform necessary invalidations for the positioning of objects,forwhosethewrappingstyleinfluencehastobeconsidered ontheobjectpositioning.
#i28701#
*/ void SwAnchoredObject::InvalidateObjPosForConsiderWrapInfluence()
{ if ( ConsiderObjWrapInfluenceOnObjPos() )
{ // indicate that object has not to be considered for text wrap
SetConsiderForTextWrap( false ); // unlock position
UnlockPosition(); // invalidate position
InvalidateObjPos(); // invalidate 'background'
NotifyBackground( GetPageFrame(), GetObjRectWithSpaces(), PrepareHint::FlyFrameLeave );
}
}
/** method to determine, if wrapping style influence of the anchored objecthastobeconsideredontheobjectpositioning
if (const SwFrameFormat* pObjFormat = GetFrameFormat())
{ // --> #i3317# - add condition <IsTmpConsiderWrapInfluence()> // --> #i55204# // - correction: wrapping style influence has been considered, if condition // <IsTmpConsiderWrapInfluence()> is hold, regardless of its anchor type // or its wrapping style. if (IsTmpConsiderWrapInfluence())
{
bRet = true;
} elseif (pObjFormat->getIDocumentSettingAccess().get(
DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION))
{ const SwFormatAnchor& rAnchor = pObjFormat->GetAnchor(); if (((rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
|| (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA))
&& pObjFormat->GetSurround().GetSurround() != css::text::WrapTextMode_THROUGH)
{ // --> #i34520# - text also wraps around anchored // objects in the layer Hell - see the text formatting. // Thus, it hasn't to be checked here.
bRet = true;
}
}
}
return bRet;
}
/** method to determine, if other anchored objects, also attached at totheanchorframe,havetoconsideritswrapinfluence.
if ( GetFrameFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) )
{ // invalidate position of all anchored objects at anchor frame if ( GetAnchorFrame()->GetDrawObjs() )
{ const SwSortedObjs* pObjs = GetAnchorFrame()->GetDrawObjs(); for(auto it = pObjs->begin(); it != pObjs->end(); ++it)
{
SwAnchoredObject* pAnchoredObj = *it; if(pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos())
pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence(); else
pAnchoredObj->InvalidateObjPos();
}
} // invalidate all following anchored objects on the page frame if ( GetPageFrame() && GetPageFrame()->GetSortedObjs() )
{ const SwSortedObjs* pObjs = GetPageFrame()->GetSortedObjs(); // determine start index for ( size_t i = pObjs->ListPosOf( *this ) + 1; i < pObjs->size(); ++i )
{
SwAnchoredObject* pAnchoredObj = (*pObjs)[i]; if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence(); else
pAnchoredObj->InvalidateObjPos();
}
}
} // update its position in the sorted object list of its anchor frame
AnchorFrame()->GetDrawObjs()->Update( *this ); // update its position in the sorted object list of its page frame // note: as-character anchored object aren't registered at a page frame if ( GetPageFrame() && GetPageFrame()->GetSortedObjs() &&
GetFrameFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR )
{
GetPageFrame()->GetSortedObjs()->Update( *this );
}
}
/** method to determine, if invalidation of position is allowed
#i28701#
*/ bool SwAnchoredObject::InvalidationOfPosAllowed() const
{ // --> Check, if page frame layout is in progress, // isn't needed, because of anchored object, whose are moved forward. return !PositionLocked();
}
/** method to determine the page frame, on which the 'anchor' of thegivenanchoredobjectis.
// --> #i44339# - check, if anchor frame exists. if ( mpAnchorFrame )
{ if (const SwFrameFormat* pFormat = GetFrameFormat())
{ const SwFormatAnchor& rAnch = pFormat->GetAnchor(); if ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
|| (rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR))
{ // When the object was already removed from text, but the layout hasn't been // updated yet, this can be nullptr: if (const SwPosition* pContentAnchor = rAnch.GetContentAnchor())
{
SwTextFrame* const pFrame(static_cast<SwTextFrame*>(AnchorFrame()));
TextFrameIndex const nOffset(pFrame->MapModelToViewPos(*pContentAnchor));
pAnchorCharFrame = &pFrame->GetFrameAtOfst(nOffset);
}
} elseif (SwFlyFrame* pFlyFrame = DynCastFlyFrame())
{ // See if this fly is split. If so, then the anchor is also split. All anchors are // empty, except the last follow. if (pFlyFrame->IsFlySplitAllowed())
{ auto pFlyAtContentFrame = static_cast<SwFlyAtContentFrame*>(pFlyFrame);
SwFlyAtContentFrame* pFly = pFlyAtContentFrame;
SwTextFrame* pAnchor = static_cast<SwTextFrame*>(AnchorFrame()); // If we have to jump back N frames to find the master fly, then we have to step N // frames from the master anchor to reach the correct follow anchor. while (pFly->GetPrecede())
{
pFly = pFly->GetPrecede(); if (!pAnchor)
{
SAL_WARN("sw.layout", "SwAnchoredObject::FindAnchorCharFrame: fly chain " "length is longer then anchor chain length"); break;
}
pAnchor = pAnchor->GetFollow();
} if (pAnchor)
{
pAnchorCharFrame = pAnchor;
}
}
}
}
}
return pAnchorCharFrame;
}
/** method to determine, if a format on the anchored object is possible
bool SwAnchoredObject::IsDraggingOffPageAllowed(const SwFrameFormat* pFrameFormat)
{
assert(pFrameFormat); constbool bDisablePositioning = pFrameFormat->getIDocumentSettingAccess().get(DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING); // If this fly is paired with a draw format, then take the wrap text mode from the outer draw // format, since the fly format is always wrap through.
SwFrameFormat* pDrawFormat = SwTextBoxHelper::getOtherTextBoxFormat(pFrameFormat, RES_FLYFRMFMT); const SwFrameFormat* pFormat = pDrawFormat ? pDrawFormat : pFrameFormat; constbool bIsWrapThrough = pFormat->GetSurround().GetSurround() == text::WrapTextMode::WrapTextMode_THROUGH;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.