// --> #i26945# - Additionally the type of the anchor text frame // is collected - by type is meant 'master' or 'follow'. class SwPageNumAndTypeOfAnchors
{ private: struct tEntry
{
SwAnchoredObject* mpAnchoredObj;
sal_uInt32 mnPageNumOfAnchor; bool mbAnchoredAtMaster;
};
std::vector< tEntry > maObjList;
public:
SwPageNumAndTypeOfAnchors()
{
}
void Collect( SwAnchoredObject& _rAnchoredObj )
{
tEntry aNewEntry;
aNewEntry.mpAnchoredObj = &_rAnchoredObj; // #i33751#, #i34060# - method <GetPageFrameOfAnchor()> // is replaced by method <FindPageFrameOfAnchor()>. It's return value // have to be checked.
SwPageFrame* pPageFrameOfAnchor = _rAnchoredObj.FindPageFrameOfAnchor(); if ( pPageFrameOfAnchor )
{
aNewEntry.mnPageNumOfAnchor = pPageFrameOfAnchor->GetPhyPageNum();
} else
{
aNewEntry.mnPageNumOfAnchor = 0;
} // --> #i26945# - collect type of anchor
SwTextFrame* pAnchorCharFrame = _rAnchoredObj.FindAnchorCharFrame(); if ( pAnchorCharFrame )
{
aNewEntry.mbAnchoredAtMaster = !pAnchorCharFrame->IsFollow();
} else
{
aNewEntry.mbAnchoredAtMaster = true;
}
maObjList.push_back( aNewEntry );
}
/** method to format all floating screen objects at the given anchor frame
*/ bool SwObjectFormatter::FormatObjsAtFrame( SwFrame& _rAnchorFrame, const SwPageFrame& _rPageFrame,
SwLayAction* _pLayAction )
{ bool bSuccess( true );
while ( pContent )
{ // format content
pContent->OptCalc();
// format floating screen objects at content text frame // #i23129#, #i36347# - pass correct page frame to // the object formatter if ( pContent->IsTextFrame() &&
!SwObjectFormatter::FormatObjsAtFrame( *pContent,
*(pContent->FindPageFrame()),
GetLayAction() ) )
{ // restart format with first content
pContent = rFlyFrame.ContainsContent(); continue;
}
// continue with next content
pContent = pContent->GetNextContentFrame();
}
}
/** performs the intrinsic format of a given floating screen object and its content.
#i28701#
*/ void SwObjectFormatter::FormatObj_( SwAnchoredObject& _rAnchoredObj )
{ // collect anchor object and its 'anchor' page number, if requested if ( mpPgNumAndTypeOfAnchors )
{
mpPgNumAndTypeOfAnchors->Collect( _rAnchoredObj );
}
if ( auto pFlyFrame = _rAnchoredObj.DynCastFlyFrame() )
{ // --> #i34753# - reset flag, which prevents a positioning if ( pFlyFrame->IsFlyLayFrame() )
{ static_cast<SwFlyLayFrame*>(pFlyFrame)->SetNoMakePos( false );
}
// #i81146# new loop control int nLoopControlRuns = 0; constint nLoopControlMax = 15;
do { if ( mpLayAction )
{
mpLayAction->FormatLayoutFly( pFlyFrame ); // --> consider, if the layout action // has to be restarted due to a delete of a page frame. if ( mpLayAction->IsAgain() )
{ break;
}
} else
{
FormatLayout_( *pFlyFrame );
} // --> #i34753# - prevent further positioning, if // to-page|to-fly anchored Writer fly frame is already clipped. if ( pFlyFrame->IsFlyLayFrame() && pFlyFrame->IsClipped() )
{ static_cast<SwFlyLayFrame*>(pFlyFrame)->SetNoMakePos( true );
} // #i23129#, #i36347# - pass correct page frame // to the object formatter
SwObjectFormatter::FormatObjsAtFrame( *pFlyFrame,
*(pFlyFrame->FindPageFrame()),
mpLayAction ); if ( mpLayAction )
{
mpLayAction->FormatFlyContent( pFlyFrame ); // --> consider, if the layout action // has to be restarted due to a delete of a page frame. if ( mpLayAction->IsAgain() )
{ break;
}
} else
{
FormatObjContent( *pFlyFrame );
}
// --> #i57917# // stop formatting of anchored object, if restart of layout process is requested.
} while ( !pFlyFrame->isFrameAreaDefinitionValid() &&
!_rAnchoredObj.RestartLayoutProcess() &&
pFlyFrame->GetAnchorFrame() == &GetAnchorFrame() );
} elseif ( dynamic_cast<const SwAnchoredDrawObject*>( &_rAnchoredObj) != nullptr )
{
_rAnchoredObj.MakeObjPos();
}
}
/** invokes the intrinsic format method for all floating screen objects, anchoredatanchorframeonthegivenpageframe
#i28701# #i26945#-forformatoffloatingscreenobjectsfor followtextframes,the'master'textframeispassedtothemethod. Thus,theobjects,whoseanchorcharacterisinsidethefollowtext framecanbeformatted.
*/ bool SwObjectFormatter::FormatObjsAtFrame_( SwTextFrame* _pMasterTextFrame )
{ // --> #i26945#
SwFrame* pAnchorFrame( nullptr ); if ( GetAnchorFrame().IsTextFrame() && static_cast<SwTextFrame&>(GetAnchorFrame()).IsFollow() &&
_pMasterTextFrame )
{
pAnchorFrame = _pMasterTextFrame;
} else
{
pAnchorFrame = &GetAnchorFrame();
} if ( !pAnchorFrame->GetDrawObjs() || pAnchorFrame->IsInDtor() )
{ // nothing to do, if no floating screen object is registered at the anchor frame. returntrue;
}
bool bSuccess( true );
for ( size_t i = 0; i < pAnchorFrame->GetDrawObjs()->size(); ++i )
{
SwAnchoredObject* pAnchoredObj = (*pAnchorFrame->GetDrawObjs())[i];
// check, if object's anchor is on the given page frame or // object is registered at the given page frame. // --> #i26945# - check, if the anchor character of the // anchored object is located in a follow text frame. If this anchor // follow text frame differs from the given anchor frame, the given // anchor frame is a 'master' text frame of the anchor follow text frame. // If the anchor follow text frame is in the same body as its 'master' // text frame, do not format the anchored object. // E.g., this situation can occur during the table row splitting algorithm.
SwTextFrame* pAnchorCharFrame = pAnchoredObj->FindAnchorCharFrame(); constbool bAnchoredAtFollowInSameBodyAsMaster =
pAnchorCharFrame && pAnchorCharFrame->IsFollow() &&
pAnchorCharFrame != pAnchoredObj->GetAnchorFrame() &&
pAnchorCharFrame->FindBodyFrame() == static_cast<SwTextFrame*>(pAnchoredObj->AnchorFrame())->FindBodyFrame(); // Make sure that in case nested split flys are moved "out of range" in // lcl_InvalidateLowerObjs(), then we moved them back here.
SwFlyFrame* pFly = pAnchoredObj->DynCastFlyFrame(); bool bSplitFly = pFly && pFly->IsFlySplitAllowed(); bool bNestedSplitFly = bSplitFly && pAnchorCharFrame && pAnchorCharFrame->IsInFly(); if (bAnchoredAtFollowInSameBodyAsMaster && !bNestedSplitFly)
{ continue;
} // #i33751#, #i34060# - method <GetPageFrameOfAnchor()> // is replaced by method <FindPageFrameOfAnchor()>. It's return value // have to be checked.
SwPageFrame* pPageFrameOfAnchor = pAnchoredObj->FindPageFrameOfAnchor();
OSL_ENSURE( pPageFrameOfAnchor, "<SwObjectFormatter::FormatObjsAtFrame_()> - missing page frame." ); // --> #i26945# if ( pPageFrameOfAnchor && pPageFrameOfAnchor == &mrPageFrame )
{ // if format of object fails, stop formatting and pass fail to // calling method via the return value. if ( !DoFormatObj( *pAnchoredObj ) )
{
bSuccess = false; break;
}
// considering changes at <pAnchorFrame->GetDrawObjs()> during // format of the object. if ( !pAnchorFrame->GetDrawObjs() ||
i > pAnchorFrame->GetDrawObjs()->size() )
{ break;
} else
{ const size_t nActPosOfObj =
pAnchorFrame->GetDrawObjs()->ListPosOf( *pAnchoredObj ); if ( nActPosOfObj == pAnchorFrame->GetDrawObjs()->size() ||
nActPosOfObj > i )
{
--i;
} elseif ( nActPosOfObj < i )
{
i = nActPosOfObj;
}
}
}
} // end of loop on <pAnchorFrame->.GetDrawObjs()>
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.