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