LibreOffice Module sw (master)  1
findfrm.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 <pagefrm.hxx>
21 #include <rootfrm.hxx>
22 #include <cellfrm.hxx>
23 #include <rowfrm.hxx>
24 #include <swtable.hxx>
25 #include <notxtfrm.hxx>
26 #include <tabfrm.hxx>
27 #include <sectfrm.hxx>
28 #include <frmatr.hxx>
29 #include <flyfrm.hxx>
30 #include <ftnfrm.hxx>
31 #include <txtftn.hxx>
32 #include <fmtftn.hxx>
33 #include <fmtpdsc.hxx>
34 #include <txtfrm.hxx>
35 #include <bodyfrm.hxx>
36 #include <calbck.hxx>
37 #include <viewopt.hxx>
38 #include <ndtxt.hxx>
39 #include <osl/diagnose.h>
40 #include <sal/log.hxx>
41 
44 {
45  SwFrame *pLay = Lower();
46  while ( pLay && !pLay->IsBodyFrame() )
47  pLay = pLay->GetNext();
48  return static_cast<SwLayoutFrame*>(pLay);
49 }
50 
53 {
55  SwContentFrame *pNxt = pRet;
56  while ( pNxt && pNxt->IsInDocBody() && IsAnLower( pNxt ) )
57  { pRet = pNxt;
58  pNxt = pNxt->FindNextCnt();
59  }
60  return pRet;
61 }
62 
68 {
69  //Search downwards the layout leaf and if there is no content, jump to the
70  //next leaf until content is found or we leave "this".
71  //Sections: Content next to sections would not be found this way (empty
72  //sections directly next to ContentFrame) therefore we need to recursively
73  //search for them even if it's more complex.
74 
75  const SwLayoutFrame *pLayLeaf = this;
76  do
77  {
78  while ( (!pLayLeaf->IsSctFrame() || pLayLeaf == this ) &&
79  pLayLeaf->Lower() && pLayLeaf->Lower()->IsLayoutFrame() )
80  pLayLeaf = static_cast<const SwLayoutFrame*>(pLayLeaf->Lower());
81 
82  if( pLayLeaf->IsSctFrame() && pLayLeaf != this )
83  {
84  const SwContentFrame *pCnt = pLayLeaf->ContainsContent();
85  if( pCnt )
86  return pCnt;
87  if( pLayLeaf->GetNext() )
88  {
89  if( pLayLeaf->GetNext()->IsLayoutFrame() )
90  {
91  pLayLeaf = static_cast<const SwLayoutFrame*>(pLayLeaf->GetNext());
92  continue;
93  }
94  else
95  return static_cast<const SwContentFrame*>(pLayLeaf->GetNext());
96  }
97  }
98  else if ( pLayLeaf->Lower() )
99  return static_cast<const SwContentFrame*>(pLayLeaf->Lower());
100 
101  pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
102  if( !IsAnLower( pLayLeaf) )
103  return nullptr;
104  } while( pLayLeaf );
105  return nullptr;
106 }
107 
114 {
115  const SwFrame* pCnt = ContainsAny();
116  while( pCnt && !pCnt->IsCellFrame() )
117  pCnt = pCnt->GetUpper();
118  return static_cast<const SwCellFrame*>(pCnt);
119 }
120 
126 const SwFrame *SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForSections ) const
127 {
128  //Search downwards the layout leaf and if there is no content, jump to the
129  //next leaf until content is found, we leave "this" or until we found
130  //a SectionFrame or a TabFrame.
131 
132  const SwLayoutFrame *pLayLeaf = this;
133  const bool bNoFootnote = IsSctFrame() && !_bInvestigateFootnoteForSections;
134  do
135  {
136  while ( ( (!pLayLeaf->IsSctFrame() && !pLayLeaf->IsTabFrame())
137  || pLayLeaf == this ) &&
138  pLayLeaf->Lower() && pLayLeaf->Lower()->IsLayoutFrame() )
139  pLayLeaf = static_cast<const SwLayoutFrame*>(pLayLeaf->Lower());
140 
141  if( ( pLayLeaf->IsTabFrame() || pLayLeaf->IsSctFrame() )
142  && pLayLeaf != this )
143  {
144  // Now we also return "deleted" SectionFrames so they can be
145  // maintained on SaveContent and RestoreContent
146  return pLayLeaf;
147  }
148  else if ( pLayLeaf->Lower() )
149  return static_cast<const SwContentFrame*>(pLayLeaf->Lower());
150 
151  pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
152  if( bNoFootnote && pLayLeaf && pLayLeaf->IsInFootnote() )
153  {
154  do
155  {
156  pLayLeaf = pLayLeaf->GetNextLayoutLeaf();
157  } while( pLayLeaf && pLayLeaf->IsInFootnote() );
158  }
159  if( !IsAnLower( pLayLeaf) )
160  return nullptr;
161  } while( pLayLeaf );
162  return nullptr;
163 }
164 
166 {
167  return IsLayoutFrame() ? static_cast<const SwLayoutFrame*>(this)->Lower() : nullptr;
168 }
169 
171 {
172  return IsLayoutFrame() ? static_cast<SwLayoutFrame*>(this)->Lower() : nullptr;
173 }
174 
176 {
177  if ( GetPrev() && GetPrev()->IsContentFrame() )
178  return static_cast<SwContentFrame*>(GetPrev());
179  else
180  return FindPrevCnt_();
181 }
182 
184 {
185  if ( GetPrev() && GetPrev()->IsContentFrame() )
186  return static_cast<const SwContentFrame*>(GetPrev());
187  else
188  return const_cast<SwFrame*>(this)->FindPrevCnt_();
189 }
190 
191 SwContentFrame *SwFrame::FindNextCnt( const bool _bInSameFootnote )
192 {
193  if ( mpNext && mpNext->IsContentFrame() )
194  return static_cast<SwContentFrame*>(mpNext);
195  else
196  return FindNextCnt_( _bInSameFootnote );
197 }
198 
199 const SwContentFrame *SwFrame::FindNextCnt( const bool _bInSameFootnote ) const
200 {
201  if ( mpNext && mpNext->IsContentFrame() )
202  return static_cast<SwContentFrame*>(mpNext);
203  else
204  return const_cast<SwFrame*>(this)->FindNextCnt_( _bInSameFootnote );
205 }
206 
207 bool SwLayoutFrame::IsAnLower( const SwFrame *pAssumed ) const
208 {
209  const SwFrame *pUp = pAssumed;
210  while ( pUp )
211  {
212  if ( pUp == this )
213  return true;
214  if ( pUp->IsFlyFrame() )
215  pUp = static_cast<const SwFlyFrame*>(pUp)->GetAnchorFrame();
216  else
217  pUp = pUp->GetUpper();
218  }
219  return false;
220 }
221 
234 bool SwLayoutFrame::IsBefore( const SwLayoutFrame* _pCheckRefLayFrame ) const
235 {
236  OSL_ENSURE( !IsRootFrame() , "<IsBefore> called at a <SwRootFrame>.");
237  OSL_ENSURE( !_pCheckRefLayFrame->IsRootFrame() , "<IsBefore> called with a <SwRootFrame>.");
238 
239  bool bReturn;
240 
241  // check, if on different pages
242  const SwPageFrame *pMyPage = FindPageFrame();
243  const SwPageFrame *pCheckRefPage = _pCheckRefLayFrame->FindPageFrame();
244  if( pMyPage != pCheckRefPage )
245  {
246  // being on different page as check reference
247  bReturn = pMyPage->GetPhyPageNum() < pCheckRefPage->GetPhyPageNum();
248  }
249  else
250  {
251  // being on same page as check reference
252  // --> search my supreme parent <pUp>, which doesn't contain check reference.
253  const SwLayoutFrame* pUp = this;
254  while ( pUp->GetUpper() &&
255  !pUp->GetUpper()->IsAnLower( _pCheckRefLayFrame )
256  )
257  pUp = pUp->GetUpper();
258  if( !pUp->GetUpper() )
259  {
260  // can occur, if <this> is a fly frm
261  bReturn = false;
262  }
263  else
264  {
265  // travel through the next's of <pUp> and check if one of these
266  // contain the check reference.
267  const SwLayoutFrame* pUpNext = static_cast<const SwLayoutFrame*>(pUp->GetNext());
268  while ( pUpNext &&
269  !pUpNext->IsAnLower( _pCheckRefLayFrame ) )
270  {
271  pUpNext = static_cast<const SwLayoutFrame*>(pUpNext->GetNext());
272  }
273  bReturn = pUpNext != nullptr;
274  }
275  }
276 
277  return bReturn;
278 }
279 
280 // Local helper functions for GetNextLayoutLeaf
281 
282 static const SwFrame* lcl_FindLayoutFrame( const SwFrame* pFrame, bool bNext )
283 {
284  const SwFrame* pRet = nullptr;
285  if ( pFrame->IsFlyFrame() )
286  pRet = bNext ? static_cast<const SwFlyFrame*>(pFrame)->GetNextLink() : static_cast<const SwFlyFrame*>(pFrame)->GetPrevLink();
287  else
288  pRet = bNext ? pFrame->GetNext() : pFrame->GetPrev();
289 
290  return pRet;
291 }
292 
293 static const SwFrame* lcl_GetLower( const SwFrame* pFrame, bool bFwd )
294 {
295  if ( !pFrame->IsLayoutFrame() )
296  return nullptr;
297 
298  return bFwd ?
299  static_cast<const SwLayoutFrame*>(pFrame)->Lower() :
300  static_cast<const SwLayoutFrame*>(pFrame)->GetLastLower();
301 }
302 
311 {
312  const SwFrame *pFrame = this;
313  const SwLayoutFrame *pLayoutFrame = nullptr;
314  const SwFrame *p = nullptr;
315  bool bGoingUp = !bFwd; // false for forward, true for backward
316  do {
317 
318  bool bGoingFwdOrBwd = false;
319 
320  bool bGoingDown = !bGoingUp;
321  if (bGoingDown)
322  {
323  p = lcl_GetLower( pFrame, bFwd );
324  bGoingDown = nullptr != p;
325  }
326  if ( !bGoingDown )
327  {
328  // I cannot go down, because either I'm currently going up or
329  // because the is no lower.
330  // I'll try to go forward:
331  p = lcl_FindLayoutFrame( pFrame, bFwd );
332  bGoingFwdOrBwd = nullptr != p;
333  if ( !bGoingFwdOrBwd )
334  {
335  // I cannot go forward, because there is no next frame.
336  // I'll try to go up:
337  p = pFrame->GetUpper();
338  bGoingUp = nullptr != p;
339  if ( !bGoingUp )
340  {
341  // I cannot go up, because there is no upper frame.
342  return nullptr;
343  }
344  }
345  }
346 
347  // If I could not go down or forward, I'll have to go up
348  bGoingUp = !bGoingFwdOrBwd && !bGoingDown;
349 
350  pFrame = p;
351  p = lcl_GetLower( pFrame, true );
352 
353  } while( ( p && !p->IsFlowFrame() ) ||
354  pFrame == this ||
355  nullptr == ( pLayoutFrame = pFrame->IsLayoutFrame() ? static_cast<const SwLayoutFrame*>(pFrame) : nullptr ) ||
356  pLayoutFrame->IsAnLower( this ) );
357 
358  return pLayoutFrame;
359 }
360 
372 {
373  const SwFrame *pFrame = this;
374  const SwContentFrame *pContentFrame = nullptr;
375  bool bGoingUp = false;
376  do {
377  const SwFrame *p = nullptr;
378  bool bGoingFwdOrBwd = false;
379 
380  bool bGoingDown = !bGoingUp;
381  if (bGoingDown)
382  {
383  p = lcl_GetLower( pFrame, true ) ;
384  bGoingDown = nullptr != p;
385  }
386  if ( !bGoingDown )
387  {
388  p = lcl_FindLayoutFrame( pFrame, bFwd );
389  bGoingFwdOrBwd = nullptr != p;
390  if ( !bGoingFwdOrBwd )
391  {
392  p = pFrame->GetUpper();
393  bGoingUp = nullptr != p;
394  if ( !bGoingUp )
395  {
396  return nullptr;
397  }
398  }
399  }
400 
401  bGoingUp = !(bGoingFwdOrBwd || bGoingDown);
402  assert(p);
403  if (!bFwd && bGoingDown)
404  {
405  while ( p->GetNext() )
406  p = p->GetNext();
407  }
408 
409  pFrame = p;
410  } while ( nullptr == (pContentFrame = (pFrame->IsContentFrame() ? static_cast<const SwContentFrame*>(pFrame) : nullptr) ));
411 
412  return pContentFrame;
413 }
414 
416 {
417  SwFrame *pRet = this;
418  while ( pRet && !pRet->IsPageFrame() )
419  {
420  if ( pRet->GetUpper() )
421  pRet = pRet->GetUpper();
422  else if ( pRet->IsFlyFrame() )
423  {
424  // #i28701# - use new method <GetPageFrame()>
425  const auto pFly(static_cast<SwFlyFrame*>(pRet));
426  pRet = pFly->GetPageFrame();
427  if (pRet == nullptr)
428  pRet = pFly->AnchorFrame();
429  }
430  else
431  return nullptr;
432  }
433  return static_cast<SwPageFrame*>(pRet);
434 }
435 
437 {
438  SwFrame *pRet = this;
439  // Footnote bosses can't exist inside a table; also sections with columns
440  // don't contain footnote texts there
441  if( pRet->IsInTab() )
442  pRet = pRet->FindTabFrame();
443  while ( pRet && !pRet->IsFootnoteBossFrame() )
444  {
445  if ( pRet->GetUpper() )
446  pRet = pRet->GetUpper();
447  else if ( pRet->IsFlyFrame() )
448  {
449  // #i28701# - use new method <GetPageFrame()>
450  if ( static_cast<SwFlyFrame*>(pRet)->GetPageFrame() )
451  pRet = static_cast<SwFlyFrame*>(pRet)->GetPageFrame();
452  else
453  pRet = static_cast<SwFlyFrame*>(pRet)->AnchorFrame();
454  }
455  else
456  return nullptr;
457  }
458  if( bFootnotes && pRet && pRet->IsColumnFrame() &&
459  !pRet->GetNext() && !pRet->GetPrev() )
460  {
461  SwSectionFrame* pSct = pRet->FindSctFrame();
462  OSL_ENSURE( pSct, "FindFootnoteBossFrame: Single column outside section?" );
463  if( !pSct->IsFootnoteAtEnd() )
464  return pSct->FindFootnoteBossFrame( true );
465  }
466  return static_cast<SwFootnoteBossFrame*>(pRet);
467 }
468 
470 {
471  SwFrame *pRet = this;
472  while ( !pRet->IsTabFrame() )
473  {
474  pRet = pRet->GetUpper();
475  if ( !pRet )
476  return nullptr;
477  }
478  return static_cast<SwTabFrame*>(pRet);
479 }
480 
482 {
483  SwFrame *pRet = this;
484  while ( !pRet->IsSctFrame() )
485  {
486  pRet = pRet->GetUpper();
487  if ( !pRet )
488  return nullptr;
489  }
490  return static_cast<SwSectionFrame*>(pRet);
491 }
492 
494 {
495  const SwFrame *pRet = this;
496  while ( !pRet->IsBodyFrame() )
497  {
498  pRet = pRet->GetUpper();
499  if ( !pRet )
500  return nullptr;
501  }
502  return static_cast<const SwBodyFrame*>(pRet);
503 }
504 
506 {
507  SwFrame *pRet = this;
508  while ( !pRet->IsFootnoteFrame() )
509  {
510  pRet = pRet->GetUpper();
511  if ( !pRet )
512  return nullptr;
513  }
514  return static_cast<SwFootnoteFrame*>(pRet);
515 }
516 
518 {
519  SwFrame *pRet = this;
520  do
521  {
522  if ( pRet->IsFlyFrame() )
523  return static_cast<SwFlyFrame*>(pRet);
524  else
525  pRet = pRet->GetUpper();
526  } while ( pRet );
527  return nullptr;
528 }
529 
531 {
532  SwFrame *pFrame = this;
533  do
534  { pFrame = pFrame->GetUpper();
535  } while ( pFrame && !pFrame->IsColumnFrame() );
536  return pFrame;
537 }
538 
540 {
541  SwFrame *pFrame = this;
542  do
543  { pFrame = pFrame->GetUpper();
544  } while ( pFrame && !pFrame->IsRowFrame() );
545  return dynamic_cast< SwRowFrame* >( pFrame );
546 }
547 
549 {
550  SwFrame* pRet = this;
551  do
552  {
553  if (pRet->GetType() & FRM_HEADFOOT) //header and footer
554  return pRet;
555  else if ( pRet->GetUpper() )
556  pRet = pRet->GetUpper();
557  else if ( pRet->IsFlyFrame() )
558  pRet = static_cast<SwFlyFrame*>(pRet)->AnchorFrame();
559  else
560  return nullptr;
561  } while ( pRet );
562  return pRet;
563 }
564 
566 {
567  const SwFootnoteFrame* pRet = static_cast<const SwFootnoteFrame*>(Lower());
568  if( pRet && !pRet->GetAttr()->GetFootnote().IsEndNote() )
569  return pRet;
570  return nullptr;
571 }
572 
573 const SwPageFrame* SwRootFrame::GetPageAtPos( const Point& rPt, const Size* pSize, bool bExtend ) const
574 {
575  const SwPageFrame* pRet = nullptr;
576 
577  SwRect aRect;
578  if ( pSize )
579  {
580  aRect.Pos() = rPt;
581  aRect.SSize( *pSize );
582  }
583 
584  const SwFrame* pPage = Lower();
585 
586  if ( !bExtend )
587  {
588  if( !getFrameArea().IsInside( rPt ) )
589  return nullptr;
590 
591  // skip pages above point:
592  while( pPage && rPt.Y() > pPage->getFrameArea().Bottom() )
593  pPage = pPage->GetNext();
594  }
595 
596  OSL_ENSURE( GetPageNum() <= maPageRects.size(), "number of pages differs from page rect array size" );
597  size_t nPageIdx = 0;
598 
599  while ( pPage && !pRet )
600  {
601  const SwRect& rBoundRect = bExtend ? maPageRects[ nPageIdx++ ] : pPage->getFrameArea();
602 
603  if ( (!pSize && rBoundRect.IsInside(rPt)) ||
604  (pSize && rBoundRect.IsOver(aRect)) )
605  {
606  pRet = static_cast<const SwPageFrame*>(pPage);
607  }
608 
609  pPage = pPage->GetNext();
610  }
611 
612  return pRet;
613 }
614 
615 bool SwRootFrame::IsBetweenPages(const Point& rPt) const
616 {
617  if (!getFrameArea().IsInside(rPt))
618  return false;
619 
620  // top visible page
621  const SwFrame* pPage = Lower();
622  if (pPage == nullptr)
623  return false;
624 
625  // skip pages above point:
626  while (pPage && rPt.Y() > pPage->getFrameArea().Bottom())
627  pPage = pPage->GetNext();
628 
629  if (pPage &&
630  rPt.X() >= pPage->getFrameArea().Left() &&
631  rPt.X() <= pPage->getFrameArea().Right())
632  {
633  // Trivial case when we're right in between.
634  if (!pPage->getFrameArea().IsInside(rPt))
635  return true;
636 
637  // In normal mode the gap is large enough and
638  // header/footer mouse interaction competes with
639  // handling hide-whitespace within them.
640  // In hide-whitespace, however, the gap is too small
641  // for convenience and there are no headers/footers.
642  const SwViewShell *pSh = GetCurrShell();
643  if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden())
644  {
646 
647  // If we are really close to the bottom or top of a page.
648  const auto toEdge = std::min(std::abs(pPage->getFrameArea().Top() - rPt.Y()),
649  std::abs(pPage->getFrameArea().Bottom() - rPt.Y()));
650  return toEdge <= constMargin;
651  }
652  }
653 
654  return false;
655 }
656 
658 {
659  return GetAttrSet()->GetBreak();
660 }
661 
663 {
664  return GetAttrSet()->GetPageDesc();
665 }
666 
668 {
669  return GetTextNodeFirst()->GetSwAttrSet().GetBreak();
670 }
671 
673 {
675 }
676 
678 {
679  if (IsTextFrame())
680  {
681  return &static_cast<const SwTextFrame*>(this)->GetTextNodeForParaProps()->GetSwAttrSet();
682  }
683  else if (IsNoTextFrame())
684  {
685  return &static_cast<const SwNoTextFrame*>(this)->GetNode()->GetSwAttrSet();
686  }
687  else
688  {
689  assert(IsLayoutFrame());
690  return &static_cast<const SwLayoutFrame*>(this)->GetFormat()->GetAttrSet();
691  }
692 }
693 
695 {
696  if (IsTextFrame())
697  {
698  return static_cast<const SwTextFrame*>(this)->GetTextNodeForParaProps()->getSdrAllFillAttributesHelper();
699  }
700  else if (IsNoTextFrame())
701  {
702  return static_cast<const SwNoTextFrame*>(this)->GetNode()->getSdrAllFillAttributesHelper();
703  }
704  else
705  {
706  return static_cast< const SwLayoutFrame* >(this)->GetFormat()->getSdrAllFillAttributesHelper();
707  }
708 }
709 
711 {
712  if (IsContentFrame())
713  {
714  return true;
715  }
716  else
717  {
718  return static_cast< const SwLayoutFrame* >(this)->GetFormat()->supportsFullDrawingLayerFillAttributeSet();
719  }
720 }
721 
722 /*
723  * SwFrame::FindNext_(), FindPrev_(), InvalidateNextPos()
724  * FindNextCnt_() visits tables and sections and only returns SwContentFrames.
725  *
726  * Description Invalidates the position of the next frame.
727  * This is the direct successor or in case of ContentFrames the next
728  * ContentFrame which sits in the same flow as I do:
729  * - body,
730  * - footnote,
731  * - in headers/footers the notification only needs to be forwarded
732  * inside the section
733  * - same for Flys
734  * - Contents in tabs remain only inside their cell
735  * - in principle tables behave exactly like the Contents
736  * - sections also
737  */
738 // This helper function is an equivalent to the ImplGetNextContentFrame() method,
739 // besides ContentFrames this function also returns TabFrames and SectionFrames.
740 static SwFrame* lcl_NextFrame( SwFrame* pFrame )
741 {
742  SwFrame *pRet = nullptr;
743  bool bGoingUp = false;
744  do {
745  SwFrame *p = nullptr;
746 
747  bool bGoingFwd = false;
748  bool bGoingDown = !bGoingUp && pFrame->IsLayoutFrame();
749  if (bGoingDown)
750  {
751  p = static_cast<SwLayoutFrame*>(pFrame)->Lower();
752  bGoingDown = nullptr != p;
753  }
754  if( !bGoingDown )
755  {
756  p = pFrame->IsFlyFrame() ? static_cast<SwFlyFrame*>(pFrame)->GetNextLink() : pFrame->GetNext();
757  bGoingFwd = nullptr != p;
758  if ( !bGoingFwd )
759  {
760  p = pFrame->GetUpper();
761  bGoingUp = nullptr != p;
762  if ( !bGoingUp )
763  {
764  return nullptr;
765  }
766  }
767  }
768  bGoingUp = !(bGoingFwd || bGoingDown);
769  pFrame = p;
770  } while ( nullptr == (pRet = ( ( pFrame->IsContentFrame() || ( !bGoingUp &&
771  ( pFrame->IsTabFrame() || pFrame->IsSctFrame() ) ) )? pFrame : nullptr ) ) );
772  return pRet;
773 }
774 
776 {
777  bool bIgnoreTab = false;
778  SwFrame *pThis = this;
779 
780  if ( IsTabFrame() )
781  {
782  //The last Content of the table gets picked up and his follower is
783  //returned. To be able to deactivate the special case for tables
784  //(see below) bIgnoreTab will be set.
785  if ( static_cast<SwTabFrame*>(this)->GetFollow() )
786  return static_cast<SwTabFrame*>(this)->GetFollow();
787 
788  pThis = static_cast<SwTabFrame*>(this)->FindLastContentOrTable();
789  if ( !pThis )
790  pThis = this;
791  bIgnoreTab = true;
792  }
793  else if ( IsSctFrame() )
794  {
795  //The last Content of the section gets picked and his follower is returned.
796  if ( static_cast<SwSectionFrame*>(this)->GetFollow() )
797  return static_cast<SwSectionFrame*>(this)->GetFollow();
798 
799  pThis = static_cast<SwSectionFrame*>(this)->FindLastContent();
800  if ( !pThis )
801  pThis = this;
802  }
803  else if ( IsContentFrame() )
804  {
805  if( static_cast<SwContentFrame*>(this)->GetFollow() )
806  return static_cast<SwContentFrame*>(this)->GetFollow();
807  }
808  else if ( IsRowFrame() )
809  {
810  SwFrame* pMyUpper = GetUpper();
811  if ( pMyUpper->IsTabFrame() && static_cast<SwTabFrame*>(pMyUpper)->GetFollow() )
812  return static_cast<SwTabFrame*>(pMyUpper)->GetFollow()->GetLower();
813  else return nullptr;
814  }
815  else
816  return nullptr;
817 
818  SwFrame* pRet = nullptr;
819  const bool bFootnote = pThis->IsInFootnote();
820  if ( !bIgnoreTab && pThis->IsInTab() )
821  {
822  SwLayoutFrame *pUp = pThis->GetUpper();
823  while (pUp && !pUp->IsCellFrame())
824  pUp = pUp->GetUpper();
825  assert(pUp && "Content flag says it's in table but it's not in cell.");
826  SwFrame* pNxt = pUp ? static_cast<SwCellFrame*>(pUp)->GetFollowCell() : nullptr;
827  if ( pNxt )
828  pNxt = static_cast<SwCellFrame*>(pNxt)->ContainsContent();
829  if ( !pNxt )
830  {
831  pNxt = lcl_NextFrame( pThis );
832  if (pUp && pUp->IsAnLower(pNxt))
833  pRet = pNxt;
834  }
835  else
836  pRet = pNxt;
837  }
838  else
839  {
840  const bool bBody = pThis->IsInDocBody();
841  SwFrame *pNxtCnt = lcl_NextFrame( pThis );
842  if ( pNxtCnt )
843  {
844  if ( bBody || bFootnote )
845  {
846  while ( pNxtCnt )
847  {
848  // OD 02.04.2003 #108446# - check for endnote, only if found
849  // next content isn't contained in a section, that collect its
850  // endnotes at its end.
851  bool bEndn = IsInSct() && !IsSctFrame() &&
852  ( !pNxtCnt->IsInSct() ||
853  !pNxtCnt->FindSctFrame()->IsEndnAtEnd()
854  );
855  if ( ( bBody && pNxtCnt->IsInDocBody() ) ||
856  ( pNxtCnt->IsInFootnote() &&
857  ( bFootnote ||
858  ( bEndn && pNxtCnt->FindFootnoteFrame()->GetAttr()->GetFootnote().IsEndNote() )
859  )
860  )
861  )
862  {
863  pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrame()
864  : pNxtCnt;
865  break;
866  }
867  pNxtCnt = lcl_NextFrame( pNxtCnt );
868  }
869  }
870  else if ( pThis->IsInFly() )
871  {
872  pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrame()
873  : pNxtCnt;
874  }
875  else //footer-/or header section
876  {
877  const SwFrame *pUp = pThis->GetUpper();
878  const SwFrame *pCntUp = pNxtCnt->GetUpper();
879  while ( pUp && pUp->GetUpper() &&
880  !pUp->IsHeaderFrame() && !pUp->IsFooterFrame() )
881  pUp = pUp->GetUpper();
882  while ( pCntUp && pCntUp->GetUpper() &&
883  !pCntUp->IsHeaderFrame() && !pCntUp->IsFooterFrame() )
884  pCntUp = pCntUp->GetUpper();
885  if ( pCntUp == pUp )
886  {
887  pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrame()
888  : pNxtCnt;
889  }
890  }
891  }
892  }
893  if( pRet && pRet->IsInSct() )
894  {
895  SwSectionFrame* pSct = pRet->FindSctFrame();
896  //Footnotes in frames with columns must not return the section which
897  //contains the footnote
898  if( !pSct->IsAnLower( this ) &&
899  (!bFootnote || pSct->IsInFootnote() ) )
900  return pSct;
901  }
902  return pRet;
903 }
904 
905 // #i27138# - add parameter <_bInSameFootnote>
906 SwContentFrame *SwFrame::FindNextCnt_( const bool _bInSameFootnote )
907 {
908  SwFrame *pThis = this;
909 
910  if ( IsTabFrame() )
911  {
912  if ( static_cast<SwTabFrame*>(this)->GetFollow() )
913  {
914  pThis = static_cast<SwTabFrame*>(this)->GetFollow()->ContainsContent();
915  if( pThis )
916  return static_cast<SwContentFrame*>(pThis);
917  }
918  pThis = static_cast<SwTabFrame*>(this)->FindLastContentOrTable();
919  if ( !pThis )
920  return nullptr;
921  }
922  else if ( IsSctFrame() )
923  {
924  if ( static_cast<SwSectionFrame*>(this)->GetFollow() )
925  {
926  pThis = static_cast<SwSectionFrame*>(this)->GetFollow()->ContainsContent();
927  if( pThis )
928  return static_cast<SwContentFrame*>(pThis);
929  }
930  pThis = static_cast<SwSectionFrame*>(this)->FindLastContent();
931  if ( !pThis )
932  return nullptr;
933  }
934  else if ( IsContentFrame() && static_cast<SwContentFrame*>(this)->GetFollow() )
935  return static_cast<SwContentFrame*>(this)->GetFollow();
936 
937  if ( pThis->IsContentFrame() )
938  {
939  const bool bBody = pThis->IsInDocBody();
940  const bool bFootnote = pThis->IsInFootnote();
941  SwContentFrame *pNxtCnt = static_cast<SwContentFrame*>(pThis)->GetNextContentFrame();
942  if ( pNxtCnt )
943  {
944  // #i27138#
945  if ( bBody || ( bFootnote && !_bInSameFootnote ) )
946  {
947  // handling for environments 'footnotes' and 'document body frames':
948  while ( pNxtCnt )
949  {
950  if ( (bBody && pNxtCnt->IsInDocBody()) ||
951  (bFootnote && pNxtCnt->IsInFootnote()) )
952  return pNxtCnt;
953  pNxtCnt = pNxtCnt->GetNextContentFrame();
954  }
955  }
956  // #i27138#
957  else if ( bFootnote && _bInSameFootnote )
958  {
959  // handling for environments 'each footnote':
960  // Assure that found next content frame belongs to the same footnotes
961  const SwFootnoteFrame* pFootnoteFrameOfNext( pNxtCnt->FindFootnoteFrame() );
962  const SwFootnoteFrame* pFootnoteFrameOfCurr( pThis->FindFootnoteFrame() );
963  OSL_ENSURE( pFootnoteFrameOfCurr,
964  "<SwFrame::FindNextCnt_() - unknown layout situation: current frame has to have an upper footnote frame." );
965  if ( pFootnoteFrameOfNext == pFootnoteFrameOfCurr )
966  {
967  return pNxtCnt;
968  }
969  else if ( pFootnoteFrameOfCurr->GetFollow() )
970  {
971  // next content frame has to be the first content frame
972  // in the follow footnote, which contains a content frame.
973  SwFootnoteFrame* pFollowFootnoteFrameOfCurr(
974  const_cast<SwFootnoteFrame*>(pFootnoteFrameOfCurr) );
975  pNxtCnt = nullptr;
976  do {
977  pFollowFootnoteFrameOfCurr = pFollowFootnoteFrameOfCurr->GetFollow();
978  pNxtCnt = pFollowFootnoteFrameOfCurr->ContainsContent();
979  } while ( !pNxtCnt && pFollowFootnoteFrameOfCurr->GetFollow() );
980  return pNxtCnt;
981  }
982  else
983  {
984  // current content frame is the last content frame in the
985  // footnote - no next content frame exists.
986  return nullptr;
987  }
988  }
989  else if ( pThis->IsInFly() )
990  // handling for environments 'unlinked fly frame' and
991  // 'group of linked fly frames':
992  return pNxtCnt;
993  else
994  {
995  // handling for environments 'page header' and 'page footer':
996  const SwFrame *pUp = pThis->GetUpper();
997  const SwFrame *pCntUp = pNxtCnt->GetUpper();
998  while ( pUp && pUp->GetUpper() &&
999  !pUp->IsHeaderFrame() && !pUp->IsFooterFrame() )
1000  pUp = pUp->GetUpper();
1001  while ( pCntUp && pCntUp->GetUpper() &&
1002  !pCntUp->IsHeaderFrame() && !pCntUp->IsFooterFrame() )
1003  pCntUp = pCntUp->GetUpper();
1004  if ( pCntUp == pUp )
1005  return pNxtCnt;
1006  }
1007  }
1008  }
1009  return nullptr;
1010 }
1011 
1018 {
1019  if ( !IsFlowFrame() )
1020  {
1021  // nothing to do, if current frame isn't a flow frame.
1022  return nullptr;
1023  }
1024 
1025  SwContentFrame* pPrevContentFrame( nullptr );
1026 
1027  // Because method <SwContentFrame::GetPrevContentFrame()> is used to travel
1028  // through the layout, a content frame, at which the travel starts, is needed.
1029  SwContentFrame* pCurrContentFrame = dynamic_cast<SwContentFrame*>(this);
1030 
1031  // perform shortcut, if current frame is a follow, and
1032  // determine <pCurrContentFrame>, if current frame is a table or section frame
1033  if ( pCurrContentFrame && pCurrContentFrame->IsFollow() )
1034  {
1035  // previous content frame is its master content frame
1036  pPrevContentFrame = pCurrContentFrame->FindMaster();
1037  }
1038  else if ( IsTabFrame() )
1039  {
1040  SwTabFrame* pTabFrame( static_cast<SwTabFrame*>(this) );
1041  if ( pTabFrame->IsFollow() )
1042  {
1043  // previous content frame is the last content of its master table frame
1044  pPrevContentFrame = pTabFrame->FindMaster()->FindLastContent();
1045  }
1046  else
1047  {
1048  // start content frame for the search is the first content frame of
1049  // the table frame.
1050  pCurrContentFrame = pTabFrame->ContainsContent();
1051  }
1052  }
1053  else if ( IsSctFrame() )
1054  {
1055  SwSectionFrame* pSectFrame( static_cast<SwSectionFrame*>(this) );
1056  if ( pSectFrame->IsFollow() )
1057  {
1058  // previous content frame is the last content of its master section frame
1059  pPrevContentFrame = pSectFrame->FindMaster()->FindLastContent();
1060  }
1061  else
1062  {
1063  // start content frame for the search is the first content frame of
1064  // the section frame.
1065  pCurrContentFrame = pSectFrame->ContainsContent();
1066  }
1067  }
1068 
1069  // search for next content frame, depending on the environment, in which
1070  // the current frame is in.
1071  if ( !pPrevContentFrame && pCurrContentFrame )
1072  {
1073  pPrevContentFrame = pCurrContentFrame->GetPrevContentFrame();
1074  if ( pPrevContentFrame )
1075  {
1076  if ( pCurrContentFrame->IsInFly() )
1077  {
1078  // handling for environments 'unlinked fly frame' and
1079  // 'group of linked fly frames':
1080  // Nothing to do, <pPrevContentFrame> is the one
1081  }
1082  else
1083  {
1084  const bool bInDocBody = pCurrContentFrame->IsInDocBody();
1085  const bool bInFootnote = pCurrContentFrame->IsInFootnote();
1086  if ( bInDocBody )
1087  {
1088  // handling for environments 'footnotes' and 'document body frames':
1089  // Assure that found previous frame is also in one of these
1090  // environments. Otherwise, travel further
1091  while ( pPrevContentFrame )
1092  {
1093  if ( ( bInDocBody && pPrevContentFrame->IsInDocBody() ) ||
1094  ( bInFootnote && pPrevContentFrame->IsInFootnote() ) )
1095  {
1096  break;
1097  }
1098  pPrevContentFrame = pPrevContentFrame->GetPrevContentFrame();
1099  }
1100  }
1101  else if ( bInFootnote )
1102  {
1103  // handling for environments 'each footnote':
1104  // Assure that found next content frame belongs to the same footnotes
1105  const SwFootnoteFrame* pFootnoteFrameOfPrev( pPrevContentFrame->FindFootnoteFrame() );
1106  const SwFootnoteFrame* pFootnoteFrameOfCurr( pCurrContentFrame->FindFootnoteFrame() );
1107  if ( pFootnoteFrameOfPrev != pFootnoteFrameOfCurr )
1108  {
1109  if ( pFootnoteFrameOfCurr->GetMaster() )
1110  {
1111  SwFootnoteFrame* pMasterFootnoteFrameOfCurr(
1112  const_cast<SwFootnoteFrame*>(pFootnoteFrameOfCurr) );
1113  pPrevContentFrame = nullptr;
1114  // correct wrong loop-condition
1115  do {
1116  pMasterFootnoteFrameOfCurr = pMasterFootnoteFrameOfCurr->GetMaster();
1117  pPrevContentFrame = pMasterFootnoteFrameOfCurr->FindLastContent();
1118  } while ( !pPrevContentFrame &&
1119  pMasterFootnoteFrameOfCurr->GetMaster() );
1120  }
1121  else
1122  {
1123  // current content frame is the first content in the
1124  // footnote - no previous content exists.
1125  pPrevContentFrame = nullptr;
1126  }
1127  }
1128  }
1129  else
1130  {
1131  // handling for environments 'page header' and 'page footer':
1132  // Assure that found previous frame is also in the same
1133  // page header respectively page footer as <pCurrContentFrame>
1134  // Note: At this point it's clear that <pCurrContentFrame> has
1135  // to be inside a page header or page footer and that
1136  // neither <pCurrContentFrame> nor <pPrevContentFrame> are
1137  // inside a fly frame.
1138  // Thus, method <FindFooterOrHeader()> can be used.
1139  OSL_ENSURE( pCurrContentFrame->FindFooterOrHeader(),
1140  "<SwFrame::FindPrevCnt_()> - unknown layout situation: current frame should be in page header or page footer" );
1141  OSL_ENSURE( !pPrevContentFrame->IsInFly(),
1142  "<SwFrame::FindPrevCnt_()> - unknown layout situation: found previous frame should *not* be inside a fly frame." );
1143  if ( pPrevContentFrame->FindFooterOrHeader() !=
1144  pCurrContentFrame->FindFooterOrHeader() )
1145  {
1146  pPrevContentFrame = nullptr;
1147  }
1148  }
1149  }
1150  }
1151  }
1152 
1153  return pPrevContentFrame;
1154 }
1155 
1157 {
1158  bool bIgnoreTab = false;
1159  SwFrame *pThis = this;
1160 
1161  if ( IsTabFrame() )
1162  {
1163  //The first Content of the table gets picked up and his predecessor is
1164  //returned. To be able to deactivate the special case for tables
1165  //(see below) bIgnoreTab will be set.
1166  if ( static_cast<SwTabFrame*>(this)->IsFollow() )
1167  return static_cast<SwTabFrame*>(this)->FindMaster();
1168  else
1169  pThis = static_cast<SwTabFrame*>(this)->ContainsContent();
1170  bIgnoreTab = true;
1171  }
1172 
1173  if ( pThis && pThis->IsContentFrame() )
1174  {
1175  SwContentFrame *pPrvCnt = static_cast<SwContentFrame*>(pThis)->GetPrevContentFrame();
1176  if( !pPrvCnt )
1177  return nullptr;
1178  if ( !bIgnoreTab && pThis->IsInTab() )
1179  {
1180  SwLayoutFrame *pUp = pThis->GetUpper();
1181  while (pUp && !pUp->IsCellFrame())
1182  pUp = pUp->GetUpper();
1183  assert(pUp && "Content flag says it's in table but it's not in cell.");
1184  if (pUp && pUp->IsAnLower(pPrvCnt))
1185  return pPrvCnt;
1186  }
1187  else
1188  {
1189  SwFrame* pRet;
1190  const bool bBody = pThis->IsInDocBody();
1191  const bool bFootnote = !bBody && pThis->IsInFootnote();
1192  if ( bBody || bFootnote )
1193  {
1194  while ( pPrvCnt )
1195  {
1196  if ( (bBody && pPrvCnt->IsInDocBody()) ||
1197  (bFootnote && pPrvCnt->IsInFootnote()) )
1198  {
1199  pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrame()
1200  : static_cast<SwFrame*>(pPrvCnt);
1201  return pRet;
1202  }
1203  pPrvCnt = pPrvCnt->GetPrevContentFrame();
1204  }
1205  }
1206  else if ( pThis->IsInFly() )
1207  {
1208  pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrame()
1209  : static_cast<SwFrame*>(pPrvCnt);
1210  return pRet;
1211  }
1212  else // footer or header or Fly
1213  {
1214  const SwFrame *pUp = pThis->GetUpper();
1215  const SwFrame *pCntUp = pPrvCnt->GetUpper();
1216  while ( pUp && pUp->GetUpper() &&
1217  !pUp->IsHeaderFrame() && !pUp->IsFooterFrame() )
1218  pUp = pUp->GetUpper();
1219  while ( pCntUp && pCntUp->GetUpper() )
1220  pCntUp = pCntUp->GetUpper();
1221  if ( pCntUp == pUp )
1222  {
1223  pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrame()
1224  : static_cast<SwFrame*>(pPrvCnt);
1225  return pRet;
1226  }
1227  }
1228  }
1229  }
1230  return nullptr;
1231 }
1232 
1233 void SwFrame::ImplInvalidateNextPos( bool bNoFootnote )
1234 {
1235  SwFrame *pFrame = FindNext_();
1236  if ( nullptr == pFrame )
1237  return;
1238 
1239  if( pFrame->IsSctFrame() )
1240  {
1241  while( pFrame && pFrame->IsSctFrame() )
1242  {
1243  if( static_cast<SwSectionFrame*>(pFrame)->GetSection() )
1244  {
1245  SwFrame* pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1246  if( pTmp )
1247  pTmp->InvalidatePos();
1248  else if( !bNoFootnote )
1249  static_cast<SwSectionFrame*>(pFrame)->InvalidateFootnotePos();
1250  if( !IsInSct() || FindSctFrame()->GetFollow() != pFrame )
1251  pFrame->InvalidatePos();
1252  return;
1253  }
1254  pFrame = pFrame->FindNext();
1255  }
1256  if( pFrame )
1257  {
1258  if ( pFrame->IsSctFrame())
1259  {
1260  // We need to invalidate the section's content so it gets
1261  // the chance to flow to a different page.
1262  SwFrame* pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1263  if( pTmp )
1264  pTmp->InvalidatePos();
1265  if( !IsInSct() || FindSctFrame()->GetFollow() != pFrame )
1266  pFrame->InvalidatePos();
1267  }
1268  else
1269  pFrame->InvalidatePos();
1270  }
1271  }
1272  else
1273  pFrame->InvalidatePos();
1274 }
1275 
1283 {
1284  // determine next frame
1285  SwFrame* pNextFrame = FindNext();
1286  // skip empty section frames and hidden text frames
1287  {
1288  while ( pNextFrame &&
1289  ( ( pNextFrame->IsSctFrame() &&
1290  !static_cast<SwSectionFrame*>(pNextFrame)->GetSection() ) ||
1291  ( pNextFrame->IsTextFrame() &&
1292  static_cast<SwTextFrame*>(pNextFrame)->IsHiddenNow() ) ) )
1293  {
1294  pNextFrame = pNextFrame->FindNext();
1295  }
1296  }
1297 
1298  // Invalidate printing area of found next frame
1299  if ( !pNextFrame )
1300  return;
1301 
1302  if ( pNextFrame->IsSctFrame() )
1303  {
1304  // Invalidate printing area of found section frame, if
1305  // (1) this text frame isn't in a section OR
1306  // (2) found section frame isn't a follow of the section frame this
1307  // text frame is in.
1308  if ( !IsInSct() || FindSctFrame()->GetFollow() != pNextFrame )
1309  {
1310  pNextFrame->InvalidatePrt();
1311  }
1312 
1313  // Invalidate printing area of first content in found section.
1314  SwFrame* pFstContentOfSctFrame =
1315  static_cast<SwSectionFrame*>(pNextFrame)->ContainsAny();
1316  if ( pFstContentOfSctFrame )
1317  {
1318  pFstContentOfSctFrame->InvalidatePrt();
1319  }
1320  }
1321  else
1322  {
1323  pNextFrame->InvalidatePrt();
1324  }
1325 }
1326 
1329 static bool lcl_IsInSectionDirectly( const SwFrame *pUp )
1330 {
1331  bool bSeenColumn = false;
1332 
1333  while( pUp )
1334  {
1335  if( pUp->IsColumnFrame() )
1336  bSeenColumn = true;
1337  else if( pUp->IsSctFrame() )
1338  {
1339  auto pSection = static_cast<const SwSectionFrame*>(pUp);
1340  const SwFrame* pHeaderFooter = pSection->FindFooterOrHeader();
1341  // When the section frame is not in header/footer:
1342  // Allow move of frame in case our only column is not growable.
1343  // Also allow if there is a previous section frame (to move back).
1344  bool bAllowOutsideHeaderFooter = !pSection->Growable() || pSection->GetPrecede();
1345  return bSeenColumn || (!pHeaderFooter && bAllowOutsideHeaderFooter);
1346  }
1347  else if( pUp->IsTabFrame() )
1348  return false;
1349  pUp = pUp->GetUpper();
1350  }
1351  return false;
1352 }
1353 
1362 bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const
1363 {
1364  bool bRetVal = false;
1365 
1366  if ( !_pLayoutFrame )
1367  {
1368  _pLayoutFrame = GetUpper();
1369  }
1370 
1371  if ( _pLayoutFrame && IsFlowFrame() )
1372  {
1373  if ( _pLayoutFrame->IsInSct() && lcl_IsInSectionDirectly( _pLayoutFrame ) )
1374  {
1375  bRetVal = true;
1376  }
1377  else if ( _pLayoutFrame->IsInFly() ||
1378  _pLayoutFrame->IsInDocBody() ||
1379  _pLayoutFrame->IsInFootnote() )
1380  {
1381  // If IsMovable() is called before a MoveFwd() the method
1382  // may return false if there is no NextCellLeaf. If
1383  // IsMovable() is called before a MoveBwd() the method may
1384  // return false if there is no PrevCellLeaf.
1385  if ( _pLayoutFrame->IsInTab() && !IsTabFrame() &&
1386  ( !IsContentFrame() || (!const_cast<SwFrame*>(this)->GetNextCellLeaf()
1387  && !const_cast<SwFrame*>(this)->GetPrevCellLeaf()) )
1388  )
1389  {
1390  bRetVal = false;
1391  }
1392  else
1393  {
1394  if ( _pLayoutFrame->IsInFly() )
1395  {
1396  // if fly frame has a follow (next linked fly frame),
1397  // frame is moveable.
1398  if ( const_cast<SwLayoutFrame*>(_pLayoutFrame)->FindFlyFrame()->GetNextLink() )
1399  {
1400  bRetVal = true;
1401  }
1402  else
1403  {
1404  // if environment is columned, frame is moveable, if
1405  // it isn't in last column.
1406  // search for column frame
1407  const SwFrame* pCol = _pLayoutFrame;
1408  while ( pCol && !pCol->IsColumnFrame() )
1409  {
1410  pCol = pCol->GetUpper();
1411  }
1412  // frame is moveable, if found column frame isn't last one.
1413  if ( pCol && pCol->GetNext() )
1414  {
1415  bRetVal = true;
1416  }
1417  }
1418  }
1419  else if (!(_pLayoutFrame->IsInFootnote() && (IsTabFrame() || IsInTab())))
1420  {
1421  bRetVal = true;
1422  }
1423  }
1424  }
1425  }
1426 
1427  return bRetVal;
1428 }
1429 
1431 {
1432  if ( !IsFlyFrame() && !GetUpper() ) //not yet pasted, no information available
1433  return;
1434 
1436 
1437  SwFrame *pFrame = this;
1438  if( IsFootnoteContFrame() )
1439  mbInfFootnote = true;
1440  do
1441  {
1442  // mbInfBody is only set in the page body, but not in the column body
1443  if ( pFrame->IsBodyFrame() && !mbInfFootnote && pFrame->GetUpper()
1444  && pFrame->GetUpper()->IsPageFrame() )
1445  mbInfBody = true;
1446  else if ( pFrame->IsTabFrame() || pFrame->IsCellFrame() )
1447  {
1448  mbInfTab = true;
1449  }
1450  else if ( pFrame->IsFlyFrame() )
1451  mbInfFly = true;
1452  else if ( pFrame->IsSctFrame() )
1453  mbInfSct = true;
1454  else if ( pFrame->IsFootnoteFrame() )
1455  mbInfFootnote = true;
1456 
1457  pFrame = pFrame->GetUpper();
1458 
1459  } while ( pFrame && !pFrame->IsPageFrame() ); //there is nothing above the page
1460 }
1461 
1467 void SwFrame::SetDirFlags( bool bVert )
1468 {
1469  if( bVert )
1470  {
1471  // OD 2004-01-21 #114969# - if derived, valid vertical flag only if
1472  // vertical flag of upper/anchor is valid.
1473  if( mbDerivedVert )
1474  {
1475  const SwFrame* pAsk = IsFlyFrame() ?
1476  static_cast<SwFlyFrame*>(this)->GetAnchorFrame() : GetUpper();
1477 
1478  OSL_ENSURE( pAsk != this, "Autsch! Stack overflow is about to happen" );
1479 
1480  if( pAsk )
1481  {
1482  mbVertical = pAsk->IsVertical();
1483  mbVertLR = pAsk->IsVertLR();
1484  mbVertLRBT = pAsk->IsVertLRBT();
1485 
1486  if ( !pAsk->mbInvalidVert )
1487  mbInvalidVert = false;
1488 
1489  if ( IsCellFrame() )
1490  {
1491  SwCellFrame* pPrv = static_cast<SwCellFrame*>(this)->GetPreviousCell();
1492  if ( pPrv && !mbVertical && pPrv->IsVertical() )
1493  {
1494  mbVertical = pPrv->IsVertical();
1495  mbVertLR = pPrv->IsVertLR();
1496  mbVertLRBT = pPrv->IsVertLRBT();
1497  }
1498  }
1499  }
1500  }
1501  else
1502  CheckDirection( bVert );
1503  }
1504  else
1505  {
1506  bool bInv = false;
1507  if( !mbDerivedR2L ) // CheckDirection is able to set bDerivedR2L!
1508  CheckDirection( bVert );
1509  if( mbDerivedR2L )
1510  {
1511  const SwFrame* pAsk = IsFlyFrame() ?
1512  static_cast<SwFlyFrame*>(this)->GetAnchorFrame() : GetUpper();
1513 
1514  OSL_ENSURE( pAsk != this, "Oops! Stack overflow is about to happen" );
1515 
1516  if( pAsk )
1517  mbRightToLeft = pAsk->IsRightToLeft();
1518  if( !pAsk || pAsk->mbInvalidR2L )
1519  bInv = mbInvalidR2L;
1520  }
1521  mbInvalidR2L = bInv;
1522  }
1523 }
1524 
1526 {
1527  SwFrame* pTmpFrame = this;
1528  while (pTmpFrame && !pTmpFrame->IsCellFrame())
1529  pTmpFrame = pTmpFrame->GetUpper();
1530 
1531  SAL_WARN_IF(!pTmpFrame, "sw.core", "SwFrame::GetNextCellLeaf() without cell");
1532  return pTmpFrame ? static_cast<SwCellFrame*>(pTmpFrame)->GetFollowCell() : nullptr;
1533 }
1534 
1536 {
1537  SwFrame* pTmpFrame = this;
1538  while (pTmpFrame && !pTmpFrame->IsCellFrame())
1539  pTmpFrame = pTmpFrame->GetUpper();
1540 
1541  SAL_WARN_IF(!pTmpFrame, "sw.core", "SwFrame::GetNextPreviousLeaf() without cell");
1542  return pTmpFrame ? static_cast<SwCellFrame*>(pTmpFrame)->GetPreviousCell() : nullptr;
1543 }
1544 
1546  const SwCellFrame& rOrigCell,
1547  const SwRowFrame& rCorrRow,
1548  bool bInFollow )
1549 {
1550  SwCellFrame* pRet = nullptr;
1551  const SwCellFrame* pCell = static_cast<const SwCellFrame*>(rOrigRow.Lower());
1552  SwCellFrame* pCorrCell = const_cast<SwCellFrame*>(static_cast<const SwCellFrame*>(rCorrRow.Lower()));
1553 
1554  while ( pCell != &rOrigCell && !pCell->IsAnLower( &rOrigCell ) )
1555  {
1556  pCell = static_cast<const SwCellFrame*>(pCell->GetNext());
1557  pCorrCell = static_cast<SwCellFrame*>(pCorrCell->GetNext());
1558  }
1559 
1560  assert(pCell && pCorrCell && "lcl_FindCorrespondingCellFrame does not work");
1561 
1562  if ( pCell != &rOrigCell )
1563  {
1564  // rOrigCell must be a lower of pCell. We need to recurse into the rows:
1565  assert(pCell->Lower() && pCell->Lower()->IsRowFrame() &&
1566  "lcl_FindCorrespondingCellFrame does not work");
1567 
1568  const SwRowFrame* pRow = static_cast<const SwRowFrame*>(pCell->Lower());
1569  while ( !pRow->IsAnLower( &rOrigCell ) )
1570  pRow = static_cast<const SwRowFrame*>(pRow->GetNext());
1571 
1572  SwRowFrame* pCorrRow = nullptr;
1573  if ( bInFollow )
1574  pCorrRow = pRow->GetFollowRow();
1575  else
1576  {
1577  SwRowFrame* pTmpRow = static_cast<SwRowFrame*>(pCorrCell->GetLastLower());
1578 
1579  if ( pTmpRow && pTmpRow->GetFollowRow() == pRow )
1580  pCorrRow = pTmpRow;
1581  }
1582 
1583  if ( pCorrRow )
1584  pRet = lcl_FindCorrespondingCellFrame( *pRow, rOrigCell, *pCorrRow, bInFollow );
1585  }
1586  else
1587  pRet = pCorrCell;
1588 
1589  return pRet;
1590 }
1591 
1592 // VERSION OF GetFollowCell() that assumes that we always have a follow flow line:
1594 {
1595  SwCellFrame* pRet = nullptr;
1596 
1597  // NEW TABLES
1598  // Covered cells do not have follow cells!
1599  const tools::Long nRowSpan = GetLayoutRowSpan();
1600  if ( nRowSpan < 1 )
1601  return nullptr;
1602 
1603  // find most upper row frame
1604  const SwFrame* pRow = GetUpper();
1605 
1606  while (pRow && (!pRow->IsRowFrame() || !pRow->GetUpper()->IsTabFrame()))
1607  pRow = pRow->GetUpper();
1608 
1609  if (!pRow)
1610  return nullptr;
1611 
1612  const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pRow->GetUpper());
1613  if (!pTabFrame || !pTabFrame->GetFollow() || !pTabFrame->HasFollowFlowLine())
1614  return nullptr;
1615 
1616  const SwCellFrame* pThisCell = this;
1617 
1618  // Get last cell of the current table frame that belongs to the rowspan:
1619  if ( nRowSpan > 1 )
1620  {
1621  // optimization: Will end of row span be in last row or exceed row?
1622  tools::Long nMax = 0;
1623  while ( pRow->GetNext() && ++nMax < nRowSpan )
1624  pRow = pRow->GetNext();
1625 
1626  if ( !pRow->GetNext() )
1627  {
1628  pThisCell = &pThisCell->FindStartEndOfRowSpanCell( false );
1629  pRow = pThisCell->GetUpper();
1630  }
1631  }
1632 
1633  const SwRowFrame* pFollowRow = nullptr;
1634  if ( !pRow->GetNext() &&
1635  nullptr != ( pFollowRow = pRow->IsInSplitTableRow() ) &&
1636  ( !pFollowRow->IsRowSpanLine() || nRowSpan > 1 ) )
1637  pRet = lcl_FindCorrespondingCellFrame( *static_cast<const SwRowFrame*>(pRow), *pThisCell, *pFollowRow, true );
1638 
1639  return pRet;
1640 }
1641 
1642 // VERSION OF GetPreviousCell() THAT ASSUMES THAT WE ALWAYS HAVE A FFL
1644 {
1645  SwCellFrame* pRet = nullptr;
1646 
1647  // NEW TABLES
1648  // Covered cells do not have previous cells!
1649  if ( GetLayoutRowSpan() < 1 )
1650  return nullptr;
1651 
1652  // find most upper row frame
1653  const SwFrame* pRow = GetUpper();
1654  while( !pRow->IsRowFrame() || (pRow->GetUpper() && !pRow->GetUpper()->IsTabFrame()) )
1655  pRow = pRow->GetUpper();
1656 
1657  OSL_ENSURE( pRow->GetUpper() && pRow->GetUpper()->IsTabFrame(), "GetPreviousCell without Table" );
1658 
1659  const SwTabFrame* pTab = static_cast<const SwTabFrame*>(pRow->GetUpper());
1660 
1661  if ( pTab && pTab->IsFollow() )
1662  {
1663  const SwFrame* pTmp = pTab->GetFirstNonHeadlineRow();
1664  const bool bIsInFirstLine = ( pTmp == pRow );
1665 
1666  if ( bIsInFirstLine )
1667  {
1668  SwTabFrame *pMaster = pTab->FindMaster();
1669  if ( pMaster && pMaster->HasFollowFlowLine() )
1670  {
1671  SwRowFrame* pMasterRow = static_cast<SwRowFrame*>(pMaster->GetLastLower());
1672  if ( pMasterRow )
1673  pRet = lcl_FindCorrespondingCellFrame( *static_cast<const SwRowFrame*>(pRow), *this, *pMasterRow, false );
1674  if ( pRet && pRet->GetTabBox()->getRowSpan() < 1 )
1675  pRet = &const_cast<SwCellFrame&>(pRet->FindStartEndOfRowSpanCell( true ));
1676  }
1677  }
1678  }
1679 
1680  return pRet;
1681 }
1682 
1683 // --> NEW TABLES
1685 {
1686  const SwTabFrame* pTableFrame = dynamic_cast<const SwTabFrame*>(GetUpper()->GetUpper());
1687 
1688  if ( !bStart && pTableFrame && pTableFrame->IsFollow() && pTableFrame->IsInHeadline( *this ) )
1689  return *this;
1690 
1691  OSL_ENSURE( pTableFrame &&
1692  ( (bStart && GetTabBox()->getRowSpan() < 1) ||
1693  (!bStart && GetLayoutRowSpan() > 1) ),
1694  "SwCellFrame::FindStartRowSpanCell: No rowspan, no table, no cookies" );
1695 
1696  if ( pTableFrame )
1697  {
1698  const SwTable* pTable = pTableFrame->GetTable();
1699 
1700  sal_uInt16 nMax = USHRT_MAX;
1701  const SwFrame* pCurrentRow = GetUpper();
1702  const bool bDoNotEnterHeadline = bStart && pTableFrame->IsFollow() &&
1703  !pTableFrame->IsInHeadline( *pCurrentRow );
1704 
1705  // check how many rows we are allowed to go up or down until we reach the end of
1706  // the current table frame:
1707  nMax = 0;
1708  while ( bStart ? pCurrentRow->GetPrev() : pCurrentRow->GetNext() )
1709  {
1710  if ( bStart )
1711  {
1712  // do not enter a repeated headline:
1713  if ( bDoNotEnterHeadline && pTableFrame->IsFollow() &&
1714  pTableFrame->IsInHeadline( *pCurrentRow->GetPrev() ) )
1715  break;
1716 
1717  pCurrentRow = pCurrentRow->GetPrev();
1718  }
1719  else
1720  pCurrentRow = pCurrentRow->GetNext();
1721 
1722  ++nMax;
1723  }
1724 
1725  // By passing the nMax value for Find*OfRowSpan (in case of bCurrentTableOnly
1726  // is set) we assure that we find a rMasterBox that has a SwCellFrame in
1727  // the current table frame:
1728  const SwTableBox& rMasterBox = bStart ?
1729  GetTabBox()->FindStartOfRowSpan( *pTable, nMax ) :
1730  GetTabBox()->FindEndOfRowSpan( *pTable, nMax );
1731 
1732  SwIterator<SwCellFrame,SwFormat> aIter( *rMasterBox.GetFrameFormat() );
1733 
1734  for ( SwCellFrame* pMasterCell = aIter.First(); pMasterCell; pMasterCell = aIter.Next() )
1735  {
1736  if ( pMasterCell->GetTabBox() == &rMasterBox )
1737  {
1738  const SwTabFrame* pMasterTable = static_cast<const SwTabFrame*>(pMasterCell->GetUpper()->GetUpper());
1739 
1740  if ( pMasterTable == pTableFrame )
1741  {
1742  return *pMasterCell;
1743  }
1744  }
1745  }
1746  }
1747 
1748  SAL_WARN("sw.core", "SwCellFrame::FindStartRowSpanCell: No result");
1749 
1750  return *this;
1751 }
1752 
1753 // <-- NEW TABLES
1754 
1756 {
1757  OSL_ENSURE( IsInTab(), "IsInSplitTableRow should only be called for frames in tables" );
1758 
1759  const SwFrame* pRow = this;
1760 
1761  // find most upper row frame
1762  while( pRow && ( !pRow->IsRowFrame() || !pRow->GetUpper()->IsTabFrame() ) )
1763  pRow = pRow->GetUpper();
1764 
1765  if ( !pRow ) return nullptr;
1766 
1767  OSL_ENSURE( pRow->GetUpper()->IsTabFrame(), "Confusion in table layout" );
1768 
1769  const SwTabFrame* pTab = static_cast<const SwTabFrame*>(pRow->GetUpper());
1770 
1771  // If most upper row frame is a headline row, the current frame
1772  // can't be in a split table row. Thus, add corresponding condition.
1773  if ( pRow->GetNext() ||
1774  pTab->GetTable()->IsHeadline(
1775  *(static_cast<const SwRowFrame*>(pRow)->GetTabLine()) ) ||
1776  !pTab->HasFollowFlowLine() ||
1777  !pTab->GetFollow() )
1778  return nullptr;
1779 
1780  // skip headline
1781  const SwRowFrame* pFollowRow = pTab->GetFollow()->GetFirstNonHeadlineRow();
1782 
1783  OSL_ENSURE( pFollowRow, "SwFrame::IsInSplitTableRow() does not work" );
1784 
1785  return pFollowRow;
1786 }
1787 
1789 {
1790  OSL_ENSURE( IsInTab(), "IsInSplitTableRow should only be called for frames in tables" );
1791 
1792  // find most upper row frame
1793  const SwFrame* pRow = this;
1794  while( pRow && ( !pRow->IsRowFrame() || !pRow->GetUpper()->IsTabFrame() ) )
1795  pRow = pRow->GetUpper();
1796 
1797  if ( !pRow ) return nullptr;
1798 
1799  OSL_ENSURE( pRow->GetUpper()->IsTabFrame(), "Confusion in table layout" );
1800 
1801  const SwTabFrame* pTab = static_cast<const SwTabFrame*>(pRow->GetUpper());
1802 
1803  const SwTabFrame* pMaster = pTab->IsFollow() ? pTab->FindMaster() : nullptr;
1804 
1805  if ( !pMaster || !pMaster->HasFollowFlowLine() )
1806  return nullptr;
1807 
1808  const SwFrame* pTmp = pTab->GetFirstNonHeadlineRow();
1809  const bool bIsInFirstLine = ( pTmp == pRow );
1810 
1811  if ( !bIsInFirstLine )
1812  return nullptr;
1813 
1814  const SwRowFrame* pMasterRow = static_cast<const SwRowFrame*>(pMaster->GetLastLower());
1815  return pMasterRow;
1816 }
1817 
1819 {
1820  bool bRet = false;
1821 
1822  if ( IsInSct() )
1823  {
1824  const SwSectionFrame* pSectionFrame = FindSctFrame();
1825  if ( pSectionFrame )
1826  bRet = pSectionFrame->IsBalancedSection();
1827  }
1828  return bRet;
1829 }
1830 
1832 {
1833  const SwFrame* pRet = Lower();
1834  if ( !pRet )
1835  return nullptr;
1836  while ( pRet->GetNext() )
1837  pRet = pRet->GetNext();
1838  return pRet;
1839 }
1840 
1841 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:207
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:548
SwSectionFrame * FindMaster() const
Definition: flowfrm.cxx:754
Base class of the Writer layout elements.
Definition: frame.hxx:313
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:158
bool mbInfFootnote
Definition: frame.hxx:440
static bool lcl_IsInSectionDirectly(const SwFrame *pUp)
Definition: findfrm.cxx:1329
void Right(const tools::Long nRight)
Definition: swrect.hxx:199
bool IsFollow() const
Definition: flowfrm.hxx:166
SwFrame * mpNext
Definition: frame.hxx:337
bool IsEndnAtEnd() const
Definition: sectfrm.hxx:157
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:115
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:823
bool IsInDocBody() const
Definition: frame.hxx:940
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:573
bool IsInFly() const
Definition: frame.hxx:958
bool IsRootFrame() const
Definition: frame.hxx:1171
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
bool IsInSct() const
Definition: frame.hxx:964
drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: findfrm.cxx:694
bool mbInvalidVert
Definition: frame.hxx:419
SwFootnoteFrame * ImplFindFootnoteFrame()
Definition: findfrm.cxx:505
const SwBodyFrame * ImplFindBodyFrame() const
Definition: findfrm.cxx:493
bool IsBefore(const SwLayoutFrame *_pCheckRefLayFrame) const
method to check relative position of layout frame to a given layout frame.
Definition: findfrm.cxx:234
const SwTable * GetTable() const
Definition: tabfrm.hxx:157
void Left(const tools::Long nLeft)
Definition: swrect.hxx:194
bool IsInFootnote() const
Definition: frame.hxx:946
SwFrameType GetType() const
Definition: frame.hxx:518
long Long
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:46
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
void InvalidatePos()
Definition: frame.hxx:1040
static const SwFrame * lcl_GetLower(const SwFrame *pFrame, bool bFwd)
Definition: findfrm.cxx:293
void Pos(const Point &rNew)
Definition: swrect.hxx:168
bool IsEndNote() const
Definition: fmtftn.hxx:71
const SwCellFrame & FindStartEndOfRowSpanCell(bool bStart) const
Definition: findfrm.cxx:1684
SwFrame * FindNext()
Definition: frame.hxx:1138
bool IsCellFrame() const
Definition: frame.hxx:1223
bool supportsFullDrawingLayerFillAttributeSet() const
Definition: findfrm.cxx:710
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
virtual const SvxFormatBreakItem & GetBreakItem() const
Definition: findfrm.cxx:657
SwContentFrame * FindFirstBodyContent()
Definition: pagefrm.hxx:350
virtual const SwFormatPageDesc & GetPageDescItem() const
Definition: findfrm.cxx:662
bool mbInfBody
Definition: frame.hxx:437
bool mbVertLR
Definition: frame.hxx:423
bool IsFootnoteFrame() const
Definition: frame.hxx:1199
static bool bFootnote
Definition: insfnote.cxx:33
bool IsVertLRBT() const
Definition: frame.hxx:980
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:204
sal_Int32 getRowSpan() const
Definition: swtable.cxx:75
SwSectionFrame * ImplFindSctFrame()
Definition: findfrm.cxx:481
std::vector< SwRect > maPageRects
Definition: rootfrm.hxx:94
bool mbVertLRBT
Definition: frame.hxx:424
bool IsFlyFrame() const
Definition: frame.hxx:1207
void InvalidateNextPrtArea()
method to invalidate printing area of next frame #i11859#
Definition: findfrm.cxx:1282
const SvxFormatBreakItem & GetBreak(bool=true) const
Definition: frmatr.hxx:62
bool IsMoveable(const SwLayoutFrame *_pLayoutFrame=nullptr) const
determine, if frame is moveable in given environment
Definition: findfrm.cxx:1362
const SwTableBox * GetTabBox() const
Definition: cellfrm.hxx:51
const SwRect & getFrameArea() const
Definition: frame.hxx:178
bool mbInfTab
Definition: frame.hxx:438
bool IsInTab() const
Definition: frame.hxx:952
static const SwFrame * lcl_FindLayoutFrame(const SwFrame *pFrame, bool bNext)
Definition: findfrm.cxx:282
SwCellFrame * GetPreviousCell() const
Definition: findfrm.cxx:1643
const SwRowFrame * IsInSplitTableRow() const
Definition: findfrm.cxx:1755
bool IsTextFrame() const
Definition: frame.hxx:1231
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:41
SwRowFrame * FindRowFrame()
Definition: findfrm.cxx:539
bool mbInfInvalid
Definition: frame.hxx:436
const SwContentFrame * ImplGetNextContentFrame(bool bFwd) const
Walk back inside the tree: grab the subordinate Frame if one exists and the last step was not moving ...
Definition: findfrm.cxx:371
SwContentFrame * GetPrevContentFrame() const
Definition: cntfrm.hxx:123
bool IsSctFrame() const
Definition: frame.hxx:1211
SwFrame * FindPrev_()
Definition: findfrm.cxx:1156
bool IsFlowFrame() const
Definition: frame.hxx:1239
SwLayoutFrame * GetNextCellLeaf()
Definition: findfrm.cxx:1525
tools::Long GetLayoutRowSpan() const
Definition: tabfrm.cxx:5580
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame, use GetBreakItem()/GetPageDescItem() instead.
Definition: findfrm.cxx:677
bool IsRowSpanLine() const
Definition: rowfrm.hxx:104
bool IsColumnFrame() const
Definition: frame.hxx:1179
SwContentFrame * FindLastContent()
Definition: tabfrm.cxx:3555
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1104
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:457
SwTabFrame * ImplFindTabFrame()
Definition: findfrm.cxx:469
void SetDirFlags(bool bVert)
Updates the vertical or the righttoleft-flags.
Definition: findfrm.cxx:1467
bool IsBalancedSection() const
Definition: sectfrm.cxx:2911
SwTabFrame * FindMaster(bool bFirstMaster=false) const
Definition: flowfrm.cxx:774
bool IsContentFrame() const
Definition: frame.hxx:1227
void InvalidatePrt()
Definition: frame.hxx:1033
#define FRM_HEADFOOT
Definition: frame.hxx:107
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1831
SwFrame * FindNext_()
Definition: findfrm.cxx:775
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:169
SwPageFrame * FindPageFrame()
Definition: frame.hxx:679
const SwLayoutFrame * ImplGetNextLayoutLeaf(bool bFwd) const
Finds the next layout leaf.
Definition: findfrm.cxx:310
const SwFrame * Lower() const
Definition: layfrm.hxx:101
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:191
bool IsInBalancedSection() const
Definition: findfrm.cxx:1818
bool mbInvalidR2L
Definition: frame.hxx:416
SwLayoutFrame * GetUpper()
Definition: frame.hxx:677
bool mbVertical
Definition: frame.hxx:421
static SwCellFrame * lcl_FindCorrespondingCellFrame(const SwRowFrame &rOrigRow, const SwCellFrame &rOrigCell, const SwRowFrame &rCorrRow, bool bInFollow)
Definition: findfrm.cxx:1545
bool IsRowFrame() const
Definition: frame.hxx:1219
SwFlyFrame * ImplFindFlyFrame()
Definition: findfrm.cxx:517
SwFootnoteBossFrame * FindFootnoteBossFrame(bool bFootnotes=false)
Definition: findfrm.cxx:436
SwFrame * GetPrev()
Definition: frame.hxx:676
const SwRowFrame * IsInFollowFlowRow() const
Definition: findfrm.cxx:1788
bool mbDerivedR2L
Definition: frame.hxx:417
void ImplInvalidateNextPos(bool bNoFootnote)
Definition: findfrm.cxx:1233
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:434
SwRowFrame * GetFollowRow() const
Definition: rowfrm.hxx:77
void SSize(const Size &rNew)
Definition: swrect.hxx:177
SwContentFrame * FindLastContent(SwFindMode nMode=SwFindMode::None)
Definition: sectfrm.cxx:908
SwCellFrame * GetFollowCell() const
Definition: findfrm.cxx:1593
A page of the document layout.
Definition: pagefrm.hxx:57
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:204
virtual const SvxFormatBreakItem & GetBreakItem() const override
Definition: findfrm.cxx:667
tools::Long SwTwips
Definition: swtypes.hxx:50
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:111
virtual const SwFormatPageDesc & GetPageDescItem() const override
Definition: findfrm.cxx:672
SwContentFrame * FindNextCnt_(const bool _bInSameFootnote)
method to determine next content frame in the same environment for a flow frame (content frame...
Definition: findfrm.cxx:906
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1112
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:43
const SwFootnoteFrame * GetMaster() const
Definition: ftnfrm.hxx:119
SwFrame * FindColFrame()
Definition: findfrm.cxx:530
const SwCellFrame * FirstCell() const
Calls ContainsAny first to reach the innermost cell.
Definition: findfrm.cxx:113
bool mbInfSct
Definition: frame.hxx:441
virtual void CheckDirection(bool bVert)
Definition: wsfrm.cxx:392
const SwFootnoteFrame * FindFootNote() const
Definition: findfrm.cxx:565
bool IsLayoutFrame() const
Definition: frame.hxx:1167
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:208
bool mbDerivedVert
Definition: frame.hxx:420
SwContentFrame * FindLastBodyContent()
Searches the last ContentFrame in BodyText below the page.
Definition: findfrm.cxx:52
bool IsVertLR() const
Definition: frame.hxx:976
SwContentFrame * FindPrevCnt_()
method to determine previous content frame in the same environment for a flow frame (content frame...
Definition: findfrm.cxx:1017
bool IsTabFrame() const
Definition: frame.hxx:1215
general base class for all free-flowing frames
Definition: flyfrm.hxx:78
SwTableBox & FindStartOfRowSpan(const SwTable &, sal_uInt16 nMaxStep=USHRT_MAX)
SwTableBox::FindStartOfRowSpan(..) returns the "master" cell, the cell which overlaps the given cell...
#define SAL_WARN_IF(condition, area, stream)
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:738
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:423
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method doesn't investigate content of footnotes by default.
Definition: findfrm.cxx:126
bool IsInside(const Point &rPOINT) const
Definition: swrect.cxx:105
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:75
bool IsNoTextFrame() const
Definition: frame.hxx:1235
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:116
SwLayoutFrame * GetPrevCellLeaf()
Definition: findfrm.cxx:1535
bool IsRightToLeft() const
Definition: frame.hxx:984
void Top(const tools::Long nTop)
Definition: swrect.hxx:203
SwTableBox & FindEndOfRowSpan(const SwTable &, sal_uInt16 nMaxStep)
SwTableBox::FindEndOfRowSpan(..) returns the last overlapped cell if there is any.
SwTableBox is one table cell in the document model.
Definition: swtable.hxx:395
SwFrame * GetLower()
Definition: findfrm.cxx:170
bool IsPageFrame() const
Definition: frame.hxx:1175
void * p
const SwTextFootnote * GetAttr() const
Definition: ftnfrm.hxx:122
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:715
void SetInfFlags()
Definition: findfrm.cxx:1430
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:249
bool mbRightToLeft
Definition: frame.hxx:418
bool IsVertical() const
Definition: frame.hxx:970
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: node.cxx:2085
#define SAL_WARN(area, stream)
bool IsFootnoteAtEnd() const
Definition: sectfrm.hxx:156
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx:175
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
bool IsFootnoteBossFrame() const
Definition: frame.hxx:1183
const SwLayoutFrame * GetNextLayoutLeaf() const
Definition: frame.hxx:1017
bool IsFootnoteContFrame() const
Definition: frame.hxx:1195
SwPageFrame * ImplFindPageFrame()
Definition: findfrm.cxx:415
bool IsOver(const SwRect &rRect) const
Definition: swrect.cxx:123
bool IsWhitespaceHidden() const
Definition: viewopt.hxx:488
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:67
bool IsBodyFrame() const
Definition: frame.hxx:1203
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:207
static SwFrame * lcl_NextFrame(SwFrame *pFrame)
Definition: findfrm.cxx:740
Container of body content (i.e.
Definition: bodyfrm.hxx:28
bool HasFollowFlowLine() const
Definition: tabfrm.hxx:173
bool mbInfFly
Definition: frame.hxx:439
sal_uInt16 GetPageNum() const
Definition: rootfrm.hxx:313
bool IsFooterFrame() const
Definition: frame.hxx:1191
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:30
bool IsBetweenPages(const Point &rPt) const
Point rPt: The point to test.
Definition: findfrm.cxx:615
SwRowFrame is one table row in the document layout.
Definition: rowfrm.hxx:28
bool IsHeaderFrame() const
Definition: frame.hxx:1187
bool IsInHeadline(const SwFrame &rFrame) const
Definition: tabfrm.cxx:5710
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1096
SwFrame * GetNext()
Definition: frame.hxx:675
SwContentFrame * FindLastContent()
search for last content in the current footnote frame
Definition: ftnfrm.cxx:2931