LibreOffice Module sw (master)  1
frmtool.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 <svx/svdpage.hxx>
21 #include <editeng/brushitem.hxx>
22 #include <editeng/shaditem.hxx>
23 #include <editeng/ulspitem.hxx>
24 #include <editeng/boxitem.hxx>
25 #include <editeng/lspcitem.hxx>
26 #include <sal/log.hxx>
27 
28 #include <drawdoc.hxx>
29 #include <fmtornt.hxx>
30 #include <fmthdft.hxx>
31 #include <fmtfsize.hxx>
32 #include <fmtsrnd.hxx>
33 #include <docary.hxx>
34 #include <lineinfo.hxx>
35 #include <swmodule.hxx>
36 #include <pagefrm.hxx>
37 #include <colfrm.hxx>
38 #include <fesh.hxx>
39 #include <viewimp.hxx>
40 #include <viewopt.hxx>
41 #include <dflyobj.hxx>
42 #include <dcontact.hxx>
43 #include <frmatr.hxx>
44 #include <frmtool.hxx>
45 #include <tabfrm.hxx>
46 #include <rowfrm.hxx>
47 #include <ftnfrm.hxx>
48 #include <txtfrm.hxx>
49 #include <notxtfrm.hxx>
50 #include <flyfrms.hxx>
51 #include <layact.hxx>
52 #include <pagedesc.hxx>
53 #include <section.hxx>
54 #include <sectfrm.hxx>
55 #include <node2lay.hxx>
56 #include <ndole.hxx>
57 #include <hints.hxx>
58 #include "layhelp.hxx"
59 #include <laycache.hxx>
60 #include <rootfrm.hxx>
61 #include <paratr.hxx>
62 #include <redline.hxx>
63 #include <sortedobjs.hxx>
64 #include <objectformatter.hxx>
65 #include <calbck.hxx>
66 #include <ndtxt.hxx>
67 #include <undobj.hxx>
70 #include <IDocumentTimerAccess.hxx>
73 #include <IDocumentState.hxx>
74 #include <boost/circular_buffer.hpp>
76 
77 using namespace ::com::sun::star;
78 
79 bool bObjsDirect = true;
80 bool bDontCreateObjects = false;
82 
84 bool StackHack::bLocked = false;
85 
87  mpFrame( pF ),
88  maFrame( pF->getFrameArea() ),
89  maPrt( pF->getFramePrintArea() ),
90  mbInvaKeep( false ),
91  mbValidSize( pF->isFrameAreaSizeValid() )
92 {
93  if ( pF->IsTextFrame() )
94  {
95  mnFlyAnchorOfst = static_cast<SwTextFrame*>(pF)->GetBaseOfstForFly( true );
96  mnFlyAnchorOfstNoWrap = static_cast<SwTextFrame*>(pF)->GetBaseOfstForFly( false );
97  }
98  else
99  {
100  mnFlyAnchorOfst = 0;
102  }
103 
104  mbHadFollow = pF->IsContentFrame() && static_cast<SwContentFrame*>(pF)->GetFollow();
105 }
106 
107 SwFrameNotify::~SwFrameNotify() COVERITY_NOEXCEPT_FALSE
108 {
109  SwRectFnSet aRectFnSet(mpFrame);
110  const bool bAbsP = aRectFnSet.PosDiff(maFrame, mpFrame->getFrameArea());
111  const bool bChgWidth =
112  aRectFnSet.GetWidth(maFrame) != aRectFnSet.GetWidth(mpFrame->getFrameArea());
113  const bool bChgHeight =
114  aRectFnSet.GetHeight(maFrame)!=aRectFnSet.GetHeight(mpFrame->getFrameArea());
115  const bool bChgFlyBasePos = mpFrame->IsTextFrame() &&
116  ( ( mnFlyAnchorOfst != static_cast<SwTextFrame*>(mpFrame)->GetBaseOfstForFly( true ) ) ||
117  ( mnFlyAnchorOfstNoWrap != static_cast<SwTextFrame*>(mpFrame)->GetBaseOfstForFly( false ) ) );
118 
119  if ( mpFrame->IsFlowFrame() && !mpFrame->IsInFootnote() )
120  {
122 
123  if ( !pFlow->IsFollow() )
124  {
125  if ( !mpFrame->GetIndPrev() )
126  {
127  if ( mbInvaKeep )
128  {
129  SwFrame *pPre = mpFrame->FindPrev();
130  if ( pPre && pPre->IsFlowFrame() )
131  {
132  // 1. pPre wants to keep with me:
133  bool bInvalidPrePos = SwFlowFrame::CastFlowFrame(pPre)->IsKeep(pPre->GetAttrSet()->GetKeep(), pPre->GetBreakItem())
134  && pPre->GetIndPrev();
135 
136  // 2. pPre is a table and the last row wants to keep with me:
137  if ( !bInvalidPrePos && pPre->IsTabFrame() )
138  {
139  SwTabFrame* pPreTab = static_cast<SwTabFrame*>(pPre);
141  {
142  SwRowFrame* pLastRow = static_cast<SwRowFrame*>(pPreTab->GetLastLower());
143  if ( pLastRow && pLastRow->ShouldRowKeepWithNext() )
144  bInvalidPrePos = true;
145  }
146  }
147 
148  if ( bInvalidPrePos )
149  pPre->InvalidatePos();
150  }
151  }
152  }
153  else if ( !pFlow->HasFollow() )
154  {
155  long nOldHeight = aRectFnSet.GetHeight(maFrame);
156  long nNewHeight = aRectFnSet.GetHeight(mpFrame->getFrameArea());
157  if( (nOldHeight > nNewHeight) || (!nOldHeight && nNewHeight) )
158  pFlow->CheckKeep();
159  }
160  }
161  }
162 
163  if ( bAbsP )
164  {
166 
167  SwFrame* pNxt = mpFrame->GetIndNext();
168  // #121888# - skip empty section frames
169  while ( pNxt &&
170  pNxt->IsSctFrame() && !static_cast<SwSectionFrame*>(pNxt)->GetSection() )
171  {
172  pNxt = pNxt->GetIndNext();
173  }
174 
175  if ( pNxt )
176  pNxt->InvalidatePos();
177  else
178  {
179  // #104100# - correct condition for setting retouche
180  // flag for vertical layout.
181  if( mpFrame->IsRetoucheFrame() &&
182  aRectFnSet.TopDist( maFrame, aRectFnSet.GetTop(mpFrame->getFrameArea()) ) > 0 )
183  {
184  mpFrame->SetRetouche();
185  }
186 
187  // A fresh follow frame does not have to be invalidated, because
188  // it is already formatted:
189  if ( mbHadFollow || !mpFrame->IsContentFrame() || !static_cast<SwContentFrame*>(mpFrame)->GetFollow() )
190  {
191  if ( !mpFrame->IsTabFrame() || !static_cast<SwTabFrame*>(mpFrame)->GetFollow() )
193  }
194  }
195  }
196 
197  //For each resize of the background graphics is a repaint necessary.
198  const bool bPrtWidth =
199  aRectFnSet.GetWidth(maPrt) != aRectFnSet.GetWidth(mpFrame->getFramePrintArea());
200  const bool bPrtHeight =
201  aRectFnSet.GetHeight(maPrt)!=aRectFnSet.GetHeight(mpFrame->getFramePrintArea());
202  if ( bPrtWidth || bPrtHeight )
203  {
204  bool bUseNewFillProperties(false);
206  {
208  if(aFillAttributes.get() && aFillAttributes->isUsed())
209  {
210  bUseNewFillProperties = true;
211  // use SetCompletePaint if needed
212  if(aFillAttributes->needCompleteRepaint())
213  {
215  }
216  }
217  }
218  if (!bUseNewFillProperties)
219  {
221  if(GPOS_NONE != ePos && GPOS_TILED != ePos)
223  }
224  }
225  else
226  {
227  // #97597# - consider case that *only* margins between
228  // frame and printing area has changed. Then, frame has to be repainted,
229  // in order to force paint of the margin areas.
230  if ( !bAbsP && (bChgWidth || bChgHeight) )
231  {
233  }
234  }
235 
236  const bool bPrtP = aRectFnSet.PosDiff( maPrt, mpFrame->getFramePrintArea() );
237  if ( bAbsP || bPrtP || bChgWidth || bChgHeight ||
238  bPrtWidth || bPrtHeight || bChgFlyBasePos )
239  {
240  if( mpFrame->IsAccessibleFrame() )
241  {
242  SwRootFrame *pRootFrame = mpFrame->getRootFrame();
243  if( pRootFrame && pRootFrame->IsAnyShellAccessible() &&
244  pRootFrame->GetCurrShell() )
245  {
246  pRootFrame->GetCurrShell()->Imp()->MoveAccessibleFrame( mpFrame, maFrame );
247  }
248  }
249 
250  // Notification of anchored objects
251  if ( mpFrame->GetDrawObjs() )
252  {
253  const SwSortedObjs &rObjs = *mpFrame->GetDrawObjs();
254  SwPageFrame* pPageFrame = nullptr;
255  for (SwAnchoredObject* pObj : rObjs)
256  {
257  // OD 2004-03-31 #i26791# - no general distinction between
258  // Writer fly frames and drawing objects
259  bool bNotify = false;
260  bool bNotifySize = false;
261  SwContact* pContact = ::GetUserCall( pObj->GetDrawObj() );
262  const bool bAnchoredAsChar = pContact->ObjAnchoredAsChar();
263  if ( !bAnchoredAsChar )
264  {
265  // Notify object, which aren't anchored as-character:
266 
267  // always notify objects, if frame position has changed
268  // or if the object is to-page|to-fly anchored.
269  if ( bAbsP ||
270  pContact->ObjAnchoredAtPage() ||
271  pContact->ObjAnchoredAtFly() )
272  {
273  bNotify = true;
274 
275  // assure that to-fly anchored Writer fly frames are
276  // registered at the correct page frame, if frame
277  // position has changed.
278  if ( bAbsP && pContact->ObjAnchoredAtFly() &&
279  dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
280  {
281  // determine to-fly anchored Writer fly frame
282  SwFlyFrame* pFlyFrame = static_cast<SwFlyFrame*>(pObj);
283  // determine page frame of to-fly anchored
284  // Writer fly frame
285  SwPageFrame* pFlyPageFrame = pFlyFrame->FindPageFrame();
286  // determine page frame, if needed.
287  if ( !pPageFrame )
288  {
289  pPageFrame = mpFrame->FindPageFrame();
290  }
291  if ( pPageFrame != pFlyPageFrame )
292  {
293  OSL_ENSURE( pFlyPageFrame, "~SwFrameNotify: Fly from Nowhere" );
294  if( pFlyPageFrame )
295  pFlyPageFrame->MoveFly( pFlyFrame, pPageFrame );
296  else
297  pPageFrame->AppendFlyToPage( pFlyFrame );
298  }
299  }
300  }
301  // otherwise the objects are notified in dependence to
302  // its positioning and alignment
303  else
304  {
305  const SwFormatVertOrient& rVert =
306  pContact->GetFormat()->GetVertOrient();
307  if ( ( rVert.GetVertOrient() == text::VertOrientation::CENTER ||
308  rVert.GetVertOrient() == text::VertOrientation::BOTTOM ||
309  rVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA ) &&
310  ( bChgHeight || bPrtHeight ) )
311  {
312  bNotify = true;
313  }
314  if ( !bNotify )
315  {
316  const SwFormatHoriOrient& rHori =
317  pContact->GetFormat()->GetHoriOrient();
318  if ( ( rHori.GetHoriOrient() != text::HoriOrientation::NONE ||
319  rHori.GetRelationOrient()== text::RelOrientation::PRINT_AREA ||
320  rHori.GetRelationOrient()== text::RelOrientation::FRAME ) &&
321  ( bChgWidth || bPrtWidth || bChgFlyBasePos ) )
322  {
323  bNotify = true;
324  }
325  }
326  }
327  }
328  else if ( bPrtWidth )
329  {
330  // Notify as-character anchored objects, if printing area
331  // width has changed.
332  bNotify = true;
333  bNotifySize = true;
334  }
335 
336  // perform notification via the corresponding invalidations
337  if ( bNotify )
338  {
339  if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
340  {
341  SwFlyFrame* pFlyFrame = static_cast<SwFlyFrame*>(pObj);
342  if ( bNotifySize )
343  pFlyFrame->InvalidateSize_();
344  // #115759# - no invalidation of
345  // position for as-character anchored objects.
346  if ( !bAnchoredAsChar )
347  {
348  pFlyFrame->InvalidatePos_();
349  }
350  pFlyFrame->Invalidate_();
351  }
352  else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr )
353  {
354  // #115759# - no invalidation of
355  // position for as-character anchored objects.
356  if ( !bAnchoredAsChar )
357  {
358  pObj->InvalidateObjPos();
359  }
360  }
361  else
362  {
363  OSL_FAIL( "<SwContentNotify::~SwContentNotify()> - unknown anchored object type." );
364  }
365  }
366  }
367  }
368  }
370  {
371  SwRootFrame *pRootFrame = mpFrame->getRootFrame();
372  if( pRootFrame && pRootFrame->IsAnyShellAccessible() &&
373  pRootFrame->GetCurrShell() )
374  {
376  }
377  }
378 
379  // #i9046# Automatic frame width
380  SwFlyFrame* pFly = nullptr;
381  // #i35879# Do not trust the inf flags. pFrame does not
382  // necessarily have to have an upper!
383  if ( !mpFrame->IsFlyFrame() && nullptr != ( pFly = mpFrame->ImplFindFlyFrame() ) )
384  {
385  // #i61999#
386  // no invalidation of columned Writer fly frames, because automatic
387  // width doesn't make sense for such Writer fly frames.
388  if ( pFly->Lower() && !pFly->Lower()->IsColumnFrame() )
389  {
390  const SwFormatFrameSize &rFrameSz = pFly->GetFormat()->GetFrameSize();
391 
392  // This could be optimized. Basically the fly frame only has to
393  // be invalidated, if the first line of pFrame (if pFrame is a content
394  // frame, for other frame types it's the print area) has changed its
395  // size and pFrame was responsible for the current width of pFly. On
396  // the other hand, this is only rarely used and re-calculation of
397  // the fly frame does not cause too much trouble. So we keep it this
398  // way:
399  if ( ATT_FIX_SIZE != rFrameSz.GetWidthSizeType() )
400  {
401  // #i50668#, #i50998# - invalidation of position
402  // of as-character anchored fly frames not needed and can cause
403  // layout loops
404  if ( dynamic_cast<const SwFlyInContentFrame*>( pFly) == nullptr )
405  {
406  pFly->InvalidatePos();
407  }
408  pFly->InvalidateSize();
409  }
410  }
411  }
412 }
413 
415  SwFrameNotify( pLayFrame ),
416  m_bLowersComplete( false )
417 {
418 }
419 
420 // OD 2004-05-11 #i28701# - local method to invalidate the position of all
421 // frames inclusive its floating screen objects, which are lowers of the given
422 // layout frame
423 static void lcl_InvalidatePosOfLowers( SwLayoutFrame& _rLayoutFrame )
424 {
425  if( _rLayoutFrame.IsFlyFrame() && _rLayoutFrame.GetDrawObjs() )
426  {
427  _rLayoutFrame.InvalidateObjs( false );
428  }
429 
430  SwFrame* pLowerFrame = _rLayoutFrame.Lower();
431  while ( pLowerFrame )
432  {
433  pLowerFrame->InvalidatePos();
434  if ( pLowerFrame->IsTextFrame() )
435  {
436  static_cast<SwTextFrame*>(pLowerFrame)->Prepare( PREP_POS_CHGD );
437  }
438  else if ( pLowerFrame->IsTabFrame() )
439  {
440  pLowerFrame->InvalidatePrt();
441  }
442 
443  pLowerFrame->InvalidateObjs( false );
444 
445  pLowerFrame = pLowerFrame->GetNext();
446  }
447 }
448 
450 {
451  SwLayoutFrame *pLay = static_cast<SwLayoutFrame*>(mpFrame);
452  SwRectFnSet aRectFnSet(pLay);
453  bool bNotify = false;
454  if ( pLay->getFramePrintArea().SSize() != maPrt.SSize() )
455  {
456  if ( !IsLowersComplete() )
457  {
458  bool bInvaPercent;
459 
460  if ( pLay->IsRowFrame() )
461  {
462  bInvaPercent = true;
463  long nNew = aRectFnSet.GetHeight(pLay->getFramePrintArea());
464  if( nNew != aRectFnSet.GetHeight(maPrt) )
465  static_cast<SwRowFrame*>(pLay)->AdjustCells( nNew, true);
466  if( aRectFnSet.GetWidth(pLay->getFramePrintArea())
467  != aRectFnSet.GetWidth(maPrt) )
468  static_cast<SwRowFrame*>(pLay)->AdjustCells( 0, false );
469  }
470  else
471  {
472  //Proportional adoption of the internal.
473  //1. If the formatted is no Fly
474  //2. If he contains no columns
475  //3. If the Fly has a fixed height and the columns
476  // are next to be.
477  // Hoehe danebenliegen.
478  //4. Never at SectionFrames.
479  bool bLow;
480  if( pLay->IsFlyFrame() )
481  {
482  if ( pLay->Lower() )
483  {
484  bLow = !pLay->Lower()->IsColumnFrame() ||
485  aRectFnSet.GetHeight(pLay->Lower()->getFrameArea())
486  != aRectFnSet.GetHeight(pLay->getFramePrintArea());
487  }
488  else
489  bLow = false;
490  }
491  else if( pLay->IsSctFrame() )
492  {
493  if ( pLay->Lower() )
494  {
495  if( pLay->Lower()->IsColumnFrame() && pLay->Lower()->GetNext() )
496  bLow = pLay->Lower()->getFrameArea().Height() != pLay->getFramePrintArea().Height();
497  else
498  bLow = pLay->getFramePrintArea().Width() != maPrt.Width();
499  }
500  else
501  bLow = false;
502  }
503  else if( pLay->IsFooterFrame() && !pLay->HasFixSize() )
504  bLow = pLay->getFramePrintArea().Width() != maPrt.Width();
505  else
506  bLow = true;
507  bInvaPercent = bLow;
508  if ( bLow )
509  {
510  pLay->ChgLowersProp( maPrt.SSize() );
511  }
512  // If the PrtArea has been extended, it might be possible that the chain of parts
513  // can take another frame. As a result, the "possible right one" needs to be
514  // invalidated. This only pays off if this or its Uppers are moveable sections.
515  // A PrtArea has been extended if width or height are larger than before.
516  if ( (pLay->getFramePrintArea().Height() > maPrt.Height() ||
517  pLay->getFramePrintArea().Width() > maPrt.Width()) &&
518  (pLay->IsMoveable() || pLay->IsFlyFrame()) )
519  {
520  SwFrame *pTmpFrame = pLay->Lower();
521  if ( pTmpFrame && pTmpFrame->IsFlowFrame() )
522  {
523  while ( pTmpFrame->GetNext() )
524  pTmpFrame = pTmpFrame->GetNext();
525  pTmpFrame->InvalidateNextPos();
526  }
527  }
528  }
529  bNotify = true;
530  //EXPENSIVE!! But how we do it more elegant?
531  if( bInvaPercent )
532  pLay->InvaPercentLowers( pLay->getFramePrintArea().Height() - maPrt.Height() );
533  }
534  if ( pLay->IsTabFrame() )
535  //So that _only_ the shadow is drawn while resizing.
536  static_cast<SwTabFrame*>(pLay)->SetComplete();
537  else
538  {
539  const SwViewShell *pSh = pLay->getRootFrame()->GetCurrShell();
540  if( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) ||
541  !(pLay->GetType() & (SwFrameType::Body | SwFrameType::Page)) )
542  //Thereby the subordinates are retouched clean.
543  //Example problem: Take the Flys with the handles and downsize.
544  //Not for body and page, otherwise it flickers when loading HTML.
545  pLay->SetCompletePaint();
546  }
547  }
548  //Notify Lower if the position has changed.
549  const bool bPrtPos = aRectFnSet.PosDiff( maPrt, pLay->getFramePrintArea() );
550  const bool bPos = bPrtPos || aRectFnSet.PosDiff( maFrame, pLay->getFrameArea() );
551  const bool bSize = pLay->getFrameArea().SSize() != maFrame.SSize();
552 
553  if ( bPos && pLay->Lower() && !IsLowersComplete() )
554  {
555  pLay->Lower()->InvalidatePos();
556  SwFootnoteFrame* pFtnFrame = pLay->Lower()->IsFootnoteFrame() ?
557  static_cast<SwFootnoteFrame*>(pLay->Lower()) : nullptr;
558  SwFrame* pFtnLower = pFtnFrame ? pFtnFrame->Lower() : nullptr;
559  if (pFtnLower)
560  pFtnLower->InvalidatePos();
561  }
562 
563  if ( bPrtPos )
564  pLay->SetCompletePaint();
565 
566  //Inform the Follower if the SSize has changed.
567  if ( bSize )
568  {
569  if( pLay->GetNext() )
570  {
571  if ( pLay->GetNext()->IsLayoutFrame() )
572  pLay->GetNext()->InvalidatePos_();
573  else
574  pLay->GetNext()->InvalidatePos();
575  }
576  else if( pLay->IsSctFrame() )
577  pLay->InvalidateNextPos();
578  }
579  if ( !IsLowersComplete() &&
581  pLay->Lower() && pLay->Lower()->IsColumnFrame()) &&
582  (bPos || bNotify) &&
584  {
585  // #i44016# - force unlock of position of lower objects.
586  // #i43913# - no unlock of position of objects,
587  // if <pLay> is a cell frame, and its table frame resp. its parent table
588  // frame is locked.
589  // #i47458# - force unlock of position of lower objects,
590  // only if position of layout frame has changed.
591  bool bUnlockPosOfObjs( bPos );
592  if ( bUnlockPosOfObjs && pLay->IsCellFrame() )
593  {
594  SwTabFrame* pTabFrame( pLay->FindTabFrame() );
595  if ( pTabFrame &&
596  ( pTabFrame->IsJoinLocked() ||
597  ( pTabFrame->IsFollow() &&
598  pTabFrame->FindMaster()->IsJoinLocked() ) ) )
599  {
600  bUnlockPosOfObjs = false;
601  }
602  }
603  // #i49383# - check for footnote frame, if unlock
604  // of position of lower objects is allowed.
605  else if ( bUnlockPosOfObjs && pLay->IsFootnoteFrame() )
606  {
607  bUnlockPosOfObjs = static_cast<SwFootnoteFrame*>(pLay)->IsUnlockPosOfLowerObjs();
608  }
609  // #i51303# - no unlock of object positions for sections
610  else if ( bUnlockPosOfObjs && pLay->IsSctFrame() )
611  {
612  bUnlockPosOfObjs = false;
613  }
614  pLay->NotifyLowerObjs( bUnlockPosOfObjs );
615  }
616  if ( bPos && pLay->IsFootnoteFrame() && pLay->Lower() )
617  {
618  // OD 2004-05-11 #i28701#
620  }
621  if( ( bPos || bSize ) && pLay->IsFlyFrame() && static_cast<SwFlyFrame*>(pLay)->GetAnchorFrame()
622  && static_cast<SwFlyFrame*>(pLay)->GetAnchorFrame()->IsFlyFrame() )
623  static_cast<SwFlyFrame*>(pLay)->AnchorFrame()->InvalidateSize();
624 }
625 
627  SwLayNotify( pFlyFrame ),
628  // #115759# - keep correct page frame - the page frame
629  // the Writer fly frame is currently registered at.
630  pOldPage( pFlyFrame->GetPageFrame() ),
631  aFrameAndSpace( pFlyFrame->GetObjRectWithSpaces() )
632 {
633 }
634 
636 {
637  SwFlyFrame *pFly = static_cast<SwFlyFrame*>(mpFrame);
638  if ( pFly->IsNotifyBack() )
639  {
640  SwViewShell *pSh = pFly->getRootFrame()->GetCurrShell();
641  SwViewShellImp *pImp = pSh ? pSh->Imp() : nullptr;
642  if ( !pImp || !pImp->IsAction() || !pImp->GetLayAction().IsAgain() )
643  {
644  //If in the LayAction the IsAgain is set it can be
645  //that the old page is destroyed in the meantime!
647  // #i35640# - additional notify anchor text frame,
648  // if Writer fly frame has changed its page
649  if ( pFly->GetAnchorFrame()->IsTextFrame() &&
650  pFly->GetPageFrame() != pOldPage )
651  {
652  pFly->AnchorFrame()->Prepare( PREP_FLY_LEAVE );
653  }
654  }
655  pFly->ResetNotifyBack();
656  }
657 
658  //Have the size or the position changed,
659  //so should the view know this.
660  SwRectFnSet aRectFnSet(pFly);
661  const bool bPosChgd = aRectFnSet.PosDiff( maFrame, pFly->getFrameArea() );
662  const bool bFrameChgd = pFly->getFrameArea().SSize() != maFrame.SSize();
663  const bool bPrtChgd = maPrt != pFly->getFramePrintArea();
664  if ( bPosChgd || bFrameChgd || bPrtChgd )
665  {
666  pFly->NotifyDrawObj();
667  }
668  if ( bPosChgd && maFrame.Pos().X() != FAR_AWAY )
669  {
670  // OD 2004-05-10 #i28701# - no direct move of lower Writer fly frames.
671  // reason: New positioning and alignment (e.g. to-paragraph anchored,
672  // but aligned at page) are introduced.
673  // <SwLayNotify::~SwLayNotify()> takes care of invalidation of lower
674  // floating screen objects by calling method <SwLayoutFrame::NotifyLowerObjs()>.
675 
676  if ( pFly->IsFlyAtContentFrame() )
677  {
678  SwFrame *pNxt = pFly->AnchorFrame()->FindNext();
679  if ( pNxt )
680  {
681  pNxt->InvalidatePos();
682  }
683  }
684 
685  // #i26945# - notify anchor.
686  // Needed for negative positioned Writer fly frames
687  if ( pFly->GetAnchorFrame()->IsTextFrame() )
688  {
689  pFly->AnchorFrame()->Prepare( PREP_FLY_LEAVE );
690  }
691  }
692 
693  // OD 2004-05-13 #i28701#
694  // #i45180# - no adjustment of layout process flags and
695  // further notifications/invalidations, if format is called by grow/shrink
696  if ( pFly->ConsiderObjWrapInfluenceOnObjPos() &&
697  ( dynamic_cast<const SwFlyFreeFrame*>( pFly) == nullptr ||
698  !static_cast<SwFlyFreeFrame*>(pFly)->IsNoMoveOnCheckClip() ) )
699  {
700  // #i54138# - suppress restart of the layout process
701  // on changed frame height.
702  // Note: It doesn't seem to be necessary and can cause layout loops.
703  if ( bPosChgd )
704  {
705  // indicate a restart of the layout process
706  pFly->SetRestartLayoutProcess( true );
707  }
708  else
709  {
710  // lock position
711  pFly->LockPosition();
712 
713  if ( !pFly->ConsiderForTextWrap() )
714  {
715  // indicate that object has to be considered for text wrap
716  pFly->SetConsiderForTextWrap( true );
717  // invalidate 'background' in order to allow its 'background'
718  // to wrap around it.
719  pFly->NotifyBackground( pFly->GetPageFrame(),
720  pFly->GetObjRectWithSpaces(),
721  PREP_FLY_ARRIVE );
722  // invalidate position of anchor frame in order to force
723  // a re-format of the anchor frame, which also causes a
724  // re-format of the invalid previous frames of the anchor frame.
725  pFly->AnchorFrame()->InvalidatePos();
726  }
727  }
728  }
729 }
730 
732  SwFrameNotify( pContentFrame ),
733  // OD 08.01.2004 #i11859#
734  mbChkHeightOfLastLine( false ),
735  mnHeightOfLastLine( 0 ),
736  // OD 2004-02-26 #i25029#
737  mbInvalidatePrevPrtArea( false ),
738  mbBordersJoinedWithPrev( false )
739 {
740  // OD 08.01.2004 #i11859#
741  if ( pContentFrame->IsTextFrame() )
742  {
743  SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pContentFrame);
745  {
746  const SvxLineSpacingItem &rSpace = pTextFrame->GetAttrSet()->GetLineSpacing();
747  if ( rSpace.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop )
748  {
749  mbChkHeightOfLastLine = true;
750  mnHeightOfLastLine = pTextFrame->GetHeightOfLastLine();
751  }
752  }
753  }
754 }
755 
757 {
758  SwContentFrame *pCnt = static_cast<SwContentFrame*>(mpFrame);
760  pCnt->SetCompletePaint();
761 
762  SwRectFnSet aRectFnSet(pCnt);
763  if ( pCnt->IsInTab() && ( aRectFnSet.PosDiff( pCnt->getFrameArea(), maFrame ) ||
764  pCnt->getFrameArea().SSize() != maFrame.SSize()))
765  {
766  SwLayoutFrame* pCell = pCnt->GetUpper();
767  while( !pCell->IsCellFrame() && pCell->GetUpper() )
768  pCell = pCell->GetUpper();
769  OSL_ENSURE( pCell->IsCellFrame(), "Where's my cell?" );
771  pCell->InvalidatePrt(); //for the vertical align.
772  }
773 
774  // OD 2004-02-26 #i25029#
776  pCnt->IsTextFrame() &&
777  !pCnt->IsFollow() && !pCnt->GetIndPrev() )
778  {
779  // determine previous frame
780  SwFrame* pPrevFrame = pCnt->FindPrev();
781  // skip empty section frames and hidden text frames
782  {
783  while ( pPrevFrame &&
784  ( ( pPrevFrame->IsSctFrame() &&
785  !static_cast<SwSectionFrame*>(pPrevFrame)->GetSection() ) ||
786  ( pPrevFrame->IsTextFrame() &&
787  static_cast<SwTextFrame*>(pPrevFrame)->IsHiddenNow() ) ) )
788  {
789  pPrevFrame = pPrevFrame->FindPrev();
790  }
791  }
792 
793  // Invalidate printing area of found previous frame
794  if ( pPrevFrame )
795  {
796  if ( pPrevFrame->IsSctFrame() )
797  {
798  if ( pCnt->IsInSct() )
799  {
800  // Note: found previous frame is a section frame and
801  // <pCnt> is also inside a section.
802  // Thus due to <mbBordersJoinedWithPrev>,
803  // <pCnt> had joined its borders/shadow with the
804  // last content of the found section.
805  // Invalidate printing area of last content in found section.
806  SwFrame* pLstContentOfSctFrame =
807  static_cast<SwSectionFrame*>(pPrevFrame)->FindLastContent();
808  if ( pLstContentOfSctFrame )
809  {
810  pLstContentOfSctFrame->InvalidatePrt();
811  }
812  }
813  }
814  else
815  {
816  pPrevFrame->InvalidatePrt();
817  }
818  }
819  }
820 
821  const bool bFirst = aRectFnSet.GetWidth(maFrame) == 0;
822 
823  if ( pCnt->IsNoTextFrame() )
824  {
825  //Active PlugIn's or OLE-Objects should know something of the change
826  //thereby they move their window appropriate.
827  SwViewShell *pSh = pCnt->getRootFrame()->GetCurrShell();
828  if ( pSh )
829  {
830  SwOLENode *const pNd(static_cast<SwNoTextFrame*>(pCnt)->GetNode()->GetOLENode());
831  if (nullptr != pNd &&
832  (pNd->GetOLEObj().IsOleRef() ||
833  pNd->IsOLESizeInvalid()) )
834  {
835  const bool bNoTextFramePrtAreaChanged =
836  ( maPrt.SSize().Width() != 0 &&
837  maPrt.SSize().Height() != 0 ) &&
838  maPrt.SSize() != pCnt->getFramePrintArea().SSize();
839  OSL_ENSURE( pCnt->IsInFly(), "OLE not in FlyFrame" );
840  SwFlyFrame *pFly = pCnt->FindFlyFrame();
841  svt::EmbeddedObjectRef& xObj = pNd->GetOLEObj().GetObject();
842  SwFEShell *pFESh = nullptr;
843  for(SwViewShell& rCurrentShell : pSh->GetRingContainer())
844  { if ( dynamic_cast<const SwCursorShell*>( &rCurrentShell) != nullptr )
845  {
846  pFESh = static_cast<SwFEShell*>(&rCurrentShell);
847  // #108369#: Here used to be the condition if (!bFirst).
848  // I think this should mean "do not call CalcAndSetScale"
849  // if the frame is formatted for the first time.
850  // Unfortunately this is not valid anymore since the
851  // SwNoTextFrame already gets a width during CalcLowerPreps.
852  // Nevertheless, the indention of !bFirst seemed to be
853  // to assure that the OLE objects have already been notified
854  // if necessary before calling CalcAndSetScale.
855  // So I replaced !bFirst by !IsOLESizeInvalid. There is
856  // one additional problem specific to the word import:
857  // The layout is calculated _before_ calling PrtOLENotify,
858  // and the OLE objects are not invalidated during import.
859  // Therefore I added the condition !IsUpdateExpField,
860  // have a look at the occurrence of CalcLayout in
861  // uiview/view.cxx.
862  if ( !pNd->IsOLESizeInvalid() &&
864  pFESh->CalcAndSetScale( xObj,
865  &pFly->getFramePrintArea(), &pFly->getFrameArea(),
866  bNoTextFramePrtAreaChanged );
867  }
868  }
869 
870  if ( pFESh && pNd->IsOLESizeInvalid() )
871  {
872  pNd->SetOLESizeInvalid( false );
873  pFESh->CalcAndSetScale( xObj ); // create client
874  }
875  }
876  //dito animated graphics
877  if ( getFrameArea().HasArea() && static_cast<SwNoTextFrame*>(pCnt)->HasAnimation() )
878  {
879  static_cast<SwNoTextFrame*>(pCnt)->StopAnimation();
881  }
882  }
883  }
884 
885  if ( bFirst )
886  {
887  pCnt->SetRetouche(); //fix(13870)
888 
889  SwDoc *const pDoc = pCnt->IsTextFrame()
890  ? &static_cast<SwTextFrame*>(pCnt)->GetDoc()
891  : static_cast<SwNoTextFrame*>(pCnt)->GetNode()->GetDoc();
892  if ( !pDoc->GetSpzFrameFormats()->empty() &&
894  {
895  // If certain import filters for foreign file format import
896  // AT_PAGE anchored objects, the corresponding page number is
897  // typically not known. In this case the content position is
898  // stored at which the anchored object is found in the
899  // imported document.
900  // When this content is formatted it is the time at which
901  // the page is known. Thus, this data can be corrected now.
902 
903  const SwPageFrame *pPage = nullptr;
904  SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
905 
906  for ( size_t i = 0; i < pTable->size(); ++i )
907  {
908  SwFrameFormat *pFormat = (*pTable)[i];
909  const SwFormatAnchor &rAnch = pFormat->GetAnchor();
910  if ( RndStdIds::FLY_AT_PAGE != rAnch.GetAnchorId() ||
911  rAnch.GetContentAnchor() == nullptr )
912  {
913  continue;
914  }
915 
916  if (FrameContainsNode(*pCnt, rAnch.GetContentAnchor()->nNode.GetIndex()))
917  {
918  OSL_FAIL( "<SwContentNotify::~SwContentNotify()> - to page anchored object with content position." );
919  if ( !pPage )
920  {
921  pPage = pCnt->FindPageFrame();
922  }
923  SwFormatAnchor aAnch( rAnch );
924  aAnch.SetAnchor( nullptr );
925  aAnch.SetPageNum( pPage->GetPhyPageNum() );
926  pFormat->SetFormatAttr( aAnch );
927  if ( RES_DRAWFRMFMT != pFormat->Which() )
928  {
929  pFormat->MakeFrames();
930  }
931  }
932  }
933  }
934  }
935 
936  // OD 12.01.2004 #i11859# - invalidate printing area of following frame,
937  // if height of last line has changed.
938  if ( pCnt->IsTextFrame() && mbChkHeightOfLastLine )
939  {
940  if ( mnHeightOfLastLine != static_cast<SwTextFrame*>(pCnt)->GetHeightOfLastLine() )
941  {
942  pCnt->InvalidateNextPrtArea();
943  }
944  }
945 
946  // #i44049#
947  if ( pCnt->IsTextFrame() && aRectFnSet.PosDiff( maFrame, pCnt->getFrameArea() ) )
948  {
949  pCnt->InvalidateObjs();
950  }
951 
952  // #i43255# - move code to invalidate at-character
953  // anchored objects due to a change of its anchor character from
954  // method <SwTextFrame::Format(..)>.
955  if ( pCnt->IsTextFrame() )
956  {
957  SwTextFrame* pMasterFrame = pCnt->IsFollow()
958  ? static_cast<SwTextFrame*>(pCnt)->FindMaster()
959  : static_cast<SwTextFrame*>(pCnt);
960  if ( pMasterFrame && !pMasterFrame->IsFlyLock() &&
961  pMasterFrame->GetDrawObjs() )
962  {
963  SwSortedObjs* pObjs = pMasterFrame->GetDrawObjs();
964  for (SwAnchoredObject* pAnchoredObj : *pObjs)
965  {
966  if ( pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
967  == RndStdIds::FLY_AT_CHAR )
968  {
969  pAnchoredObj->CheckCharRectAndTopOfLine( !pMasterFrame->IsEmpty() );
970  }
971  }
972  }
973  }
974 }
975 
976 // note this *cannot* be static because it's a friend
977 void AppendObj(SwFrame *const pFrame, SwPageFrame *const pPage, SwFrameFormat *const pFormat, const SwFormatAnchor & rAnch)
978 {
979  const bool bFlyAtFly = rAnch.GetAnchorId() == RndStdIds::FLY_AT_FLY; // LAYER_IMPL
980  //Is a frame or a SdrObject described?
981  const bool bSdrObj = RES_DRAWFRMFMT == pFormat->Which();
982  // OD 23.06.2003 #108784# - append also drawing objects anchored
983  // as character.
984  const bool bDrawObjInContent = bSdrObj &&
985  (rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR);
986 
987  if( bFlyAtFly ||
988  (rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA) ||
989  (rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR) ||
990  bDrawObjInContent )
991  {
992  SdrObject* pSdrObj = nullptr;
993  if ( bSdrObj && nullptr == (pSdrObj = pFormat->FindSdrObject()) )
994  {
995  OSL_ENSURE( !bSdrObj, "DrawObject not found." );
996  pFormat->GetDoc()->DelFrameFormat( pFormat );
997  return;
998  }
999  if ( pSdrObj )
1000  {
1001  if ( !pSdrObj->getSdrPageFromSdrObject() )
1002  {
1004  InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect());
1005  }
1006 
1007  SwDrawContact* pNew =
1008  static_cast<SwDrawContact*>(GetUserCall( pSdrObj ));
1009  if ( !pNew->GetAnchorFrame() )
1010  {
1011  pFrame->AppendDrawObj( *(pNew->GetAnchoredObj( nullptr )) );
1012  }
1013  // OD 19.06.2003 #108784# - add 'virtual' drawing object,
1014  // if necessary. But control objects have to be excluded.
1015  else if ( !::CheckControlLayer( pSdrObj ) &&
1016  pNew->GetAnchorFrame() != pFrame &&
1017  !pNew->GetDrawObjectByAnchorFrame( *pFrame ) )
1018  {
1019  SwDrawVirtObj* pDrawVirtObj = pNew->AddVirtObj();
1020  pFrame->AppendDrawObj( *(pNew->GetAnchoredObj( pDrawVirtObj )) );
1021 
1022  pDrawVirtObj->ActionChanged();
1023  }
1024  }
1025  else
1026  {
1027  SwFlyFrame *pFly;
1028  if( bFlyAtFly )
1029  pFly = new SwFlyLayFrame( static_cast<SwFlyFrameFormat*>(pFormat), pFrame, pFrame );
1030  else
1031  pFly = new SwFlyAtContentFrame( static_cast<SwFlyFrameFormat*>(pFormat), pFrame, pFrame );
1032  pFly->Lock();
1033  pFrame->AppendFly( pFly );
1034  pFly->Unlock();
1035  if ( pPage )
1036  ::RegistFlys( pPage, pFly );
1037  }
1038  }
1039 }
1040 
1041 static bool IsShown(sal_uLong const nIndex,
1042  const SwFormatAnchor & rAnch,
1043  std::vector<sw::Extent>::const_iterator const*const pIter,
1044  std::vector<sw::Extent>::const_iterator const*const pEnd,
1045  SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
1046 {
1047  assert(!pIter || *pIter == *pEnd || (*pIter)->pNode->GetIndex() == nIndex);
1048  SwPosition const& rAnchor(*rAnch.GetContentAnchor());
1049  if (rAnchor.nNode.GetIndex() != nIndex)
1050  {
1051  return false;
1052  }
1053  if (pIter && rAnch.GetAnchorId() != RndStdIds::FLY_AT_PARA)
1054  {
1055  // note: frames are not sorted by anchor position.
1056  assert(pEnd);
1057  assert(pFirstNode);
1058  assert(pLastNode);
1059  assert(rAnch.GetAnchorId() != RndStdIds::FLY_AT_FLY);
1060  for (auto iter = *pIter; iter != *pEnd; ++iter)
1061  {
1062  assert(iter->nStart != iter->nEnd); // TODO possible?
1063  assert(iter->pNode->GetIndex() == nIndex);
1064  if (rAnchor.nContent.GetIndex() < iter->nStart)
1065  {
1066  return false;
1067  }
1068  if (rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
1069  {
1070  // if there is an extent then obviously the node was not
1071  // deleted fully...
1072  // show if start <= pos <= end
1073  // *or* if first-node/0 *and* not StartOfSection
1074  // *or* if last-node/Len *and* not EndOfSection
1075 
1076  // first determine the extent to compare to, then
1077  // construct start/end positions for the deletion *before* the
1078  // extent and compare once.
1079  // the interesting corner cases are on the edge of the extent!
1080  // no need to check for > the last extent because those
1081  // are never visible.
1082  if (rAnchor.nContent.GetIndex() <= iter->nEnd)
1083  {
1084  if (iter->nStart == 0)
1085  {
1086  return true;
1087  }
1088  else
1089  {
1090  SwPosition const start(
1091  const_cast<SwTextNode&>(
1092  iter == *pIter
1093  ? *pFirstNode // simplification
1094  : *iter->pNode),
1095  iter == *pIter // first extent?
1096  ? iter->pNode == pFirstNode
1097  ? 0 // at start of 1st node
1098  : pFirstNode->Len() // previous node; simplification but should get right result
1099  : (iter-1)->nEnd); // previous extent
1100  SwPosition const end(*iter->pNode, iter->nStart);
1101  return !IsDestroyFrameAnchoredAtChar(rAnchor, start, end);
1102  }
1103  }
1104  else if (iter == *pEnd - 1) // special case: after last extent
1105  {
1106  if (iter->nEnd == iter->pNode->Len())
1107  {
1108  return true; // special case: end of node
1109  }
1110  else
1111  {
1112  SwPosition const start(*iter->pNode, iter->nEnd);
1113  SwPosition const end(
1114  const_cast<SwTextNode&>(*pLastNode), // simplification
1115  iter->pNode == pLastNode
1116  ? iter->pNode->Len()
1117  : 0);
1118  return !IsDestroyFrameAnchoredAtChar(rAnchor, start, end);
1119  }
1120  }
1121  }
1122  else
1123  {
1124  assert(rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR);
1125  // for AS_CHAR obviously must be <
1126  if (rAnchor.nContent.GetIndex() < iter->nEnd)
1127  {
1128  return true;
1129  }
1130  }
1131  }
1132  return false;
1133  }
1134  else
1135  {
1136  return true;
1137  }
1138 }
1139 
1141  std::vector<sw::Extent>::const_iterator const*const pIter,
1142  std::vector<sw::Extent>::const_iterator const*const pEnd,
1143  SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
1144 {
1145  std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
1146  if (!pFlys)
1147  {
1148  return;
1149  }
1150  for (SwFrameFormat * pFrameFormat : *pFlys)
1151  {
1152  SwFormatAnchor const& rAnchor = pFrameFormat->GetAnchor();
1153  if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR
1154  || (rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR
1155  && RES_DRAWFRMFMT == pFrameFormat->Which()))
1156  {
1157  assert(rAnchor.GetContentAnchor()->nNode.GetIndex() == rNode.GetIndex());
1158  if (!IsShown(rNode.GetIndex(), rAnchor, pIter, pEnd, pFirstNode, pLastNode))
1159  {
1160  pFrameFormat->DelFrames();
1161  }
1162  }
1163  }
1164 }
1165 
1166 void AppendObjsOfNode(SwFrameFormats const*const pTable, sal_uLong const nIndex,
1167  SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc,
1168  std::vector<sw::Extent>::const_iterator const*const pIter,
1169  std::vector<sw::Extent>::const_iterator const*const pEnd,
1170  SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
1171 {
1172 #if OSL_DEBUG_LEVEL > 0
1173  std::vector<SwFrameFormat*> checkFormats;
1174  for ( size_t i = 0; i < pTable->size(); ++i )
1175  {
1176  SwFrameFormat *pFormat = (*pTable)[i];
1177  const SwFormatAnchor &rAnch = pFormat->GetAnchor();
1178  if ( rAnch.GetContentAnchor() &&
1179  IsShown(nIndex, rAnch, pIter, pEnd, pFirstNode, pLastNode))
1180  {
1181  checkFormats.push_back( pFormat );
1182  }
1183  }
1184 #else
1185  (void)pTable;
1186 #endif
1187 
1188  SwNode const& rNode(*pDoc->GetNodes()[nIndex]);
1189  std::vector<SwFrameFormat*> const*const pFlys(rNode.GetAnchoredFlys());
1190  for (size_t it = 0; pFlys && it != pFlys->size(); )
1191  {
1192  SwFrameFormat *const pFormat = (*pFlys)[it];
1193  const SwFormatAnchor &rAnch = pFormat->GetAnchor();
1194  if ( rAnch.GetContentAnchor() &&
1195  IsShown(nIndex, rAnch, pIter, pEnd, pFirstNode, pLastNode))
1196  {
1197 #if OSL_DEBUG_LEVEL > 0
1198  std::vector<SwFrameFormat*>::iterator checkPos = std::find( checkFormats.begin(), checkFormats.end(), pFormat );
1199  assert( checkPos != checkFormats.end());
1200  checkFormats.erase( checkPos );
1201 #endif
1202  AppendObj(pFrame, pPage, pFormat, rAnch);
1203  }
1204  ++it;
1205  }
1206 
1207 #if OSL_DEBUG_LEVEL > 0
1208  assert( checkFormats.empty());
1209 #endif
1210 }
1211 
1212 
1213 void AppendObjs(const SwFrameFormats *const pTable, sal_uLong const nIndex,
1214  SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc)
1215 {
1216  if (pFrame->IsTextFrame())
1217  {
1218  SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(pFrame));
1219  if (sw::MergedPara const*const pMerged = pTextFrame->GetMergedPara())
1220  {
1221  std::vector<sw::Extent>::const_iterator iterFirst(pMerged->extents.begin());
1222  std::vector<sw::Extent>::const_iterator iter(iterFirst);
1223  SwTextNode const* pNode(pMerged->pFirstNode);
1224  for ( ; ; ++iter)
1225  {
1226  if (iter == pMerged->extents.end()
1227  || iter->pNode != pNode)
1228  {
1229  AppendObjsOfNode(pTable, pNode->GetIndex(), pFrame, pPage, pDoc,
1230  &iterFirst, &iter, pMerged->pFirstNode, pMerged->pLastNode);
1231  sal_uLong const until = iter == pMerged->extents.end()
1232  ? pMerged->pLastNode->GetIndex() + 1
1233  : iter->pNode->GetIndex();
1234  for (sal_uLong i = pNode->GetIndex() + 1; i < until; ++i)
1235  {
1236  // let's show at-para flys on nodes that contain start/end of
1237  // redline too, even if there's no text there
1238  SwNode const*const pTmp(pNode->GetNodes()[i]);
1239  if (pTmp->GetRedlineMergeFlag() == SwNode::Merge::NonFirst)
1240  {
1241  AppendObjsOfNode(pTable, pTmp->GetIndex(), pFrame, pPage, pDoc, &iter, &iter, pMerged->pFirstNode, pMerged->pLastNode);
1242  }
1243  }
1244  if (iter == pMerged->extents.end())
1245  {
1246  break;
1247  }
1248  pNode = iter->pNode;
1249  iterFirst = iter;
1250  }
1251  }
1252  }
1253  else
1254  {
1255  return AppendObjsOfNode(pTable, nIndex, pFrame, pPage, pDoc, nullptr, nullptr, nullptr, nullptr);
1256  }
1257  }
1258  else
1259  {
1260  return AppendObjsOfNode(pTable, nIndex, pFrame, pPage, pDoc, nullptr, nullptr, nullptr, nullptr);
1261  }
1262 }
1263 
1264 bool IsAnchoredObjShown(SwTextFrame const& rFrame, SwFormatAnchor const& rAnchor)
1265 {
1266  assert(rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA ||
1267  rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR ||
1268  rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR);
1269  bool ret(true);
1270  if (auto const pMergedPara = rFrame.GetMergedPara())
1271  {
1272  ret = false;
1273  auto const pAnchor(rAnchor.GetContentAnchor());
1274  auto iterFirst(pMergedPara->extents.cbegin());
1275  auto iter(iterFirst);
1276  SwTextNode const* pNode(pMergedPara->pFirstNode);
1277  for ( ; ; ++iter)
1278  {
1279  if (iter == pMergedPara->extents.end()
1280  || iter->pNode != pNode)
1281  {
1282  assert(pNode->GetRedlineMergeFlag() != SwNode::Merge::Hidden);
1283  if (pNode == &pAnchor->nNode.GetNode())
1284  {
1285  ret = IsShown(pNode->GetIndex(), rAnchor, &iterFirst, &iter,
1286  pMergedPara->pFirstNode, pMergedPara->pLastNode);
1287  break;
1288  }
1289  if (iter == pMergedPara->extents.end())
1290  {
1291  break;
1292  }
1293  pNode = iter->pNode;
1294  if (pAnchor->nNode.GetIndex() < pNode->GetIndex())
1295  {
1296  break;
1297  }
1298  iterFirst = iter;
1299  }
1300  }
1301  }
1302  return ret;
1303 }
1304 
1305 void AppendAllObjs(const SwFrameFormats* pTable, const SwFrame* pSib)
1306 {
1307  //Connecting of all Objects, which are described in the SpzTable with the
1308  //layout.
1309 
1310  boost::circular_buffer<SwFrameFormat*> vFormatsToConnect(pTable->size());
1311  for(const auto& pFormat : *pTable)
1312  {
1313  const auto& rAnch = pFormat->GetAnchor();
1314  // Formats can still remain, because we neither use character bound
1315  // frames nor objects which are anchored to character bounds.
1316  if ((rAnch.GetAnchorId() != RndStdIds::FLY_AT_PAGE) && (rAnch.GetAnchorId() != RndStdIds::FLY_AS_CHAR))
1317  {
1318  auto pContentAnchor = rAnch.GetContentAnchor();
1319  // formats in header/footer have no dependencies
1320  if(pContentAnchor && pFormat->GetDoc()->IsInHeaderFooter(pContentAnchor->nNode))
1321  pFormat->MakeFrames();
1322  else
1323  vFormatsToConnect.push_back(pFormat);
1324  }
1325  }
1326  const SwRootFrame* pRoot = pSib ? pSib->getRootFrame() : nullptr;
1327  const SwFrameFormat* pFirstRequeued(nullptr);
1328  while(!vFormatsToConnect.empty())
1329  {
1330  auto& pFormat = vFormatsToConnect.front();
1331  bool isConnected(false);
1332  pFormat->CallSwClientNotify(sw::GetObjectConnectedHint(isConnected, pRoot));
1333  if(!isConnected)
1334  {
1335  pFormat->MakeFrames();
1336  pFormat->CallSwClientNotify(sw::GetObjectConnectedHint(isConnected, pRoot));
1337  }
1338  // do this *before* push_back! the circular_buffer can be "full"!
1339  vFormatsToConnect.pop_front();
1340  if (!isConnected)
1341  {
1342  if(pFirstRequeued == pFormat)
1343  // If nothing happens anymore we can stop.
1344  break;
1345  if(!pFirstRequeued)
1346  pFirstRequeued = pFormat;
1347  assert(!vFormatsToConnect.full());
1348  vFormatsToConnect.push_back(pFormat);
1349  }
1350  else
1351  {
1352  pFirstRequeued = nullptr;
1353  }
1354  }
1355 }
1356 
1361 static void lcl_SetPos( SwFrame& _rNewFrame,
1362  const SwLayoutFrame& _rLayFrame )
1363 {
1364  SwRectFnSet aRectFnSet(&_rLayFrame);
1366  aRectFnSet.SetPos( aFrm, aRectFnSet.GetPos(_rLayFrame.getFrameArea()) );
1367 
1368  // move position by one SwTwip in text flow direction in order to get
1369  // notifications for a new calculated position after its formatting.
1370  if ( aRectFnSet.IsVert() )
1371  {
1372  aFrm.Pos().AdjustX( -1 );
1373  }
1374  else
1375  {
1376  aFrm.Pos().AdjustY(1 );
1377  }
1378 }
1379 
1380 void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
1381  sal_uLong nIndex, bool bPages, sal_uLong nEndIndex,
1382  SwFrame *pPrv, sw::FrameMode const eMode )
1383 {
1385  SwRootFrame* pLayout = pLay->getRootFrame();
1386  const bool bOldCallbackActionEnabled = pLayout && pLayout->IsCallbackActionEnabled();
1387  if( bOldCallbackActionEnabled )
1388  pLayout->SetCallbackActionEnabled( false );
1389 
1390  //In the generation of the Layout bPages=true will be handed over.
1391  //Then will be new pages generated all x paragraphs already times in advance.
1392  //On breaks and/or pagedescriptorchanges the corresponding will be generated
1393  //immediately.
1394  //The advantage is, that on one hand already a nearly realistic number of
1395  //pages are created, but above all there are no almost endless long chain
1396  //of paragraphs, which must be moved expensively until it reaches a tolerable
1397  //reduced level.
1398  //We'd like to think that 20 Paragraphs fit on one page.
1399  //So that it does not become in extreme situations so violent we calculate depending
1400  //on the node something to it.
1401  //If in the DocStatistic a usable given pagenumber
1402  //(Will be cared for while writing), so it will be presumed that this will be
1403  //number of pages.
1404  const bool bStartPercent = bPages && !nEndIndex;
1405 
1406  SwPageFrame *pPage = pLay->FindPageFrame();
1407  const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
1408  SwFrame *pFrame = nullptr;
1409  std::unique_ptr<SwActualSection> pActualSection;
1410  std::unique_ptr<SwLayHelper> pPageMaker;
1411 
1412  //If the layout will be created (bPages == true) we do head on the progress
1413  //Flys and DrawObjects are not connected immediately, this
1414  //happens only at the end of the function.
1415  if ( bPages )
1416  {
1417  // Attention: the SwLayHelper class uses references to the content-,
1418  // page-, layout-frame etc. and may change them!
1419  pPageMaker.reset(new SwLayHelper( pDoc, pFrame, pPrv, pPage, pLay,
1420  pActualSection, nIndex, 0 == nEndIndex ));
1421  if( bStartPercent )
1422  {
1423  const sal_uLong nPageCount = pPageMaker->CalcPageCount();
1424  if( nPageCount )
1425  bObjsDirect = false;
1426  }
1427  }
1428  else
1429  pPageMaker = nullptr;
1430 
1431  if( pLay->IsInSct() &&
1432  ( pLay->IsSctFrame() || pLay->GetUpper() ) ) // Hereby will newbies
1433  // be intercepted, of which flags could not determined yet,
1434  // for e.g. while inserting a table
1435  {
1436  SwSectionFrame* pSct = pLay->FindSctFrame();
1437  // If content will be inserted in a footnote, which in a column area,
1438  // the column area it is not allowed to be broken up.
1439  // Only if in the inner of the footnote lies an area, is this a candidate
1440  // for pActualSection.
1441  // The same applies for areas in tables, if inside the table will be
1442  // something inserted, it's only allowed to break up areas, which
1443  // lies in the inside also.
1444  if( ( !pLay->IsInFootnote() || pSct->IsInFootnote() ) &&
1445  ( !pLay->IsInTab() || pSct->IsInTab() ) )
1446  {
1447  pActualSection.reset(new SwActualSection( nullptr, pSct, nullptr ));
1448  OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrame(),
1449  "InsertCnt_: Wrong Call" );
1450  }
1451  }
1452 
1453  //If a section is "open", the pActualSection points to an SwActualSection.
1454  //If the page breaks, for "open" sections a follow will created.
1455  //For nested sections (which have, however, not a nested layout),
1456  //the SwActualSection class has a member, which points to an upper(section).
1457  //When the "inner" section finishes, the upper will used instead.
1458 
1459  // Do not consider the end node. The caller (Section/MakeFrames()) has to
1460  // ensure that the end of this range is positioned before EndIndex!
1461  for ( ; nEndIndex == 0 || nIndex < nEndIndex; ++nIndex)
1462  {
1463  SwNode *pNd = pDoc->GetNodes()[nIndex];
1464  if ( pNd->IsContentNode() )
1465  {
1466  SwContentNode* pNode = static_cast<SwContentNode*>(pNd);
1467  if (pLayout->IsHideRedlines() && !pNd->IsCreateFrameWhenHidingRedlines())
1468  {
1469  if (pNd->IsTextNode()
1471  { // must have a frame already
1472  assert(static_cast<SwTextFrame*>(pNode->getLayoutFrame(pLayout))->GetMergedPara());
1473  }
1474  continue; // skip it
1475  }
1476  pFrame = pNode->IsTextNode()
1477  ? sw::MakeTextFrame(*pNode->GetTextNode(), pLay, eMode)
1478  : pNode->MakeFrame(pLay);
1479  if( pPageMaker )
1480  pPageMaker->CheckInsert( nIndex );
1481 
1482  pFrame->InsertBehind( pLay, pPrv );
1483  // #i27138#
1484  // notify accessibility paragraphs objects about changed
1485  // CONTENT_FLOWS_FROM/_TO relation.
1486  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1487  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1488  if ( pFrame->IsTextFrame() )
1489  {
1490  SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1491  // no notification, if <SwViewShell> is in construction
1492  if ( pViewShell && !pViewShell->IsInConstructor() &&
1493  pViewShell->GetLayout() &&
1494  pViewShell->GetLayout()->IsAnyShellAccessible() &&
1495  pFrame->FindPageFrame() != nullptr)
1496  {
1498  dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
1499  dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
1500  // #i68958#
1501  // The information flags of the text frame are validated
1502  // in methods <FindNextCnt(..)> and <FindPrevCnt(..)>.
1503  // The information flags have to be invalidated, because
1504  // it is possible, that the one of its upper frames
1505  // isn't inserted into the layout.
1506  pFrame->InvalidateInfFlags();
1507  }
1508  }
1509  // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1510  // for setting position at newly inserted frame
1511  lcl_SetPos( *pFrame, *pLay );
1512  pPrv = pFrame;
1513 
1514  if ( !pTable->empty() && bObjsDirect && !bDontCreateObjects )
1515  AppendObjs( pTable, nIndex, pFrame, pPage, pDoc );
1516  }
1517  else if ( pNd->IsTableNode() )
1518  { //Should we have encountered a table?
1519  SwTableNode *pTableNode = static_cast<SwTableNode*>(pNd);
1520  if (pLayout->IsHideRedlines())
1521  {
1522  // in the problematic case, there can be only 1 redline...
1523  SwPosition const tmp(*pNd);
1524  SwRangeRedline const*const pRedline(
1525  pDoc->getIDocumentRedlineAccess().GetRedline(tmp, nullptr));
1526  // pathology: redline that starts on a TableNode; cannot
1527  // be created in UI but by import filters...
1528  if (pRedline
1529  && pRedline->GetType() == RedlineType::Delete
1530  && &pRedline->Start()->nNode.GetNode() == pNd)
1531  {
1532  SAL_WARN("sw.pageframe", "skipping table frame creation on bizarre redline");
1533  while (true)
1534  {
1535  pTableNode->GetNodes()[nIndex]->SetRedlineMergeFlag(SwNode::Merge::Hidden);
1536  if (nIndex == pTableNode->EndOfSectionIndex())
1537  {
1538  break;
1539  }
1540  ++nIndex;
1541  }
1542  continue;
1543  }
1544  }
1545  if (pLayout->IsHideRedlines() && !pNd->IsCreateFrameWhenHidingRedlines())
1546  {
1547  assert(pNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden);
1548  nIndex = pTableNode->EndOfSectionIndex();
1549  continue; // skip it
1550  }
1551 
1552  // #108116# loading may produce table structures that GCLines
1553  // needs to clean up. To keep table formulas correct, change
1554  // all table formulas to internal (BOXPTR) representation.
1555  SwTableFormulaUpdate aMsgHint( &pTableNode->GetTable() );
1556  aMsgHint.m_eFlags = TBL_BOXPTR;
1557  pDoc->getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
1558  pTableNode->GetTable().GCLines();
1559 
1560  pFrame = pTableNode->MakeFrame( pLay );
1561 
1562  if( pPageMaker )
1563  pPageMaker->CheckInsert( nIndex );
1564 
1565  pFrame->InsertBehind( pLay, pPrv );
1566  // #i27138#
1567  // notify accessibility paragraphs objects about changed
1568  // CONTENT_FLOWS_FROM/_TO relation.
1569  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1570  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1571  {
1572  SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1573  // no notification, if <SwViewShell> is in construction
1574  if ( pViewShell && !pViewShell->IsInConstructor() &&
1575  pViewShell->GetLayout() &&
1576  pViewShell->GetLayout()->IsAnyShellAccessible() &&
1577  pFrame->FindPageFrame() != nullptr)
1578  {
1580  dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
1581  dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
1582  }
1583  }
1584  if ( bObjsDirect && !pTable->empty() )
1585  static_cast<SwTabFrame*>(pFrame)->RegistFlys();
1586  // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1587  // for setting position at newly inserted frame
1588  lcl_SetPos( *pFrame, *pLay );
1589 
1590  pPrv = pFrame;
1591  //Set the index to the endnode of the table section.
1592  nIndex = pTableNode->EndOfSectionIndex();
1593 
1594  SwTabFrame* pTmpFrame = static_cast<SwTabFrame*>(pFrame);
1595  while ( pTmpFrame )
1596  {
1597  pTmpFrame->CheckDirChange();
1598  pTmpFrame = pTmpFrame->IsFollow() ? pTmpFrame->FindMaster() : nullptr;
1599  }
1600 
1601  }
1602  else if ( pNd->IsSectionNode() )
1603  {
1604  if (pLayout->IsHideRedlines() && !pNd->IsCreateFrameWhenHidingRedlines())
1605  {
1606  assert(pNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden);
1607  continue; // skip it
1608  }
1609  SwSectionNode *pNode = static_cast<SwSectionNode*>(pNd);
1610  if( pNode->GetSection().CalcHiddenFlag() )
1611  // is hidden, skip the area
1612  nIndex = pNode->EndOfSectionIndex();
1613  else
1614  {
1615  pFrame = pNode->MakeFrame( pLay );
1616  pActualSection.reset( new SwActualSection( pActualSection.release(),
1617  static_cast<SwSectionFrame*>(pFrame), pNode ) );
1618  if ( pActualSection->GetUpper() )
1619  {
1620  //Insert behind the Upper, the "Follow" of the Upper will be
1621  //generated at the EndNode.
1622  SwSectionFrame *pTmp = pActualSection->GetUpper()->GetSectionFrame();
1623  pFrame->InsertBehind( pTmp->GetUpper(), pTmp );
1624  // OD 25.03.2003 #108339# - direct initialization of section
1625  // after insertion in the layout
1626  static_cast<SwSectionFrame*>(pFrame)->Init();
1627  }
1628  else
1629  {
1630  pFrame->InsertBehind( pLay, pPrv );
1631  // OD 25.03.2003 #108339# - direct initialization of section
1632  // after insertion in the layout
1633  static_cast<SwSectionFrame*>(pFrame)->Init();
1634 
1635  // #i33963#
1636  // Do not trust the IsInFootnote flag. If we are currently
1637  // building up a table, the upper of pPrv may be a cell
1638  // frame, but the cell frame does not have an upper yet.
1639  if( pPrv && nullptr != pPrv->ImplFindFootnoteFrame() )
1640  {
1641  if( pPrv->IsSctFrame() )
1642  pPrv = static_cast<SwSectionFrame*>(pPrv)->ContainsContent();
1643  if( pPrv && pPrv->IsTextFrame() )
1644  static_cast<SwTextFrame*>(pPrv)->Prepare( PREP_QUOVADIS, nullptr, false );
1645  }
1646  }
1647  // #i27138#
1648  // notify accessibility paragraphs objects about changed
1649  // CONTENT_FLOWS_FROM/_TO relation.
1650  // Relation CONTENT_FLOWS_FROM for next paragraph will change
1651  // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1652  {
1653  SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1654  // no notification, if <SwViewShell> is in construction
1655  if ( pViewShell && !pViewShell->IsInConstructor() &&
1656  pViewShell->GetLayout() &&
1657  pViewShell->GetLayout()->IsAnyShellAccessible() &&
1658  pFrame->FindPageFrame() != nullptr)
1659  {
1661  dynamic_cast<SwTextFrame*>(pFrame->FindNextCnt( true )),
1662  dynamic_cast<SwTextFrame*>(pFrame->FindPrevCnt()) );
1663  }
1664  }
1665  pFrame->CheckDirChange();
1666 
1667  // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1668  // for setting position at newly inserted frame
1669  lcl_SetPos( *pFrame, *pLay );
1670 
1671  // OD 20.11.2002 #105405# - no page, no invalidate.
1672  if ( pPage )
1673  {
1674  // OD 18.09.2002 #100522#
1675  // invalidate page in order to force format and paint of
1676  // inserted section frame
1677  pFrame->InvalidatePage( pPage );
1678 
1679  // FME 10.11.2003 #112243#
1680  // Invalidate fly content flag:
1681  if ( pFrame->IsInFly() )
1682  pPage->InvalidateFlyContent();
1683 
1684  // OD 14.11.2002 #104684# - invalidate page content in order to
1685  // force format and paint of section content.
1686  pPage->InvalidateContent();
1687  }
1688 
1689  pLay = static_cast<SwLayoutFrame*>(pFrame);
1690  if ( pLay->Lower() && pLay->Lower()->IsLayoutFrame() )
1691  pLay = pLay->GetNextLayoutLeaf();
1692  pPrv = nullptr;
1693  }
1694  }
1695  else if ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )
1696  {
1697  if (pLayout->IsHideRedlines() && !pNd->IsCreateFrameWhenHidingRedlines())
1698  {
1699  assert(pNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden);
1700  continue; // skip it
1701  }
1702  assert(pActualSection && "Section end without section start?");
1703  assert(pActualSection->GetSectionNode() == pNd->StartOfSectionNode());
1704 
1705  //Close the section, where appropriate activate the surrounding
1706  //section again.
1707  pActualSection.reset(pActualSection->GetUpper());
1708  pLay = pLay->FindSctFrame();
1709  if ( pActualSection )
1710  {
1711  //Could be, that the last SectionFrame remains empty.
1712  //Then now is the time to remove them.
1713  if ( !pLay->ContainsContent() )
1714  {
1715  SwFrame *pTmpFrame = pLay;
1716  pLay = pTmpFrame->GetUpper();
1717  pPrv = pTmpFrame->GetPrev();
1718  pTmpFrame->RemoveFromLayout();
1719  SwFrame::DestroyFrame(pTmpFrame);
1720  }
1721  else
1722  {
1723  pPrv = pLay;
1724  pLay = pLay->GetUpper();
1725  }
1726 
1727  // new section frame
1728  pFrame = pActualSection->GetSectionNode()->MakeFrame( pLay );
1729  pFrame->InsertBehind( pLay, pPrv );
1730  static_cast<SwSectionFrame*>(pFrame)->Init();
1731 
1732  // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1733  // for setting position at newly inserted frame
1734  lcl_SetPos( *pFrame, *pLay );
1735 
1736  SwSectionFrame* pOuterSectionFrame = pActualSection->GetSectionFrame();
1737 
1738  // a follow has to be appended to the new section frame
1739  SwSectionFrame* pFollow = pOuterSectionFrame->GetFollow();
1740  if ( pFollow )
1741  {
1742  pOuterSectionFrame->SetFollow( nullptr );
1743  pOuterSectionFrame->InvalidateSize();
1744  static_cast<SwSectionFrame*>(pFrame)->SetFollow( pFollow );
1745  }
1746 
1747  // We don't want to leave empty parts back.
1748  if( ! pOuterSectionFrame->IsColLocked() &&
1749  ! pOuterSectionFrame->ContainsContent() )
1750  {
1751  pOuterSectionFrame->DelEmpty( true );
1752  SwFrame::DestroyFrame(pOuterSectionFrame);
1753  }
1754  pActualSection->SetSectionFrame( static_cast<SwSectionFrame*>(pFrame) );
1755 
1756  pLay = static_cast<SwLayoutFrame*>(pFrame);
1757  if ( pLay->Lower() && pLay->Lower()->IsLayoutFrame() )
1758  pLay = pLay->GetNextLayoutLeaf();
1759  pPrv = nullptr;
1760  }
1761  else
1762  {
1763  //Nothing more with sections, it goes on right behind
1764  //the SectionFrame.
1765  pPrv = pLay;
1766  pLay = pLay->GetUpper();
1767  }
1768  }
1769  else if( pNd->IsStartNode() &&
1770  SwFlyStartNode == static_cast<SwStartNode*>(pNd)->GetStartNodeType() )
1771  {
1772  if (pLayout->IsHideRedlines() && !pNd->IsCreateFrameWhenHidingRedlines())
1773  {
1774  assert(pNd->GetRedlineMergeFlag() == SwNode::Merge::Hidden);
1775  assert(false); // actually a fly-section can't be deleted?
1776  continue; // skip it
1777  }
1778  if ( !pTable->empty() && bObjsDirect && !bDontCreateObjects )
1779  {
1780  SwFlyFrame* pFly = pLay->FindFlyFrame();
1781  if( pFly )
1782  AppendObjs( pTable, nIndex, pFly, pPage, pDoc );
1783  }
1784  }
1785  else
1786  {
1787  assert(!pLayout->IsHideRedlines()
1789  // Neither Content nor table nor section, so we are done.
1790  break;
1791  }
1792  }
1793 
1794  if ( pActualSection )
1795  {
1796  // Might happen that an empty (Follow-)Section is left over.
1797  if ( !(pLay = pActualSection->GetSectionFrame())->ContainsContent() )
1798  {
1799  pLay->RemoveFromLayout();
1800  SwFrame::DestroyFrame(pLay);
1801  }
1802  pActualSection.reset();
1803  }
1804 
1805  if ( bPages ) // let the Flys connect to each other
1806  {
1807  if ( !bDontCreateObjects )
1808  AppendAllObjs( pTable, pLayout );
1809  bObjsDirect = true;
1810  }
1811 
1812  if( pPageMaker )
1813  {
1814  pPageMaker->CheckFlyCache( pPage );
1815  pPageMaker.reset();
1816  if( pDoc->GetLayoutCache() )
1817  {
1818 #ifdef DBG_UTIL
1819  pDoc->GetLayoutCache()->CompareLayout( *pDoc );
1820 #endif
1821  pDoc->GetLayoutCache()->ClearImpl();
1822  }
1823  }
1824 
1826  if( bOldCallbackActionEnabled )
1827  pLayout->SetCallbackActionEnabled( bOldCallbackActionEnabled );
1828 }
1829 
1830 void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
1831  const SwNodeIndex &rEndIdx )
1832 {
1833  bObjsDirect = false;
1834 
1835  SwNodeIndex aTmp( rSttIdx );
1836  sal_uLong nEndIdx = rEndIdx.GetIndex();
1837  SwNode* pNd = pDoc->GetNodes().FindPrvNxtFrameNode( aTmp,
1838  pDoc->GetNodes()[ nEndIdx-1 ]);
1839  if ( pNd )
1840  {
1841  bool bApres = aTmp < rSttIdx;
1842  SwNode2Layout aNode2Layout( *pNd, rSttIdx.GetIndex() );
1843  SwFrame* pFrame;
1845  while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
1846  {
1847  SwLayoutFrame *pUpper = pFrame->GetUpper();
1848  SwFootnoteFrame* pFootnoteFrame = pUpper->FindFootnoteFrame();
1849  bool bOldLock, bOldFootnote;
1850  if( pFootnoteFrame )
1851  {
1852  bOldFootnote = pFootnoteFrame->IsColLocked();
1853  pFootnoteFrame->ColLock();
1854  }
1855  else
1856  bOldFootnote = true;
1857  SwSectionFrame* pSct = pUpper->FindSctFrame();
1858  // Inside of footnotes only those areas are interesting that are inside of them. But
1859  // not the ones (e.g. column areas) in which are the footnote containers positioned.
1860  // #109767# Table frame is in section, insert section in cell frame.
1861  if( pSct && ((pFootnoteFrame && !pSct->IsInFootnote()) || pUpper->IsCellFrame()) )
1862  pSct = nullptr;
1863  if( pSct )
1864  { // to prevent pTmp->MoveFwd from destroying the SectionFrame
1865  bOldLock = pSct->IsColLocked();
1866  pSct->ColLock();
1867  }
1868  else
1869  bOldLock = true;
1870 
1871  // If pFrame cannot be moved, it is not possible to move it to the next page. This applies
1872  // also for frames (in the first column of a frame pFrame is moveable) and column
1873  // sections of tables (also here pFrame is moveable).
1874  bool bMoveNext = nEndIdx - rSttIdx.GetIndex() > 120;
1875  bool bAllowMove = !pFrame->IsInFly() && pFrame->IsMoveable() &&
1876  (!pFrame->IsInTab() || pFrame->IsTabFrame() );
1877  if ( bMoveNext && bAllowMove )
1878  {
1879  SwFrame *pMove = pFrame;
1880  SwFrame *pPrev = pFrame->GetPrev();
1881  SwFlowFrame *pTmp = SwFlowFrame::CastFlowFrame( pMove );
1882  assert(pTmp);
1883 
1884  if ( bApres )
1885  {
1886  // The rest of this page should be empty. Thus, the following one has to move to
1887  // the next page (it might also be located in the following column).
1888  assert(!pTmp->HasFollow() && "prev. node's frame is not last");
1889  pPrev = pFrame;
1890  // If the surrounding SectionFrame has a "next" one,
1891  // so this one needs to be moved as well.
1892  pMove = pFrame->GetIndNext();
1893  SwColumnFrame* pCol = static_cast<SwColumnFrame*>(pFrame->FindColFrame());
1894  if( pCol )
1895  pCol = static_cast<SwColumnFrame*>(pCol->GetNext());
1896  do
1897  {
1898  if( pCol && !pMove )
1899  { // No successor so far, look into the next column
1900  pMove = pCol->ContainsAny();
1901  if( pCol->GetNext() )
1902  pCol = static_cast<SwColumnFrame*>(pCol->GetNext());
1903  else if( pCol->IsInSct() )
1904  { // If there is no following column but we are in a column frame,
1905  // there might be (page) columns outside of it.
1906  pCol = static_cast<SwColumnFrame*>(pCol->FindSctFrame()->FindColFrame());
1907  if( pCol )
1908  pCol = static_cast<SwColumnFrame*>(pCol->GetNext());
1909  }
1910  else
1911  pCol = nullptr;
1912  }
1913  // skip invalid SectionFrames
1914  while( pMove && pMove->IsSctFrame() &&
1915  !static_cast<SwSectionFrame*>(pMove)->GetSection() )
1916  pMove = pMove->GetNext();
1917  } while( !pMove && pCol );
1918 
1919  if( pMove )
1920  {
1921  if ( pMove->IsContentFrame() )
1922  pTmp = static_cast<SwContentFrame*>(pMove);
1923  else if ( pMove->IsTabFrame() )
1924  pTmp = static_cast<SwTabFrame*>(pMove);
1925  else if ( pMove->IsSctFrame() )
1926  {
1927  pMove = static_cast<SwSectionFrame*>(pMove)->ContainsAny();
1928  if( pMove )
1929  pTmp = SwFlowFrame::CastFlowFrame( pMove );
1930  else
1931  pTmp = nullptr;
1932  }
1933  }
1934  else
1935  pTmp = nullptr;
1936  }
1937  else
1938  {
1939  assert(!pTmp->IsFollow() && "next node's frame is not master");
1940  // move the _content_ of a section frame
1941  if( pMove->IsSctFrame() )
1942  {
1943  while( pMove && pMove->IsSctFrame() &&
1944  !static_cast<SwSectionFrame*>(pMove)->GetSection() )
1945  pMove = pMove->GetNext();
1946  if( pMove && pMove->IsSctFrame() )
1947  pMove = static_cast<SwSectionFrame*>(pMove)->ContainsAny();
1948  if( pMove )
1949  pTmp = SwFlowFrame::CastFlowFrame( pMove );
1950  else
1951  pTmp = nullptr;
1952  }
1953  }
1954 
1955  if( pTmp )
1956  {
1957  SwFrame* pOldUp = pTmp->GetFrame().GetUpper();
1958  // MoveFwd==true means that we are still on the same page.
1959  // But since we want to move if possible!
1960  bool bTmpOldLock = pTmp->IsJoinLocked();
1961  pTmp->LockJoin();
1962  while( pTmp->MoveFwd( true, false, true ) )
1963  {
1964  if( pOldUp == pTmp->GetFrame().GetUpper() )
1965  break;
1966  pOldUp = pTmp->GetFrame().GetUpper();
1967  }
1968  if( !bTmpOldLock )
1969  pTmp->UnlockJoin();
1970  }
1971  ::InsertCnt_( pUpper, pDoc, rSttIdx.GetIndex(),
1972  pFrame->IsInDocBody(), nEndIdx, pPrev, eMode );
1973  }
1974  else
1975  {
1976  bool bSplit;
1977  SwFrame* pPrv = bApres ? pFrame : pFrame->GetPrev();
1978  // If the section frame is inserted into another one, it must be split.
1979  if( pSct && rSttIdx.GetNode().IsSectionNode() )
1980  {
1981  bSplit = pSct->SplitSect( pFrame, bApres );
1982  if( !bSplit && !bApres )
1983  {
1984  pUpper = pSct->GetUpper();
1985  pPrv = pSct->GetPrev();
1986  }
1987  }
1988  else
1989  bSplit = false;
1990 
1991  ::InsertCnt_( pUpper, pDoc, rSttIdx.GetIndex(), false,
1992  nEndIdx, pPrv, eMode );
1993  // OD 23.06.2003 #108784# - correction: append objects doesn't
1994  // depend on value of <bAllowMove>
1995  if( !bDontCreateObjects )
1996  {
1997  const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
1998  if( !pTable->empty() )
1999  AppendAllObjs( pTable, pUpper );
2000  }
2001 
2002  // If nothing was added (e.g. a hidden section), the split must be reversed.
2003  if( bSplit && pSct && pSct->GetNext()
2004  && pSct->GetNext()->IsSctFrame() )
2005  pSct->MergeNext( static_cast<SwSectionFrame*>(pSct->GetNext()) );
2006  if( pFrame->IsInFly() )
2007  pFrame->FindFlyFrame()->Invalidate_();
2008  if( pFrame->IsInTab() )
2009  pFrame->InvalidateSize();
2010  }
2011 
2012  SwPageFrame *pPage = pUpper->FindPageFrame();
2013  SwFrame::CheckPageDescs( pPage, false );
2014  if( !bOldFootnote )
2015  pFootnoteFrame->ColUnlock();
2016  if( !bOldLock )
2017  {
2018  pSct->ColUnlock();
2019  // pSct might be empty (e.g. when inserting linked section containing further
2020  // sections) and can be destroyed in such cases.
2021  if( !pSct->ContainsContent() )
2022  {
2023  pSct->DelEmpty( true );
2024  pUpper->getRootFrame()->RemoveFromList( pSct );
2025  SwFrame::DestroyFrame(pSct);
2026  }
2027  }
2028  eMode = sw::FrameMode::New; // use Existing only once!
2029  }
2030  }
2031 
2032  bObjsDirect = true;
2033 }
2034 
2035 SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor)
2036  : SwCacheObj(pMod)
2037  , m_rAttrSet(pConstructor->IsContentFrame()
2038  ? pConstructor->IsTextFrame()
2039  ? static_cast<const SwTextFrame*>(pConstructor)->GetTextNodeForParaProps()->GetSwAttrSet()
2040  : static_cast<const SwNoTextFrame*>(pConstructor)->GetNode()->GetSwAttrSet()
2041  : static_cast<const SwLayoutFrame*>(pConstructor)->GetFormat()->GetAttrSet())
2042  , m_rUL(m_rAttrSet.GetULSpace())
2043  // #i96772#
2044  // LRSpaceItem is copied due to the possibility that it is adjusted - see below
2045  , m_rLR(static_cast<SvxLRSpaceItem*>(m_rAttrSet.GetLRSpace().Clone()))
2046  , m_rBox(m_rAttrSet.GetBox())
2047  , m_rShadow(m_rAttrSet.GetShadow())
2048  , m_aFrameSize(m_rAttrSet.GetFrameSize().GetSize())
2049  , m_bIsLine(false)
2050  , m_bJoinedWithPrev(false)
2051  , m_bJoinedWithNext(false)
2052  , m_nTopLine(0)
2053  , m_nBottomLine(0)
2054  , m_nLeftLine(0)
2055  , m_nRightLine(0)
2056  , m_nTop(0)
2057  , m_nBottom(0)
2058  , m_nGetTopLine(0)
2059  , m_nGetBottomLine(0)
2060 {
2061  // #i96772#
2062  const SwTextFrame* pTextFrame = dynamic_cast<const SwTextFrame*>(pConstructor);
2063  if ( pTextFrame )
2064  {
2066  }
2067  else if ( pConstructor->IsNoTextFrame() )
2068  {
2069  m_rLR = std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE);
2070  }
2071 
2072  // Caution: The USHORTs for the cached values are not initialized by intention!
2073 
2074  // everything needs to be calculated at least once:
2076  m_bTop = m_bBottom = m_bLine = true;
2077 
2079  // OD 21.05.2003 #108789# - init cache status for values <m_bJoinedWithPrev>
2080  // and <m_bJoinedWithNext>, which aren't initialized by default.
2081  m_bCachedJoinedWithPrev = false;
2082  m_bCachedJoinedWithNext = false;
2083 }
2084 
2086 {
2087  const_cast<SwModify *>(static_cast<SwModify const *>(m_pOwner))->SetInCache( false );
2088 }
2089 
2090 /* All calc methods calculate a safety distance in addition to the values given by the attributes.
2091  * This safety distance is only added when working with borders and/or shadows to prevent that
2092  * e.g. borders are painted over.
2093  */
2094 
2096 {
2097  m_nTop = CalcTopLine() + m_rUL.GetUpper();
2098  m_bTop = false;
2099 }
2100 
2102 {
2104  m_bBottom = false;
2105 }
2106 
2107 long SwBorderAttrs::CalcRight( const SwFrame* pCaller ) const
2108 {
2109  long nRight=0;
2110 
2111  if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING)) {
2112  // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
2113  // and right border are painted on the right respectively left.
2114  if ( pCaller->IsCellFrame() && pCaller->IsRightToLeft() )
2115  nRight = CalcLeftLine();
2116  else
2117  nRight = CalcRightLine();
2118 
2119  }
2120  // for paragraphs, "left" is "before text" and "right" is "after text"
2121  if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
2122  nRight += m_rLR->GetLeft();
2123  else
2124  nRight += m_rLR->GetRight();
2125 
2126  // correction: retrieve left margin for numbering in R2L-layout
2127  if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
2128  {
2129  nRight += static_cast<const SwTextFrame*>(pCaller)->GetTextNodeForParaProps()->GetLeftMarginWithNum();
2130  }
2131 
2132  return nRight;
2133 }
2134 
2136 static bool lcl_hasTabFrame(const SwTextFrame* pTextFrame)
2137 {
2138  if (pTextFrame->GetDrawObjs())
2139  {
2140  const SwSortedObjs* pSortedObjs = pTextFrame->GetDrawObjs();
2141  if (pSortedObjs->size() > 0)
2142  {
2143  SwAnchoredObject* pObject = (*pSortedObjs)[0];
2144  if (dynamic_cast<const SwFlyFrame*>(pObject) != nullptr)
2145  {
2146  SwFlyFrame* pFly = static_cast<SwFlyFrame*>(pObject);
2147  if (pFly->Lower() && pFly->Lower()->IsTabFrame())
2148  return true;
2149  }
2150  }
2151  }
2152  return false;
2153 }
2154 
2155 long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const
2156 {
2157  long nLeft=0;
2158 
2159  if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING))
2160  {
2161  // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
2162  // and right border are painted on the right respectively left.
2163  if ( pCaller->IsCellFrame() && pCaller->IsRightToLeft() )
2164  nLeft = CalcRightLine();
2165  else
2166  nLeft = CalcLeftLine();
2167  }
2168 
2169  // for paragraphs, "left" is "before text" and "right" is "after text"
2170  if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
2171  nLeft += m_rLR->GetRight();
2172  else
2173  {
2174  bool bIgnoreMargin = false;
2175  if (pCaller->IsTextFrame())
2176  {
2177  const SwTextFrame* pTextFrame = static_cast<const SwTextFrame*>(pCaller);
2179  {
2180  // If this is explicitly requested, ignore the margins next to the floating table.
2181  if (lcl_hasTabFrame(pTextFrame))
2182  bIgnoreMargin = true;
2183  // TODO here we only handle the first two paragraphs, would be nice to generalize this.
2184  else if (pTextFrame->FindPrev() && pTextFrame->FindPrev()->IsTextFrame() && lcl_hasTabFrame(static_cast<const SwTextFrame*>(pTextFrame->FindPrev())))
2185  bIgnoreMargin = true;
2186  }
2187  }
2188  if (!bIgnoreMargin)
2189  nLeft += m_rLR->GetLeft();
2190  }
2191 
2192  // correction: do not retrieve left margin for numbering in R2L-layout
2193  if ( pCaller->IsTextFrame() && !pCaller->IsRightToLeft() )
2194  {
2195  nLeft += static_cast<const SwTextFrame*>(pCaller)->GetTextNodeForParaProps()->GetLeftMarginWithNum();
2196  }
2197 
2198  return nLeft;
2199 }
2200 
2201 /* Calculated values for borders and shadows.
2202  * It might be that a distance is wanted even without lines. This will be
2203  * considered here and not by the attribute (e.g. bBorderDist for cells).
2204  */
2205 
2207 {
2208  m_nTopLine = m_rBox.CalcLineSpace( SvxBoxItemLine::TOP, /*bEvenIfNoLine*/true );
2209  m_nTopLine = m_nTopLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::TOP);
2210  m_bTopLine = false;
2211 }
2212 
2214 {
2215  m_nBottomLine = m_rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM, true );
2216  m_nBottomLine = m_nBottomLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::BOTTOM);
2217  m_bBottomLine = false;
2218 }
2219 
2221 {
2222  m_nLeftLine = m_rBox.CalcLineSpace( SvxBoxItemLine::LEFT, true);
2223  m_nLeftLine = m_nLeftLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::LEFT);
2224  m_bLeftLine = false;
2225 }
2226 
2228 {
2229  m_nRightLine = m_rBox.CalcLineSpace( SvxBoxItemLine::RIGHT, true );
2230  m_nRightLine = m_nRightLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::RIGHT);
2231  m_bRightLine = false;
2232 }
2233 
2235 {
2236  m_bIsLine = m_rBox.GetTop() || m_rBox.GetBottom() ||
2237  m_rBox.GetLeft()|| m_rBox.GetRight();
2238  m_bLine = false;
2239 }
2240 
2241 /* The borders of neighboring paragraphs are condensed by following algorithm:
2242  *
2243  * 1. No top border if the predecessor has the same top border and (3) applies.
2244  * In addition, the paragraph needs to have a border at least one side (left/right/bottom).
2245  * 2. No bottom border if the successor has the same bottom border and (3) applies.
2246  * In addition, the paragraph needs to have a border at least one side (left/right/top).
2247  * 3. The borders on the left and right side are identical between the current and the
2248  * pre-/succeeding paragraph.
2249  */
2250 
2251 static bool CmpLines( const editeng::SvxBorderLine *pL1, const editeng::SvxBorderLine *pL2 )
2252 {
2253  return ( ((pL1 && pL2) && (*pL1 == *pL2)) || (!pL1 && !pL2) );
2254 }
2255 
2256 // OD 21.05.2003 #108789# - change name of 1st parameter - "rAttrs" -> "rCmpAttrs"
2257 // OD 21.05.2003 #108789# - compare <CalcRight()> and <rCmpAttrs.CalcRight()>
2258 // instead of only the right LR-spacing, because R2L-layout has to be
2259 // considered.
2261  const SwFrame *pCaller,
2262  const SwFrame *pCmp ) const
2263 {
2264  return ( CmpLines( rCmpAttrs.GetBox().GetLeft(), GetBox().GetLeft() ) &&
2265  CmpLines( rCmpAttrs.GetBox().GetRight(),GetBox().GetRight() ) &&
2266  CalcLeft( pCaller ) == rCmpAttrs.CalcLeft( pCmp ) &&
2267  // OD 21.05.2003 #108789# - compare <CalcRight> with <rCmpAttrs.CalcRight>.
2268  CalcRight( pCaller ) == rCmpAttrs.CalcRight( pCmp ) );
2269 }
2270 
2271 bool SwBorderAttrs::JoinWithCmp( const SwFrame& _rCallerFrame,
2272  const SwFrame& _rCmpFrame ) const
2273 {
2274  bool bReturnVal = false;
2275 
2276  SwBorderAttrAccess aCmpAccess( SwFrame::GetCache(), &_rCmpFrame );
2277  const SwBorderAttrs &rCmpAttrs = *aCmpAccess.Get();
2278  if ( m_rShadow == rCmpAttrs.GetShadow() &&
2279  CmpLines( m_rBox.GetTop(), rCmpAttrs.GetBox().GetTop() ) &&
2280  CmpLines( m_rBox.GetBottom(), rCmpAttrs.GetBox().GetBottom() ) &&
2281  CmpLeftRight( rCmpAttrs, &_rCallerFrame, &_rCmpFrame )
2282  )
2283  {
2284  bReturnVal = true;
2285  }
2286 
2287  return bReturnVal;
2288 }
2289 
2290 // OD 21.05.2003 #108789# - method to determine, if borders are joined with
2291 // previous frame. Calculated value saved in cached value <m_bJoinedWithPrev>
2292 // OD 2004-02-26 #i25029# - add 2nd parameter <_pPrevFrame>
2294  const SwFrame* _pPrevFrame )
2295 {
2296  // set default
2297  m_bJoinedWithPrev = false;
2298 
2299  if ( _rFrame.IsTextFrame() )
2300  {
2301  // text frame can potentially join with previous text frame, if
2302  // corresponding attribute set is set at previous text frame.
2303  // OD 2004-02-26 #i25029# - If parameter <_pPrevFrame> is set, take this
2304  // one as previous frame.
2305  const SwFrame* pPrevFrame = _pPrevFrame ? _pPrevFrame : _rFrame.GetPrev();
2306  // OD 2004-02-13 #i25029# - skip hidden text frames.
2307  while ( pPrevFrame && pPrevFrame->IsTextFrame() &&
2308  static_cast<const SwTextFrame*>(pPrevFrame)->IsHiddenNow() )
2309  {
2310  pPrevFrame = pPrevFrame->GetPrev();
2311  }
2312  if ( pPrevFrame && pPrevFrame->IsTextFrame() &&
2313  pPrevFrame->GetAttrSet()->GetParaConnectBorder().GetValue()
2314  )
2315  {
2316  m_bJoinedWithPrev = JoinWithCmp( _rFrame, *pPrevFrame );
2317  }
2318  }
2319 
2320  // valid cache status, if demanded
2321  // OD 2004-02-26 #i25029# - Do not validate cache, if parameter <_pPrevFrame>
2322  // is set.
2323  m_bCachedJoinedWithPrev = m_bCacheGetLine && !_pPrevFrame;
2324 }
2325 
2326 // OD 21.05.2003 #108789# - method to determine, if borders are joined with
2327 // next frame. Calculated value saved in cached value <m_bJoinedWithNext>
2329 {
2330  // set default
2331  m_bJoinedWithNext = false;
2332 
2333  if ( _rFrame.IsTextFrame() )
2334  {
2335  // text frame can potentially join with next text frame, if
2336  // corresponding attribute set is set at current text frame.
2337  // OD 2004-02-13 #i25029# - get next frame, but skip hidden text frames.
2338  const SwFrame* pNextFrame = _rFrame.GetNext();
2339  while ( pNextFrame && pNextFrame->IsTextFrame() &&
2340  static_cast<const SwTextFrame*>(pNextFrame)->IsHiddenNow() )
2341  {
2342  pNextFrame = pNextFrame->GetNext();
2343  }
2344  if ( pNextFrame && pNextFrame->IsTextFrame() &&
2346  )
2347  {
2348  m_bJoinedWithNext = JoinWithCmp( _rFrame, *pNextFrame );
2349  }
2350  }
2351 
2352  // valid cache status, if demanded
2354 }
2355 
2356 // OD 21.05.2003 #108789# - accessor for cached values <m_bJoinedWithPrev>
2357 // OD 2004-02-26 #i25029# - add 2nd parameter <_pPrevFrame>, which is passed to
2358 // method <_CalcJoindWithPrev(..)>.
2360  const SwFrame* _pPrevFrame ) const
2361 {
2362  if ( !m_bCachedJoinedWithPrev || _pPrevFrame )
2363  {
2364  // OD 2004-02-26 #i25029# - pass <_pPrevFrame> as 2nd parameter
2365  const_cast<SwBorderAttrs*>(this)->CalcJoinedWithPrev( _rFrame, _pPrevFrame );
2366  }
2367 
2368  return m_bJoinedWithPrev;
2369 }
2370 
2371 bool SwBorderAttrs::JoinedWithNext( const SwFrame& _rFrame ) const
2372 {
2373  if ( !m_bCachedJoinedWithNext )
2374  {
2375  const_cast<SwBorderAttrs*>(this)->CalcJoinedWithNext( _rFrame );
2376  }
2377 
2378  return m_bJoinedWithNext;
2379 }
2380 
2381 // OD 2004-02-26 #i25029# - added 2nd parameter <_pPrevFrame>, which is passed to
2382 // method <JoinedWithPrev>
2384  const SwFrame* _pPrevFrame )
2385 {
2386  sal_uInt16 nRet = CalcTopLine();
2387 
2388  // OD 21.05.2003 #108789# - use new method <JoinWithPrev()>
2389  // OD 2004-02-26 #i25029# - add 2nd parameter
2390  if ( JoinedWithPrev( _rFrame, _pPrevFrame ) )
2391  {
2392  nRet = 0;
2393  }
2394 
2396 
2397  m_nGetTopLine = nRet;
2398 }
2399 
2401 {
2402  sal_uInt16 nRet = CalcBottomLine();
2403 
2404  // OD 21.05.2003 #108789# - use new method <JoinWithPrev()>
2405  if ( JoinedWithNext( _rFrame ) )
2406  {
2407  nRet = 0;
2408  }
2409 
2411 
2412  m_nGetBottomLine = nRet;
2413 }
2414 
2415 static SwModify const* GetCacheOwner(SwFrame const& rFrame)
2416 {
2417  return rFrame.IsContentFrame()
2418  ? static_cast<SwModify const*>(rFrame.IsTextFrame()
2419  // sw_redlinehide: presumably this caches the border attrs at the model level and can be shared across different layouts so we want the ParaProps node here
2420  ? static_cast<const SwTextFrame&>(rFrame).GetTextNodeForParaProps()
2421  : static_cast<const SwNoTextFrame&>(rFrame).GetNode())
2422  : static_cast<SwModify const*>(static_cast<const SwLayoutFrame&>(rFrame).GetFormat());
2423 }
2424 
2426  SwCacheAccess( rCach,
2427  static_cast<void const *>(GetCacheOwner(*pFrame)),
2428  GetCacheOwner(*pFrame)->IsInCache()),
2429  m_pConstructor( pFrame )
2430 {
2431 }
2432 
2434 {
2435  const_cast<SwModify *>(static_cast<SwModify const *>(m_pOwner))->SetInCache( true );
2436  return new SwBorderAttrs( static_cast<SwModify const *>(m_pOwner), m_pConstructor );
2437 }
2438 
2440 {
2441  return static_cast<SwBorderAttrs*>(SwCacheAccess::Get());
2442 }
2443 
2445  m_pPage( pPg ),
2446  m_pCurrent( nullptr )
2447 {
2448 }
2449 
2451 {
2452  m_pCurrent = nullptr;
2453  if ( m_pPage->GetSortedObjs() )
2454  {
2455  const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
2456  if ( pObjs->size() )
2457  {
2458  sal_uInt32 nTopOrd = 0;
2459  (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
2460  for (SwAnchoredObject* i : *pObjs)
2461  {
2462  const SdrObject* pObj = i->GetDrawObj();
2463  if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
2464  continue;
2465  sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2466  if ( nTmp >= nTopOrd )
2467  {
2468  nTopOrd = nTmp;
2469  m_pCurrent = pObj;
2470  }
2471  }
2472  }
2473  }
2474 }
2475 
2477 {
2478  m_pCurrent = nullptr;
2479  if ( m_pPage->GetSortedObjs() )
2480  {
2481  sal_uInt32 nBotOrd = USHRT_MAX;
2482  const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
2483  if ( pObjs->size() )
2484  {
2485  (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
2486  for (SwAnchoredObject* i : *pObjs)
2487  {
2488  const SdrObject* pObj = i->GetDrawObj();
2489  if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
2490  continue;
2491  sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2492  if ( nTmp < nBotOrd )
2493  {
2494  nBotOrd = nTmp;
2495  m_pCurrent = pObj;
2496  }
2497  }
2498  }
2499  }
2500  return m_pCurrent;
2501 }
2502 
2504 {
2505  const sal_uInt32 nCurOrd = m_pCurrent ? m_pCurrent->GetOrdNumDirect() : 0;
2506  m_pCurrent = nullptr;
2507  if ( m_pPage->GetSortedObjs() )
2508  {
2509  sal_uInt32 nOrd = USHRT_MAX;
2510  const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
2511  if ( pObjs->size() )
2512  {
2513  (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
2514  for (SwAnchoredObject* i : *pObjs)
2515  {
2516  const SdrObject* pObj = i->GetDrawObj();
2517  if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
2518  continue;
2519  sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2520  if ( nTmp > nCurOrd && nTmp < nOrd )
2521  {
2522  nOrd = nTmp;
2523  m_pCurrent = pObj;
2524  }
2525  }
2526  }
2527  }
2528  return m_pCurrent;
2529 }
2530 
2532 {
2533  const sal_uInt32 nCurOrd = m_pCurrent ? m_pCurrent->GetOrdNumDirect() : 0;
2534  m_pCurrent = nullptr;
2535  if ( m_pPage->GetSortedObjs() )
2536  {
2537  const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
2538  if ( pObjs->size() )
2539  {
2540  sal_uInt32 nOrd = 0;
2541  (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
2542  for (SwAnchoredObject* i : *pObjs)
2543  {
2544  const SdrObject* pObj = i->GetDrawObj();
2545  if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
2546  continue;
2547  sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2548  if ( nTmp < nCurOrd && nTmp >= nOrd )
2549  {
2550  nOrd = nTmp;
2551  m_pCurrent = pObj;
2552  }
2553  }
2554  }
2555  }
2556 }
2557 
2559 // New algorithm:
2560 // Do not look at each neighbor one by one to set all pointers correctly.
2561 // It is sufficient to detach a part of a chain and check if another chain needs to be added
2562 // when attaching it again. Only the pointers necessary for the chain connection need to be
2563 // adjusted. The correction happens in RestoreContent(). In between all access is restricted.
2564 // During this action, the Flys are detached from the page.
2565 
2566 // #115759# - 'remove' also drawing object from page and
2567 // at-fly anchored objects from page
2568 static void lcl_RemoveObjsFromPage( SwFrame* _pFrame )
2569 {
2570  OSL_ENSURE( _pFrame->GetDrawObjs(), "no DrawObjs in lcl_RemoveObjsFromPage." );
2571  SwSortedObjs &rObjs = *_pFrame->GetDrawObjs();
2572  for (SwAnchoredObject* pObj : rObjs)
2573  {
2574  // #115759# - reset member, at which the anchored
2575  // object orients its vertical position
2576  pObj->ClearVertPosOrientFrame();
2577  // #i43913#
2578  pObj->ResetLayoutProcessBools();
2579  // #115759# - remove also lower objects of as-character
2580  // anchored Writer fly frames from page
2581  if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
2582  {
2583  SwFlyFrame* pFlyFrame = static_cast<SwFlyFrame*>(pObj);
2584 
2585  // #115759# - remove also direct lowers of Writer
2586  // fly frame from page
2587  if ( pFlyFrame->GetDrawObjs() )
2588  {
2589  ::lcl_RemoveObjsFromPage( pFlyFrame );
2590  }
2591 
2592  SwContentFrame* pCnt = pFlyFrame->ContainsContent();
2593  while ( pCnt )
2594  {
2595  if ( pCnt->GetDrawObjs() )
2596  ::lcl_RemoveObjsFromPage( pCnt );
2597  pCnt = pCnt->GetNextContentFrame();
2598  }
2599  if ( pFlyFrame->IsFlyFreeFrame() )
2600  {
2601  // #i28701# - use new method <GetPageFrame()>
2602  pFlyFrame->GetPageFrame()->RemoveFlyFromPage( pFlyFrame );
2603  }
2604  }
2605  // #115759# - remove also drawing objects from page
2606  else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr )
2607  {
2608  if (pObj->GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR)
2609  {
2610  if (SwPageFrame *pPg = pObj->GetPageFrame())
2611  pPg->RemoveDrawObjFromPage(
2612  *static_cast<SwAnchoredDrawObject*>(pObj) );
2613  }
2614  }
2615  }
2616 }
2617 
2619 {
2620  if( pLay->IsSctFrame() && pLay->Lower() && pLay->Lower()->IsColumnFrame() )
2621  sw_RemoveFootnotes( static_cast<SwColumnFrame*>(pLay->Lower()), true, true );
2622 
2623  SwFrame *pSav;
2624  if ( nullptr == (pSav = pLay->ContainsAny()) )
2625  return nullptr;
2626 
2627  if( pSav->IsInFootnote() && !pLay->IsInFootnote() )
2628  {
2629  do
2630  pSav = pSav->FindNext();
2631  while( pSav && pSav->IsInFootnote() );
2632  if( !pSav || !pLay->IsAnLower( pSav ) )
2633  return nullptr;
2634  }
2635 
2636  // Tables should be saved as a whole, exception:
2637  // The contents of a section or a cell inside a table should be saved
2638  if ( pSav->IsInTab() && !( ( pLay->IsSctFrame() || pLay->IsCellFrame() ) && pLay->IsInTab() ) )
2639  while ( !pSav->IsTabFrame() )
2640  pSav = pSav->GetUpper();
2641 
2642  if( pSav->IsInSct() )
2643  { // search the upmost section inside of pLay
2644  SwFrame* pSect = pLay->FindSctFrame();
2645  SwFrame *pTmp = pSav;
2646  do
2647  {
2648  pSav = pTmp;
2649  pTmp = (pSav && pSav->GetUpper()) ? pSav->GetUpper()->FindSctFrame() : nullptr;
2650  } while ( pTmp != pSect );
2651  }
2652 
2653  SwFrame *pFloat = pSav;
2654  if( !pStart )
2655  pStart = pSav;
2656  bool bGo = pStart == pSav;
2657  do
2658  {
2659  if( bGo )
2660  pFloat->GetUpper()->m_pLower = nullptr; // detach the chain part
2661 
2662  // search the end of the chain part, remove Flys on the way
2663  do
2664  {
2665  if( bGo )
2666  {
2667  if ( pFloat->IsContentFrame() )
2668  {
2669  if ( pFloat->GetDrawObjs() )
2670  ::lcl_RemoveObjsFromPage( static_cast<SwContentFrame*>(pFloat) );
2671  }
2672  else if ( pFloat->IsTabFrame() || pFloat->IsSctFrame() )
2673  {
2674  SwContentFrame *pCnt = static_cast<SwLayoutFrame*>(pFloat)->ContainsContent();
2675  if( pCnt )
2676  {
2677  do
2678  { if ( pCnt->GetDrawObjs() )
2679  ::lcl_RemoveObjsFromPage( pCnt );
2680  pCnt = pCnt->GetNextContentFrame();
2681  } while ( pCnt && static_cast<SwLayoutFrame*>(pFloat)->IsAnLower( pCnt ) );
2682  }
2683  }
2684  else {
2685  OSL_ENSURE( !pFloat, "new FloatFrame?" );
2686  }
2687  }
2688  if ( pFloat->GetNext() )
2689  {
2690  if( bGo )
2691  pFloat->mpUpper = nullptr;
2692  pFloat = pFloat->GetNext();
2693  if( !bGo && pFloat == pStart )
2694  {
2695  bGo = true;
2696  pFloat->mpPrev->mpNext = nullptr;
2697  pFloat->mpPrev = nullptr;
2698  }
2699  }
2700  else
2701  break;
2702 
2703  } while ( pFloat );
2704 
2705  // search next chain part and connect both chains
2706  SwFrame *pTmp = pFloat->FindNext();
2707  if( bGo )
2708  pFloat->mpUpper = nullptr;
2709 
2710  if( !pLay->IsInFootnote() )
2711  while( pTmp && pTmp->IsInFootnote() )
2712  pTmp = pTmp->FindNext();
2713 
2714  if ( !pLay->IsAnLower( pTmp ) )
2715  pTmp = nullptr;
2716 
2717  if ( pTmp && bGo )
2718  {
2719  pFloat->mpNext = pTmp; // connect both chains
2720  pFloat->mpNext->mpPrev = pFloat;
2721  }
2722  pFloat = pTmp;
2723  bGo = bGo || ( pStart == pFloat );
2724  } while ( pFloat );
2725 
2726  return bGo ? pStart : nullptr;
2727 }
2728 
2729 // #115759# - add also drawing objects to page and at-fly
2730 // anchored objects to page
2731 static void lcl_AddObjsToPage( SwFrame* _pFrame, SwPageFrame* _pPage )
2732 {
2733  OSL_ENSURE( _pFrame->GetDrawObjs(), "no DrawObjs in lcl_AddObjsToPage." );
2734  SwSortedObjs &rObjs = *_pFrame->GetDrawObjs();
2735  for (SwAnchoredObject* pObj : rObjs)
2736  {
2737  // #115759# - unlock position of anchored object
2738  // in order to get the object's position calculated.
2739  pObj->UnlockPosition();
2740  // #115759# - add also lower objects of as-character
2741  // anchored Writer fly frames from page
2742  if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
2743  {
2744  SwFlyFrame* pFlyFrame = static_cast<SwFlyFrame*>(pObj);
2745  if ( dynamic_cast<const SwFlyFreeFrame*>( pObj) != nullptr )
2746  {
2747  _pPage->AppendFlyToPage( pFlyFrame );
2748  }
2749  pFlyFrame->InvalidatePos_();
2750  pFlyFrame->InvalidateSize_();
2751  pFlyFrame->InvalidatePage( _pPage );
2752 
2753  // #115759# - add also at-fly anchored objects
2754  // to page
2755  if ( pFlyFrame->GetDrawObjs() )
2756  {
2757  ::lcl_AddObjsToPage( pFlyFrame, _pPage );
2758  }
2759 
2760  SwContentFrame *pCnt = pFlyFrame->ContainsContent();
2761  while ( pCnt )
2762  {
2763  if ( pCnt->GetDrawObjs() )
2764  ::lcl_AddObjsToPage( pCnt, _pPage );
2765  pCnt = pCnt->GetNextContentFrame();
2766  }
2767  }
2768  // #115759# - remove also drawing objects from page
2769  else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr )
2770  {
2771  if (pObj->GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR)
2772  {
2773  pObj->InvalidateObjPos();
2774  _pPage->AppendDrawObjToPage(
2775  *static_cast<SwAnchoredDrawObject*>(pObj) );
2776  }
2777  }
2778  }
2779 }
2780 
2781 void RestoreContent( SwFrame *pSav, SwLayoutFrame *pParent, SwFrame *pSibling )
2782 {
2783  OSL_ENSURE( pSav && pParent, "no Save or Parent provided for RestoreContent." );
2784  SwRectFnSet aRectFnSet(pParent);
2785 
2786  // If there are already FlowFrames below the new parent, so add the chain (starting with pSav)
2787  // after the last one. The parts are inserted and invalidated if needed.
2788  // On the way, the Flys of the ContentFrames are registered at the page.
2789 
2790  SwPageFrame *pPage = pParent->FindPageFrame();
2791 
2792  if ( pPage )
2793  pPage->InvalidatePage( pPage );
2794 
2795  // determine predecessor and establish connection or initialize
2796  pSav->mpPrev = pSibling;
2797  SwFrame* pNxt;
2798  if ( pSibling )
2799  {
2800  pNxt = pSibling->mpNext;
2801  pSibling->mpNext = pSav;
2802  pSibling->InvalidatePrt_();
2803  pSibling->InvalidatePage( pPage );
2804  SwFlowFrame *pFlowFrame = dynamic_cast<SwFlowFrame*>(pSibling);
2805  if (pFlowFrame && pFlowFrame->GetFollow())
2806  pSibling->Prepare( PREP_CLEAR, nullptr, false );
2807  }
2808  else
2809  { pNxt = pParent->m_pLower;
2810  pParent->m_pLower = pSav;
2811  pSav->mpUpper = pParent; // set here already, so that it is explicit when invalidating
2812 
2813  if ( pSav->IsContentFrame() )
2814  static_cast<SwContentFrame*>(pSav)->InvalidatePage( pPage );
2815  else
2816  { // pSav might be an empty SectFrame
2817  SwContentFrame* pCnt = pParent->ContainsContent();
2818  if( pCnt )
2819  pCnt->InvalidatePage( pPage );
2820  }
2821  }
2822 
2823  // the parent needs to grow appropriately
2824  SwTwips nGrowVal = 0;
2825  SwFrame* pLast;
2826  do
2827  { pSav->mpUpper = pParent;
2828  nGrowVal += aRectFnSet.GetHeight(pSav->getFrameArea());
2829  pSav->InvalidateAll_();
2830 
2831  // register Flys, if TextFrames than also invalidate appropriately
2832  if ( pSav->IsContentFrame() )
2833  {
2834  if ( pSav->IsTextFrame() &&
2835  static_cast<SwTextFrame*>(pSav)->GetCacheIdx() != USHRT_MAX )
2836  static_cast<SwTextFrame*>(pSav)->Init(); // I am its friend
2837 
2838  if ( pPage && pSav->GetDrawObjs() )
2839  ::lcl_AddObjsToPage( static_cast<SwContentFrame*>(pSav), pPage );
2840  }
2841  else
2842  { SwContentFrame *pBlub = static_cast<SwLayoutFrame*>(pSav)->ContainsContent();
2843  if( pBlub )
2844  {
2845  do
2846  { if ( pPage && pBlub->GetDrawObjs() )
2847  ::lcl_AddObjsToPage( pBlub, pPage );
2848  if( pBlub->IsTextFrame() && static_cast<SwTextFrame*>(pBlub)->HasFootnote() &&
2849  static_cast<SwTextFrame*>(pBlub)->GetCacheIdx() != USHRT_MAX )
2850  static_cast<SwTextFrame*>(pBlub)->Init(); // I am its friend
2851  pBlub = pBlub->GetNextContentFrame();
2852  } while ( pBlub && static_cast<SwLayoutFrame*>(pSav)->IsAnLower( pBlub ));
2853  }
2854  }
2855  pLast = pSav;
2856  pSav = pSav->GetNext();
2857 
2858  } while ( pSav );
2859 
2860  if( pNxt )
2861  {
2862  pLast->mpNext = pNxt;
2863  pNxt->mpPrev = pLast;
2864  }
2865 
2866  pParent->Grow( nGrowVal );
2867 }
2868 
2870  bool bOdd, bool bFirst, bool bInsertEmpty, bool bFootnote,
2871  SwFrame *pSibling )
2872 {
2873  SwPageFrame *pRet;
2874  SwDoc *pDoc = static_cast<SwLayoutFrame*>(pUpper)->GetFormat()->GetDoc();
2875  if (bFirst)
2876  {
2877  if (rDesc.IsFirstShared())
2878  {
2879  // We need to fallback to left or right page format, decide it now.
2880  // FIXME: is this still needed?
2881  if (bOdd)
2882  {
2883  rDesc.GetFirstMaster().SetFormatAttr( rDesc.GetMaster().GetHeader() );
2884  rDesc.GetFirstMaster().SetFormatAttr( rDesc.GetMaster().GetFooter() );
2885  // fdo#60250 copy margins for mirrored pages
2886  rDesc.GetFirstMaster().SetFormatAttr( rDesc.GetMaster().GetLRSpace() );
2887  }
2888  else
2889  {
2890  rDesc.GetFirstLeft().SetFormatAttr( rDesc.GetLeft().GetHeader() );
2891  rDesc.GetFirstLeft().SetFormatAttr( rDesc.GetLeft().GetFooter() );
2892  rDesc.GetFirstLeft().SetFormatAttr( rDesc.GetLeft().GetLRSpace() );
2893  }
2894  }
2895  }
2896  SwFrameFormat *pFormat(bOdd ? rDesc.GetRightFormat(bFirst) : rDesc.GetLeftFormat(bFirst));
2897  // If there is no FrameFormat for this page, add an empty page
2898  if ( !pFormat )
2899  {
2900  pFormat = bOdd ? rDesc.GetLeftFormat() : rDesc.GetRightFormat();
2901  OSL_ENSURE( pFormat, "Descriptor without any format?!" );
2902  bInsertEmpty = !bInsertEmpty;
2903  }
2904  if( bInsertEmpty )
2905  {
2906  SwPageDesc *pTmpDesc = pSibling && pSibling->GetPrev() ?
2907  static_cast<SwPageFrame*>(pSibling->GetPrev())->GetPageDesc() : &rDesc;
2908  pRet = new SwPageFrame( pDoc->GetEmptyPageFormat(), pUpper, pTmpDesc );
2909  SAL_INFO( "sw.pageframe", "InsertNewPage - insert empty p: " << pRet << " d: " << pTmpDesc );
2910  pRet->Paste( pUpper, pSibling );
2911  pRet->PreparePage( bFootnote );
2912  }
2913  pRet = new SwPageFrame( pFormat, pUpper, &rDesc );
2914  SAL_INFO( "sw.pageframe", "InsertNewPage p: " << pRet << " d: " << &rDesc << " f: " << pFormat );
2915  pRet->Paste( pUpper, pSibling );
2916  pRet->PreparePage( bFootnote );
2917  if ( pRet->GetNext() )
2919  return pRet;
2920 }
2921 
2922 /* The following two methods search the layout structure recursively and
2923  * register all Flys at the page that have a Frame in this structure as an anchor.
2924  */
2925 
2926 static void lcl_Regist( SwPageFrame *pPage, const SwFrame *pAnch )
2927 {
2928  SwSortedObjs *pObjs = const_cast<SwSortedObjs*>(pAnch->GetDrawObjs());
2929  for (SwAnchoredObject* pObj : *pObjs)
2930  {
2931  if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
2932  {
2933  SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pObj);
2934  // register (not if already known)
2935  // #i28701# - use new method <GetPageFrame()>
2936  SwPageFrame *pPg = pFly->IsFlyFreeFrame()
2937  ? pFly->GetPageFrame() : pFly->FindPageFrame();
2938  if ( pPg != pPage )
2939  {
2940  if ( pPg )
2941  pPg->RemoveFlyFromPage( pFly );
2942  pPage->AppendFlyToPage( pFly );
2943  }
2944  ::RegistFlys( pPage, pFly );
2945  }
2946  else
2947  {
2948  // #i87493#
2949  if ( pPage != pObj->GetPageFrame() )
2950  {
2951  // #i28701#
2952  if (SwPageFrame *pPg = pObj->GetPageFrame())
2953  pPg->RemoveDrawObjFromPage( *pObj );
2954  pPage->AppendDrawObjToPage( *pObj );
2955  }
2956  }
2957 
2958  const SwFlyFrame* pFly = pAnch->FindFlyFrame();
2959  if ( pFly &&
2960  pObj->GetDrawObj()->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() &&
2961  pObj->GetDrawObj()->getSdrPageFromSdrObject() )
2962  {
2963  //#i119945# set pFly's OrdNum to pObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
2965  pObj->GetDrawObj()->GetOrdNumDirect() );
2966  }
2967  }
2968 }
2969 
2970 void RegistFlys( SwPageFrame *pPage, const SwLayoutFrame *pLay )
2971 {
2972  if ( pLay->GetDrawObjs() )
2973  ::lcl_Regist( pPage, pLay );
2974  const SwFrame *pFrame = pLay->Lower();
2975  while ( pFrame )
2976  {
2977  if ( pFrame->IsLayoutFrame() )
2978  ::RegistFlys( pPage, static_cast<const SwLayoutFrame*>(pFrame) );
2979  else if ( pFrame->GetDrawObjs() )
2980  ::lcl_Regist( pPage, pFrame );
2981  pFrame = pFrame->GetNext();
2982  }
2983 }
2984 
2986 void Notify( SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld,
2987  const SwRect* pOldPrt )
2988 {
2989  const SwRect aFrame( pFly->GetObjRectWithSpaces() );
2990  if ( rOld.Pos() != aFrame.Pos() )
2991  { // changed position, invalidate old and new area
2992  if ( rOld.HasArea() &&
2993  rOld.Left()+pFly->GetFormat()->GetLRSpace().GetLeft() < FAR_AWAY )
2994  {
2995  pFly->NotifyBackground( pOld, rOld, PREP_FLY_LEAVE );
2996  }
2997  pFly->NotifyBackground( pFly->FindPageFrame(), aFrame, PREP_FLY_ARRIVE );
2998  }
2999  else if ( rOld.SSize() != aFrame.SSize() )
3000  { // changed size, invalidate the area that was left or is now overlapped
3001  // For simplicity, we purposely invalidate a Twip even if not needed.
3002 
3003  SwViewShell *pSh = pFly->getRootFrame()->GetCurrShell();
3004  if( pSh && rOld.HasArea() )
3005  pSh->InvalidateWindows( rOld );
3006 
3007  // #i51941# - consider case that fly frame isn't
3008  // registered at the old page <pOld>
3009  SwPageFrame* pPageFrame = pFly->FindPageFrame();
3010  if ( pOld != pPageFrame )
3011  {
3012  pFly->NotifyBackground( pPageFrame, aFrame, PREP_FLY_ARRIVE );
3013  }
3014 
3015  if ( rOld.Left() != aFrame.Left() )
3016  {
3017  SwRect aTmp( rOld );
3018  aTmp.Union( aFrame );
3019  aTmp.Left( std::min(aFrame.Left(), rOld.Left()) );
3020  aTmp.Right( std::max(aFrame.Left(), rOld.Left()) );
3021  pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
3022  }
3023  SwTwips nOld = rOld.Right();
3024  SwTwips nNew = aFrame.Right();
3025  if ( nOld != nNew )
3026  {
3027  SwRect aTmp( rOld );
3028  aTmp.Union( aFrame );
3029  aTmp.Left( std::min(nNew, nOld) );
3030  aTmp.Right( std::max(nNew, nOld) );
3031  pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
3032  }
3033  if ( rOld.Top() != aFrame.Top() )
3034  {
3035  SwRect aTmp( rOld );
3036  aTmp.Union( aFrame );
3037  aTmp.Top( std::min(aFrame.Top(), rOld.Top()) );
3038  aTmp.Bottom( std::max(aFrame.Top(), rOld.Top()) );
3039  pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
3040  }
3041  nOld = rOld.Bottom();
3042  nNew = aFrame.Bottom();
3043  if ( nOld != nNew )
3044  {
3045  SwRect aTmp( rOld );
3046  aTmp.Union( aFrame );
3047  aTmp.Top( std::min(nNew, nOld) );
3048  aTmp.Bottom( std::max(nNew, nOld) );
3049  pFly->NotifyBackground( pOld, aTmp, PREP_FLY_CHGD );
3050  }
3051  }
3052  else if(pOldPrt && *pOldPrt != pFly->getFramePrintArea())
3053  {
3054  bool bNotifyBackground(pFly->GetFormat()->GetSurround().IsContour());
3055 
3056  if(!bNotifyBackground &&
3057  pFly->IsFlyFreeFrame() &&
3058  static_cast< const SwFlyFreeFrame* >(pFly)->supportsAutoContour())
3059  {
3060  // RotateFlyFrame3: Also notify for FlyFrames which allow AutoContour
3061  bNotifyBackground = true;
3062  }
3063 
3064  if(bNotifyBackground)
3065  {
3066  // #i24097#
3067  pFly->NotifyBackground( pFly->FindPageFrame(), aFrame, PREP_FLY_ARRIVE );
3068  }
3069  }
3070 }
3071 
3072 static void lcl_CheckFlowBack( SwFrame* pFrame, const SwRect &rRect )
3073 {
3074  SwTwips nBottom = rRect.Bottom();
3075  while( pFrame )
3076  {
3077  if( pFrame->IsLayoutFrame() )
3078  {
3079  if( rRect.IsOver( pFrame->getFrameArea() ) )
3080  lcl_CheckFlowBack( static_cast<SwLayoutFrame*>(pFrame)->Lower(), rRect );
3081  }
3082  else if( !pFrame->GetNext() && nBottom > pFrame->getFrameArea().Bottom() )
3083  {
3084  if( pFrame->IsContentFrame() && static_cast<SwContentFrame*>(pFrame)->HasFollow() )
3085  pFrame->InvalidateSize();
3086  else
3087  pFrame->InvalidateNextPos();
3088  }
3089  pFrame = pFrame->GetNext();
3090  }
3091 }
3092 
3093 static void lcl_NotifyContent( const SdrObject *pThis, SwContentFrame *pCnt,
3094  const SwRect &rRect, const PrepareHint eHint )
3095 {
3096  if ( pCnt->IsTextFrame() )
3097  {
3098  SwRect aCntPrt( pCnt->getFramePrintArea() );
3099  aCntPrt.Pos() += pCnt->getFrameArea().Pos();
3100  if ( eHint == PREP_FLY_ATTR_CHG )
3101  {
3102  // #i35640# - use given rectangle <rRect> instead
3103  // of current bound rectangle
3104  if ( aCntPrt.IsOver( rRect ) )
3105  pCnt->Prepare( PREP_FLY_ATTR_CHG );
3106  }
3107  // #i23129# - only invalidate, if the text frame
3108  // printing area overlaps with the given rectangle.
3109  else if ( aCntPrt.IsOver( rRect ) )
3110  pCnt->Prepare( eHint, static_cast<void*>(&aCntPrt.Intersection_( rRect )) );
3111  if ( pCnt->GetDrawObjs() )
3112  {
3113  const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
3114  for (SwAnchoredObject* pObj : rObjs)
3115  {
3116  if ( dynamic_cast<const SwFlyFrame*>( pObj) != nullptr )
3117  {
3118  SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pObj);
3119  if ( pFly->IsFlyInContentFrame() )
3120  {
3121  SwContentFrame *pContent = pFly->ContainsContent();
3122  while ( pContent )
3123  {
3124  ::lcl_NotifyContent( pThis, pContent, rRect, eHint );
3125  pContent = pContent->GetNextContentFrame();
3126  }
3127  }
3128  }
3129  }
3130  }
3131  }
3132 }
3133 
3134 void Notify_Background( const SdrObject* pObj,
3135  SwPageFrame* pPage,
3136  const SwRect& rRect,
3137  const PrepareHint eHint,
3138  const bool bInva )
3139 {
3140  // If the frame was positioned correctly for the first time, do not inform the old area
3141  if ( eHint == PREP_FLY_LEAVE && rRect.Top() == FAR_AWAY )
3142  return;
3143 
3144  SwLayoutFrame* pArea;
3145  SwFlyFrame *pFlyFrame = nullptr;
3146  SwFrame* pAnchor;
3147  if( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) )
3148  {
3149  pFlyFrame = const_cast<SwVirtFlyDrawObj*>(pVirtFlyDrawObj)->GetFlyFrame();
3150  pAnchor = pFlyFrame->AnchorFrame();
3151  }
3152  else
3153  {
3154  pFlyFrame = nullptr;
3155  pAnchor = const_cast<SwFrame*>(
3156  GetUserCall(pObj)->GetAnchoredObj( pObj )->GetAnchorFrame() );
3157  }
3158  if( PREP_FLY_LEAVE != eHint && pAnchor->IsInFly() )
3159  pArea = pAnchor->FindFlyFrame();
3160  else
3161  pArea = pPage;
3162  SwContentFrame *pCnt = nullptr;
3163  if ( pArea )
3164  {
3165  if( PREP_FLY_ARRIVE != eHint )
3166  lcl_CheckFlowBack( pArea, rRect );
3167 
3168  // Only the Flys following this anchor are reacting. Thus, those do not
3169  // need to be processed.
3170  // An exception is LEAVE, since the Fly might come "from above".
3171  // If the anchor is positioned on the previous page, the whole page
3172  // needs to be processed (47722).
3173  // OD 2004-05-13 #i28701# - If the wrapping style has to be considered
3174  // on the object positioning, the complete area has to be processed,
3175  // because content frames before the anchor frame also have to consider
3176  // the object for the text wrapping.
3177  // #i3317# - The complete area has always been
3178  // processed.
3179  {
3180  pCnt = pArea->ContainsContent();
3181  }
3182  }
3183  SwFrame *pLastTab = nullptr;
3184 
3185  bool isValidTableBeforeAnchor(false);
3186  while ( pCnt && pArea && pArea->IsAnLower( pCnt ) )
3187  {
3188  ::lcl_NotifyContent( pObj, pCnt, rRect, eHint );
3189  if ( pCnt->IsInTab() )
3190  {
3191  SwTabFrame *pTab = pCnt->FindTabFrame();
3192  if ( pTab != pLastTab )
3193  {
3194  pLastTab = pTab;
3195  isValidTableBeforeAnchor = false;
3196  if (PREP_FLY_ARRIVE == eHint
3197  && pFlyFrame // TODO: do it for draw objects too?
3198  && pTab->IsFollow() // table starts on previous page?
3199  // "through" means they will actually overlap anyway
3200  && css::text::WrapTextMode_THROUGH != pFlyFrame->GetFormat()->GetSurround().GetSurround()
3201  // if it's anchored in footer it can't move to other page
3202  && !pAnchor->FindFooterOrHeader())
3203  {
3204  SwFrame * pTmp(pAnchor->GetPrev());
3205  while (pTmp)
3206  {
3207  if (pTmp == pTab)
3208  {
3209  // tdf#99460 the table shouldn't be moved by the fly
3210  isValidTableBeforeAnchor = true;
3211  break;
3212  }
3213  pTmp = pTmp->GetPrev();
3214  }
3215  }
3216  // #i40606# - use <GetLastBoundRect()>
3217  // instead of <GetCurrentBoundRect()>, because a recalculation
3218  // of the bounding rectangle isn't intended here.
3219  if (!isValidTableBeforeAnchor
3220  && (pTab->getFrameArea().IsOver(pObj->GetLastBoundRect()) ||
3221  pTab->getFrameArea().IsOver(rRect)))
3222  {
3223  if ( !pFlyFrame || !pFlyFrame->IsLowerOf( pTab ) )
3224  pTab->InvalidatePrt();
3225  }
3226  }
3227  SwLayoutFrame* pCell = pCnt->GetUpper();
3228  // #i40606# - use <GetLastBoundRect()>
3229  // instead of <GetCurrentBoundRect()>, because a recalculation
3230  // of the bounding rectangle isn't intended here.
3231  if (!isValidTableBeforeAnchor && pCell->IsCellFrame() &&
3232  ( pCell->getFrameArea().IsOver( pObj->GetLastBoundRect() ) ||
3233  pCell->getFrameArea().IsOver( rRect ) ) )
3234  {
3235  const SwFormatVertOrient &rOri = pCell->GetFormat()->GetVertOrient();
3237  pCell->InvalidatePrt();
3238  }
3239  }
3240  pCnt = pCnt->GetNextContentFrame();
3241  }
3242  // #128702# - make code robust
3243  if ( pPage && pPage->GetSortedObjs() )
3244  {
3245  pObj->GetOrdNum();
3246  const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
3247  for (SwAnchoredObject* pAnchoredObj : rObjs)
3248  {
3249  if ( dynamic_cast<const SwFlyFrame*>( pAnchoredObj) != nullptr )
3250  {
3251  if( pAnchoredObj->GetDrawObj() == pObj )
3252  continue;
3253  SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
3254  if ( pFly->getFrameArea().Top() == FAR_AWAY )
3255  continue;
3256 
3257  if ( !pFlyFrame ||
3258  (!pFly->IsLowerOf( pFlyFrame ) &&
3259  pFly->GetVirtDrawObj()->GetOrdNumDirect() < pObj->GetOrdNumDirect()))
3260  {
3261  pCnt = pFly->ContainsContent();
3262  while ( pCnt )
3263  {
3264  ::lcl_NotifyContent( pObj, pCnt, rRect, eHint );
3265  pCnt = pCnt->GetNextContentFrame();
3266  }
3267  }
3268  if( pFly->IsFlyLayFrame() )
3269  {
3270  if( pFly->Lower() && pFly->Lower()->IsColumnFrame() &&
3271  pFly->getFrameArea().Bottom() >= rRect.Top() &&
3272  pFly->getFrameArea().Top() <= rRect.Bottom() &&
3273  pFly->getFrameArea().Right() >= rRect.Left() &&
3274  pFly->getFrameArea().Left() <= rRect.Right() )
3275  {
3276  pFly->InvalidateSize();
3277  }
3278  }
3279  // Flys above myself might sidestep if they have an automatic
3280  // alignment. This happens independently of my attributes since
3281  // this might have been changed as well.
3282  else if ( pFly->IsFlyAtContentFrame() &&
3283  pObj->GetOrdNumDirect() <
3284  pFly->GetVirtDrawObj()->GetOrdNumDirect() &&
3285  pFlyFrame && !pFly->IsLowerOf( pFlyFrame ) )
3286  {
3287  const SwFormatHoriOrient &rH = pFly->GetFormat()->GetHoriOrient();
3289  text::HoriOrientation::CENTER != rH.GetHoriOrient() &&
3290  ( !pFly->IsAutoPos() || text::RelOrientation::CHAR != rH.GetRelationOrient() ) &&
3291  (pFly->getFrameArea().Bottom() >= rRect.Top() &&
3292  pFly->getFrameArea().Top() <= rRect.Bottom()) )
3293  pFly->InvalidatePos();
3294  }
3295  }
3296  }
3297  }
3298  if ( pFlyFrame && pAnchor->GetUpper() && pAnchor->IsInTab() )//MA_FLY_HEIGHT
3299  pAnchor->GetUpper()->InvalidateSize();
3300 
3301  // #i82258# - make code robust
3302  SwViewShell* pSh = nullptr;
3303  if ( bInva && pPage &&
3304  nullptr != (pSh = pPage->getRootFrame()->GetCurrShell()) )
3305  {
3306  pSh->InvalidateWindows( rRect );
3307  }
3308 }
3309 
3312 const SwFrame* GetVirtualUpper( const SwFrame* pFrame, const Point& rPos )
3313 {
3314  if( pFrame->IsTextFrame() )
3315  {
3316  pFrame = pFrame->GetUpper();
3317  if( !pFrame->getFrameArea().IsInside( rPos ) )
3318  {
3319  if( pFrame->IsFootnoteFrame() )
3320  {
3321  const SwFootnoteFrame* pTmp = static_cast<const SwFootnoteFrame*>(pFrame)->GetFollow();
3322  while( pTmp )
3323  {
3324  if( pTmp->getFrameArea().IsInside( rPos ) )
3325  return pTmp;
3326  pTmp = pTmp->GetFollow();
3327  }
3328  }
3329  else
3330  {
3331  SwFlyFrame* pTmp = const_cast<SwFlyFrame*>(pFrame->FindFlyFrame());
3332  while( pTmp )
3333  {
3334  if( pTmp->getFrameArea().IsInside( rPos ) )
3335  return pTmp;
3336  pTmp = pTmp->GetNextLink();
3337  }
3338  }
3339  }
3340  }
3341  return pFrame;
3342 }
3343 
3344 bool Is_Lower_Of(const SwFrame *pCurrFrame, const SdrObject* pObj)
3345 {
3346  Point aPos;
3347  const SwFrame* pFrame;
3348  if (const SwVirtFlyDrawObj *pFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObj))
3349  {
3350  const SwFlyFrame* pFly = pFlyDrawObj->GetFlyFrame();
3351  pFrame = pFly->GetAnchorFrame();
3352  aPos = pFly->getFrameArea().Pos();
3353  }
3354  else
3355  {
3356  pFrame = static_cast<SwDrawContact*>(GetUserCall(pObj))->GetAnchorFrame(pObj);
3357  aPos = pObj->GetCurrentBoundRect().TopLeft();
3358  }
3359  OSL_ENSURE( pFrame, "8-( Fly is lost in Space." );
3360  pFrame = GetVirtualUpper( pFrame, aPos );
3361  do
3362  { if ( pFrame == pCurrFrame )
3363  return true;
3364  if( pFrame->IsFlyFrame() )
3365  {
3366  aPos = pFrame->getFrameArea().Pos();
3367  pFrame = GetVirtualUpper( static_cast<const SwFlyFrame*>(pFrame)->GetAnchorFrame(), aPos );
3368  }
3369  else
3370  pFrame = pFrame->GetUpper();
3371  } while ( pFrame );
3372  return false;
3373 }
3374 
3376 const SwFrame *FindContext( const SwFrame *pFrame, SwFrameType nAdditionalContextType )
3377 {
3381  nAdditionalContextType;
3382  do
3383  { if ( pFrame->GetType() & nTyp )
3384  break;
3385  pFrame = pFrame->GetUpper();
3386  } while( pFrame );
3387  return pFrame;
3388 }
3389 
3390 bool IsFrameInSameContext( const SwFrame *pInnerFrame, const SwFrame *pFrame )
3391 {
3392  const SwFrame *pContext = FindContext( pInnerFrame, SwFrameType::None );
3393 
3397  do
3398  { if ( pFrame->GetType() & nTyp )
3399  {
3400  if( pFrame == pContext )
3401  return true;
3402  if( pFrame->IsCellFrame() )
3403  return false;
3404  }
3405  if( pFrame->IsFlyFrame() )
3406  {
3407  Point aPos( pFrame->getFrameArea().Pos() );
3408  pFrame = GetVirtualUpper( static_cast<const SwFlyFrame*>(pFrame)->GetAnchorFrame(), aPos );
3409  }
3410  else
3411  pFrame = pFrame->GetUpper();
3412  } while( pFrame );
3413 
3414  return false;
3415 }
3416 
3418 {
3419  if ( pCell->Lower()->IsContentFrame() || pCell->Lower()->IsSctFrame() )
3420  {
3421  SwFrame *pLow = pCell->Lower();
3422  long nHeight = 0, nFlyAdd = 0;
3423  do
3424  {
3425  long nLow = pLow->getFrameArea().Height();
3426  if( pLow->IsTextFrame() && static_cast<SwTextFrame*>(pLow)->IsUndersized() )
3427  nLow += static_cast<SwTextFrame*>(pLow)->GetParHeight()-pLow->getFramePrintArea().Height();
3428  else if( pLow->IsSctFrame() && static_cast<SwSectionFrame*>(pLow)->IsUndersized() )
3429  nLow += static_cast<SwSectionFrame*>(pLow)->Undersize();
3430  nFlyAdd = std::max( 0L, nFlyAdd - nLow );
3431  nFlyAdd = std::max( nFlyAdd, ::CalcHeightWithFlys( pLow ) );
3432  nHeight += nLow;
3433  pLow = pLow->GetNext();
3434  } while ( pLow );
3435  if ( nFlyAdd )
3436  nHeight += nFlyAdd;
3437 
3438  // The border cannot be calculated based on PrtArea and Frame, since both can be invalid.
3439  SwBorderAttrAccess aAccess( SwFrame::GetCache(), pCell );
3440  const SwBorderAttrs &rAttrs = *aAccess.Get();
3441  nHeight += rAttrs.CalcTop() + rAttrs.CalcBottom();
3442 
3443  return pCell->getFrameArea().Height() - nHeight;
3444  }
3445  else
3446  {
3447  long nRstHeight = 0;
3448  SwFrame *pLow = pCell->Lower();
3449  while (pLow && pLow->IsLayoutFrame())
3450  {
3451  nRstHeight += ::CalcRowRstHeight(static_cast<SwLayoutFrame*>(pLow));
3452  pLow = pLow->GetNext();
3453  }
3454  return nRstHeight;
3455  }
3456 }
3457 
3459 {
3460  SwFrame *pLow = pRow->Lower();
3461  if (!(pLow && pLow->IsLayoutFrame()))
3462  {
3463  return 0;
3464  }
3465  SwTwips nRstHeight = LONG_MAX;
3466  while (pLow && pLow->IsLayoutFrame())
3467  {
3468  nRstHeight = std::min(nRstHeight, ::lcl_CalcCellRstHeight(static_cast<SwLayoutFrame*>(pLow)));
3469  pLow = pLow->GetNext();
3470  }
3471  return nRstHeight;
3472 }
3473 
3474 const SwFrame* FindPage( const SwRect &rRect, const SwFrame *pPage )
3475 {
3476  if ( !rRect.IsOver( pPage->getFrameArea() ) )
3477  {
3478  const SwRootFrame* pRootFrame = static_cast<const SwRootFrame*>(pPage->GetUpper());
3479  const SwFrame* pTmpPage = pRootFrame ? pRootFrame->GetPageAtPos( rRect.TopLeft(), &rRect.SSize(), true ) : nullptr;
3480  if ( pTmpPage )
3481  pPage = pTmpPage;
3482  }
3483 
3484  return pPage;
3485 }
3486 
3488 {
3490  bool bSet;
3491  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
3492 public:
3493  SwFrameHolder() : pFrame(nullptr), bSet(false) {}
3494  void SetFrame( SwFrame* pHold );
3495  SwFrame* GetFrame() { return pFrame; }
3496  void Reset();
3497  bool IsSet() const { return bSet; }
3498 };
3499 
3501 {
3502  bSet = true;
3503  if (pFrame != pHold)
3504  {
3505  if (pFrame)
3506  EndListening(*pFrame);
3507  StartListening(*pHold);
3508  pFrame = pHold;
3509  }
3510 }
3511 
3513 {
3514  if (pFrame)
3515  EndListening(*pFrame);
3516  bSet = false;
3517  pFrame = nullptr;
3518 }
3519 
3521 {
3522  if ( rHint.GetId() == SfxHintId::Dying && &rBC == pFrame )
3523  {
3524  pFrame = nullptr;
3525  }
3526 }
3527 
3528 SwFrame* GetFrameOfModify(SwRootFrame const*const pLayout, SwModify const& rMod,
3529  SwFrameType const nFrameType, SwPosition const*const pPos,
3530  std::pair<Point, bool> const*const pViewPosAndCalcFrame)
3531 {
3532  SwFrame *pMinFrame = nullptr, *pTmpFrame;
3533  SwFrameHolder aHolder;
3534  SwRect aCalcRect;
3535  bool bClientIterChanged = false;
3536 
3538  do {
3539  pMinFrame = nullptr;
3540  aHolder.Reset();
3541  sal_uInt64 nMinDist = 0;
3542  bClientIterChanged = false;
3543 
3544  for( pTmpFrame = aIter.First(); pTmpFrame; pTmpFrame = aIter.Next() )
3545  {
3546  if( pTmpFrame->GetType() & nFrameType &&
3547  ( !pLayout || pLayout == pTmpFrame->getRootFrame() ) &&
3548  (!pTmpFrame->IsFlowFrame() ||
3549  !SwFlowFrame::CastFlowFrame( pTmpFrame )->IsFollow() ))
3550  {
3551  if (pViewPosAndCalcFrame)
3552  {
3553  // watch for Frame being deleted
3554  if ( pMinFrame )
3555  aHolder.SetFrame( pMinFrame );
3556  else
3557  aHolder.Reset();
3558 
3559  if (pViewPosAndCalcFrame->second)
3560  {
3561  // tdf#108118 prevent recursion
3562  DisableCallbackAction a(*pTmpFrame->getRootFrame());
3563  // - format parent Writer
3564  // fly frame, if it isn't been formatted yet.
3565  // Note: The Writer fly frame could be the frame itself.
3566  SwFlyFrame* pFlyFrame( pTmpFrame->FindFlyFrame() );
3567  if ( pFlyFrame &&
3568  pFlyFrame->getFrameArea().Pos().X() == FAR_AWAY &&
3569  pFlyFrame->getFrameArea().Pos().Y() == FAR_AWAY )
3570  {
3571  SwObjectFormatter::FormatObj( *pFlyFrame );
3572  }
3573  pTmpFrame->Calc(pLayout ? pLayout->GetCurrShell()->GetOut() : nullptr);
3574  }
3575 
3576  // aIter.IsChanged checks if the current pTmpFrame has been deleted while
3577  // it is the current iterator
3578  // FrameHolder watches for deletion of the current pMinFrame
3579  if( aIter.IsChanged() || ( aHolder.IsSet() && !aHolder.GetFrame() ) )
3580  {
3581  // restart iteration
3582  bClientIterChanged = true;
3583  break;
3584  }
3585 
3586  // for Flys go via the parent if the Fly is not yet "formatted"
3587  if (!pViewPosAndCalcFrame->second &&
3588  pTmpFrame->GetType() & SwFrameType::Fly &&
3589  static_cast<SwFlyFrame*>(pTmpFrame)->GetAnchorFrame() &&
3590  FAR_AWAY == pTmpFrame->getFrameArea().Pos().getX() &&
3591  FAR_AWAY == pTmpFrame->getFrameArea().Pos().getY() )
3592  aCalcRect = static_cast<SwFlyFrame*>(pTmpFrame)->GetAnchorFrame()->getFrameArea();
3593  else
3594  aCalcRect = pTmpFrame->getFrameArea();
3595 
3596  if (aCalcRect.IsInside(pViewPosAndCalcFrame->first))
3597  {
3598  pMinFrame = pTmpFrame;
3599  break;
3600  }
3601 
3602  // Point not in rectangle. Compare distances:
3603  const Point aCalcRectCenter = aCalcRect.Center();
3604  const Point aDiff = aCalcRectCenter - pViewPosAndCalcFrame->first;
3605  const sal_uInt64 nCurrentDist = sal_Int64(aDiff.getX()) * sal_Int64(aDiff.getX()) + sal_Int64(aDiff.getY()) * sal_Int64(aDiff.getY()); // opt: no sqrt
3606  if ( !pMinFrame || nCurrentDist < nMinDist )
3607  {
3608  pMinFrame = pTmpFrame;
3609  nMinDist = nCurrentDist;
3610  }
3611  }
3612  else
3613  {
3614  // if no pViewPosAndCalcFrame is provided, take the first one
3615  pMinFrame = pTmpFrame;
3616  break;
3617  }
3618  }
3619  }
3620  } while( bClientIterChanged );
3621 
3622  if( pPos && pMinFrame && pMinFrame->IsTextFrame() )
3623  return static_cast<SwTextFrame*>(pMinFrame)->GetFrameAtPos( *pPos );
3624 
3625  return pMinFrame;
3626 }
3627 
3628 bool IsExtraData( const SwDoc *pDoc )
3629 {
3630  const SwLineNumberInfo &rInf = pDoc->GetLineNumberInfo();
3631  return rInf.IsPaintLineNumbers() ||
3632  rInf.IsCountInFlys() ||
3633  (static_cast<sal_Int16>(SW_MOD()->GetRedlineMarkPos()) != text::HoriOrientation::NONE &&
3635 }
3636 
3637 // OD 22.09.2003 #110978#
3639 {
3640  SwRect aPrtWithoutHeaderFooter( getFramePrintArea() );
3641  aPrtWithoutHeaderFooter.Pos() += getFrameArea().Pos();
3642 
3643  const SwFrame* pLowerFrame = Lower();
3644  while ( pLowerFrame )
3645  {
3646  // Note: independent on text direction page header and page footer are
3647  // always at top respectively at bottom of the page frame.
3648  if ( pLowerFrame->IsHeaderFrame() )
3649  {
3650  aPrtWithoutHeaderFooter.Top( aPrtWithoutHeaderFooter.Top() +
3651  pLowerFrame->getFrameArea().Height() );
3652  }
3653  if ( pLowerFrame->IsFooterFrame() )
3654  {
3655  aPrtWithoutHeaderFooter.Bottom( aPrtWithoutHeaderFooter.Bottom() -
3656  pLowerFrame->getFrameArea().Height() );
3657  }
3658 
3659  pLowerFrame = pLowerFrame->GetNext();
3660  }
3661 
3662  return aPrtWithoutHeaderFooter;
3663 }
3664 
3671 void GetSpacingValuesOfFrame( const SwFrame& rFrame,
3672  SwTwips& onLowerSpacing,
3673  SwTwips& onLineSpacing,
3674  bool& obIsLineSpacingProportional )
3675 {
3676  if ( !rFrame.IsFlowFrame() )
3677  {
3678  onLowerSpacing = 0;
3679  onLineSpacing = 0;
3680  }
3681  else
3682  {
3683  const SvxULSpaceItem& rULSpace = rFrame.GetAttrSet()->GetULSpace();
3684  onLowerSpacing = rULSpace.GetLower();
3685 
3686  onLineSpacing = 0;
3687  obIsLineSpacingProportional = false;
3688  if ( rFrame.IsTextFrame() )
3689  {
3690  onLineSpacing = static_cast<const SwTextFrame&>(rFrame).GetLineSpace();
3691  obIsLineSpacingProportional =
3692  onLineSpacing != 0 &&
3693  static_cast<const SwTextFrame&>(rFrame).GetLineSpace( true ) == 0;
3694  }
3695 
3696  OSL_ENSURE( onLowerSpacing >= 0 && onLineSpacing >= 0,
3697  "<GetSpacingValuesOfFrame(..)> - spacing values aren't positive!" );
3698  }
3699 }
3700 
3703 {
3704  const SwContentFrame* pContent = rCell.ContainsContent();
3705  const SwTabFrame* pTab = rCell.FindTabFrame();
3706 
3707  while ( pContent && rCell.IsAnLower( pContent ) )
3708  {
3709  const SwTabFrame* pTmpTab = pContent->FindTabFrame();
3710  if ( pTmpTab != pTab )
3711  {
3712  SwFrame const*const pTmp = pTmpTab->FindLastContentOrTable();
3713  if (pTmp)
3714  {
3715  pContent = pTmp->FindNextCnt();
3716  }
3717  else
3718  {
3719  pContent = nullptr;
3720  }
3721  }
3722  else
3723  break;
3724  }
3725  return pContent;
3726 }
3727 
3729  : mpFrame( pFrame )
3730  , mpRegIn( pFrame
3731  ? pFrame->IsTextFrame()
3732  // sw_redlinehide: GetDep() may be a member of SwTextFrame!
3733  ? static_cast<SwTextFrame const*>(pFrame)->GetTextNodeFirst()
3734  : const_cast<SwFrame*>(pFrame)->GetDep()
3735  : nullptr )
3736 {
3737 }
3738 
3741 {
3742  if ( !mpFrame || !mpRegIn )
3743  return false;
3744 
3746  SwFrame* pLast = aIter.First();
3747  while ( pLast )
3748  {
3749  if ( pLast == mpFrame )
3750  return false;
3751  pLast = aIter.Next();
3752  }
3753 
3754  return true;
3755 }
3756 
3757 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool m_bJoinedWithPrev
Definition: frmtool.hxx:312
SwTwips mnFlyAnchorOfstNoWrap
Definition: frmtool.hxx:214
long GetLeft() const
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:206
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:341
Point TopLeft() const
bool GetValue() const
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:547
Starts a section of nodes in the document model.
Definition: node.hxx:303
sal_uInt16 CalcBottomLine() const
Definition: frmtool.hxx:484
bool IsContour() const
Definition: fmtsrnd.hxx:53
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2721
Base class for the following contact objects (frame + draw objects).
Definition: dcontact.hxx:66
Base class of the Writer layout elements.
Definition: frame.hxx:295
Base class that provides the general functionalities for frames that are allowed at page breaks (flow...
Definition: flowfrm.hxx:58
SwFlyNotify(SwFlyFrame *pFlyFrame)
Definition: frmtool.cxx:626
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
SdrObject * GetDrawObjectByAnchorFrame(const SwFrame &_rAnchorFrame)
get drawing object ('master' or 'virtual') by frame.
Definition: dcontact.cxx:833
bool m_bBottom
Definition: frmtool.hxx:298
void InvalidateInfFlags()
Definition: frame.hxx:586
void InvalidateAccessibleFrameContent(const SwFrame *pFrame)
Invalidate accessible frame's content.
Definition: viewimp.cxx:339
void NotifyDrawObj()
Definition: fly.cxx:2429
const SdrObject * Next()
Definition: frmtool.cxx:2503
sal_uLong GetIndex() const
Definition: node.hxx:282
static void lcl_SetPos(SwFrame &_rNewFrame, const SwLayoutFrame &_rLayFrame)
local method to set 'working' position for newly inserted frames
Definition: frmtool.cxx:1361
const SvxBoxItem & m_rBox
Definition: frmtool.hxx:287
bool IsFlyLayFrame() const
Definition: flyfrm.hxx:195
sal_uInt16 m_nLeftLine
Definition: frmtool.hxx:316
void ColLock()
Definition: ftnfrm.hxx:121
bool IsFollow() const
Definition: flowfrm.hxx:166
Point GetPos(const SwRect &rRect) const
Definition: frame.hxx:1359
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2810
void RemoveFromList(SwSectionFrame *pSct)
Definition: rootfrm.hxx:376
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:543
void SetCallbackActionEnabled(bool b)
Definition: rootfrm.hxx:381
bool IsSet() const
Definition: frmtool.cxx:3497
bool m_bTopLine
Definition: frmtool.hxx:293
Marks a position in the document model.
Definition: pam.hxx:35
virtual const tools::Rectangle & GetCurrentBoundRect() const
SwFrame * mpNext
Definition: frame.hxx:319
SwFrame * mpPrev
Definition: frame.hxx:320
bool IsSectionNode() const
Definition: node.hxx:644
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:98
SwFrame * mpFrame
Definition: frmtool.hxx:210
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:758
void Init()
const SwPageFrame * GetPageAtPos(const Point &rPt, const Size *pSize=nullptr, bool bExtend=false) const
Point rPt: The point that should be used to find the page Size pSize: If given, we return the (first)...
Definition: findfrm.cxx:572
bool IsInFly() const
Definition: frame.hxx:937
SwRect & Union(const SwRect &rRect)
Definition: swrect.cxx:39
const SwFrame * m_pConstructor
Definition: frmtool.hxx:399
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1462
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:218
sal_uInt16 GetLower() const
bool IsInSct() const
Definition: frame.hxx:943
bool CheckControlLayer(const SdrObject *pObj)
Definition: dcontact.cxx:656
bool MoveFwd(bool bMakePage, bool bPageBreak, bool bMoveAlways=false)
Return value tells us whether the Frame has changed the page.
Definition: flowfrm.cxx:1836
const SwPageFrame * m_pPage
Definition: frmtool.hxx:415
drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: findfrm.cxx:691
void ClearImpl()
Definition: laycache.cxx:440
bool m_bRightLine
Definition: frmtool.hxx:296
bool IsAnyShellAccessible() const
Definition: rootfrm.hxx:384
const SwLineNumberInfo & GetLineNumberInfo() const
Definition: lineinfo.cxx:49
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:112
SwViewShellImp * Imp()
Definition: viewsh.hxx:185
void DelEmpty(bool bRemove)
Definition: sectfrm.cxx:185
bool IsLowerOf(const SwLayoutFrame *pUpper) const
Definition: fly.cxx:2109
SwFootnoteFrame * ImplFindFootnoteFrame()
Definition: findfrm.cxx:504
static void CheckPageDescs(SwPageFrame *pStart, bool bNotifyFields=true, SwPageFrame **ppPrev=nullptr)
Check all pages (starting from the given one) if they use the right frame format. ...
Definition: pagechg.cxx:1002
const SvxBrushItem & GetBackground(bool=true) const
Definition: frmatr.hxx:58
void RestoreContent(SwFrame *pSav, SwLayoutFrame *pParent, SwFrame *pSibling)
Definition: frmtool.cxx:2781
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
const SwRect & getFrameArea() const
Definition: frmtool.hxx:223
~SwFrameNotify() COVERITY_NOEXCEPT_FALSE
Definition: frmtool.cxx:107
bool bObjsDirect
Definition: frmtool.cxx:79
void ColLock()
Definition: sectfrm.hxx:86
bool IsColLocked() const
Definition: frame.hxx:862
bool SplitSect(SwFrame *pFrame, bool bApres)
Splits the SectionFrame surrounding the pFrame up in two parts: pFrame and the start of the 2nd part...
Definition: sectfrm.cxx:506
SwTwips mnHeightOfLastLine
Definition: frmtool.hxx:254
bool IsKeep(SvxFormatKeepItem const &rKeep, SvxFormatBreakItem const &rBreak, bool bBreakCheck=false) const
method to determine if a Keep needs to be considered (Breaks!)
Definition: flowfrm.cxx:179
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
SwNodeIndex nNode
Definition: pam.hxx:37
GPOS_NONE
void SetCompletePaint() const
Definition: frame.hxx:970
bool IsInFootnote() const
Definition: frame.hxx:925
SwFrameType GetType() const
Definition: frame.hxx:498
bool IsNoMoveOnCheckClip() const
Definition: flyfrms.hxx:88
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:284
sal_uIntPtr sal_uLong
std::shared_ptr< SvxLRSpaceItem > m_rLR
Definition: frmtool.hxx:286
const SwRect & getFramePrintArea() const
Definition: frame.hxx:176
void SetConsiderForTextWrap(const bool _bConsiderForTextWrap)
const SwParaConnectBorderItem & GetParaConnectBorder(bool=true) const
Definition: paratr.hxx:208
static SwCache & GetCache()
Definition: frame.hxx:500
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:30
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:219
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:438
bool JoinedWithPrev(const SwFrame &_rFrame, const SwFrame *_pPrevFrame=nullptr) const
Definition: frmtool.cxx:2359
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1147
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e...
static sal_uInt8 nCnt
Definition: frmtool.hxx:431
void InvalidateSize_()
Definition: frame.hxx:749
Definition: doc.hxx:185
SwFrame * FindPrev()
Definition: frame.hxx:1131
void Unlock()
Definition: flyfrm.hxx:124
TElementType * Next()
Definition: calbck.hxx:373
SwLayNotify(SwLayoutFrame *pLayFrame)
Definition: frmtool.cxx:414
bool HasFollow() const
Definition: flowfrm.hxx:165
helper class to disable creation of an action by a callback event in particular, change event from a ...
Definition: rootfrm.hxx:440
void Height(long nNew)
Definition: swrect.hxx:189
bool m_bJoinedWithNext
Definition: frmtool.hxx:313
void Prev()
Definition: frmtool.cxx:2531
const SvxShadowItem & GetShadow() const
Definition: frmtool.hxx:366
void InvalidatePos()
Definition: frame.hxx:1019
void Invalidate_(SwPageFrame const *pPage=nullptr)
Definition: fly.cxx:1035
SwFrameNotify(SwFrame *pFrame)
Definition: frmtool.cxx:86
virtual void CalcAndSetScale(svt::EmbeddedObjectRef &xObj, const SwRect *pFlyPrtRect=nullptr, const SwRect *pFlyFrameRect=nullptr, const bool bNoTextFramePrtAreaChanged=false)=0
Client for OleObject has to be up-to-date regarding scaling.
bool JoinWithCmp(const SwFrame &_rCallerFrame, const SwFrame &_rCmpFrame) const
Definition: frmtool.cxx:2271
static void lcl_CheckFlowBack(SwFrame *pFrame, const SwRect &rRect)
Definition: frmtool.cxx:3072
Helps during the InsertCnt_ function to create new pages.
Definition: layhelp.hxx:102
void SetInCache(bool bNew)
Definition: calbck.hxx:215
long CalcHeightWithFlys(const SwFrame *pFrame)
Definition: tabfrm.cxx:3791
long SwTwips
Definition: swtypes.hxx:49
sal_uInt16 CalcTopLine() const
Definition: frmtool.hxx:478
bool IsVert() const
Definition: frame.hxx:1343
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:382
void Pos(const Point &rNew)
Definition: swrect.hxx:167
void Reset()
Definition: frmtool.cxx:3512
sal_uInt16 m_nRightLine
Definition: frmtool.hxx:316
SwFrame * FindNext()
Definition: frame.hxx:1117
bool IsCellFrame() const
Definition: frame.hxx:1202
bool supportsFullDrawingLayerFillAttributeSet() const
Definition: findfrm.cxx:707
void Top()
Definition: frmtool.cxx:2450
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
virtual const SvxFormatBreakItem & GetBreakItem() const
Definition: findfrm.cxx:654
long CalcRight(const SwFrame *pCaller) const
Definition: frmtool.cxx:2107
const void * m_pOwner
Definition: swcache.hxx:202
bool IsDestroyFrameAnchoredAtChar(SwPosition const &rAnchorPos, SwPosition const &rStart, SwPosition const &rEnd, DelContentType const nDelContentType)
will DelContentIndex destroy a frame anchored at character at rAnchorPos?
Definition: undobj.cxx:1547
const editeng::SvxBorderLine * GetRight() const
bool IsFlyLock() const
Definition: flowfrm.hxx:230
static SwFlowFrame * CastFlowFrame(SwFrame *pFrame)
Definition: flowfrm.cxx:2622
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
Frame cannot be moved in Var-direction.
Definition: fmtfsize.hxx:38
bool IsCountInFlys() const
Definition: lineinfo.hxx:86
The root element of a Writer document layout.
Definition: rootfrm.hxx:79
SwContact * GetUserCall(const SdrObject *pObj)
Returns the UserCall if applicable from the group object.
Definition: dcontact.cxx:170
css::chart::ChartAxisLabelPosition ePos
static void lcl_RemoveObjsFromPage(SwFrame *_pFrame)
Keep and restore the substructure of a layout frame for an action.
Definition: frmtool.cxx:2568
bool IsFootnoteFrame() const
Definition: frame.hxx:1178
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:737
SfxHintId GetId() const
static bool bFootnote
Definition: insfnote.cxx:40
SwCacheObj * Get(bool isDuplicateOwnerAllowed)
Definition: swcache.hxx:248
void CheckDirChange()
checks the layout direction and invalidates the lower frames recursively, if necessary.
Definition: ssfrm.cxx:190
SwDrawVirtObj * AddVirtObj()
add a 'virtual' drawing object to drawing page.
Definition: dcontact.cxx:807
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:190
const SwSection & GetSection() const
Definition: node.hxx:541
bool IsFlyAtContentFrame() const
Definition: flyfrm.hxx:196
virtual SwCacheObj * NewObj() override
Can be use in NewObj.
Definition: frmtool.cxx:2433
virtual void UnblockIdling()=0
Decrement block count.
Point TopLeft() const
Definition: swrect.cxx:174
void RemoveFlyFromPage(SwFlyFrame *pToRemove)
Definition: flylay.cxx:902
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
void CalcBottomLine_()
Definition: frmtool.cxx:2213
void SetRetouche() const
Definition: frame.hxx:979
long CalcLeft(const SwFrame *pCaller) const
Definition: frmtool.cxx:2155
bool IsFrameInSameContext(const SwFrame *pInnerFrame, const SwFrame *pFrame)
Definition: frmtool.cxx:3390
GPOS_TILED
void InvalidateObjs(const bool _bNoInvaOfAsCharAnchoredObjs=true)
Definition: fly.cxx:2293
bool IsFlyFrame() const
Definition: frame.hxx:1186
sal_uInt16 CalcLeftLine() const
Definition: frmtool.hxx:490
void InvalidateNextPrtArea()
method to invalidate printing area of next frame #i11859#
Definition: findfrm.cxx:1279
long TopDist(const SwRect &rRect, long nPos) const
Definition: frame.hxx:1389
void ChgLowersProp(const Size &rOldSize)
Change size of lowers proportionally.
Definition: wsfrm.cxx:2954
wrapper class for the positioning of Writer fly frames and drawing objects
virtual bool IsUpdateExpField() const =0
const void * m_pOwner
Definition: swcache.hxx:160
bool DoesContainAtPageObjWithContentAnchor()
Definition: doc.hxx:566
SvxGraphicPosition GetGraphicPos() const
void AppendFly(SwFlyFrame *pNew)
Definition: fly.cxx:2128
void Top(const long nTop)
Definition: swrect.hxx:202
bool IsMoveable(const SwLayoutFrame *_pLayoutFrame=nullptr) const
determine, if frame is moveable in given environment
Definition: findfrm.cxx:1359
const SwFrame * GetVirtualUpper(const SwFrame *pFrame, const Point &rPos)
Provides the Upper of an anchor in paragraph-bound objects.
Definition: frmtool.cxx:3312
void Notify_Background(const SdrObject *pObj, SwPageFrame *pPage, const SwRect &rRect, const PrepareHint eHint, const bool bInva)
Definition: frmtool.cxx:3134
SwBorderAttrs(const SwModify *pOwner, const SwFrame *pConstructor)
Definition: frmtool.cxx:2035
SdrPage * getSdrPageFromSdrObject() const
bool IsLowersComplete() const
Definition: frmtool.hxx:236
const SwFrame * GetAnchorFrame(const SdrObject *_pDrawObj=nullptr) const
Definition: dcontact.cxx:781
bool empty() const
Definition: docary.hxx:367
const SwRect & getFrameArea() const
Definition: frame.hxx:175
bool getBrowseMode() const
Definition: viewopt.hxx:433
bool IsInTab() const
Definition: frame.hxx:931
bool m_bCachedGetBottomLine
Definition: frmtool.hxx:305
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:965
const SvxShadowItem & m_rShadow
Definition: frmtool.hxx:288
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
virtual void UpdateTableFields(SfxPoolItem *pHt)=0
SwFrame * MakeFrame(SwFrame *)
Definition: ndsect.cxx:1012
bool IsTextFrame() const
Definition: frame.hxx:1210
void InsertCnt_(SwLayoutFrame *pLay, SwDoc *pDoc, sal_uLong nIndex, bool bPages, sal_uLong nEndIndex, SwFrame *pPrv, sw::FrameMode const eMode)
Definition: frmtool.cxx:1380
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:38
void InvalidateFlyContent() const
Definition: pagefrm.hxx:351
void CalcJoinedWithNext(const SwFrame &_rFrame)
Definition: frmtool.cxx:2328
void CalcTopLine_()
Definition: frmtool.cxx:2206
bool IsStartNode() const
Definition: node.hxx:624
void CalcJoinedWithPrev(const SwFrame &_rFrame, const SwFrame *_pPrevFrame)
Definition: frmtool.cxx:2293
bool mbHadFollow
Definition: frmtool.hxx:215
std::vector< SwFrameFormat * > const * GetAnchoredFlys() const
Definition: node.hxx:288
void Lock()
Definition: flyfrm.hxx:123
void GetTopLine_(const SwFrame &_rFrame, const SwFrame *_pPrevFrame)
Definition: frmtool.cxx:2383
const SwTable & GetTable() const
Definition: node.hxx:497
bool m_bLeftLine
Definition: frmtool.hxx:295
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
bool empty() const
Definition: docary.hxx:224
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:954
bool IsSctFrame() const
Definition: frame.hxx:1190
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1087
bool mbInvaKeep
Definition: frmtool.hxx:216
void Right(const long nRight)
Definition: swrect.hxx:198
const SwRect aFrameAndSpace
Definition: frmtool.hxx:242
void AppendObjs(const SwFrameFormats *const pTable, sal_uLong const nIndex, SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc)
Definition: frmtool.cxx:1213
SdrObject * DrawObj()
const SwRect maPrt
Definition: frmtool.hxx:212
bool IsFlyInContentFrame() const
Definition: flyfrm.hxx:193
const SwRect maFrame
Definition: frmtool.hxx:211
bool IsFlowFrame() const
Definition: frame.hxx:1218
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:56
SwFrame * AnchorFrame()
SwPageFrame *const pOldPage
Definition: frmtool.hxx:241
sal_uInt32 GetOrdNumDirect() const
Specific frame formats (frames, DrawObjects).
Definition: docary.hxx:201
SwLayoutCache * GetLayoutCache() const
Definition: doc.hxx:1533
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame, use GetBreakItem()/GetPageDescItem() instead.
Definition: findfrm.cxx:674
void InvalidateContent() const
Definition: pagefrm.hxx:363
const SwFrame & GetFrame() const
Definition: flowfrm.hxx:151
FrameMode
Definition: txtfrm.hxx:102
long getY() const
bool IsColumnFrame() const
Definition: frame.hxx:1158
const SwContentFrame * GetCellContent(const SwLayoutFrame &rCell)
get the content of the table cell, skipping content from nested tables
Definition: frmtool.cxx:3702
void AppendObj(SwFrame *const pFrame, SwPageFrame *const pPage, SwFrameFormat *const pFormat, const SwFormatAnchor &rAnch)
Definition: frmtool.cxx:977
long getX() const
bool ConsiderForTextWrap() const
bool IsEmpty() const
Definition: txtfrm.hxx:509
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1083
bool IsContentNode() const
Definition: node.hxx:628
bool FrameContainsNode(SwContentFrame const &rFrame, sal_uLong nNodeIndex)
Definition: txtfrm.cxx:296
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1300
const editeng::SvxBorderLine * GetTop() const
SwFrame * FindLastContentOrTable()
Definition: tabfrm.cxx:3337
Style of a layout element.
Definition: frmfmt.hxx:57
SwFrame * GetFrameOfModify(SwRootFrame const *const pLayout, SwModify const &rMod, SwFrameType const nFrameType, SwPosition const *const pPos, std::pair< Point, bool > const *const pViewPosAndCalcFrame)
Definition: frmtool.cxx:3528
PrepareHint
Definition: swtypes.hxx:204
SwTabFrame * FindMaster(bool bFirstMaster=false) const
Definition: flowfrm.cxx:717
bool IsContentFrame() const
Definition: frame.hxx:1206
#define SW_MOD()
Definition: swmodule.hxx:256
SwFrame * GetIndPrev() const
Definition: frame.hxx:702
const editeng::SvxBorderLine * GetLeft() const
const SdrObject * GetDrawObj() const
void InvalidatePrt()
Definition: frame.hxx:1012
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:118
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
void MoveAccessibleFrame(const SwFrame *pFrame, const SwRect &rOldFrame)
Definition: viewimp.hxx:290
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1817
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
SwFrameType
Definition: frame.hxx:72
void ClearLRSpaceItemDueToListLevelIndents(std::shared_ptr< SvxLRSpaceItem > &o_rLRSpaceItem) const
Definition: ndtxt.cxx:3291
SwFrame * GetIndNext()
Definition: frame.hxx:705
SwPageFrame * InsertNewPage(SwPageDesc &rDesc, SwFrame *pUpper, bool bOdd, bool bFirst, bool bInsertEmpty, bool bFootnote, SwFrame *pSibling)
Definition: frmtool.cxx:2869
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:160
SwFrameFormat * GetFormat()
Definition: dcontact.hxx:112
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
void RemoveHiddenObjsOfNode(SwTextNode const &rNode, std::vector< sw::Extent >::const_iterator const *const pIter, std::vector< sw::Extent >::const_iterator const *const pEnd, SwTextNode const *const pFirstNode, SwTextNode const *const pLastNode)
Definition: frmtool.cxx:1140
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
size_t size() const
Definition: sortedobjs.cxx:42
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
sal_uInt16 m_nTopLine
Definition: frmtool.hxx:316
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
SwFrame * m_pLower
Definition: layfrm.hxx:53
SwFrame * GetFrame()
Definition: frmtool.cxx:3495
bool CmpLeftRight(const SwBorderAttrs &rCmpAttrs, const SwFrame *pCaller, const SwFrame *pCmp) const
Definition: frmtool.cxx:2260
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
Definition: pagedesc.cxx:362
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
Definition: flylay.cxx:1046
SwOrderIter(const SwPageFrame *pPage)
Definition: frmtool.cxx:2444
SwTabFrame * MakeFrame(SwFrame *)
Definition: ndtbl.cxx:2325
const SwFrame * Lower() const
Definition: layfrm.hxx:101
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:190
TElementType * First()
Definition: calbck.hxx:342
int i
static SwModify const * GetCacheOwner(SwFrame const &rFrame)
Definition: frmtool.cxx:2415
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
Definition: wsfrm.cxx:597
FlyAnchors.
Definition: fmtanchr.hxx:34
bool IsJoinLocked() const
Definition: flowfrm.hxx:175
static void lcl_AddObjsToPage(SwFrame *_pFrame, SwPageFrame *_pPage)
Definition: frmtool.cxx:2731
void SetFollow(SwFlowFrame *const pFollow)
Definition: flowfrm.cxx:91
const SwFrameFormat * GetEmptyPageFormat() const
Definition: doc.hxx:742
SwDoc * GetDoc()
Definition: node.hxx:702
bool IsAction() const
SS for the Lay-/IdleAction and relatives.
Definition: viewimp.hxx:188
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void ActionChanged() const
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
bool HasArea() const
Definition: swrect.hxx:290
const SvxBoxItem & GetBox() const
Definition: frmtool.hxx:365
bool PosDiff(const SwRect &rRect1, const SwRect &rRect2) const
Definition: frame.hxx:1347
static void lcl_InvalidatePosOfLowers(SwLayoutFrame &_rLayoutFrame)
Definition: frmtool.cxx:423
const SwFrame * mpFrame
Definition: frmtool.hxx:567
SwBorderAttrAccess(SwCache &rCache, const SwFrame *pOwner)
Definition: frmtool.cxx:2425
SvxGraphicPosition
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
SwFrameSize GetWidthSizeType() const
Definition: fmtfsize.hxx:83
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
void LockJoin()
Definition: flowfrm.hxx:139
bool IsRowFrame() const
Definition: frame.hxx:1198
sal_uInt32 GetOrdNum() const
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:393
SwFlyFrame * ImplFindFlyFrame()
Definition: findfrm.cxx:516
bool ObjAnchoredAtPage() const
Definition: dcontact.hxx:146
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
SvxInterLineSpaceRule GetInterLineSpaceRule() const
bool IsRetoucheFrame() const
Definition: frame.hxx:1222
SwFrame * GetPrev()
Definition: frame.hxx:655
SwLayoutFrame * mpUpper
Definition: frame.hxx:318
static bool bLocked
Definition: frmtool.hxx:432
sal_uInt16 m_nBottom
Definition: frmtool.hxx:316
const SdrObject * m_pCurrent
Definition: frmtool.hxx:416
Marks a node in the document model.
Definition: ndindex.hxx:31
SwRect PrtWithoutHeaderAndFooter() const
Definition: frmtool.cxx:3638
bool IsChanged() const
Definition: calbck.hxx:327
bool IsEndNode() const
Definition: node.hxx:632
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:693
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Definition: paratr.hxx:178
void AppendObjsOfNode(SwFrameFormats const *const pTable, sal_uLong const nIndex, SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc, std::vector< sw::Extent >::const_iterator const *const pIter, std::vector< sw::Extent >::const_iterator const *const pEnd, SwTextNode const *const pFirstNode, SwTextNode const *const pLastNode)
Definition: frmtool.cxx:1166
ring_container GetRingContainer()
Definition: ring.hxx:240
bool m_bCachedJoinedWithNext
Definition: frmtool.hxx:310
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void MoveFly(SwFlyFrame *pToMove, SwPageFrame *pDest)
Definition: flylay.cxx:950
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
void SSize(const Size &rNew)
Definition: swrect.hxx:176
bool HasFixSize() const
Definition: frame.hxx:648
bool isFrameAreaSizeValid() const
Definition: frame.hxx:163
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const =0
bool IsNotifyBack() const
Definition: flyfrm.hxx:198
SwContentNotify(SwContentFrame *pContentFrame)
Definition: frmtool.cxx:731
bool mbBordersJoinedWithPrev
Definition: frmtool.hxx:258
void InvalidatePos_()
Definition: frame.hxx:765
void SetFrame(SwFrame *pHold)
Definition: frmtool.cxx:3500
SwTwips CalcRowRstHeight(SwLayoutFrame *pRow)
Definition: frmtool.cxx:3458
A page of the document layout.
Definition: pagefrm.hxx:40
static void lcl_Regist(SwPageFrame *pPage, const SwFrame *pAnch)
Definition: frmtool.cxx:2926
bool mbChkHeightOfLastLine
Definition: frmtool.hxx:253
SwDeletionChecker(const SwFrame *pFrame)
Definition: frmtool.cxx:3728
const SwFrame * FindPage(const SwRect &rRect, const SwFrame *pPage)
Definition: frmtool.cxx:3474
SwTextFrame * MakeTextFrame(SwTextNode &rNode, SwFrame *, sw::FrameMode eMode)
Definition: txtfrm.cxx:808
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: frmtool.cxx:3520
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:552
void CalcRightLine_()
Definition: frmtool.cxx:2227
enumrange< T >::Iterator end(enumrange< T >)
const long LONG_MAX
sal_uInt16 CalcTop() const
Definition: frmtool.hxx:502
Point Center() const
Definition: swrect.cxx:33
bool IsExtraData(const SwDoc *pDoc)
Definition: frmtool.cxx:3628
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:37
SwBorderAttrs * Get()
Definition: frmtool.cxx:2439
bool m_bCacheGetLine
Definition: frmtool.hxx:303
void InvalidateSize()
Definition: frame.hxx:1005
SwTwips mnFlyAnchorOfst
Definition: frmtool.hxx:213
bool ShouldRowKeepWithNext(const bool bCheckParents=true) const
Definition: tabfrm.cxx:4661
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1091
#define RES_LR_SPACE
Definition: hintids.hxx:198
void CalcTop_()
Definition: frmtool.cxx:2095
SwFrame * FindColFrame()
Definition: findfrm.cxx:529
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
bool CalcHiddenFlag() const
Definition: section.cxx:336
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2430
void sw_RemoveFootnotes(SwFootnoteBossFrame *pBoss, bool bPageOnly, bool bEndNotes)
remove all footnotes (not the references) and all footnote pages
Definition: ftnfrm.cxx:847
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
bool IsOleRef() const
To avoid unnecessary loading of object.
Definition: ndole.cxx:908
static bool lcl_hasTabFrame(const SwTextFrame *pTextFrame)
Tries to detect if this paragraph has a floating table attached.
Definition: frmtool.cxx:2136
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
long GetWidth(const SwRect &rRect) const
Definition: frame.hxx:1357
virtual const tools::Rectangle & GetLastBoundRect() const
bool IsLayoutFrame() const
Definition: frame.hxx:1146
void Left(const long nLeft)
Definition: swrect.hxx:193
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:217
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:677
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
void Bottom(const long nBottom)
Definition: swrect.hxx:207
const SwModify * mpRegIn
Definition: frmtool.hxx:568
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:46
bool ConsiderObjWrapInfluenceOnObjPos() const
method to determine, if wrapping style influence of the anchored object has to be considered on the o...
SwLayAction & GetLayAction()
Definition: viewimp.hxx:190
bool IsTabFrame() const
Definition: frame.hxx:1194
void GCLines()
Definition: gctable.cxx:430
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
void IsLine_()
Definition: frmtool.cxx:2234
void CheckKeep()
Definition: flowfrm.cxx:146
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
void UnlockJoin()
Definition: flowfrm.hxx:140
#define RES_DRAWFRMFMT
Definition: hintids.hxx:279
bool IsPaintLineNumbers() const
Definition: lineinfo.hxx:80
static SwTwips lcl_CalcCellRstHeight(SwLayoutFrame *pCell)
Definition: frmtool.cxx:3417
const SvxULSpaceItem & m_rUL
Definition: frmtool.hxx:284
bool bDontCreateObjects
Definition: frmtool.cxx:80
void ColUnlock()
Definition: sectfrm.hxx:87
unsigned char sal_uInt8
SwPageFrame * GetPageFrame()
void InvaPercentLowers(SwTwips nDiff=0)
Invalidates the inner Frames, whose width and/or height are calculated using percentages.
Definition: wsfrm.cxx:3504
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
static bool FormatObj(SwAnchoredObject &_rAnchoredObj, SwFrame *_pAnchorFrame=nullptr, const SwPageFrame *_pPageFrame=nullptr)
method to format a given floating screen object
void Width(long nNew)
Definition: swrect.hxx:185
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method doesn't investigate content of footnotes by default.
Definition: findfrm.cxx:125
The Cache object base class Users of the Cache must derive a class from the SwCacheObj and store thei...
Definition: swcache.hxx:133
void NotifyLowerObjs(const bool _bUnlockPosOfObjs=false)
force an unlockposition call for the lower objects.
Definition: fly.cxx:2361
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:261
void InvalidateAll_()
Definition: frame.hxx:781
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:220
void InsertBehind(SwLayoutFrame *pParent, SwFrame *pBefore)
Insert SwFrame into existing structure.
Definition: wsfrm.cxx:855
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const override
Definition: dcontact.cxx:739
bool bSetCompletePaintOnInvalidate
Definition: frmtool.cxx:81
sal_uInt16 CalcBottom() const
Definition: frmtool.hxx:508
#define SAL_INFO(area, stream)
sal_uInt16 m_nBottomLine
Definition: frmtool.hxx:316
void GetBottomLine_(const SwFrame &_rFrame)
Definition: frmtool.cxx:2400
bool IsInside(const Point &rPOINT) const
Definition: swrect.cxx:107
SwFrameFormat * GetRightFormat(bool const bFirst=false)
Layout uses the following methods to obtain a format in order to be able to create a page...
Definition: pagedesc.cxx:369
void CalcLeftLine_()
Definition: frmtool.cxx:2220
bool IsNoTextFrame() const
Definition: frame.hxx:1214
void RemoveFromLayout()
Definition: wsfrm.cxx:994
SwTwips GetHeightOfLastLine() const
Definition: txtfrm.hxx:756
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2642
bool IsFlyFreeFrame() const
Definition: flyfrm.hxx:194
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:175
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:101
SwNodes & GetNodes()
Definition: doc.hxx:402
bool IsAnchoredObjShown(SwTextFrame const &rFrame, SwFormatAnchor const &rAnchor)
Definition: frmtool.cxx:1264
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object...
Definition: dcontact.hxx:210
bool JoinedWithNext(const SwFrame &_rFrame) const
Definition: frmtool.cxx:2371
void InvalidateNextPos(bool bNoFootnote=false)
Definition: frame.hxx:1048
bool IsRightToLeft() const
Definition: frame.hxx:963
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:185
bool mbInvalidatePrevPrtArea
Definition: frmtool.hxx:257
static void lcl_NotifyContent(const SdrObject *pThis, SwContentFrame *pCnt, const SwRect &rRect, const PrepareHint eHint)
Definition: frmtool.cxx:3093
bool IsAgain() const
Definition: layact.hxx:160
bool HasBeenDeleted() const
return true if mpFrame != 0 and mpFrame is not client of pRegIn false otherwise
Definition: frmtool.cxx:3740
SwFlyFrame * GetNextLink() const
Definition: flyfrm.hxx:173
bool Is_Lower_Of(const SwFrame *pCurrFrame, const SdrObject *pObj)
Definition: frmtool.cxx:3344
bool ObjAnchoredAtFly() const
Definition: dcontact.hxx:147
bool ObjAnchoredAsChar() const
Definition: dcontact.hxx:150
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldPrt)
Notify the background based on the difference between old and new rectangle.
Definition: frmtool.cxx:2986
static bool CmpLines(const editeng::SvxBorderLine *pL1, const editeng::SvxBorderLine *pL2)
Definition: frmtool.cxx:2251
SwFrame * pFrame
Definition: frmtool.cxx:3489
const SwFrame * FindContext(const SwFrame *pFrame, SwFrameType nAdditionalContextType)
provides the area of a frame in that no Fly from another area can overlap
Definition: frmtool.cxx:3376
void AppendAllObjs(const SwFrameFormats *pTable, const SwFrame *pSib)
Definition: frmtool.cxx:1305
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
void SetPos(SwRect &rRect, const Point &rNew) const
Definition: frame.hxx:1396
void AppendFlyToPage(SwFlyFrame *pNew)
Definition: flylay.cxx:804
long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1358
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding)...
Definition: rootfrm.hxx:416
bool m_bBottomLine
Definition: frmtool.hxx:294
void PreparePage(bool bFootnote)
Always call after Paste Creates the page-bound frames and formats the generic content.
Definition: pagechg.cxx:467
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual bool IsNewDoc() const =0
#define FAR_AWAY
Definition: frmtool.hxx:52
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
sal_uInt16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false) const
void AppendDrawObj(SwAnchoredObject &_rNewObj)
Definition: fly.cxx:2186
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:134
static void AssertPageFlys(SwPageFrame *)
Makes sure that, starting from the passed Page, all page-bound Frames are on the right Page (pagenumb...
Definition: pagechg.cxx:1652
bool IsOLESizeInvalid() const
Definition: ndole.hxx:133
bool CompareLayout(const SwDoc &rDoc) const
Definition: laycache.cxx:325
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:683
long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1353
bool IsAccessibleFrame() const
Definition: frame.hxx:1226
void InvalidatePrt_()
Definition: frame.hxx:757
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint)=0
method to trigger notification of 'background'
bool m_bIsLine
Definition: frmtool.hxx:301
#define SAL_WARN(area, stream)
void GetSpacingValuesOfFrame(const SwFrame &rFrame, SwTwips &onLowerSpacing, SwTwips &onLineSpacing, bool &obIsLineSpacingProportional)
method to determine the spacing values of a frame
Definition: frmtool.cxx:3671
SwDoc & GetDoc()
Definition: txtfrm.hxx:448
bool IsTableNode() const
Definition: node.hxx:640
virtual SdrObject * SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
Access class for the Cache.
Definition: swcache.hxx:194
size_t size() const
Definition: docary.hxx:225
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx:174
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: pagechg.cxx:898
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
SwFrame * SaveContent(SwLayoutFrame *pLay, SwFrame *pStart)
Definition: frmtool.cxx:2618
bool IsFirstShared() const
Definition: pagedesc.cxx:376
void MakeFrames(SwDoc *pDoc, const SwNodeIndex &rSttIdx, const SwNodeIndex &rEndIdx)
Definition: frmtool.cxx:1830
void MergeNext(SwSectionFrame *pNxt)
|* Merges two SectionFrames, in case it's about the same section.
Definition: sectfrm.cxx:463
const SwFrame * GetAnchorFrame() const
const SwLayoutFrame * GetNextLayoutLeaf() const
Definition: frame.hxx:996
void ColUnlock()
Definition: ftnfrm.hxx:122
static bool IsShown(sal_uLong const nIndex, const SwFormatAnchor &rAnch, std::vector< sw::Extent >::const_iterator const *const pIter, std::vector< sw::Extent >::const_iterator const *const pEnd, SwTextNode const *const pFirstNode, SwTextNode const *const pLastNode)
Definition: frmtool.cxx:1041
TableFormulaUpdateFlags m_eFlags
Definition: hints.hxx:208
void RegistFlys(SwPageFrame *pPage, const SwLayoutFrame *pLay)
Definition: frmtool.cxx:2970
virtual const SwRedlineTable & GetRedlineTable() const =0
bool m_bCachedGetTopLine
Definition: frmtool.hxx:304
virtual bool Prepare(const PrepareHint ePrep=PREP_CLEAR, const void *pVoid=nullptr, bool bNotify=true)
Definition: wsfrm.cxx:587
bool IsOver(const SwRect &rRect) const
Definition: swrect.cxx:125
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:66
const SwFlowFrame * GetFollow() const
Definition: flowfrm.hxx:168
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
class for collecting anchored objects
Definition: sortedobjs.hxx:48
bool IsTextNode() const
Definition: node.hxx:636
sal_uInt16 m_nGetBottomLine
Definition: frmtool.hxx:316
void SetRestartLayoutProcess(const bool _bRestartLayoutProcess)
Merge GetRedlineMergeFlag() const
Definition: node.hxx:97
const editeng::SvxBorderLine * GetBottom() const
virtual ~SwBorderAttrs() override
Definition: frmtool.cxx:2085
SwNode * FindPrvNxtFrameNode(SwNodeIndex &rFrameIdx, const SwNode *pEnd) const
Search previous / next content node or table node with frames.
Definition: nodes.cxx:2040
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:137
sal_uInt16 m_nTop
Definition: frmtool.hxx:316
void ResetNotifyBack()
Definition: flyfrm.hxx:200
bool IsFooterFrame() const
Definition: frame.hxx:1170
sal_uInt16 m_nGetTopLine
Definition: frmtool.hxx:316
SwRootFrame * getRootFrame()
Definition: frame.hxx:657
bool IsCallbackActionEnabled() const
Definition: rootfrm.hxx:382
bool IsAutoPos() const
Definition: flyfrm.hxx:192
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:842
const SdrObject * Bottom()
Definition: frmtool.cxx:2476
IDocumentTimerAccess const & getIDocumentTimerAccess() const
Definition: doc.cxx:248
SwRowFrame is one table row in the document layout.
Definition: rowfrm.hxx:28
sal_uInt16 GetUpper() const
bool IsHeaderFrame() const
Definition: frame.hxx:1166
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:758
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:93
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1476
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:393
bool m_bCachedJoinedWithPrev
Definition: frmtool.hxx:309
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1075
sal_uInt16 CalcRightLine() const
Definition: frmtool.hxx:496
void CalcBottom_()
Definition: frmtool.cxx:2101
SwFrame * GetNext()
Definition: frame.hxx:654
bool const mbValidSize
Definition: frmtool.hxx:217
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
virtual void BlockIdling()=0
Increment block count.
Base class of the Writer document model elements.
Definition: node.hxx:79
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo