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