LibreOffice Module sw (master)  1
flycnt.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sal/log.hxx>
21 #include <osl/diagnose.h>
22 #include <svx/swframetypes.hxx>
23 #include <pagefrm.hxx>
24 #include <txtfrm.hxx>
25 #include <notxtfrm.hxx>
26 #include <doc.hxx>
27 #include <pam.hxx>
28 #include <IDocumentUndoRedo.hxx>
31 #include <frmtool.hxx>
32 #include <dflyobj.hxx>
33 #include <hints.hxx>
34 #include <fmtanchr.hxx>
35 #include <fmtornt.hxx>
36 #include <fmtfsize.hxx>
37 #include <fmtsrnd.hxx>
38 #include <txatbase.hxx>
39 
40 #include <tabfrm.hxx>
41 #include <flyfrms.hxx>
42 #include <crstate.hxx>
43 #include <sectfrm.hxx>
44 
46 #include <sortedobjs.hxx>
47 #include <layouter.hxx>
49 #include <HandleAnchorNodeChg.hxx>
50 #include <ndtxt.hxx>
51 #include <textboxhelper.hxx>
52 #include <fmtfollowtextflow.hxx>
53 #include <unoprnms.hxx>
54 
55 using namespace ::com::sun::star;
56 
57 namespace
58 {
59 
60 SwTwips lcl_GetTopForObjPos(const SwContentFrame* pCnt, const bool bVert, const bool bVertL2R)
61 {
62  if ( bVert )
63  {
64  SwTwips aResult = pCnt->getFrameArea().Left();
65  if ( bVertL2R )
67  else
69  return aResult;
70  }
71  else
73 }
74 
75 }
76 
78  SwFlyFreeFrame( pFormat, pSib, pAnch )
79 {
80  m_bAtCnt = true;
81  m_bAutoPosition = (RndStdIds::FLY_AT_CHAR == pFormat->GetAnchor().GetAnchorId());
82 }
83 
84 // #i28701#
85 
86 void SwFlyAtContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
87 {
88  if (rHint.GetId() != SfxHintId::SwLegacyModify)
89  return;
90  auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
91  const SwFormatAnchor* pAnch = pLegacy->m_pNew ? GetAnchorFromPoolItem(*pLegacy->m_pNew) : nullptr;
92  if(!pAnch)
93  {
94  SwFlyFrame::SwClientNotify(rMod, rHint);
95  return;
96  }
97  OSL_ENSURE(pAnch->GetAnchorId() == GetFormat()->GetAnchor().GetAnchorId(),
98  "Illegal change of anchor type.");
99 
100  //Unregister, get hold of a new anchor and attach it
102  SwPageFrame* pOldPage = FindPageFrame();
103  const SwFrame* pOldAnchor = GetAnchorFrame();
104  SwContentFrame* pContent = const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetAnchorFrame()));
105  AnchorFrame()->RemoveFly(this);
106 
107  const bool bBodyFootnote = (pContent->IsInDocBody() || pContent->IsInFootnote());
108 
109  // Search the new anchor using the NodeIdx; the relation between old
110  // and new NodeIdx determines the search direction
111  const SwNodeIndex aNewIdx(pAnch->GetContentAnchor()->nNode);
112  SwNodeIndex aOldIdx(pContent->IsTextFrame()
113  // sw_redlinehide: can pick any node here, the compare with
114  // FrameContainsNode should catch it
115  ? *static_cast<SwTextFrame *>(pContent)->GetTextNodeFirst()
116  : *static_cast<SwNoTextFrame *>(pContent)->GetNode());
117 
118  //fix: depending on which index was smaller, searching in the do-while
119  //loop previously was done forward or backwards respectively. This however
120  //could lead to an infinite loop. To at least avoid the loop, searching
121  //is now done in only one direction. Getting hold of a frame from the node
122  //is still possible if the new anchor could not be found. Chances are
123  //good that this will be the correct one.
124  // consider the case that at found anchor frame candidate already a
125  // fly frame of the given fly format is registered.
126  // consider, that <pContent> is the already
127  // the new anchor frame.
128  bool bFound(FrameContainsNode(*pContent, aNewIdx.GetIndex()));
129  const bool bNext = !bFound && aOldIdx < aNewIdx;
130  while(pContent && !bFound)
131  {
132  do
133  {
134  if(bNext)
135  pContent = pContent->GetNextContentFrame();
136  else
137  pContent = pContent->GetPrevContentFrame();
138  } while(pContent &&
139  (bBodyFootnote != (pContent->IsInDocBody() || pContent->IsInFootnote())));
140  if(pContent)
141  bFound = FrameContainsNode(*pContent, aNewIdx.GetIndex());
142 
143  // check, if at found anchor frame candidate already a fly frame
144  // of the given fly frame format is registered.
145  if(bFound && pContent && pContent->GetDrawObjs())
146  {
147  SwFrameFormat* pMyFlyFrameFormat(&GetFrameFormat());
148  SwSortedObjs &rObjs = *pContent->GetDrawObjs();
149  for(SwAnchoredObject* rObj : rObjs)
150  {
151  SwFlyFrame* pFlyFrame = rObj->DynCastFlyFrame();
152  if (pFlyFrame &&
153  &(pFlyFrame->GetFrameFormat()) == pMyFlyFrameFormat)
154  {
155  bFound = false;
156  break;
157  }
158  }
159  }
160  }
161  if(!pContent)
162  {
163  SwContentNode *pNode = aNewIdx.GetNode().GetContentNode();
164  std::pair<Point, bool> const tmp(pOldAnchor->getFrameArea().Pos(), false);
165  pContent = pNode->getLayoutFrame(getRootFrame(), nullptr, &tmp);
166  OSL_ENSURE(pContent, "New anchor not found");
167  }
168  //Flys are never attached to a follow, but always on the master which
169  //we are going to search now.
170  SwContentFrame* pFlow = pContent;
171  while(pFlow->IsFollow())
172  pFlow = pFlow->FindMaster();
173  pContent = pFlow;
174 
175  //and *puff* it's attached...
176  pContent->AppendFly( this );
177  if(pOldPage && pOldPage != FindPageFrame())
179 
180  //Fix(3495)
181  InvalidatePos_();
182  InvalidatePage();
183  SetNotifyBack();
184  // #i28701# - reset member <maLastCharRect> and
185  // <mnLastTopOfLine> for to-character anchored objects.
187 }
188 
189 //We need some helper classes to monitor the oscillation and a few functions
190 //to not get lost.
191 
192 namespace {
193 
194 // #i3317# - re-factoring of the position stack
195 class SwOszControl
196 {
197  static const SwFlyFrame* s_pStack1;
198  static const SwFlyFrame* s_pStack2;
199  static const SwFlyFrame* s_pStack3;
200  static const SwFlyFrame* s_pStack4;
201  static const SwFlyFrame* s_pStack5;
202 
203  const SwFlyFrame* m_pFly;
204  std::vector<Point> maObjPositions;
205 
206 public:
207  explicit SwOszControl( const SwFlyFrame *pFrame );
208  ~SwOszControl();
209  bool ChkOsz();
210  static bool IsInProgress( const SwFlyFrame *pFly );
211 };
212 
213 }
214 
215 const SwFlyFrame* SwOszControl::s_pStack1 = nullptr;
216 const SwFlyFrame* SwOszControl::s_pStack2 = nullptr;
217 const SwFlyFrame* SwOszControl::s_pStack3 = nullptr;
218 const SwFlyFrame* SwOszControl::s_pStack4 = nullptr;
219 const SwFlyFrame* SwOszControl::s_pStack5 = nullptr;
220 
221 SwOszControl::SwOszControl(const SwFlyFrame* pFrame)
222  : m_pFly(pFrame)
223 {
224  if (!SwOszControl::s_pStack1)
225  SwOszControl::s_pStack1 = m_pFly;
226  else if (!SwOszControl::s_pStack2)
227  SwOszControl::s_pStack2 = m_pFly;
228  else if (!SwOszControl::s_pStack3)
229  SwOszControl::s_pStack3 = m_pFly;
230  else if (!SwOszControl::s_pStack4)
231  SwOszControl::s_pStack4 = m_pFly;
232  else if (!SwOszControl::s_pStack5)
233  SwOszControl::s_pStack5 = m_pFly;
234 }
235 
236 SwOszControl::~SwOszControl()
237 {
238  if (SwOszControl::s_pStack1 == m_pFly)
239  SwOszControl::s_pStack1 = nullptr;
240  else if (SwOszControl::s_pStack2 == m_pFly)
241  SwOszControl::s_pStack2 = nullptr;
242  else if (SwOszControl::s_pStack3 == m_pFly)
243  SwOszControl::s_pStack3 = nullptr;
244  else if (SwOszControl::s_pStack4 == m_pFly)
245  SwOszControl::s_pStack4 = nullptr;
246  else if (SwOszControl::s_pStack5 == m_pFly)
247  SwOszControl::s_pStack5 = nullptr;
248  // #i3317#
249  maObjPositions.clear();
250 }
251 
252 bool SwOszControl::IsInProgress( const SwFlyFrame *pFly )
253 {
254  if (SwOszControl::s_pStack1 && !pFly->IsLowerOf(SwOszControl::s_pStack1))
255  return true;
256  if (SwOszControl::s_pStack2 && !pFly->IsLowerOf(SwOszControl::s_pStack2))
257  return true;
258  if (SwOszControl::s_pStack3 && !pFly->IsLowerOf(SwOszControl::s_pStack3))
259  return true;
260  if (SwOszControl::s_pStack4 && !pFly->IsLowerOf(SwOszControl::s_pStack4))
261  return true;
262  if (SwOszControl::s_pStack5 && !pFly->IsLowerOf(SwOszControl::s_pStack5))
263  return true;
264  return false;
265 }
266 
267 bool SwOszControl::ChkOsz()
268 {
269  bool bOscillationDetected = false;
270 
271  if ( maObjPositions.size() == 20 )
272  {
273  // #i3317# position stack is full -> oscillation
274  bOscillationDetected = true;
275  }
276  else
277  {
278  Point aNewObjPos = m_pFly->GetObjRect().Pos();
279  for ( auto const & pt : maObjPositions )
280  {
281  if ( aNewObjPos == pt )
282  {
283  // position already occurred -> oscillation
284  bOscillationDetected = true;
285  break;
286  }
287  }
288  if ( !bOscillationDetected )
289  {
290  maObjPositions.push_back( aNewObjPos );
291  }
292  }
293 
294  return bOscillationDetected;
295 }
296 
314 {
315  if ( !GetFormat()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) )
316  {
317  return;
318  }
319 
320  if ( SwOszControl::IsInProgress( this ) || IsLocked() || IsColLocked() )
321  return;
322 
323  // #i28701# - use new method <GetPageFrame()>
324  if( !GetPageFrame() && GetAnchorFrame() && GetAnchorFrame()->IsInFly() )
325  {
326  SwFlyFrame* pFly = AnchorFrame()->FindFlyFrame();
327  SwPageFrame *pTmpPage = pFly ? pFly->FindPageFrame() : nullptr;
328  if( pTmpPage )
329  pTmpPage->AppendFlyToPage( this );
330  }
331  // #i28701# - use new method <GetPageFrame()>
332  if( !GetPageFrame() )
333  return;
334 
336  {
337  SwFlyFrameFormat *pFormat = GetFormat();
338  const SwFormatFrameSize &rFrameSz = GetFormat()->GetFrameSize();
339  if( rFrameSz.GetHeightPercent() != SwFormatFrameSize::SYNCED &&
340  rFrameSz.GetHeightPercent() >= 100 )
341  {
342  pFormat->LockModify();
343  SwFormatSurround aMain( pFormat->GetSurround() );
344  if ( aMain.GetSurround() == css::text::WrapTextMode_NONE )
345  {
346  aMain.SetSurround( css::text::WrapTextMode_THROUGH );
347  pFormat->SetFormatAttr( aMain );
348  }
349  pFormat->UnlockModify();
350  }
351  }
352 
353  SwOszControl aOszCntrl( this );
354 
355  // #i43255#
356  // #i50356# - format the anchor frame, which
357  // contains the anchor position. E.g., for at-character anchored
358  // object this can be the follow frame of the anchor frame.
359  const bool bFormatAnchor =
360  !static_cast<const SwTextFrame*>( GetAnchorFrameContainingAnchPos() )->IsAnyJoinLocked() &&
363 
364  const SwFrame* pFooter = GetAnchorFrame()->FindFooterOrHeader();
365  if( pFooter && !pFooter->IsFooterFrame() )
366  pFooter = nullptr;
367  bool bOsz = false;
368  bool bExtra = Lower() && Lower()->IsColumnFrame();
369  // #i3317# - boolean, to apply temporarily the
370  // 'straightforward positioning process' for the frame due to its
371  // overlapping with a previous column.
372  bool bConsiderWrapInfluenceDueToOverlapPrevCol( false );
373  // #i35911# - boolean, to apply temporarily the
374  // 'straightforward positioning process' for the frame due to fact
375  // that it causes the complete content of its layout environment
376  // to move forward.
377  // #i40444# - extend usage of this boolean:
378  // apply temporarily the 'straightforward positioning process' for
379  // the frame due to the fact that the frame clears the area for
380  // the anchor frame, thus it has to move forward.
381  bool bConsiderWrapInfluenceDueToMovedFwdAnchor( false );
382  do {
383  SwRectFnSet aRectFnSet(this);
384  Point aOldPos( aRectFnSet.GetPos(getFrameArea()) );
385  SwFlyFreeFrame::MakeAll(pRenderContext);
386 
387  const bool bPosChgDueToOwnFormat =
388  aOldPos != aRectFnSet.GetPos(getFrameArea());
389  // #i3317#
392  {
393  bConsiderWrapInfluenceDueToOverlapPrevCol = true;
394  }
395  // #i28701# - no format of anchor frame, if
396  // wrapping style influence is considered on object positioning
397  if ( bFormatAnchor )
398  {
399  SwTextFrame& rAnchPosAnchorFrame =
401  // #i58182# - For the usage of new method
402  // <SwObjectFormatterTextFrame::CheckMovedFwdCondition(..)>
403  // to check move forward of anchor frame due to the object
404  // positioning it's needed to know, if the object is anchored
405  // at the master frame before the anchor frame is formatted.
406  const bool bAnchoredAtMaster(!rAnchPosAnchorFrame.IsFollow());
407 
408  // #i56300#
409  // perform complete format of anchor text frame and its
410  // previous frames, which have become invalid due to the
411  // fly frame format.
413  // #i35911#
414  // #i40444#
415  // #i58182# - usage of new method
416  // <SwObjectFormatterTextFrame::CheckMovedFwdCondition(..)>
417  sal_uInt32 nToPageNum( 0 );
418  bool bDummy( false );
419  bool bPageHasFlysAnchoredBelowThis(false);
421 // TODO: what if this fly moved bc it's in table? does sth prevent that?
422  *this, *GetPageFrame(),
423  bAnchoredAtMaster, nToPageNum, bDummy,
424  bPageHasFlysAnchoredBelowThis) )
425  {
426  bConsiderWrapInfluenceDueToMovedFwdAnchor = true;
427  // mark anchor text frame
428  // directly, that it is moved forward by object positioning.
429  SwTextFrame* pAnchorTextFrame( static_cast<SwTextFrame*>(AnchorFrame()) );
430  bool bInsert( true );
431  sal_uInt32 nAnchorFrameToPageNum( 0 );
432  const SwDoc& rDoc = *(GetFrameFormat().GetDoc());
434  rDoc, *pAnchorTextFrame, nAnchorFrameToPageNum ) )
435  {
436  if ( nAnchorFrameToPageNum < nToPageNum )
437  {
438  if (!bPageHasFlysAnchoredBelowThis)
439  {
440  SwLayouter::RemoveMovedFwdFrame(rDoc, *pAnchorTextFrame);
441  }
442  }
443  else
444  bInsert = false;
445  }
446  if ( bInsert )
447  {
448  if (!bPageHasFlysAnchoredBelowThis)
449  {
450  SwLayouter::InsertMovedFwdFrame(rDoc, *pAnchorTextFrame,
451  nToPageNum);
452  }
453  }
454  }
455  }
456 
457  if ( aOldPos != aRectFnSet.GetPos(getFrameArea()) ||
459  ( pFooter || bPosChgDueToOwnFormat ) ) )
460  {
461  bOsz = aOszCntrl.ChkOsz();
462 
463  // special loop prevention for dedicated document:
464  if ( bOsz &&
465  HasFixSize() && IsClipped() &&
467  {
468  SwFrameFormat* pFormat = GetFormat();
469  const SwFormatFrameSize& rFrameSz = pFormat->GetFrameSize();
470  if ( rFrameSz.GetWidthPercent() &&
472  {
473  SwFormatSurround aSurround( pFormat->GetSurround() );
474  if ( aSurround.GetSurround() == css::text::WrapTextMode_NONE )
475  {
476  pFormat->LockModify();
477  aSurround.SetSurround( css::text::WrapTextMode_THROUGH );
478  pFormat->SetFormatAttr( aSurround );
479  pFormat->UnlockModify();
480  bOsz = false;
481  OSL_FAIL( "<SwFlyAtContentFrame::MakeAll()> - special loop prevention for dedicated document of b6403541 applied" );
482  }
483  }
484  }
485  }
486 
487  if ( bExtra && Lower() && !Lower()->isFrameAreaPositionValid() )
488  {
489  // If a multi column frame leaves invalid columns because of
490  // a position change, we loop once more and format
491  // our content using FormatWidthCols again.
492  InvalidateSize_();
493  bExtra = false; // Ensure only one additional loop run
494  }
495  } while ( !isFrameAreaDefinitionValid() && !bOsz &&
496  // #i3317#
497  !bConsiderWrapInfluenceDueToOverlapPrevCol &&
498  // #i40444#
499  !bConsiderWrapInfluenceDueToMovedFwdAnchor &&
500  GetFormat()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) );
501 
502  // #i3317# - instead of attribute change apply
503  // temporarily the 'straightforward positioning process'.
504  // #i80924#
505  // handle special case during splitting of table rows
506  if ( bConsiderWrapInfluenceDueToMovedFwdAnchor &&
507  GetAnchorFrame()->IsInTab() &&
509  {
510  const SwFrame* pCellFrame = GetAnchorFrame();
511  while ( pCellFrame && !pCellFrame->IsCellFrame() )
512  {
513  pCellFrame = pCellFrame->GetUpper();
514  }
515  if ( pCellFrame )
516  {
517  SwRectFnSet aRectFnSet(pCellFrame);
518  if ( aRectFnSet.GetTop(pCellFrame->getFrameArea()) == 0 &&
519  aRectFnSet.GetHeight(pCellFrame->getFrameArea()) == 0 )
520  {
521  bConsiderWrapInfluenceDueToMovedFwdAnchor = false;
522  }
523  }
524  }
525  // tdf#137803: Fix the position of the shape during autoSize
526  SwFrameFormat* pShapeFormat
528  // FIXME: According to tdf37153, ignore FollowTextFlow objs, because
529  // wrong position will applied in that case. FollowTextFlow needs fix.
530  if (pShapeFormat && !pShapeFormat->GetFollowTextFlow().GetValue() &&
531  SwTextBoxHelper::getProperty(pShapeFormat,
532  UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT).hasValue() &&
533  SwTextBoxHelper::getProperty(pShapeFormat,
534  UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT).get<bool>() )
535  {
536  // get the text area of the shape
537  const tools::Rectangle aTextRectangle
538  = SwTextBoxHelper::getTextRectangle(pShapeFormat->FindRealSdrObject(), false);
539  // get the original textframe position
540  SwFormatHoriOrient aHOri = pShapeFormat->GetHoriOrient();
541  SwFormatVertOrient aVOri = pShapeFormat->GetVertOrient();
542  // calc the right position of the shape depending on text area
543  aHOri.SetPos(aHOri.GetPos() + aTextRectangle.Left());
544  aVOri.SetPos(aVOri.GetPos() + aTextRectangle.Top());
545  // save the new position for the shape
546  GetFormat()->SetFormatAttr(aHOri);
547  GetFormat()->SetFormatAttr(aVOri);
548  }
549  if ( bOsz || bConsiderWrapInfluenceDueToOverlapPrevCol ||
550  // #i40444#
551  bConsiderWrapInfluenceDueToMovedFwdAnchor )
552  {
554  SetRestartLayoutProcess( true );
556  }
558 }
559 
565 {
567  !SwOszControl::IsInProgress( this );
568 }
569 
570 namespace {
571 
572 class SwDistance
573 {
574 public:
575  SwTwips m_nMain, m_nSub;
576  SwDistance()
577  : m_nMain(0)
578  , m_nSub(0)
579  {
580  }
581  bool operator<( const SwDistance& rTwo ) const
582  {
583  return m_nMain < rTwo.m_nMain
584  || (m_nMain == rTwo.m_nMain && m_nSub && rTwo.m_nSub && m_nSub < rTwo.m_nSub);
585  }
586  bool operator<=( const SwDistance& rTwo ) const
587  {
588  return m_nMain < rTwo.m_nMain
589  || (m_nMain == rTwo.m_nMain
590  && (!m_nSub || !rTwo.m_nSub || m_nSub <= rTwo.m_nSub));
591  }
592 };
593 
594 }
595 
596 static const SwFrame * lcl_CalcDownDist( SwDistance &rRet,
597  const Point &rPt,
598  const SwContentFrame *pCnt )
599 {
600  rRet.m_nSub = 0;
601  //If the point stays inside the Cnt everything is clear already; the Content
602  //automatically has a distance of 0.
603  if ( pCnt->getFrameArea().IsInside( rPt ) )
604  {
605  rRet.m_nMain = 0;
606  return pCnt;
607  }
608  else
609  {
610  const SwLayoutFrame *pUp = pCnt->IsInTab() ? pCnt->FindTabFrame()->GetUpper() : pCnt->GetUpper();
611  // single column sections need to interconnect to their upper
612  while( pUp->IsSctFrame() )
613  pUp = pUp->GetUpper();
614  const bool bVert = pUp->IsVertical();
615 
616  const bool bVertL2R = pUp->IsVertLR();
617 
618  //Follow the text flow.
619  // #i70582#
620  // --> OD 2009-03-05 - adopted for Support for Classical Mongolian Script
621  const SwTwips nTopForObjPos = lcl_GetTopForObjPos(pCnt, bVert, bVertL2R);
622  if ( pUp->getFrameArea().IsInside( rPt ) )
623  {
624  // <rPt> point is inside environment of given content frame
625  // #i70582#
626  if( bVert )
627  {
628  if ( bVertL2R )
629  rRet.m_nMain = rPt.X() - nTopForObjPos;
630  else
631  rRet.m_nMain = nTopForObjPos - rPt.X();
632  }
633  else
634  rRet.m_nMain = rPt.Y() - nTopForObjPos;
635  return pCnt;
636  }
637  else if ( rPt.Y() <= pUp->getFrameArea().Top() )
638  {
639  // <rPt> point is above environment of given content frame
640  // correct for vertical layout?
641  rRet.m_nMain = LONG_MAX;
642  }
643  else if( rPt.X() < pUp->getFrameArea().Left() &&
644  rPt.Y() <= ( bVert ? pUp->getFrameArea().Top() : pUp->getFrameArea().Bottom() ) )
645  {
646  // <rPt> point is left of environment of given content frame
647  // seems not to be correct for vertical layout!?
648  const SwFrame *pLay = pUp->GetLeaf( MAKEPAGE_NONE, false, pCnt );
649  if( !pLay ||
650  (bVert && (pLay->getFrameArea().Top() + pLay->getFramePrintArea().Bottom()) <rPt.Y())||
651  (!bVert && (pLay->getFrameArea().Left() + pLay->getFramePrintArea().Right())<rPt.X()) )
652  {
653  // <rPt> point is in left border of environment
654  // #i70582#
655  if( bVert )
656  {
657  if ( bVertL2R )
658  rRet.m_nMain = rPt.X() - nTopForObjPos;
659  else
660  rRet.m_nMain = nTopForObjPos - rPt.X();
661  }
662  else
663  rRet.m_nMain = rPt.Y() - nTopForObjPos;
664  return pCnt;
665  }
666  else
667  rRet.m_nMain = LONG_MAX;
668  }
669  else
670  {
671  rRet.m_nMain
672  = bVert ? (bVertL2R
673  ? ((pUp->getFrameArea().Left() + pUp->getFramePrintArea().Right())
674  - nTopForObjPos)
675  : (nTopForObjPos
676  - (pUp->getFrameArea().Left() + pUp->getFramePrintArea().Left())))
677  : ((pUp->getFrameArea().Top() + pUp->getFramePrintArea().Bottom())
678  - nTopForObjPos);
679 
680  const SwFrame *pPre = pCnt;
681  const SwFrame *pLay = pUp->GetLeaf( MAKEPAGE_NONE, true, pCnt );
682  SwTwips nFrameTop = 0;
683  SwTwips nPrtHeight = 0;
684  bool bSct = false;
685  const SwSectionFrame *pSect = pUp->FindSctFrame();
686  if( pSect )
687  {
688  rRet.m_nSub = rRet.m_nMain;
689  rRet.m_nMain = 0;
690  }
691  if( pSect && !pSect->IsAnLower( pLay ) )
692  {
693  bSct = false;
694  const SwSectionFrame* pNxtSect = pLay ? pLay->FindSctFrame() : nullptr;
695  if (pSect->IsAnFollow(pNxtSect) && pLay)
696  {
697  if( pLay->IsVertical() )
698  {
699  if ( pLay->IsVertLR() )
700  nFrameTop = pLay->getFrameArea().Left();
701  else
702  nFrameTop = pLay->getFrameArea().Left() + pLay->getFrameArea().Width();
703  nPrtHeight = pLay->getFramePrintArea().Width();
704  }
705  else
706  {
707  nFrameTop = pLay->getFrameArea().Top();
708  nPrtHeight = pLay->getFramePrintArea().Height();
709  }
710  pSect = pNxtSect;
711  }
712  else
713  {
714  pLay = pSect->GetUpper();
715  if( pLay->IsVertical() )
716  {
717  if ( pLay->IsVertLR() )
718  {
719  nFrameTop = pSect->getFrameArea().Right();
720  nPrtHeight = pLay->getFrameArea().Left() + pLay->getFramePrintArea().Left()
721  + pLay->getFramePrintArea().Width() - pSect->getFrameArea().Left()
722  - pSect->getFrameArea().Width();
723  }
724  else
725  {
726  nFrameTop = pSect->getFrameArea().Left();
727  nPrtHeight = pSect->getFrameArea().Left() - pLay->getFrameArea().Left()
728  - pLay->getFramePrintArea().Left();
729  }
730  }
731  else
732  {
733  nFrameTop = pSect->getFrameArea().Bottom();
734  nPrtHeight = pLay->getFrameArea().Top() + pLay->getFramePrintArea().Top()
735  + pLay->getFramePrintArea().Height() - pSect->getFrameArea().Top()
736  - pSect->getFrameArea().Height();
737  }
738  pSect = nullptr;
739  }
740  }
741  else if( pLay )
742  {
743  if( pLay->IsVertical() )
744  {
745  if ( pLay->IsVertLR() )
746  {
747  nFrameTop = pLay->getFrameArea().Left();
748  nPrtHeight = pLay->getFramePrintArea().Width();
749  }
750  else
751  {
752  nFrameTop = pLay->getFrameArea().Left() + pLay->getFrameArea().Width();
753  nPrtHeight = pLay->getFramePrintArea().Width();
754  }
755  }
756  else
757  {
758  nFrameTop = pLay->getFrameArea().Top();
759  nPrtHeight = pLay->getFramePrintArea().Height();
760  }
761  bSct = nullptr != pSect;
762  }
763  while ( pLay && !pLay->getFrameArea().IsInside( rPt ) &&
764  ( pLay->getFrameArea().Top() <= rPt.Y() || pLay->IsInFly() ||
765  ( pLay->IsInSct() &&
766  pLay->FindSctFrame()->GetUpper()->getFrameArea().Top() <= rPt.Y())) )
767  {
768  if ( pLay->IsFootnoteContFrame() )
769  {
770  if ( !static_cast<const SwLayoutFrame*>(pLay)->Lower() )
771  {
772  SwFrame *pDel = const_cast<SwFrame*>(pLay);
773  pDel->Cut();
774  SwFrame::DestroyFrame(pDel);
775  return pPre;
776  }
777  return nullptr;
778  }
779  else
780  {
781  if( bSct || pSect )
782  rRet.m_nSub += nPrtHeight;
783  else
784  rRet.m_nMain += nPrtHeight;
785  pPre = pLay;
786  pLay = pLay->GetLeaf( MAKEPAGE_NONE, true, pCnt );
787  if( pSect && !pSect->IsAnLower( pLay ) )
788  { // If we're leaving a SwSectionFrame, the next Leaf-Frame
789  // is the part of the upper below the SectionFrame.
790  const SwSectionFrame* pNxtSect = pLay ?
791  pLay->FindSctFrame() : nullptr;
792  bSct = false;
793  if (pLay && pSect->IsAnFollow(pNxtSect))
794  {
795  pSect = pNxtSect;
796  if( pLay->IsVertical() )
797  {
798  if ( pLay->IsVertLR() )
799  {
800  nFrameTop = pLay->getFrameArea().Left();
801  nPrtHeight = pLay->getFramePrintArea().Width();
802  }
803  else
804  {
805  nFrameTop = pLay->getFrameArea().Left() + pLay->getFrameArea().Width();
806  nPrtHeight = pLay->getFramePrintArea().Width();
807  }
808  }
809  else
810  {
811  nFrameTop = pLay->getFrameArea().Top();
812  nPrtHeight = pLay->getFramePrintArea().Height();
813  }
814  }
815  else
816  {
817  pLay = pSect->GetUpper();
818  if( pLay->IsVertical() )
819  {
820  if ( pLay->IsVertLR() )
821  {
822  nFrameTop = pSect->getFrameArea().Right();
823  nPrtHeight = pLay->getFrameArea().Left()+pLay->getFramePrintArea().Left()
824  + pLay->getFramePrintArea().Width() - pSect->getFrameArea().Left()
825  - pSect->getFrameArea().Width();
826  }
827  else
828  {
829  nFrameTop = pSect->getFrameArea().Left();
830  nPrtHeight = pSect->getFrameArea().Left() -
831  pLay->getFrameArea().Left() - pLay->getFramePrintArea().Left();
832  }
833  }
834  else
835  {
836  nFrameTop = pSect->getFrameArea().Bottom();
837  nPrtHeight = pLay->getFrameArea().Top()+pLay->getFramePrintArea().Top()
838  + pLay->getFramePrintArea().Height() - pSect->getFrameArea().Top()
839  - pSect->getFrameArea().Height();
840  }
841  pSect = nullptr;
842  }
843  }
844  else if( pLay )
845  {
846  if( pLay->IsVertical() )
847  {
848  if ( pLay->IsVertLR() )
849  {
850  nFrameTop = pLay->getFrameArea().Left();
851  nPrtHeight = pLay->getFramePrintArea().Width();
852  }
853  else
854  {
855  nFrameTop = pLay->getFrameArea().Left() + pLay->getFrameArea().Width();
856  nPrtHeight = pLay->getFramePrintArea().Width();
857  }
858  }
859  else
860  {
861  nFrameTop = pLay->getFrameArea().Top();
862  nPrtHeight = pLay->getFramePrintArea().Height();
863  }
864  bSct = nullptr != pSect;
865  }
866  }
867  }
868  if ( pLay )
869  {
870  if ( pLay->getFrameArea().IsInside( rPt ) )
871  {
872  SwTwips nDiff = pLay->IsVertical() ? ( pLay->IsVertLR() ? ( rPt.X() - nFrameTop ) : ( nFrameTop - rPt.X() ) )
873  : ( rPt.Y() - nFrameTop );
874  if( bSct || pSect )
875  rRet.m_nSub += nDiff;
876  else
877  rRet.m_nMain += nDiff;
878  }
879  if ( pLay->IsFootnoteContFrame() && !static_cast<const SwLayoutFrame*>(pLay)->Lower() )
880  {
881  SwFrame *pDel = const_cast<SwFrame*>(pLay);
882  pDel->Cut();
883  SwFrame::DestroyFrame(pDel);
884  return nullptr;
885  }
886  return pLay;
887  }
888  else
889  rRet.m_nMain = LONG_MAX;
890  }
891  }
892  return nullptr;
893 }
894 
895 static sal_uInt64 lcl_FindCntDiff( const Point &rPt, const SwLayoutFrame *pLay,
896  const SwContentFrame *& rpCnt,
897  const bool bBody, const bool bFootnote )
898 {
899  // Searches below pLay the nearest Cnt to the point. The reference point of
900  //the Contents is always the left upper corner.
901  //The Cnt should preferably be above the point.
902 
903  rpCnt = nullptr;
904  sal_uInt64 nDistance = SAL_MAX_UINT64;
905  sal_uInt64 nNearest = SAL_MAX_UINT64;
906  const SwContentFrame *pCnt = pLay ? pLay->ContainsContent() : nullptr;
907 
908  while ( pCnt && (bBody != pCnt->IsInDocBody() || bFootnote != pCnt->IsInFootnote()))
909  {
910  pCnt = pCnt->GetNextContentFrame();
911  if ( !pLay->IsAnLower( pCnt ) )
912  pCnt = nullptr;
913  }
914  const SwContentFrame *pNearest = pCnt;
915  if ( pCnt )
916  {
917  do
918  {
919  //Calculate the distance between those two points.
920  //'delta' X^2 + 'delta' Y^2 = 'distance'^2
921  sal_uInt64 dX = std::max( pCnt->getFrameArea().Left(), rPt.X() ) -
922  std::min( pCnt->getFrameArea().Left(), rPt.X() ),
923  dY = std::max( pCnt->getFrameArea().Top(), rPt.Y() ) -
924  std::min( pCnt->getFrameArea().Top(), rPt.Y() );
925  // square of the difference will do fine here
926  const sal_uInt64 nDiff = (dX * dX) + (dY * dY);
927  if ( pCnt->getFrameArea().Top() <= rPt.Y() )
928  {
929  if ( nDiff < nDistance )
930  {
931  //This one is the nearer one
932  nDistance = nNearest = nDiff;
933  rpCnt = pNearest = pCnt;
934  }
935  }
936  else if ( nDiff < nNearest )
937  {
938  nNearest = nDiff;
939  pNearest = pCnt;
940  }
941  pCnt = pCnt->GetNextContentFrame();
942  while ( pCnt &&
943  (bBody != pCnt->IsInDocBody() || bFootnote != pCnt->IsInFootnote()))
944  pCnt = pCnt->GetNextContentFrame();
945 
946  } while ( pCnt && pLay->IsAnLower( pCnt ) );
947  }
948  if (nDistance == SAL_MAX_UINT64)
949  { rpCnt = pNearest;
950  return nNearest;
951  }
952  return nDistance;
953 }
954 
955 static const SwContentFrame * lcl_FindCnt( const Point &rPt, const SwContentFrame *pCnt,
956  const bool bBody, const bool bFootnote )
957 {
958  //Starting from pCnt searches the ContentFrame whose left upper corner is the
959  //nearest to the point.
960  //Always returns a ContentFrame.
961 
962  //First the nearest Content inside the page which contains the Content is
963  //searched. Starting from this page the pages in both directions need to
964  //be considered. If possible a Content is returned whose Y-position is
965  //above the point.
966  const SwContentFrame *pRet, *pNew;
967  const SwLayoutFrame *pLay = pCnt->FindPageFrame();
968  sal_uInt64 nDist; // not sure if a sal_Int32 would be enough?
969 
970  nDist = ::lcl_FindCntDiff( rPt, pLay, pNew, bBody, bFootnote );
971  if ( pNew )
972  pRet = pNew;
973  else
974  { pRet = pCnt;
975  nDist = SAL_MAX_UINT64;
976  }
977  const SwContentFrame *pNearest = pRet;
978  sal_uInt64 nNearest = nDist;
979 
980  if ( pLay )
981  {
982  const SwLayoutFrame *pPge = pLay;
983  sal_uInt64 nOldNew = SAL_MAX_UINT64;
984  for ( int i = 0; pPge->GetPrev() && (i < 3); ++i )
985  {
986  pPge = static_cast<const SwLayoutFrame*>(pPge->GetPrev());
987  const sal_uInt64 nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFootnote );
988  if ( nNew < nDist )
989  {
990  if ( pNew->getFrameArea().Top() <= rPt.Y() )
991  {
992  pRet = pNearest = pNew;
993  nDist = nNearest = nNew;
994  }
995  else if ( nNew < nNearest )
996  {
997  pNearest = pNew;
998  nNearest = nNew;
999  }
1000  }
1001  else if (nOldNew != SAL_MAX_UINT64 && nNew > nOldNew)
1002  break;
1003  else
1004  nOldNew = nNew;
1005 
1006  }
1007  pPge = pLay;
1008  nOldNew = SAL_MAX_UINT64;
1009  for ( int j = 0; pPge->GetNext() && (j < 3); ++j )
1010  {
1011  pPge = static_cast<const SwLayoutFrame*>(pPge->GetNext());
1012  const sal_uInt64 nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFootnote );
1013  if ( nNew < nDist )
1014  {
1015  if ( pNew->getFrameArea().Top() <= rPt.Y() )
1016  {
1017  pRet = pNearest = pNew;
1018  nDist = nNearest = nNew;
1019  }
1020  else if ( nNew < nNearest )
1021  {
1022  pNearest = pNew;
1023  nNearest = nNew;
1024  }
1025  }
1026  else if (nOldNew != SAL_MAX_UINT64 && nNew > nOldNew)
1027  break;
1028  else
1029  nOldNew = nNew;
1030  }
1031  }
1032  if ( pRet->getFrameArea().Top() > rPt.Y() )
1033  return pNearest;
1034  else
1035  return pRet;
1036 }
1037 
1038 static void lcl_PointToPrt( Point &rPoint, const SwFrame *pFrame )
1039 {
1040  SwRect aTmp( pFrame->getFramePrintArea() );
1041  aTmp += pFrame->getFrameArea().Pos();
1042  if ( rPoint.getX() < aTmp.Left() )
1043  rPoint.setX(aTmp.Left());
1044  else if ( rPoint.getX() > aTmp.Right() )
1045  rPoint.setX(aTmp.Right());
1046  if ( rPoint.getY() < aTmp.Top() )
1047  rPoint.setY(aTmp.Top());
1048  else if ( rPoint.getY() > aTmp.Bottom() )
1049  rPoint.setY(aTmp.Bottom());
1050 
1051 }
1052 
1058 const SwContentFrame *FindAnchor( const SwFrame *pOldAnch, const Point &rNew,
1059  const bool bBodyOnly )
1060 {
1061  //Search the nearest Cnt around the given document position in the text
1062  //flow. The given anchor is the starting Frame.
1063  const SwContentFrame* pCnt;
1064  if ( pOldAnch->IsContentFrame() )
1065  {
1066  pCnt = static_cast<const SwContentFrame*>(pOldAnch);
1067  }
1068  else
1069  {
1070  Point aTmp( rNew );
1071  const SwLayoutFrame *pTmpLay = static_cast<const SwLayoutFrame*>(pOldAnch);
1072  if( pTmpLay->IsRootFrame() )
1073  {
1074  SwRect aTmpRect( aTmp, Size(0,0) );
1075  pTmpLay = static_cast<const SwLayoutFrame*>(::FindPage( aTmpRect, pTmpLay->Lower() ));
1076  }
1077  pCnt = pTmpLay->GetContentPos( aTmp, false, bBodyOnly );
1078  }
1079 
1080  //Take care to use meaningful ranges during search. This means to not enter
1081  //or leave header/footer in this case.
1082  const bool bBody = pCnt->IsInDocBody() || bBodyOnly;
1083  const bool bFootnote = !bBodyOnly && pCnt->IsInFootnote();
1084 
1085  Point aNew( rNew );
1086  if ( bBody )
1087  {
1088  //#38848 drag from page margin into the body.
1089  const SwFrame *pPage = pCnt->FindPageFrame();
1090  ::lcl_PointToPrt( aNew, pPage->GetUpper() );
1091  SwRect aTmp( aNew, Size( 0, 0 ) );
1092  pPage = ::FindPage( aTmp, pPage );
1093  ::lcl_PointToPrt( aNew, pPage );
1094  }
1095 
1096  if ( pCnt->IsInDocBody() == bBody && pCnt->getFrameArea().IsInside( aNew ) )
1097  return pCnt;
1098  else if ( pOldAnch->IsInDocBody() || pOldAnch->IsPageFrame() )
1099  {
1100  // Maybe the selected anchor is on the same page as the current anchor.
1101  // With this we won't run into problems with the columns.
1102  Point aTmp( aNew );
1103  const SwContentFrame *pTmp = pCnt->FindPageFrame()->
1104  GetContentPos( aTmp, false, true );
1105  if ( pTmp && pTmp->getFrameArea().IsInside( aNew ) )
1106  return pTmp;
1107  }
1108 
1109  //Starting from the anchor we now search in both directions until we found
1110  //the nearest one respectively.
1111  //Not the direct distance is relevant but the distance which needs to be
1112  //traveled through the text flow.
1113  const SwContentFrame *pUpLst;
1114  const SwContentFrame *pUpFrame = pCnt;
1115  SwDistance nUp, nUpLst;
1116  ::lcl_CalcDownDist( nUp, aNew, pUpFrame );
1117  SwDistance nDown = nUp;
1118  bool bNegAllowed = true;// Make it possible to leave the negative section once.
1119  do
1120  {
1121  pUpLst = pUpFrame; nUpLst = nUp;
1122  pUpFrame = pUpLst->GetPrevContentFrame();
1123  while ( pUpFrame &&
1124  (bBody != pUpFrame->IsInDocBody() || bFootnote != pUpFrame->IsInFootnote()))
1125  pUpFrame = pUpFrame->GetPrevContentFrame();
1126  if ( pUpFrame )
1127  {
1128  ::lcl_CalcDownDist( nUp, aNew, pUpFrame );
1129  //It makes sense to search further, if the distance grows inside
1130  //a table.
1131  if ( pUpLst->IsInTab() && pUpFrame->IsInTab() )
1132  {
1133  while ( pUpFrame && ((nUpLst < nUp && pUpFrame->IsInTab()) ||
1134  bBody != pUpFrame->IsInDocBody()) )
1135  {
1136  pUpFrame = pUpFrame->GetPrevContentFrame();
1137  if ( pUpFrame )
1138  ::lcl_CalcDownDist( nUp, aNew, pUpFrame );
1139  }
1140  }
1141  }
1142  if ( !pUpFrame )
1143  nUp.m_nMain = LONG_MAX;
1144  if (nUp.m_nMain >= 0 && LONG_MAX != nUp.m_nMain)
1145  {
1146  bNegAllowed = false;
1147  if (nUpLst.m_nMain < 0) //don't take the wrong one, if the value
1148  //just changed from negative to positive.
1149  { pUpLst = pUpFrame;
1150  nUpLst = nUp;
1151  }
1152  }
1153  } while (pUpFrame && ((bNegAllowed && nUp.m_nMain < 0) || (nUp <= nUpLst)));
1154 
1155  const SwContentFrame *pDownLst;
1156  const SwContentFrame *pDownFrame = pCnt;
1157  SwDistance nDownLst;
1158  if (nDown.m_nMain < 0)
1159  nDown.m_nMain = LONG_MAX;
1160  do
1161  {
1162  pDownLst = pDownFrame; nDownLst = nDown;
1163  pDownFrame = pDownLst->GetNextContentFrame();
1164  while ( pDownFrame &&
1165  (bBody != pDownFrame->IsInDocBody() || bFootnote != pDownFrame->IsInFootnote()))
1166  pDownFrame = pDownFrame->GetNextContentFrame();
1167  if ( pDownFrame )
1168  {
1169  ::lcl_CalcDownDist( nDown, aNew, pDownFrame );
1170  if (nDown.m_nMain < 0)
1171  nDown.m_nMain = LONG_MAX;
1172  //It makes sense to search further, if the distance grows inside
1173  //a table.
1174  if ( pDownLst->IsInTab() && pDownFrame->IsInTab() )
1175  {
1176  while (pDownFrame
1177  && ((nDown.m_nMain != LONG_MAX && pDownFrame->IsInTab())
1178  || bBody != pDownFrame->IsInDocBody()))
1179  {
1180  pDownFrame = pDownFrame->GetNextContentFrame();
1181  if ( pDownFrame )
1182  ::lcl_CalcDownDist( nDown, aNew, pDownFrame );
1183  if (nDown.m_nMain < 0)
1184  nDown.m_nMain = LONG_MAX;
1185  }
1186  }
1187  }
1188  if ( !pDownFrame )
1189  nDown.m_nMain = LONG_MAX;
1190 
1191  } while (pDownFrame && nDown <= nDownLst && nDown.m_nMain != LONG_MAX
1192  && nDownLst.m_nMain != LONG_MAX);
1193 
1194  //If we couldn't find one in both directions, we'll search the Content whose
1195  //left upper corner is the nearest to the point. Such a situation may
1196  //happen, if the point doesn't lay in the text flow but in any margin.
1197  if (nDownLst.m_nMain == LONG_MAX && nUpLst.m_nMain == LONG_MAX)
1198  {
1199  // If an OLE objects, which is contained in a fly frame
1200  // is resized in inplace mode and the new Position is outside the
1201  // fly frame, we do not want to leave our fly frame.
1202  if ( pCnt->IsInFly() )
1203  return pCnt;
1204 
1205  return ::lcl_FindCnt( aNew, pCnt, bBody, bFootnote );
1206  }
1207  else
1208  return nDownLst < nUpLst ? pDownLst : pUpLst;
1209 }
1210 
1211 void SwFlyAtContentFrame::SetAbsPos( const Point &rNew )
1212 {
1213  SwPageFrame *pOldPage = FindPageFrame();
1214  const SwRect aOld( GetObjRectWithSpaces() );
1215  Point aNew( rNew );
1216 
1218  aNew.setX(aNew.getX() + getFrameArea().Width());
1219  SwContentFrame *pCnt = const_cast<SwContentFrame*>(::FindAnchor( GetAnchorFrame(), aNew ));
1220  if( pCnt->IsProtected() )
1221  pCnt = const_cast<SwContentFrame*>(static_cast<const SwContentFrame*>(GetAnchorFrame()));
1222 
1223  SwPageFrame *pTmpPage = nullptr;
1224  const bool bVert = pCnt->IsVertical();
1225 
1226  const bool bVertL2R = pCnt->IsVertLR();
1227  const bool bRTL = pCnt->IsRightToLeft();
1228 
1229  if( ( !bVert != !GetAnchorFrame()->IsVertical() ) ||
1230  ( !bRTL != !GetAnchorFrame()->IsRightToLeft() ) )
1231  {
1232  if( bVert || bRTL )
1233  aNew.setX(aNew.getX() + getFrameArea().Width());
1234  else
1235  aNew.setX(aNew.getX() - getFrameArea().Width());
1236  }
1237 
1238  if ( pCnt->IsInDocBody() )
1239  {
1240  //#38848 drag from page margin into the body.
1241  pTmpPage = pCnt->FindPageFrame();
1242  ::lcl_PointToPrt( aNew, pTmpPage->GetUpper() );
1243  SwRect aTmp( aNew, Size( 0, 0 ) );
1244  pTmpPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(::FindPage( aTmp, pTmpPage )));
1245  ::lcl_PointToPrt( aNew, pTmpPage );
1246  }
1247 
1248  //Setup RelPos, only invalidate if requested.
1249  //rNew is an absolute position. We need to calculate the distance from rNew
1250  //to the anchor inside the text flow to correctly set RelPos.
1252  const SwFrame *pFrame = nullptr;
1253  SwTwips nY;
1254  if ( pCnt->getFrameArea().IsInside( aNew ) )
1255  {
1256  // #i70582#
1257  if ( bVert )
1258  {
1259  nY = pCnt->getFrameArea().Left() - rNew.X();
1260  if ( bVertL2R )
1261  nY = -nY;
1262  else
1263  nY += pCnt->getFrameArea().Width() - getFrameArea().Width();
1265  }
1266  else
1267  nY = rNew.Y() - pCnt->getFrameArea().Top() - pCnt->GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid();
1268  }
1269  else
1270  {
1271  SwDistance aDist;
1272  pFrame = ::lcl_CalcDownDist( aDist, aNew, pCnt );
1273  nY = aDist.m_nMain + aDist.m_nSub;
1274  }
1275 
1276  SwTwips nX = 0;
1277 
1278  if ( pCnt->IsFollow() )
1279  {
1280  // Flys are never attached to the follow but always to the master,
1281  // which we're going to search now.
1282  const SwContentFrame *pOriginal = pCnt;
1283  const SwContentFrame *pFollow = pCnt;
1284  while ( pCnt->IsFollow() )
1285  {
1286  do
1287  {
1288  SwContentFrame* pPrev = pCnt->GetPrevContentFrame();
1289  if (!pPrev)
1290  {
1291  SAL_WARN("sw.core", "very unexpected missing PrevContentFrame");
1292  break;
1293  }
1294  pCnt = pPrev;
1295  }
1296  while ( pCnt->GetFollow() != pFollow );
1297  pFollow = pCnt;
1298  }
1299  SwTwips nDiff = 0;
1300  do
1301  { const SwFrame *pUp = pFollow->GetUpper();
1302  if( pUp->IsVertical() )
1303  {
1304  if ( pUp->IsVertLR() )
1305  nDiff += pUp->getFramePrintArea().Width() - pFollow->GetRelPos().getX();
1306  else
1307  nDiff += pFollow->getFrameArea().Left() + pFollow->getFrameArea().Width()
1308  - pUp->getFrameArea().Left() - pUp->getFramePrintArea().Left();
1309  }
1310  else
1311  nDiff += pUp->getFramePrintArea().Height() - pFollow->GetRelPos().Y();
1312  pFollow = pFollow->GetFollow();
1313  } while ( pFollow != pOriginal );
1314  nY += nDiff;
1315  if( bVert )
1316  nX = pCnt->getFrameArea().Top() - pOriginal->getFrameArea().Top();
1317  else
1318  nX = pCnt->getFrameArea().Left() - pOriginal->getFrameArea().Left();
1319  }
1320 
1321  if ( nY == LONG_MAX )
1322  {
1323  // #i70582#
1324  const SwTwips nTopForObjPos = lcl_GetTopForObjPos(pCnt, bVert, bVertL2R);
1325  if( bVert )
1326  {
1327  if ( bVertL2R )
1328  nY = rNew.X() - nTopForObjPos;
1329  else
1330  nY = nTopForObjPos - rNew.X();
1331  }
1332  else
1333  {
1334  nY = rNew.Y() - nTopForObjPos;
1335  }
1336  }
1337 
1338  SwFlyFrameFormat *pFormat = GetFormat();
1339 
1340  if( bVert )
1341  {
1342  if( !pFrame )
1343  nX += rNew.Y() - pCnt->getFrameArea().Top();
1344  else
1345  nX = rNew.Y() - pFrame->getFrameArea().Top();
1346  }
1347  else
1348  {
1349  if( !pFrame )
1350  {
1351  if ( pCnt->IsRightToLeft() )
1352  nX += pCnt->getFrameArea().Right() - rNew.X() - getFrameArea().Width();
1353  else
1354  nX += rNew.X() - pCnt->getFrameArea().Left();
1355  }
1356  else
1357  {
1358  if ( pFrame->IsRightToLeft() )
1359  nX += pFrame->getFrameArea().Right() - rNew.X() - getFrameArea().Width();
1360  else
1361  nX = rNew.X() - pFrame->getFrameArea().Left();
1362  }
1363  }
1365 
1366  if( pCnt != GetAnchorFrame() || ( IsAutoPos() && pCnt->IsTextFrame() &&
1368  {
1369  //Set the anchor attribute according to the new Cnt.
1370  SwFormatAnchor aAnch( pFormat->GetAnchor() );
1371  SwPosition pos = *aAnch.GetContentAnchor();
1372  if( IsAutoPos() && pCnt->IsTextFrame() )
1373  {
1374  SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(pCnt));
1376  Point aPt( rNew );
1377  if( pCnt->GetModelPositionForViewPoint( &pos, aPt, &eTmpState )
1378  && FrameContainsNode(*pTextFrame, pos.nNode.GetIndex()))
1379  {
1380  const SwTextAttr *const pTextInputField =
1381  pos.nNode.GetNode().GetTextNode()->GetTextAttrAt(
1382  pos.nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTextNode::PARENT );
1383  if (pTextInputField != nullptr)
1384  {
1385  pos.nContent = pTextInputField->GetStart();
1386  }
1388  if( text::RelOrientation::CHAR == pFormat->GetVertOrient().GetRelationOrient() )
1389  nY = LONG_MAX;
1390  if( text::RelOrientation::CHAR == pFormat->GetHoriOrient().GetRelationOrient() )
1391  nX = LONG_MAX;
1392  }
1393  else
1394  {
1395  pos = pTextFrame->MapViewToModelPos(TextFrameIndex(0));
1396  }
1397  }
1398  else if (pCnt->IsTextFrame())
1399  {
1400  pos = static_cast<SwTextFrame const*>(pCnt)->MapViewToModelPos(TextFrameIndex(0));
1401  }
1402  else // is that even possible? maybe if there was a change of anchor type from AT_FLY or something?
1403  {
1404  assert(pCnt->IsNoTextFrame());
1405  pos.nNode = *static_cast<SwNoTextFrame*>(pCnt)->GetNode();
1406  pos.nContent.Assign(static_cast<SwNoTextFrame*>(pCnt)->GetNode(), 0);
1407  }
1408  aAnch.SetAnchor( &pos );
1409 
1410  // handle change of anchor node:
1411  // if count of the anchor frame also change, the fly frames have to be
1412  // re-created. Thus, delete all fly frames except the <this> before the
1413  // anchor attribute is change and re-create them afterwards.
1414  {
1415  SwHandleAnchorNodeChg aHandleAnchorNodeChg( *pFormat, aAnch, this );
1416  pFormat->GetDoc()->SetAttr( aAnch, *pFormat );
1417  }
1418  }
1419  else if ( pTmpPage && pTmpPage != GetPageFrame() )
1420  GetPageFrame()->MoveFly( this, pTmpPage );
1421 
1422  const Point aRelPos = bVert ? Point( -nY, nX ) : Point( nX, nY );
1423  ChgRelPos( aRelPos );
1425 
1426  if ( pOldPage != FindPageFrame() )
1427  ::Notify_Background( GetVirtDrawObj(), pOldPage, aOld, PrepareHint::FlyFrameLeave, false );
1428 }
1429 
1437 {
1438  SwPageFrame* pPageFrame( nullptr );
1439  if ( GetVertPosOrientFrame() )
1440  {
1441  pPageFrame = const_cast<SwPageFrame*>(GetVertPosOrientFrame()->FindPageFrame());
1442  }
1443  if ( pPageFrame && GetPageFrame() != pPageFrame )
1444  {
1445  RegisterAtPage(*pPageFrame);
1446  }
1447 }
1448 
1450 {
1451  assert(GetPageFrame() != &rPageFrame);
1452  if (GetPageFrame())
1453  {
1454  GetPageFrame()->MoveFly( this, &rPageFrame );
1455  }
1456  else
1457  {
1458  rPageFrame.AppendFlyToPage( this );
1459  }
1460 }
1461 
1462 // #i26791#
1464 {
1465  // if fly frame position is valid, nothing is to do. Thus, return
1466  if ( isFrameAreaPositionValid() )
1467  {
1468  return;
1469  }
1470 
1471  // #i26791# - validate position flag here.
1473 
1474  // #i35911# - no calculation of new position, if
1475  // anchored object is marked that it clears its environment and its
1476  // environment is already cleared.
1477  // before checking for cleared environment
1478  // check, if member <mpVertPosOrientFrame> is set.
1479  if ( GetVertPosOrientFrame() &&
1481  {
1482  return;
1483  }
1484 
1485  // use new class to position object
1487  aObjPositioning( *GetVirtDrawObj() );
1488  aObjPositioning.CalcPosition();
1489 
1490  SetVertPosOrientFrame ( aObjPositioning.GetVertPosOrientFrame() );
1491 }
1492 
1493 // #i28701#
1495 {
1496  bool bAllowed( SwFlyFreeFrame::InvalidationAllowed( _nInvalid ) );
1497 
1498  // forbiddance of base instance can't be over ruled.
1499  if ( bAllowed )
1500  {
1501  if ( _nInvalid == INVALID_POS ||
1502  _nInvalid == INVALID_ALL )
1503  {
1504  bAllowed = InvalidationOfPosAllowed();
1505  }
1506  }
1507 
1508  return bAllowed;
1509 }
1510 
1511 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:207
bool GetValue() const
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:548
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2783
Base class of the Writer layout elements.
Definition: frame.hxx:315
virtual const SwFlyFrame * DynCastFlyFrame() const override
Definition: fly.cxx:2961
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
bool OverlapsPrevColumn() const
method to determine, if the anchored object is overlapping with a previous column ...
void Right(const tools::Long nRight)
Definition: swrect.hxx:199
virtual void SwClientNotify(const SwModify &rMod, const SfxHint &rHint) override
Definition: fly.cxx:661
bool IsFollow() const
Definition: flowfrm.hxx:166
Point GetPos(const SwRect &rRect) const
Definition: frame.hxx:1384
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2877
void SetNotifyBack()
Definition: flyfrm.hxx:225
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:565
Marks a position in the document model.
Definition: pam.hxx:35
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:115
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.
Definition: pam.cxx:823
bool IsInDocBody() const
Definition: frame.hxx:944
SwTextFrame * DynCastTextFrame()
Definition: findfrm.cxx:1841
bool IsInFly() const
Definition: frame.hxx:962
bool IsRootFrame() const
Definition: frame.hxx:1175
bool IsInSct() const
Definition: frame.hxx:968
bool IsLowerOf(const SwLayoutFrame *pUpper) const
Definition: fly.cxx:2161
const SwContentFrame * FindAnchor(const SwFrame *pOldAnch, const Point &rNew, const bool bBodyOnly)
Searches an anchor for paragraph bound objects starting from pOldAnch.
Definition: flycnt.cxx:1058
static sal_uInt64 lcl_FindCntDiff(const Point &rPt, const SwLayoutFrame *pLay, const SwContentFrame *&rpCnt, const bool bBody, const bool bFootnote)
Definition: flycnt.cxx:895
bool IsColLocked() const
Definition: frame.hxx:887
virtual bool IsFormatPossible() const override
method to determine, if a format on the Writer fly frame is possible
Definition: flylay.cxx:711
virtual void NotifyBackground(SwPageFrame *pPage, const SwRect &rRect, PrepareHint eHint) override
Notifies the background (all ContentFrames that currently are overlapping).
Definition: flylay.cxx:106
constexpr tools::Long Left() const
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
void Left(const tools::Long nLeft)
Definition: swrect.hxx:194
SwNodeIndex nNode
Definition: pam.hxx:37
bool IsInFootnote() const
Definition: frame.hxx:950
bool ClearedEnvironment() const
const SwFrame * FindPage(const SwRect &rRect, const SwFrame *pPage)
Definition: frmtool.cxx:3690
const SwRect & getFramePrintArea() const
Definition: frame.hxx:181
void SetAbsPos(const Point &rNew)
Definition: flycnt.cxx:1211
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1213
virtual SwUndoId EndUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Closes undo block.
void InvalidateSize_()
Definition: frame.hxx:772
Definition: doc.hxx:188
virtual bool InvalidationAllowed(const InvalidationType _nInvalid) const
method to determine, if an invalidation is allowed.
Definition: wsfrm.cxx:1944
void SetSurround(css::text::WrapTextMode eNew)
Definition: fmtsrnd.hxx:55
bool operator<=(const BigInt &rVal1, const BigInt &rVal2)
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:384
void Pos(const Point &rNew)
Definition: swrect.hxx:168
void SetTmpConsiderWrapInfluenceOfOtherObjs()
method to apply temporary consideration of wrapping style influence to the anchored objects...
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
bool IsCellFrame() const
Definition: frame.hxx:1227
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
void ClearCharRectAndTopOfLine()
reset members and
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
void Notify_Background(const SdrObject *pObj, SwPageFrame *pPage, const SwRect &rRect, const PrepareHint eHint, const bool bInva)
Definition: frmtool.cxx:3351
SfxHintId GetId() const
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:172
static bool bFootnote
Definition: insfnote.cxx:33
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
virtual SwFrameFormat & GetFrameFormat() override
Definition: fly.cxx:2802
bool bSetCompletePaintOnInvalidate
Definition: frmtool.cxx:101
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const
Definition: unusedf.cxx:47
tools::Long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1378
virtual void MakeObjPos() override
method to determine position for the object and set the position at the object
Definition: flycnt.cxx:1463
wrapper class for the positioning of Writer fly frames and drawing objects
void AppendFly(SwFlyFrame *pNew)
Definition: fly.cxx:2180
const SwRect & getFrameArea() const
Definition: frame.hxx:180
size_t pos
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
bool IsInTab() const
Definition: frame.hxx:956
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history...
Definition: docfmt.cxx:453
virtual void RegisterAtCorrectPage() override
method to assure that anchored object is registered at the correct page frame
Definition: flycnt.cxx:1436
void SetTmpConsiderWrapInfluence(const bool _bTmpConsiderWrapInfluence)
bool IsTextFrame() const
Definition: frame.hxx:1235
sal_Int32 GetStart() const
Definition: txatbase.hxx:86
void Width(tools::Long nNew)
Definition: swrect.hxx:186
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
bool m_bAtCnt
RndStdIds::FLY_AT_PARA, anchored at paragraph or RndStdIds::FLY_AT_CHAR.
Definition: flyfrm.hxx:129
SwContentFrame * GetPrevContentFrame() const
Definition: cntfrm.hxx:123
bool IsSctFrame() const
Definition: frame.hxx:1215
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1112
SwFrame * AnchorFrame()
static SwFrameFormat * getOtherTextBoxFormat(const SwFrameFormat *pFormat, sal_uInt16 nType, SdrObject *pObject=nullptr)
If we have an associated TextFrame, then return that.
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
|* With a paragraph-anchored fly it's absolutely possible that |* the anchor reacts to changes of the...
Definition: flycnt.cxx:313
static bool CheckMovedFwdCondition(SwAnchoredObject &_rAnchoredObj, SwPageFrame const &rFromPageFrame, const bool _bAnchoredAtMasterBeforeFormatAnchor, sal_uInt32 &_noToPageNum, bool &_boInFollow, bool &o_rbPageHasFlysAnchoredBelowThis)
method to check the conditions, if 'anchor is moved forward'
virtual void Cut()=0
bool IsColumnFrame() const
Definition: frame.hxx:1183
bool FrameContainsNode(SwContentFrame const &rFrame, sal_uLong nNodeIndex)
Definition: txtfrm.cxx:288
Point GetRelPos() const
Definition: trvlfrm.cxx:1796
virtual void CalcPosition() override
calculate position of object
const SwFormatFollowTextFlow & GetFollowTextFlow(bool=true) const
Style of a layout element.
Definition: frmfmt.hxx:59
virtual SwUndoId StartUndo(SwUndoId const eUndoId, SwRewriter const *const pRewriter)=0
Opens undo block.
bool IsContentFrame() const
Definition: frame.hxx:1231
const SwContentFrame * GetFollow() const
Definition: cntfrm.hxx:131
void RemoveFly(SwFlyFrame *pToRemove)
Definition: fly.cxx:2198
#define SAL_MAX_UINT64
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
virtual void RegisterAtPage(SwPageFrame &) override
Definition: flycnt.cxx:1449
int i
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SwPageFrame * FindPageFrame()
Definition: frame.hxx:681
static void RemoveMovedFwdFrame(const SwDoc &_rDoc, const SwTextFrame &_rTextFrame)
Definition: layouter.cxx:332
const SwFrame * Lower() const
Definition: layfrm.hxx:101
void SetPos(SwTwips nNew)
Definition: fmtornt.hxx:60
SwContentNode * GetContentNode()
Definition: node.hxx:616
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
Definition: wsfrm.cxx:607
tools::Long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1383
FlyAnchors.
Definition: fmtanchr.hxx:34
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
SwLayoutFrame * GetUpper()
Definition: frame.hxx:679
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
void UnlockModify()
Definition: calbck.hxx:210
static void getProperty(SwFrameFormat const *pShape, sal_uInt16 nWID, sal_uInt8 nMemberID, css::uno::Any &rValue)
Get a property of the underlying TextFrame.
SwTwips GetUpperSpaceAmountConsideredForPrevFrameAndPageGrid() const
method to determine the upper space amount, which is considered for the previous frame and the page g...
Definition: flowfrm.cxx:1725
void LockModify()
Definition: calbck.hxx:209
constexpr tools::Long Top() const
bool operator<(const wwFont &r1, const wwFont &r2)
Definition: wrtw8sty.cxx:834
SwFrame * GetPrev()
Definition: frame.hxx:678
const SwRowFrame * IsInFollowFlowRow() const
Definition: findfrm.cxx:1788
virtual const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() override
Definition: fly.cxx:304
Marks a node in the document model.
Definition: ndindex.hxx:31
bool isFrameAreaPositionValid() const
Definition: frame.hxx:167
void MoveFly(SwFlyFrame *pToMove, SwPageFrame *pDest)
Definition: flylay.cxx:934
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:717
bool HasFixSize() const
Definition: frame.hxx:671
void InvalidatePos_()
Definition: frame.hxx:788
virtual bool IsFormatPossible() const override
method to determine, if a format on the Writer fly frame is possible
Definition: flycnt.cxx:564
A page of the document layout.
Definition: pagefrm.hxx:57
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: flylay.cxx:112
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)
Definition: flycnt.cxx:955
tools::Long SwTwips
Definition: swtypes.hxx:52
const long LONG_MAX
EXPAND : (Start < nIndex <= End)
Definition: ndtxt.hxx:368
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1116
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
void setFrameAreaPositionValid(bool bNew)
Definition: wsfrm.cxx:83
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:208
const SwLayoutFrame * GetVertPosOrientFrame() const
bool m_bAutoPosition
RndStdIds::FLY_AT_CHAR, anchored at character.
Definition: flyfrm.hxx:132
bool IsVertLR() const
Definition: frame.hxx:980
SwLayoutFrame * GetLeaf(MakePageType eMakePage, bool bFwd)
Definition: flowfrm.cxx:843
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
Definition: flyfrm.hxx:78
bool InvalidationOfPosAllowed() const
method to determine, if invalidation of position is allowed
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
bool IsLocked() const
Definition: flyfrm.hxx:213
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:738
SwPageFrame * GetPageFrame()
SwTwips GetPos() const
Definition: fmtornt.hxx:59
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
Definition: swrect.cxx:105
bool IsNoTextFrame() const
Definition: frame.hxx:1239
bool IsRightToLeft() const
Definition: frame.hxx:988
bool IsClipped() const
Definition: flyfrm.hxx:228
void Top(const tools::Long nTop)
Definition: swrect.hxx:203
bool IsPageFrame() const
Definition: frame.hxx:1179
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: flycnt.cxx:86
static const SwFormatAnchor * GetAnchorFromPoolItem(const SfxPoolItem &rItem)
Definition: fly.cxx:2948
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)
Definition: flylay.cxx:789
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
bool IsAnFollow(const SwFlowFrame *pFlow) const
Definition: flowfrm.cxx:727
constexpr TypedWhichId< SwFormatField > RES_TXTATR_INPUTFIELD(55)
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
#define UNO_NAME_FRAME_ISAUTOMATIC_HEIGHT
Definition: unoprnms.hxx:591
bool IsVertical() const
Definition: frame.hxx:974
#define SAL_WARN(area, stream)
static void lcl_PointToPrt(Point &rPoint, const SwFrame *pFrame)
Definition: flycnt.cxx:1038
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
const SwFrame * GetAnchorFrame() const
void SetVertPosOrientFrame(const SwLayoutFrame &_rVertPosOrientFrame)
static tools::Rectangle getTextRectangle(SdrObject *pShape, bool bAbsolute=true)
Return the textbox rectangle of a draw shape (in twips).
static bool FrameMovedFwdByObjPos(const SwDoc &_rDoc, const SwTextFrame &_rTextFrame, sal_uInt32 &_ornToPageNum)
Definition: layouter.cxx:342
bool IsFootnoteContFrame() const
Definition: frame.hxx:1199
SwFlyAtContentFrame(SwFlyFrameFormat *, SwFrame *, SwFrame *pAnchor)
Definition: flycnt.cxx:77
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.
Definition: flycnt.cxx:1494
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:67
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
Definition: sortedobjs.hxx:48
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...
Definition: trvlfrm.cxx:1186
void ResetLastCharRectHeight()
void ChgRelPos(const Point &rAbsPos)
Change the relative position.
Definition: fly.cxx:1120
void SetRestartLayoutProcess(const bool _bRestartLayoutProcess)
void Height(tools::Long nNew)
Definition: swrect.hxx:190
static const SwFrame * lcl_CalcDownDist(SwDistance &rRet, const Point &rPt, const SwContentFrame *pCnt)
Definition: flycnt.cxx:596
SwPosition MapViewToModelPos(TextFrameIndex nIndex) const
Definition: txtfrm.cxx:1248
InvalidationType
enumeration for the different invalidations #i28701#
Definition: frame.hxx:489
bool IsFooterFrame() const
Definition: frame.hxx:1195
SwRootFrame * getRootFrame()
Definition: frame.hxx:680
SdrObject * FindRealSdrObject()
Definition: atrfrm.cxx:2773
const SwLayoutFrame & GetVertPosOrientFrame() const
frame, at which the vertical position is oriented at
bool IsAutoPos() const
Definition: flyfrm.hxx:214
static void InsertMovedFwdFrame(const SwDoc &_rDoc, const SwTextFrame &_rMovedFwdFrameByObjPos, const sal_uInt32 _nToPageNum)
Definition: layouter.cxx:312
bool IsProtected() const
Is the Frame or rather the Section in which it lies protected?
Definition: trvlfrm.cxx:1628
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1100
SwFrame * GetNext()
Definition: frame.hxx:677