30 #include <osl/diagnose.h>
61 if ( pPageFrameOfAnchor )
71 if ( pAnchorCharFrame )
79 maObjList.push_back( aNewEntry );
84 return maObjList[_nIndex].mpAnchoredObj;
89 return maObjList[_nIndex].mnPageNumOfAnchor;
95 return maObjList[_nIndex].mbAnchoredAtMaster;
100 return maObjList.size();
106 const bool _bCollectPgNumOfAnchors )
107 : mrPageFrame( _rPageFrame ),
109 mpLayAction( _pLayAction ),
124 std::unique_ptr<SwObjectFormatter> pObjFormatter;
128 static_cast<SwTextFrame&>(_rAnchorFrame),
129 _rPageFrame, _pLayAction );
134 static_cast<SwLayoutFrame&>(_rAnchorFrame),
135 _rPageFrame, _pLayAction );
139 OSL_FAIL(
"<SwObjectFormatter::CreateObjFormatter(..)> - unexpected type of anchor frame" );
142 return pObjFormatter;
151 bool bSuccess(
true );
154 std::unique_ptr<SwObjectFormatter> pObjFormatter =
160 bSuccess = pObjFormatter->DoFormatObjs();
172 bool bSuccess(
true );
175 "<SwObjectFormatter::FormatObj(..)> - missing anchor frame" );
176 SwFrame& rAnchorFrame = _pAnchorFrame ? *_pAnchorFrame : *(_rAnchoredObj.
AnchorFrame());
179 "<SwObjectFormatter::FormatObj(..)> - missing page frame" );
180 const SwPageFrame& rPageFrame = _pPageFrame ? *_pPageFrame : *(rAnchorFrame.FindPageFrame());
183 std::unique_ptr<SwObjectFormatter> pObjFormatter =
190 bSuccess = pObjFormatter->DoFormatObj( _rAnchoredObj,
true );
210 while ( pLowerFrame )
216 pLowerFrame = pLowerFrame->
GetNext();
227 if ( dynamic_cast<const SwFlyFrame*>( &_rAnchoredObj) ==
nullptr )
271 if (
auto pFlyFrame = dynamic_cast<SwFlyFrame*>( &_rAnchoredObj) )
274 if ( pFlyFrame->IsFlyLayFrame() )
276 static_cast<SwFlyLayFrame*
>(pFlyFrame)->SetNoMakePos(
false );
280 int nLoopControlRuns = 0;
281 const int nLoopControlMax = 15;
300 if ( pFlyFrame->IsFlyLayFrame() && pFlyFrame->IsClipped() )
302 static_cast<SwFlyLayFrame*
>(pFlyFrame)->SetNoMakePos(
true );
307 *(pFlyFrame->FindPageFrame()),
324 if ( ++nLoopControlRuns >= nLoopControlMax )
326 OSL_FAIL(
"LoopControl in SwObjectFormatter::FormatObj_: Stage 3!!!" );
327 pFlyFrame->ValidateThisAndAllLowers( 2 );
328 nLoopControlRuns = 0;
333 }
while ( !pFlyFrame->isFrameAreaDefinitionValid() &&
337 else if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rAnchoredObj) != nullptr )
355 SwFrame* pAnchorFrame(
nullptr );
360 pAnchorFrame = _pMasterTextFrame;
372 bool bSuccess(
true );
388 const bool bAnchoredAtFollowInSameBodyAsMaster =
389 pAnchorCharFrame && pAnchorCharFrame->
IsFollow() &&
393 if ( bAnchoredAtFollowInSameBodyAsMaster )
401 OSL_ENSURE( pPageFrameOfAnchor,
402 "<SwObjectFormatter::FormatObjsAtFrame_()> - missing page frame." );
404 if ( pPageFrameOfAnchor && pPageFrameOfAnchor == &
mrPageFrame )
423 const size_t nActPosOfObj =
430 else if ( nActPosOfObj <
i )
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
vcl::RenderContext * GetOut() const
virtual void MakeObjPos()=0
method to determine position for the object and set the position at the object
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
SwAnchoredObject * operator[](sal_uInt32 _nIndex)
const SwSortedObjs * GetDrawObjs() const
SwAnchoredObject * mpAnchoredObj
SwContentFrame * GetNextContentFrame() const
sal_uInt32 GetPageNum(sal_uInt32 _nIndex) const
void FormatFlyContent(const SwFlyFrame *)
static std::unique_ptr< SwObjectFormatterTextFrame > CreateObjFormatter(SwTextFrame &_rAnchorTextFrame, const SwPageFrame &_rPageFrame, SwLayAction *_pLayAction)
method to create an instance of is necessary.
SwPageNumAndTypeOfAnchors()
const SwBodyFrame * FindBodyFrame() const
virtual void Calc(vcl::RenderContext *pRenderContext) const
bool AnchoredAtMaster(sal_uInt32 _nIndex)
sal_uInt16 GetPhyPageNum() const
SwTextFrame * FindAnchorCharFrame()
get frame, which contains the anchor character, if the object is anchored at-character or as-characte...
wrapper class for the positioning of Writer fly frames and drawing objects
sal_uInt32 mnPageNumOfAnchor
void Collect(SwAnchoredObject &_rAnchoredObj)
The usage of LayAction is always the same:
SwPageFrame * FindPageFrame()
const SwFrame * Lower() const
::rtl::Reference< Content > pContent
A page of the document layout.
std::vector< tEntry > maObjList
bool RestartLayoutProcess() const
bool IsLayoutFrame() const
general base class for all free-flowing frames
SwPageFrame * FindPageFrameOfAnchor()
method to determine the page frame, on which the 'anchor' of the given anchored object is...
size_t ListPosOf(const SwAnchoredObject &_rAnchoredObj) const
Position of object <_rAnchoredObj> in sorted list.
void FormatLayoutFly(SwFlyFrame *)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
const SwFrame * GetAnchorFrame() const
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
SwViewShell * GetCurrShell() const
SwRootFrame * getRootFrame()