43 #include <viewimp.hxx>
50 #include <osl/diagnose.h>
59 mbNoMoveOnCheckClip( false ),
62 mpTransformableSwFrame()
75 const bool bRemoveFromPage =
79 if ( bRemoveFromPage )
165 int nLoopControlRuns = 0;
166 const int nLoopControlMax = 10;
250 OSL_ENSURE( nLoopControlRuns < nLoopControlMax,
"LoopControl in SwFlyFreeFrame::MakeAll" );
252 if ( nLoopControlRuns < nLoopControlMax )
256 nLoopControlRuns = 0;
295 #if OSL_DEBUG_LEVEL > 0
299 "SwFlyFreeFrame::Format(), flipping Fly." );
306 static bool bOverrideHandleContourToAlwaysOff(
true);
312 if(bOverrideHandleContourToAlwaysOff)
355 if(aFillAttributes && aFillAttributes->isUsed())
362 const std::unique_ptr<SvxBrushItem> aBack(
GetFormat()->makeBackgroundBrushItem());
364 if(aBack && aBack->isUsed())
411 rOffset.X(), rOffset.Y()));
430 if(
nullptr != pSwNoTextFrame)
451 bool bRetVal =
false;
454 while ( pToBeCheckedFrame &&
468 pToBeCheckedFrame = pToBeCheckedFrame->
GetUpper();
485 SwRect aClip, aTmpStretch;
495 const bool bBot = nBot > nClipBot;
496 const bool bRig = nRig > nClipRig;
515 if ( !bDisableOffPagePositioning || nOld <= nClipBot)
518 aFrm.
Pos().setY( std::max( aClip.
Top(), nClipBot - aFrm.
Height() ) );
535 if ( !bDisableOffPagePositioning || nOld <= nClipRig )
538 aFrm.
Pos().setX( std::max( aClip.
Left(), nClipRig - aFrm.
Width() ) );
549 aFrm.
Pos().setX( nOld );
578 nDiff -= aFrameRect.
Top();
579 nDiff = aFrameRect.
Height() - nDiff;
586 nDiff -= aFrameRect.
Left();
587 nDiff = aFrameRect.
Width() - nDiff;
588 aFrameRect.
Width( aFrameRect.
Width() - nDiff );
608 if ( aFrameRect.
Width() != aOldSize.
Width() &&
611 if ( (aOldSize.
Width() - aFrameRect.
Width()) >
708 "<SwFlyFreeFrame::CheckClip(..)> - fly frame has negative height now." );
732 if(!pLegacy || !pLegacy->m_pNew)
749 if(RndStdIds::FLY_AT_PAGE == pAnch->GetAnchorId())
753 sal_uInt16 nPagesToFlip = pAnch->GetPageNum()-1;
754 while(pTmpPage && nPagesToFlip)
759 if(pTmpPage && !nPagesToFlip)
772 SwNodeIndex aIdx(pAnch->GetContentAnchor()->nNode);
811 if ( pFly && pObj->
GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() )
818 pFly->GetVirtDrawObj()->
SetOrdNum( nNewNum );
833 const bool bSuccessInserted =
m_pSortedObjs->Insert( *pNew );
834 OSL_ENSURE( bSuccessInserted,
"Fly not inserted in Sorted." );
838 "<SwPageFrame::AppendFlyToPage(..)> - anchored fly frame seems to be registered at another page frame. Serious defect." );
851 static_cast< SwRootFrame * >(
GetUpper() )->IsAnyShellAccessible() &&
852 static_cast< SwRootFrame * >(
GetUpper() )->GetCurrShell() )
855 ->AddAccessibleFrame( pNew );
866 if (
auto pTmpFly = dynamic_cast<SwFlyFrame*>( pTmpObj) )
869 if ( pTmpFly->IsFlyFreeFrame() && !pTmpFly->GetPageFrame() )
872 else if ( dynamic_cast<const SwAnchoredDrawObject*>( pTmpObj) != nullptr )
875 if ( pTmpObj->GetPageFrame() != this )
877 if ( pTmpObj->GetPageFrame() != nullptr )
879 pTmpObj->GetPageFrame()->RemoveDrawObjFromPage( *pTmpObj );
896 static_cast<SwRootFrame*>(
GetUpper())->SetSuperfluous();
924 static_cast< SwRootFrame * >(
GetUpper() )->IsAnyShellAccessible() &&
925 static_cast< SwRootFrame * >(
GetUpper() )->GetCurrShell() )
928 ->DisposeAccessibleFrame( pToRemove,
true );
942 static_cast<SwRootFrame*>(
GetUpper())->SetSuperfluous();
960 static_cast< SwRootFrame * >(
GetUpper() )->IsAnyShellAccessible() &&
961 static_cast< SwRootFrame * >(
GetUpper() )->GetCurrShell() )
964 ->DisposeAccessibleFrame( pToMove,
true );
982 OSL_ENSURE( bSuccessInserted,
"Fly not inserted in Sorted." );
996 static_cast< SwRootFrame * >(
GetUpper() )->IsAnyShellAccessible() &&
997 static_cast< SwRootFrame * >(
GetUpper() )->GetCurrShell() )
1000 ->AddAccessibleFrame( pToMove );
1010 if (
auto pFly = dynamic_cast<SwFlyFrame*>( pObj) )
1012 if ( pFly->IsFlyFreeFrame() )
1017 pPageFrame->
MoveFly( pFly, pDest );
1022 else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) !=
nullptr )
1032 if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rNewObj) ==
nullptr )
1034 OSL_FAIL(
"SwPageFrame::AppendDrawObjToPage(..) - anchored object of unexpected type -> object not appended" );
1053 pFlyFrame->GetVirtDrawObj()->
SetOrdNum( nNewNum );
1068 "Drawing object not appended into list <pSortedObjs>." );
1072 "<SwPageFrame::AppendDrawObjToPage(..)> - anchored draw object seems to be registered at another page frame. Serious defect." );
1081 if ( dynamic_cast<const SwAnchoredDrawObject*>( &_rToRemoveObj) ==
nullptr )
1083 OSL_FAIL(
"SwPageFrame::RemoveDrawObjFromPage(..) - anchored object of unexpected type -> object not removed" );
1096 if (RndStdIds::FLY_AS_CHAR !=
1114 "<SwPageFrame::PlaceFly(..)> - empty page with no next page! -> fly frame appended at empty page" );
1127 OSL_ENSURE( pFormat,
":-( No Format given for Fly." );
1148 if (
auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pSdrObj) )
1150 const SwFlyFrame* pFly = pVirtFlyDrawObj->GetFlyFrame();
1153 const bool bConsiderWrapOnObjPos =
1161 if ( !bFollowTextFlow || bConsiderWrapOnObjPos )
1194 if ( !pVertPosOrientFrame )
1196 OSL_FAIL(
"::CalcClipRect(..) - frame, vertical position is oriented at, is missing .");
1200 if ( !bFollowTextFlow || bConsiderWrapOnObjPos )
1205 OSL_FAIL(
"!pClipFrame: "
1206 "if you can reproduce this please file a bug");
1220 rRect.
Union( aTmp );
1223 ->GetAnchorFrameContainingAnchPos()->
GetUpper();
1224 while ( pCellFrame && !pCellFrame->
IsCellFrame() )
1226 pCellFrame = pCellFrame->
GetUpper();
1232 rRect.
Union( aTmp );
1241 aEnvOfObj( bFollowTextFlow );
1252 rRect =
static_cast<const SwPageFrame&
>(rVertClipFrame).PrtWithoutHeaderAndFooter();
1263 aRectFnSet.SetRight(rRect, aRectFnSet.GetRight(pHoriClipFrame->
getFrameArea()));
1269 const_cast<SwFlyFrame*
>(pFly)->GetAnchorFrameContainingAnchPos();
1356 rRect.
Union( aTmp );
1374 aRectFnSet.SetBottom( rRect, aRectFnSet.GetPrtBottom(*pTab->
GetUpper()) );
1383 tools::Long nHeight = (9*aRectFnSet.GetHeight(rRect))/10;
1389 nTop = aRectFnSet.IsVert() ?
static_cast<const SwFlyInContentFrame*
>(pFly)->GetRefPoint().X() :
1391 nTop = aRectFnSet.YInc( nTop, -nHeight );
1393 aRectFnSet.SetLeftAndWidth( rRect, aRectFnSet.IsVert() ?
1400 nTop = aRectFnSet.YInc( aRectFnSet.GetBottom(pFly->
getFrameArea()),
1402 nHeight = 2*nHeight - aRectFnSet.GetHeight(pFly->
getFrameArea())
1405 aRectFnSet.SetTopAndHeight( rRect, nTop, nHeight );
1413 if ( RndStdIds::FLY_AS_CHAR == rAnch.
GetAnchorId() )
1418 OSL_FAIL(
"<::CalcClipRect(..)> - missing anchor frame." );
1446 nTop = aRectFnSet.
YInc( aRectFnSet.
GetTop(aSnapRect),
1447 rUL.
GetLower() + nTmpH - nHeight );
SwFrame * FindFooterOrHeader()
void SetTop(SwRect &rRect, tools::Long nNew) const
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Base class of the Writer layout elements.
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
virtual bool IsFormatPossible() const override
method to determine if a format on the Writer fly frame is possible
virtual void SwClientNotify(const SwModify &rMod, const SfxHint &rHint) override
bool IsFlyLayFrame() const
Point GetPos(const SwRect &rRect) const
virtual const SwFlyFrameFormat * GetFormat() const override
const SwSortedObjs * GetDrawObjs() const
double getLocalFrameRotation() const
SdrObject & ReferencedObj()
virtual const tools::Rectangle & GetCurrentBoundRect() const
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
tools::Long GetPrtRight(const SwFrame &rFrame) const
SwRect & Union(const SwRect &rRect)
sal_uInt16 GetLower() const
void SetHeight(tools::Long n)
drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
const SwLayoutFrame & GetVertEnvironmentLayoutFrame(const SwFrame &_rVertOrientFrame) const
determine environment layout frame for possible vertical object positions respectively for alignments...
TransformableSwFrame * getTransformableSwFrame()
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const override
static SwContentNode * GetContentNode(SwDoc &rDoc, SwNodeIndex &rIdx, bool bNext)
virtual bool IsFormatPossible() const override
method to determine, if a format on the Writer fly frame is possible
void MakeContentPos(const SwBorderAttrs &rAttrs)
virtual void NotifyBackground(SwPageFrame *pPage, const SwRect &rRect, PrepareHint eHint) override
Notifies the background (all ContentFrames that currently are overlapping).
void Left(const tools::Long nLeft)
virtual void InvalidateObjPos() override
method to invalidate position of the anchored object
void SetCompletePaint() const
bool IsInFootnote() const
SwFrameType GetType() const
bool IsNoMoveOnCheckClip() const
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const
const SdrPage * GetDrawPage() const
const SwRect & getFramePrintArea() const
static SwCache & GetCache()
SwTabFrame is one table in the document layout, containing rows (which contain cells).
void RemoveDrawObjFromPage(SwAnchoredObject &_rToRemoveObj)
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
void Pos(const Point &rNew)
virtual void Calc(vcl::RenderContext *pRenderContext) const
Of course Writer needs its own rectangles.
void AssertFlyPages()
Ensures that enough pages exist, so that all page bound frames and draw objects can be placed...
tools::Long GetWidth(const SwRect &rRect) const
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
The root element of a Writer document layout.
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
void InvalidateFlyInCnt() const
SwFlyLayFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
bool isFrameAreaDefinitionValid() const
double getLocalFrameRotation() const
virtual SwFrameFormat & GetFrameFormat() override
virtual const tools::Rectangle & GetSnapRect() const
sal_uInt16 GetPhyPageNum() const
bool IsFlyAtContentFrame() const
tools::Long GetTop(const SwRect &rRect) const
SwRect & Intersection_(const SwRect &rRect)
constexpr tools::Long Width() const
void RemoveFlyFromPage(SwFlyFrame *pToRemove)
virtual void DestroyImpl() override
void ChgLowersProp(const Size &rOldSize)
Change size of lowers proportionally.
void SetBottom(SwRect &rRect, tools::Long nNew) const
wrapper class for the positioning of Writer fly frames and drawing objects
void AppendFly(SwFlyFrame *pNew)
SdrPage * getSdrPageFromSdrObject() const
const SwRect & getFrameArea() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool isTransformableSwFrame() const
void CheckClip(const SwFormatFrameSize &rSz)
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
void InvalidateFlyContent() const
tools::Long GetPrtLeft(const SwFrame &rFrame) const
void Width(tools::Long nNew)
void setFramePrintAreaValid(bool bNew)
const SdrObject & GetReferencedObj() const
SwFlyFrame * FindFlyFrame()
static bool IsDraggingOffPageAllowed(const SwFrameFormat *)
method to determine if dragging objects off page is allowed
bool IsFlyInContentFrame() const
virtual void transform_translate(const Point &rOffset) override
sal_uInt32 GetOrdNumDirect() const
bool CalcClipRect(const SdrObject *pSdrObj, SwRect &rRect, bool bMove)
calculate rectangle in that the object can be moved or rather be resized
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame, use GetBreakItem()/GetPageDescItem() instead.
void PlaceFly(SwFlyFrame *pFly, SwFlyFrameFormat *pFormat)
double getLocalFrameRotation_from_SwNoTextFrame(const SwNoTextFrame &rNoTextFrame)
bool IsColumnFrame() const
SwFootnoteFrame * FindFootnoteFrame()
virtual ~SwFlyFreeFrame() override
bool m_bLayout
RndStdIds::FLY_AT_PAGE, RndStdIds::FLY_AT_FLY, at page or at frame.
void InvalidateAutoCompleteWords() const
void RemoveFly(SwFlyFrame *pToRemove)
std::unique_ptr< TransformableSwFrame > mpTransformableSwFrame
const SdrObject * GetDrawObj() const
const SwSortedObjs * GetSortedObjs() const
void MakePrtArea(const SwBorderAttrs &rAttrs)
void InvalidateSpelling() const
tools::Long GetPrtBottom(const SwFrame &rFrame) const
void SetAssertFlyPages()
Makes sure that all requested page-bound Flys find a Page.
void Remove(SwAnchoredObject &_rAnchoredObj)
bool Insert(SwAnchoredObject &_rAnchoredObj)
SwPageFrame * FindPageFrame()
tools::Long YInc(tools::Long n1, tools::Long n2) const
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
const SwFrame * Lower() const
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
tools::Long GetHeight(const SwRect &rRect) const
void SetRight(SwRect &rRect, tools::Long nNew) const
SwLayoutFrame * GetUpper()
void InvalidateSmartTags() const
virtual void DestroyImpl() override
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
bool isFramePrintAreaValid() const
::rtl::Reference< Content > pContent
bool HasEnvironmentAutoSize() const
determines, if direct environment of fly frame has 'auto' size
sal_uInt32 GetOrdNum() const
tools::Long GetPrtTop(const SwFrame &rFrame) const
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const override
const SwAttrSet & GetAttrSet() const
virtual const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() override
Marks a node in the document model.
bool isFrameAreaPositionValid() const
void MoveFly(SwFlyFrame *pToMove, SwPageFrame *pDest)
void SSize(const Size &rNew)
bool isFrameAreaSizeValid() const
void InvalidateFlyLayout() const
Validate, invalidate and query the Page status Layout/Content and Fly/non-Fly respectively are inspec...
A page of the document layout.
virtual SdrObject * RemoveObject(size_t nObjNum)
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Frame cannot be moved in Var-direction.
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
void SetWidth(tools::Long n)
SwSectionFrame * FindSctFrame()
void setFrameAreaPositionValid(bool bNew)
void SetTopAndHeight(SwRect &rRect, tools::Long nTop, tools::Long nHeight) const
const SwLayoutFrame * GetVertPosOrientFrame() const
bool HasBorder(bool bTreatPaddingAsBorder) const
general base class for all free-flowing frames
virtual SwFrameFormat & GetFrameFormat()=0
#define SAL_WARN_IF(condition, area, stream)
constexpr tools::Long Height() const
SwPageFrame * GetPageFrame()
void ClrContourCache(const SdrObject *pObj)
bool supportsAutoContour() const
void SetOrdNum(sal_uInt32 nNum)
void SetPageFrame(SwPageFrame *_pNewPageFrame)
bool IsInside(const Point &rPOINT) const
bool IsNoTextFrame() const
void Top(const tools::Long nTop)
bool IsColBodyFrame() const
These SwFrame inlines are here, so that frame.hxx does not need to include layfrm.hxx.
void setFrameAreaSizeValid(bool bNew)
SwFlyFrame * GetNextLink() const
static const SwFormatAnchor * GetAnchorFromPoolItem(const SfxPoolItem &rItem)
void AppendFlyToPage(SwFlyFrame *pNew)
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
const Point & GetAnchorPos() const
constexpr TypedWhichId< SvxBoxItem > RES_BOX(106)
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"Formats" the Frame; Frame and PrtArea.
void SetLeft(SwRect &rRect, tools::Long nNew) const
virtual SdrObject * SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
const SwFrame * GetAnchorFrame() const
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
void InvalidateWordCount() const
bool PositionLocked() const
void SetLeftAndWidth(SwRect &rRect, tools::Long nLeft, tools::Long nWidth) const
class for collecting anchored objects
void Height(tools::Long nNew)
SwContentNode * GoNext(SwNodeIndex *) const
bool IsFooterFrame() const
SwRootFrame * getRootFrame()
virtual void transform_translate(const Point &rOffset)
std::unique_ptr< SwSortedObjs > m_pSortedObjs
SwFlyFreeFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
const SwFormatFrameSize & GetFrameSize(bool=true) const
sal_uInt16 GetUpper() const
bool IsHeaderFrame() const
SwTabFrame * FindTabFrame()