94 "Illegal change of anchor type.");
111 ? *
static_cast<SwTextFrame *
>(pContent)->GetTextNodeFirst()
125 const bool bNext = !bFound && aOldIdx < aNewIdx;
126 while(pContent && !bFound)
160 std::pair<Point, bool>
const tmp(pOldAnchor->
getFrameArea().
Pos(),
false);
162 OSL_ENSURE(pContent,
"New anchor not found");
200 std::vector<Point> maObjPositions;
203 explicit SwOszControl(
const SwFlyFrame *pFrame );
206 static bool IsInProgress(
const SwFlyFrame *pFly );
211 const SwFlyFrame* SwOszControl::s_pStack1 =
nullptr;
212 const SwFlyFrame* SwOszControl::s_pStack2 =
nullptr;
213 const SwFlyFrame* SwOszControl::s_pStack3 =
nullptr;
214 const SwFlyFrame* SwOszControl::s_pStack4 =
nullptr;
215 const SwFlyFrame* SwOszControl::s_pStack5 =
nullptr;
217 SwOszControl::SwOszControl(
const SwFlyFrame* pFrame)
220 if (!SwOszControl::s_pStack1)
221 SwOszControl::s_pStack1 = m_pFly;
222 else if (!SwOszControl::s_pStack2)
223 SwOszControl::s_pStack2 = m_pFly;
224 else if (!SwOszControl::s_pStack3)
225 SwOszControl::s_pStack3 = m_pFly;
226 else if (!SwOszControl::s_pStack4)
227 SwOszControl::s_pStack4 = m_pFly;
228 else if (!SwOszControl::s_pStack5)
229 SwOszControl::s_pStack5 = m_pFly;
232 SwOszControl::~SwOszControl()
234 if (SwOszControl::s_pStack1 == m_pFly)
235 SwOszControl::s_pStack1 =
nullptr;
236 else if (SwOszControl::s_pStack2 == m_pFly)
237 SwOszControl::s_pStack2 =
nullptr;
238 else if (SwOszControl::s_pStack3 == m_pFly)
239 SwOszControl::s_pStack3 =
nullptr;
240 else if (SwOszControl::s_pStack4 == m_pFly)
241 SwOszControl::s_pStack4 =
nullptr;
242 else if (SwOszControl::s_pStack5 == m_pFly)
243 SwOszControl::s_pStack5 =
nullptr;
245 maObjPositions.clear();
248 bool SwOszControl::IsInProgress(
const SwFlyFrame *pFly )
250 if (SwOszControl::s_pStack1 && !pFly->
IsLowerOf(SwOszControl::s_pStack1))
252 if (SwOszControl::s_pStack2 && !pFly->
IsLowerOf(SwOszControl::s_pStack2))
254 if (SwOszControl::s_pStack3 && !pFly->
IsLowerOf(SwOszControl::s_pStack3))
256 if (SwOszControl::s_pStack4 && !pFly->
IsLowerOf(SwOszControl::s_pStack4))
258 if (SwOszControl::s_pStack5 && !pFly->
IsLowerOf(SwOszControl::s_pStack5))
263 bool SwOszControl::ChkOsz()
265 bool bOscillationDetected =
false;
267 if ( maObjPositions.size() == 20 )
270 bOscillationDetected =
true;
274 Point aNewObjPos = m_pFly->GetObjRect().Pos();
275 for (
auto const & pt : maObjPositions )
277 if ( aNewObjPos == pt )
280 bOscillationDetected =
true;
284 if ( !bOscillationDetected )
286 maObjPositions.push_back( aNewObjPos );
290 return bOscillationDetected;
340 if ( aMain.GetSurround() == css::text::WrapTextMode_NONE )
342 aMain.
SetSurround( css::text::WrapTextMode_THROUGH );
349 SwOszControl aOszCntrl(
this );
355 const bool bFormatAnchor =
368 bool bConsiderWrapInfluenceDueToOverlapPrevCol(
false );
377 bool bConsiderWrapInfluenceDueToMovedFwdAnchor(
false );
382 const bool bPosChgDueToOwnFormat =
388 bConsiderWrapInfluenceDueToOverlapPrevCol =
true;
401 const bool bAnchoredAtMaster(!rAnchPosAnchorFrame.
IsFollow());
412 sal_uInt32 nToPageNum( 0 );
413 bool bDummy(
false );
416 bAnchoredAtMaster, nToPageNum, bDummy ) )
418 bConsiderWrapInfluenceDueToMovedFwdAnchor =
true;
422 bool bInsert(
true );
423 sal_uInt32 nAnchorFrameToPageNum( 0 );
426 rDoc, *pAnchorTextFrame, nAnchorFrameToPageNum ) )
428 if ( nAnchorFrameToPageNum < nToPageNum )
443 ( pFooter || bPosChgDueToOwnFormat ) ) )
445 bOsz = aOszCntrl.ChkOsz();
458 if ( aSurround.GetSurround() == css::text::WrapTextMode_NONE )
461 aSurround.SetSurround( css::text::WrapTextMode_THROUGH );
465 OSL_FAIL(
"<SwFlyAtContentFrame::MakeAll()> - special loop prevention for dedicated document of b6403541 applied" );
481 !bConsiderWrapInfluenceDueToOverlapPrevCol &&
483 !bConsiderWrapInfluenceDueToMovedFwdAnchor &&
490 if ( bConsiderWrapInfluenceDueToMovedFwdAnchor &&
497 pCellFrame = pCellFrame->
GetUpper();
505 bConsiderWrapInfluenceDueToMovedFwdAnchor =
false;
509 if ( bOsz || bConsiderWrapInfluenceDueToOverlapPrevCol ||
511 bConsiderWrapInfluenceDueToMovedFwdAnchor )
527 !SwOszControl::IsInProgress(
this );
541 bool operator<(
const SwDistance& rTwo )
const
543 return m_nMain < rTwo.m_nMain
544 || (m_nMain == rTwo.m_nMain && m_nSub && rTwo.m_nSub && m_nSub < rTwo.m_nSub);
546 bool operator<=(
const SwDistance& rTwo )
const
548 return m_nMain < rTwo.m_nMain
549 || (m_nMain == rTwo.m_nMain
550 && (!m_nSub || !rTwo.m_nSub || m_nSub <= rTwo.m_nSub));
576 const bool bVertL2R = pUp->
IsVertLR();
581 const SwTwips nTopForObjPos = lcl_GetTopForObjPos(pCnt, bVert, bVertL2R);
589 rRet.m_nMain = rPt.X() - nTopForObjPos;
591 rRet.m_nMain = nTopForObjPos - rPt.X();
594 rRet.m_nMain = rPt.Y() - nTopForObjPos;
618 rRet.m_nMain = rPt.X() - nTopForObjPos;
620 rRet.m_nMain = nTopForObjPos - rPt.X();
623 rRet.m_nMain = rPt.Y() - nTopForObjPos;
648 rRet.m_nSub = rRet.m_nMain;
721 bSct =
nullptr != pSect;
730 if ( !static_cast<const SwLayoutFrame*>(pLay)->Lower() )
742 rRet.m_nSub += nPrtHeight;
744 rRet.m_nMain += nPrtHeight;
824 bSct =
nullptr != pSect;
833 : ( rPt.Y() - nFrameTop );
835 rRet.m_nSub += nDiff;
837 rRet.m_nMain += nDiff;
886 const sal_uInt64 nDiff = (dX * dX) + (dY * dY);
889 if ( nDiff < nDistance )
892 nDistance = nNearest = nDiff;
893 rpCnt = pNearest = pCnt;
896 else if ( nDiff < nNearest )
906 }
while ( pCnt && pLay->
IsAnLower( pCnt ) );
938 sal_uInt64 nNearest = nDist;
944 for (
int i = 0; pPge->
GetPrev() && (
i < 3); ++
i )
952 pRet = pNearest = pNew;
953 nDist = nNearest = nNew;
955 else if ( nNew < nNearest )
969 for (
int j = 0; pPge->
GetNext() && (j < 3); ++j )
977 pRet = pNearest = pNew;
978 nDist = nNearest = nNew;
980 else if ( nNew < nNearest )
1002 if ( rPoint.getX() < aTmp.Left() )
1003 rPoint.setX(aTmp.Left());
1004 else if ( rPoint.getX() > aTmp.Right() )
1005 rPoint.setX(aTmp.Right());
1006 if ( rPoint.getY() < aTmp.Top() )
1007 rPoint.setY(aTmp.Top());
1008 else if ( rPoint.getY() > aTmp.Bottom() )
1009 rPoint.setY(aTmp.Bottom());
1019 const bool bBodyOnly )
1042 const bool bBody = pCnt->
IsInDocBody() || bBodyOnly;
1064 GetContentPos( aTmp,
false,
true );
1075 SwDistance nUp, nUpLst;
1077 SwDistance nDown = nUp;
1078 bool bNegAllowed =
true;
1081 pUpLst = pUpFrame; nUpLst = nUp;
1093 while ( pUpFrame && ((nUpLst < nUp && pUpFrame->IsInTab()) ||
1104 if (nUp.m_nMain >= 0 &&
LONG_MAX != nUp.m_nMain)
1106 bNegAllowed =
false;
1107 if (nUpLst.m_nMain < 0)
1109 { pUpLst = pUpFrame;
1113 }
while (pUpFrame && ((bNegAllowed && nUp.m_nMain < 0) || (nUp <= nUpLst)));
1117 SwDistance nDownLst;
1118 if (nDown.m_nMain < 0)
1122 pDownLst = pDownFrame; nDownLst = nDown;
1124 while ( pDownFrame &&
1130 if (nDown.m_nMain < 0)
1143 if (nDown.m_nMain < 0)
1151 }
while (pDownFrame && nDown <= nDownLst && nDown.m_nMain !=
LONG_MAX
1168 return nDownLst < nUpLst ? pDownLst : pUpLst;
1181 pCnt = const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(
GetAnchorFrame()));
1186 const bool bVertL2R = pCnt->
IsVertLR();
1212 const SwFrame *pFrame =
nullptr;
1233 nY = aDist.m_nMain + aDist.m_nSub;
1251 SAL_WARN(
"sw.core",
"very unexpected missing PrevContentFrame");
1273 }
while ( pFollow != pOriginal );
1284 const SwTwips nTopForObjPos = lcl_GetTopForObjPos(pCnt, bVert, bVertL2R);
1288 nY = rNew.X() - nTopForObjPos;
1290 nY = nTopForObjPos - rNew.X();
1294 nY = rNew.Y() - nTopForObjPos;
1334 SwTextFrame const*
const pTextFrame(static_cast<SwTextFrame const*>(pCnt));
1341 pos.nNode.GetNode().GetTextNode()->GetTextAttrAt(
1343 if (pTextInputField !=
nullptr)
1345 pos.nContent = pTextInputField->
GetStart();
1366 pos.nContent.Assign(static_cast<SwNoTextFrame*>(pCnt)->
GetNode(), 0);
1368 aAnch.SetAnchor( &pos );
1382 const Point aRelPos = bVert ?
Point( -nY, nX ) : Point( nX, nY );
bool IsAnLower(const SwFrame *) const
static bool CheckMovedFwdCondition(SwAnchoredObject &_rAnchoredObj, const sal_uInt32 _nFromPageNum, const bool _bAnchoredAtMasterBeforeFormatAnchor, sal_uInt32 &_noToPageNum, bool &_boInFollow)
method to check the conditions, if 'anchor is moved forward'
SwFrame * FindFooterOrHeader()
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Base class of the Writer layout elements.
Represents the visualization of a paragraph.
bool OverlapsPrevColumn() const
method to determine, if the anchored object is overlapping with a previous column ...
bool operator<(const SwTextGlyphsKey &l, const SwTextGlyphsKey &r)
void Right(const tools::Long nRight)
virtual void SwClientNotify(const SwModify &rMod, const SfxHint &rHint) override
Point GetPos(const SwRect &rRect) const
virtual const SwFlyFrameFormat * GetFormat() const override
const SwSortedObjs * GetDrawObjs() const
Marks a position in the document model.
SwContentFrame * GetNextContentFrame() 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.
bool IsLowerOf(const SwLayoutFrame *pUpper) const
const SwContentFrame * FindAnchor(const SwFrame *pOldAnch, const Point &rNew, const bool bBodyOnly)
Searches an anchor for paragraph bound objects starting from pOldAnch.
static sal_uInt64 lcl_FindCntDiff(const Point &rPt, const SwLayoutFrame *pLay, const SwContentFrame *&rpCnt, const bool bBody, const bool bFootnote)
virtual bool IsFormatPossible() const override
method to determine, if a format on the Writer fly frame is possible
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)
bool IsInFootnote() const
bool ClearedEnvironment() const
const SwRect & getFramePrintArea() const
void SetAbsPos(const Point &rNew)
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
virtual bool InvalidationAllowed(const InvalidationType _nInvalid) const
method to determine, if an invalidation is allowed.
bool operator<=(const BigInt &rVal1, const BigInt &rVal2)
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
void Pos(const Point &rNew)
void SetTmpConsiderWrapInfluenceOfOtherObjs()
method to apply temporary consideration of wrapping style influence to the anchored objects...
IDocumentUndoRedo & GetIDocumentUndoRedo()
Of course Writer needs its own rectangles.
void ClearCharRectAndTopOfLine()
reset members and
bool isFrameAreaDefinitionValid() const
virtual SwFrameFormat & GetFrameFormat() override
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const
tools::Long GetTop(const SwRect &rRect) const
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
wrapper class for the positioning of Writer fly frames and drawing objects
void AppendFly(SwFlyFrame *pNew)
const SwRect & getFrameArea() const
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history...
virtual void RegisterAtCorrectPage() override
method to assure that anchored object is registered at the correct page frame
void SetTmpConsiderWrapInfluence(const bool _bTmpConsiderWrapInfluence)
sal_Int32 GetStart() const
void Width(tools::Long nNew)
bool m_bAtCnt
RndStdIds::FLY_AT_PARA, anchored at paragraph or RndStdIds::FLY_AT_CHAR.
SwContentFrame * GetPrevContentFrame() const
SwFlyFrame * FindFlyFrame()
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
|* With a paragraph-anchored fly it's absolutely possible that |* the anchor reacts to changes of the...
bool IsColumnFrame() const
bool FrameContainsNode(SwContentFrame const &rFrame, sal_uLong nNodeIndex)
virtual void CalcPosition() override
calculate position of object
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
bool IsContentFrame() const
const SwContentFrame * GetFollow() const
void RemoveFly(SwFlyFrame *pToRemove)
SwPageFrame * FindPageFrame()
static void RemoveMovedFwdFrame(const SwDoc &_rDoc, const SwTextFrame &_rTextFrame)
const SwFrame * Lower() const
SwContentNode * GetContentNode()
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
tools::Long GetHeight(const SwRect &rRect) const
SwLayoutFrame * GetUpper()
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
::rtl::Reference< Content > pContent
SwTwips GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() const
method to determine the upper space amount, which is considered for the previous frame and the page g...
const SwRowFrame * IsInFollowFlowRow() const
virtual const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() override
Marks a node in the document model.
bool isFrameAreaPositionValid() const
void MoveFly(SwFlyFrame *pToMove, SwPageFrame *pDest)
virtual bool IsFormatPossible() const override
method to determine, if a format on the Writer fly frame is possible
A page of the document layout.
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
stay with the cursor inside text
SwFrame * GetAnchorFrameContainingAnchPos()
determine anchor frame containing the anchor position
static const SwContentFrame * lcl_FindCnt(const Point &rPt, const SwContentFrame *pCnt, const bool bBody, const bool bFootnote)
EXPAND : (Start < nIndex <= End)
SwSectionFrame * FindSctFrame()
void setFrameAreaPositionValid(bool bNew)
void Bottom(const tools::Long nBottom)
const SwLayoutFrame * GetVertPosOrientFrame() const
bool m_bAutoPosition
RndStdIds::FLY_AT_CHAR, anchored at character.
SwLayoutFrame * GetLeaf(MakePageType eMakePage, bool bFwd)
bool ConsiderObjWrapInfluenceOnObjPos() const
method to determine, if wrapping style influence of the anchored object has to be considered on the o...
general base class for all free-flowing frames
bool InvalidationOfPosAllowed() const
method to determine, if invalidation of position is allowed
SwTextFrame * FindMaster() const
SwPageFrame * GetPageFrame()
sal_uInt16 GetPhyPageNum() const
bool HasClearedEnvironment() const
method to determine, if due to anchored object size and wrapping style, its layout environment is cle...
bool IsInside(const Point &rPOINT) const
bool IsNoTextFrame() const
bool IsRightToLeft() const
void Top(const tools::Long nTop)
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
static const SwFormatAnchor * GetAnchorFromPoolItem(const SfxPoolItem &rItem)
bool ConsiderObjWrapInfluenceOfOtherObjs() const
method to determine, if other anchored objects, also attached at to the anchor frame, have to consider its wrap influence.
void AppendFlyToPage(SwFlyFrame *pNew)
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool IsAnFollow(const SwFlowFrame *pFlow) const
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
#define SAL_WARN(area, stream)
static void lcl_PointToPrt(Point &rPoint, const SwFrame *pFrame)
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
const SwFrame * GetAnchorFrame() const
void SetVertPosOrientFrame(const SwLayoutFrame &_rVertPosOrientFrame)
static bool FrameMovedFwdByObjPos(const SwDoc &_rDoc, const SwTextFrame &_rTextFrame, sal_uInt32 &_ornToPageNum)
bool IsFootnoteContFrame() const
SwFlyAtContentFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
static void FormatAnchorFrameAndItsPrevs(SwTextFrame &_rAnchorTextFrame)
method to format given anchor text frame and its previous frames
virtual bool InvalidationAllowed(const InvalidationType _nInvalid) const override
method to determine, if an invalidation is allowed.
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
o3tl::strong_int< sal_Int32, struct Tag_TextFrameIndex > TextFrameIndex
Denotes a character index in a text frame at a layout level, after extent mapping from a text node at...
class for collecting anchored objects
const SwContentFrame * GetContentPos(Point &rPoint, const bool bDontLeave, const bool bBodyOnly=false, SwCursorMoveState *pCMS=nullptr, const bool bDefaultExpand=true) const
Finds the closest Content for the SPoint Is used for Pages, Flys and Cells if GetModelPositionForView...
void ResetLastCharRectHeight()
void ChgRelPos(const Point &rAbsPos)
Change the relative position.
void SetRestartLayoutProcess(const bool _bRestartLayoutProcess)
void Height(tools::Long nNew)
static const SwFrame * lcl_CalcDownDist(SwDistance &rRet, const Point &rPt, const SwContentFrame *pCnt)
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
InvalidationType
enumeration for the different invalidations #i28701#
bool IsFooterFrame() const
SwRootFrame * getRootFrame()
const SwLayoutFrame & GetVertPosOrientFrame() const
frame, at which the vertical position is oriented at
static void InsertMovedFwdFrame(const SwDoc &_rDoc, const SwTextFrame &_rMovedFwdFrameByObjPos, const sal_uInt32 _nToPageNum)
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
SwTabFrame * FindTabFrame()