// get attributes of new object const SwFrameFormat* pFormatNew = _pNewAnchoredObj->GetFrameFormat(); if (!pFormatNew) returnfalse; const SwFormatAnchor* pAnchorNew = &(pFormatNew->GetAnchor());
// Both objects aren't anchor to page or to fly // Thus, compare content anchor nodes, if existing. const SwNode* pContentAnchorListed = pAnchorListed->GetAnchorNode(); const SwNode* pContentAnchorNew = pAnchorNew->GetAnchorNode(); if ( pContentAnchorListed && pContentAnchorNew &&
*pContentAnchorListed != *pContentAnchorNew )
{ return *pContentAnchorListed < *pContentAnchorNew;
}
// objects anchored at the same content. // --> OD 2006-11-29 #???# - objects have to be ordered by anchor node position // Thus, compare content anchor node positions and anchor type, // if not anchored at-paragraph if (pContentAnchorListed && pContentAnchorNew)
{
sal_Int32 nListedIndex = pAnchorListed->GetAnchorId() != RndStdIds::FLY_AT_PARA ?
pAnchorListed->GetAnchorContentOffset() : 0;
sal_Int32 nNewIndex = pAnchorNew->GetAnchorId() != RndStdIds::FLY_AT_PARA ?
pAnchorNew->GetAnchorContentOffset() : 0; if (nListedIndex != nNewIndex)
{ return nListedIndex < nNewIndex;
}
}
int nAnchorListedWeight = GetAnchorWeight(pAnchorListed->GetAnchorId()); int nAnchorNewWeight = GetAnchorWeight(pAnchorNew->GetAnchorId()); if (nAnchorListedWeight != nAnchorNewWeight)
{ return nAnchorListedWeight < nAnchorNewWeight;
}
// objects anchored at the same content and at the same content anchor // node position with the same anchor type // Thus, compare its wrapping style including its layer const IDocumentDrawModelAccess& rIDDMA = pFormatListed->getIDocumentDrawModelAccess(); const SdrLayerID nHellId = rIDDMA.GetHellId(); const SdrLayerID nInvisibleHellId = rIDDMA.GetInvisibleHellId(); constbool bWrapThroughOrHellListed =
pFormatListed->GetSurround().GetSurround() == css::text::WrapTextMode_THROUGH ||
_pListedAnchoredObj->GetDrawObj()->GetLayer() == nHellId ||
_pListedAnchoredObj->GetDrawObj()->GetLayer() == nInvisibleHellId; constbool bWrapThroughOrHellNew =
pFormatNew->GetSurround().GetSurround() == css::text::WrapTextMode_THROUGH ||
_pNewAnchoredObj->GetDrawObj()->GetLayer() == nHellId ||
_pNewAnchoredObj->GetDrawObj()->GetLayer() == nInvisibleHellId; if ( bWrapThroughOrHellListed != bWrapThroughOrHellNew )
{ return !bWrapThroughOrHellListed;
} elseif ( bWrapThroughOrHellListed && bWrapThroughOrHellNew )
{ return pAnchorListed->GetOrder() < pAnchorNew->GetOrder();
}
// objects anchored at the same content with a set text wrapping // Thus, compare wrap influences on object position const SwFormatWrapInfluenceOnObjPos* pWrapInfluenceOnObjPosListed =
&(pFormatListed->GetWrapInfluenceOnObjPos()); const SwFormatWrapInfluenceOnObjPos* pWrapInfluenceOnObjPosNew =
&(pFormatNew->GetWrapInfluenceOnObjPos()); // #i35017# - handle ITERATIVE as ONCE_SUCCESSIVE if ( pWrapInfluenceOnObjPosListed->GetWrapInfluenceOnObjPos( true ) !=
pWrapInfluenceOnObjPosNew->GetWrapInfluenceOnObjPos( true ) )
{ // #i35017# - constant name has changed return pWrapInfluenceOnObjPosListed->GetWrapInfluenceOnObjPos( true )
== text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE;
}
// objects anchored at the same content position/page/fly with same // wrap influence. // Thus, compare anchor order number return pAnchorListed->GetOrder() < pAnchorNew->GetOrder();
}
};
bool SwSortedObjs::Insert( SwAnchoredObject& _rAnchoredObj )
{ if (!is_sorted())
{
SAL_WARN("sw.core", "SwSortedObjs::Insert: object list is not sorted");
UpdateAll();
}
void SwSortedObjs::Update( const SwAnchoredObject& _rAnchoredObj )
{ if ( !Contains( _rAnchoredObj ) )
{ // given anchored object not found in list
OSL_FAIL( "<SwSortedObjs::Update(..) - sorted list doesn't contain given anchored object" ); return;
}
if ( size() == 1 )
{ // given anchored object is the only one in the list. return;
}
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.