20#include <config_wasm_strip.h>
51#include <osl/diagnose.h>
60 mbNoMoveOnCheckClip( false )
73 const bool bRemoveFromPage =
77 if ( bRemoveFromPage )
163 int nLoopControlRuns = 0;
164 const int nLoopControlMax = 10;
248 OSL_ENSURE( nLoopControlRuns < nLoopControlMax,
"LoopControl in SwFlyFreeFrame::MakeAll" );
250 if ( nLoopControlRuns < nLoopControlMax )
254 nLoopControlRuns = 0;
293#if OSL_DEBUG_LEVEL > 0
297 "SwFlyFreeFrame::Format(), flipping Fly." );
304 static bool bOverrideHandleContourToAlwaysOff(
true);
310 if(bOverrideHandleContourToAlwaysOff)
351 if(aFillAttributes && aFillAttributes->isUsed())
358 const std::unique_ptr<SvxBrushItem> aBack(
GetFormat()->makeBackgroundBrushItem());
407 rOffset.
X(), rOffset.
Y()));
426 if(
nullptr != pSwNoTextFrame)
447 bool bRetVal =
false;
450 while ( pToBeCheckedFrame &&
464 pToBeCheckedFrame = pToBeCheckedFrame->
GetUpper();
481 SwRect aClip, aTmpStretch;
491 const bool bBot = nBot > nClipBot;
492 const bool bRig = nRig > nClipRig;
511 if ( !bDisableOffPagePositioning || nOld <= nClipBot)
514 aFrm.
Pos().setY( std::max( aClip.
Top(), nClipBot - aFrm.
Height() ) );
531 if ( !bDisableOffPagePositioning || nOld <= nClipRig )
534 aFrm.
Pos().setX( std::max( aClip.
Left(), nClipRig - aFrm.
Width() ) );
545 aFrm.
Pos().setX( nOld );
574 nDiff -= aFrameRect.
Top();
575 nDiff = aFrameRect.
Height() - nDiff;
582 nDiff -= aFrameRect.
Left();
583 nDiff = aFrameRect.
Width() - nDiff;
584 aFrameRect.
Width( aFrameRect.
Width() - nDiff );
604 if ( aFrameRect.
Width() != aOldSize.
Width() &&
607 if ( (aOldSize.
Width() - aFrameRect.
Width()) >
643 pFormat->LockModify();
648 pFormat->UnlockModify();
704 "<SwFlyFreeFrame::CheckClip(..)> - fly frame has negative height now." );
740 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
752 SAL_WARN_IF(pAnch->GetAnchorId() ==
GetFormat()->GetAnchor().GetAnchorId(),
"sw.core",
"Invalid change of anchor type.");
760 if(RndStdIds::FLY_AT_PAGE == pAnch->GetAnchorId())
764 sal_uInt16 nPagesToFlip = pAnch->GetPageNum()-1;
765 while(pTmpPage && nPagesToFlip)
770 if(pTmpPage && !nPagesToFlip)
829 pDrawObj = pShapeFormat->FindRealSdrObject();
857 const bool bSuccessInserted =
m_pSortedObjs->Insert( *pNew );
858 OSL_ENSURE( bSuccessInserted,
"Fly not inserted in Sorted." );
862 "<SwPageFrame::AppendFlyToPage(..)> - anchored fly frame seems to be registered at another page frame. Serious defect." );
874#if !ENABLE_WASM_STRIP_ACCESSIBILITY
880 ->AddAccessibleFrame( pNew );
892 if (
auto pTmpFly = pTmpObj->DynCastFlyFrame() )
895 if ( pTmpFly->IsFlyFreeFrame() && !pTmpFly->GetPageFrame() )
901 if ( pTmpObj->GetPageFrame() != this )
903 pTmpObj->RegisterAtPage(*
this);
945#if !ENABLE_WASM_STRIP_ACCESSIBILITY
951 ->DisposeAccessibleFrame( pToRemove,
true );
983#if !ENABLE_WASM_STRIP_ACCESSIBILITY
989 ->DisposeAccessibleFrame( pToMove,
true );
1009 if (!pFrame->IsTabFrame())
1016 pFrame->InvalidatePrt();
1026 OSL_ENSURE( bSuccessInserted,
"Fly not inserted in Sorted." );
1039#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1045 ->AddAccessibleFrame( pToMove );
1056 pObj->RegisterAtPage(*pDest);
1064 OSL_FAIL(
"SwPageFrame::AppendDrawObjToPage(..) - anchored object of unexpected type -> object not appended" );
1098 "Drawing object not appended into list <pSortedObjs>." );
1102 "<SwPageFrame::AppendDrawObjToPage(..)> - anchored draw object seems to be registered at another page frame. Serious defect." );
1113 OSL_FAIL(
"SwPageFrame::RemoveDrawObjFromPage(..) - anchored object of unexpected type -> object not removed" );
1126 if (RndStdIds::FLY_AS_CHAR !=
1144 "<SwPageFrame::PlaceFly(..)> - empty page with no next page! -> fly frame appended at empty page" );
1157 OSL_ENSURE( pFormat,
":-( No Format given for Fly." );
1178 if (
auto pVirtFlyDrawObj =
dynamic_cast<const SwVirtFlyDrawObj*
>(pSdrObj) )
1180 const SwFlyFrame* pFly = pVirtFlyDrawObj->GetFlyFrame();
1183 const bool bConsiderWrapOnObjPos =
1191 if ( !bFollowTextFlow || bConsiderWrapOnObjPos )
1224 if ( !pVertPosOrientFrame )
1226 OSL_FAIL(
"::CalcClipRect(..) - frame, vertical position is oriented at, is missing .");
1230 if ( !bFollowTextFlow || bConsiderWrapOnObjPos )
1235 OSL_FAIL(
"!pClipFrame: "
1236 "if you can reproduce this please file a bug");
1250 rRect.
Union( aTmp );
1253 ->GetAnchorFrameContainingAnchPos()->
GetUpper();
1254 while ( pCellFrame && !pCellFrame->
IsCellFrame() )
1256 pCellFrame = pCellFrame->
GetUpper();
1262 rRect.
Union( aTmp );
1271 aEnvOfObj( bFollowTextFlow );
1282 rRect =
static_cast<const SwPageFrame&
>(rVertClipFrame).PrtWithoutHeaderAndFooter();
1299 const_cast<SwFlyFrame*
>(pFly)->GetAnchorFrameContainingAnchPos();
1386 rRect.
Union( aTmp );
1421 nTop = aRectFnSet.
YInc( nTop, -nHeight );
1443 if ( RndStdIds::FLY_AS_CHAR == rAnch.
GetAnchorId() )
1448 OSL_FAIL(
"<::CalcClipRect(..)> - missing anchor frame." );
1476 nTop = aRectFnSet.
YInc( aRectFnSet.
GetTop(aSnapRect),
1477 rUL.
GetLower() + nTmpH - nHeight );
@ CONSIDER_WRAP_ON_OBJECT_POSITION
@ DISABLE_OFF_PAGE_POSITIONING
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
constexpr tools::Long Y() const
constexpr tools::Long X() const
virtual SdrObject * SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
virtual rtl::Reference< SdrObject > RemoveObject(size_t nObjNum)
sal_uInt32 GetOrdNumDirect() const
const Point & GetAnchorPos() const
sal_uInt32 GetOrdNum() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
virtual const tools::Rectangle & GetSnapRect() const
void SetOrdNum(sal_uInt32 nNum)
SdrPage * getSdrPageFromSdrObject() const
const SdrObject & GetReferencedObj() const
SdrObject & ReferencedObj()
constexpr tools::Long Height() const
constexpr tools::Long Width() const
bool HasBorder(bool bTreatPaddingAsBorder) const
void SetHeight(tools::Long n)
void SetWidth(tools::Long n)
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
class for the positioning of drawing objects
wrapper class for the positioning of Writer fly frames and drawing objects
const SwFrame * GetAnchorFrame() const
bool PositionLocked() const
void SetPageFrame(SwPageFrame *_pNewPageFrame)
const SwLayoutFrame * GetVertPosOrientFrame() const
virtual SwFrameFormat & GetFrameFormat()=0
SwPageFrame * GetPageFrame()
bool IsForceNotifyNewBackground()
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
static bool IsDraggingOffPageAllowed(const SwFrameFormat *)
method to determine if dragging objects off page is allowed
const SdrObject * GetDrawObj() const
const SwFormatFrameSize & GetFrameSize(bool=true) const
const SwAttrSet & GetAttrSet() const
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
general base class for all free-flowing frames
const SwVirtFlyDrawObj * GetVirtDrawObj() const
virtual void DestroyImpl() override
void MakeContentPos(const SwBorderAttrs &rAttrs)
virtual bool IsFormatPossible() const override
method to determine if a format on the Writer fly frame is possible
virtual const SwFlyFrameFormat * GetFormat() const override
bool IsFlyAtContentFrame() const
static const SwFormatAnchor * GetAnchorFromPoolItem(const SfxPoolItem &rItem)
virtual void InvalidateObjPos() override
method to invalidate position of the anchored object
virtual SwFrameFormat & GetFrameFormat() override
virtual void SwClientNotify(const SwModify &rMod, const SfxHint &rHint) override
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
SwFlyFrame * GetNextLink() const
bool IsFlyInContentFrame() const
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"Formats" the Frame; Frame and PrtArea.
bool IsFlyLayFrame() const
void MakePrtArea(const SwBorderAttrs &rAttrs)
virtual const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() override
bool m_bLayout
RndStdIds::FLY_AT_PAGE, RndStdIds::FLY_AT_FLY, at page or at frame.
bool HasEnvironmentAutoSize() const
determines, if direct environment of fly frame has 'auto' size
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
virtual ~SwFlyFreeFrame() override
bool isTransformableSwFrame() const
std::unique_ptr< TransformableSwFrame > mpTransformableSwFrame
virtual void DestroyImpl() override
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const override
double getLocalFrameRotation() const
bool supportsAutoContour() const
virtual void NotifyBackground(SwPageFrame *pPage, const SwRect &rRect, PrepareHint eHint) override
Notifies the background (all ContentFrames that currently are overlapping).
bool IsNoMoveOnCheckClip() const
SwFlyFreeFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor, bool bFollow=false)
void CheckClip(const SwFormatFrameSize &rSz)
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const override
virtual void transform_translate(const Point &rOffset) override
virtual bool IsFormatPossible() const override
method to determine, if a format on the Writer fly frame is possible
TransformableSwFrame * getTransformableSwFrame()
Flys that are anchored as a character in the content.
Flys that are bound to layout frames (to-frame) and not to/as content.
virtual void RegisterAtPage(SwPageFrame &) override
SwFlyLayFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
const SwRect & getFrameArea() const
bool isFrameAreaDefinitionValid() const
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
bool isFrameAreaPositionValid() const
const SwRect & getFramePrintArea() const
void setFramePrintAreaValid(bool bNew)
void setFrameAreaPositionValid(bool bNew)
virtual void transform_translate(const Point &rOffset)
bool isFramePrintAreaValid() const
bool isFrameAreaSizeValid() const
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const
void setFrameAreaSizeValid(bool bNew)
Base class of the Writer layout elements.
void RemoveFly(SwFlyFrame *pToRemove)
SwFlyFrame * FindFlyFrame()
SwSectionFrame * FindSctFrame()
SwTabFrame * FindTabFrame()
bool supportsFullDrawingLayerFillAttributeSet() const
bool IsColumnFrame() const
SwFrameType GetType() const
bool IsInFootnote() const
bool IsHeaderFrame() const
virtual void Calc(vcl::RenderContext *pRenderContext) const
const SwSortedObjs * GetDrawObjs() const
static SwCache & GetCache()
void AppendFly(SwFlyFrame *pNew)
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame,...
bool IsFooterFrame() const
SwLayoutFrame * GetUpper()
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
SwRootFrame * getRootFrame()
bool IsNoTextFrame() const
void SetCompletePaint() const
SwPageFrame * FindPageFrame()
drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
SwFrame * FindFooterOrHeader()
SwFootnoteFrame * FindFootnoteFrame()
bool IsColBodyFrame() const
These SwFrame inlines are here, so that frame.hxx does not need to include layfrm....
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
void ChgLowersProp(const Size &rOldSize)
Change size of lowers proportionally.
const SwFrame * Lower() const
double getLocalFrameRotation() const
Marks a node in the document model.
SwContentNode * GoNext(SwNodeIndex *) const
A page of the document layout.
void AppendFlyToPage(SwFlyFrame *pNew)
void PlaceFly(SwFlyFrame *pFly, SwFlyFrameFormat *pFormat)
void InvalidateWordCount() const
void InvalidateFlyLayout() const
Validate, invalidate and query the Page status Layout/Content and Fly/non-Fly respectively are inspec...
void InvalidateAutoCompleteWords() const
sal_uInt16 GetPhyPageNum() const
void RemoveFlyFromPage(SwFlyFrame *pToRemove)
void InvalidateFlyInCnt() const
const SwSortedObjs * GetSortedObjs() const
void InvalidateSmartTags() const
void MoveFly(SwFlyFrame *pToMove, SwPageFrame *pDest)
void RemoveDrawObjFromPage(SwAnchoredObject &_rToRemoveObj)
void InvalidateSpelling() const
void InvalidateFlyContent() const
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
std::unique_ptr< SwSortedObjs > m_pSortedObjs
tools::Long GetHeight(const SwRect &rRect) const
tools::Long YInc(tools::Long n1, tools::Long n2) const
void SetLeftAndWidth(SwRect &rRect, tools::Long nLeft, tools::Long nWidth) const
void SetBottom(SwRect &rRect, tools::Long nNew) const
void SetRight(SwRect &rRect, tools::Long nNew) const
tools::Long GetWidth(const SwRect &rRect) const
tools::Long GetTop(const SwRect &rRect) const
tools::Long GetPrtRight(const SwFrame &rFrame) const
Point GetPos(const SwRect &rRect) const
void SetTopAndHeight(SwRect &rRect, tools::Long nTop, tools::Long nHeight) const
tools::Long GetLeft(const SwRect &rRect) const
tools::Long GetPrtTop(const SwFrame &rFrame) const
tools::Long GetPrtLeft(const SwFrame &rFrame) const
tools::Long GetBottom(const SwRect &rRect) const
void SetTop(SwRect &rRect, tools::Long nNew) const
tools::Long GetRight(const SwRect &rRect) const
tools::Long GetPrtBottom(const SwFrame &rFrame) const
void SetLeft(SwRect &rRect, tools::Long nNew) const
Of course Writer needs its own rectangles.
void Height(tools::Long nNew)
SwRect & Union(const SwRect &rRect)
void Top(const tools::Long nTop)
SwRect & Intersection_(const SwRect &rRect)
void Pos(const Point &rNew)
void SSize(const Size &rNew)
bool Contains(const Point &rPOINT) const
void Left(const tools::Long nLeft)
void Width(tools::Long nNew)
The root element of a Writer document layout.
SwViewShell * GetCurrShell() const
const SdrPage * GetDrawPage() const
void SetAssertFlyPages()
Makes sure that all requested page-bound Flys find a Page.
void AssertFlyPages()
Ensures that enough pages exist, so that all page bound frames and draw objects can be placed.
class for collecting anchored objects
bool Insert(SwAnchoredObject &_rAnchoredObj)
void Remove(SwAnchoredObject &_rAnchoredObj)
SwTabFrame is one table in the document layout, containing rows (which contain cells).
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType, const SdrObject *pObject=nullptr)
If we have an associated TextFrame, then return that.
vcl::RenderContext * GetOut() const
const SwLayoutFrame & GetVertEnvironmentLayoutFrame(const SwFrame &_rVertOrientFrame) const
determine environment layout frame for possible vertical object positions respectively for alignments...
static SwContentNode * GetContentNode(SwDoc &rDoc, SwPosition &rPos, bool bNext)
double getLocalFrameRotation_from_SwNoTextFrame(const SwNoTextFrame &rNoTextFrame)
bool CalcClipRect(const SdrObject *pSdrObj, SwRect &rRect, bool bMove)
calculate rectangle in that the object can be moved or rather be resized
@ Fixed
Frame cannot be moved in Var-direction.
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
#define SAL_WARN_IF(condition, area, stream)
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
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.
void ClrContourCache(const SdrObject *pObj)