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