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  {
645  // If we are really close to the bottom or top of a page.
646  const auto toEdge = std::min(std::abs(pPage->getFrameArea().Top() - rPt.Y()),
647  std::abs(pPage->getFrameArea().Bottom() - rPt.Y()));
648  return toEdge <= MmToTwips(2.0);
649  }
650  }
651 
652  return false;
653 }
654 
656 {
657  return GetAttrSet()->GetBreak();
658 }
659 
661 {
662  return GetAttrSet()->GetPageDesc();
663 }
664 
666 {
667  return GetTextNodeFirst()->GetSwAttrSet().GetBreak();
668 }
669 
671 {
673 }
674 
676 {
677  if (IsTextFrame())
678  {
679  return &static_cast<const SwTextFrame*>(this)->GetTextNodeForParaProps()->GetSwAttrSet();
680  }
681  else if (IsNoTextFrame())
682  {
683  return &static_cast<const SwNoTextFrame*>(this)->GetNode()->GetSwAttrSet();
684  }
685  else
686  {
688  return &static_cast<const SwLayoutFrame*>(this)->GetFormat()->GetAttrSet();
689  }
690 }
691 
693 {
694  if (IsTextFrame())
695  {
696  return static_cast<const SwTextFrame*>(this)->GetTextNodeForParaProps()->getSdrAllFillAttributesHelper();
697  }
698  else if (IsNoTextFrame())
699  {
700  return static_cast<const SwNoTextFrame*>(this)->GetNode()->getSdrAllFillAttributesHelper();
701  }
702  else
703  {
704  return static_cast< const SwLayoutFrame* >(this)->GetFormat()->getSdrAllFillAttributesHelper();
705  }
706 }
707 
709 {
710  if (IsContentFrame())
711  {
712  return true;
713  }
714  else
715  {
716  return static_cast< const SwLayoutFrame* >(this)->GetFormat()->supportsFullDrawingLayerFillAttributeSet();
717  }
718 }
719 
720 /*
721  * SwFrame::FindNext_(), FindPrev_(), InvalidateNextPos()
722  * FindNextCnt_() visits tables and sections and only returns SwContentFrames.
723  *
724  * Description Invalidates the position of the next frame.
725  * This is the direct successor or in case of ContentFrames the next
726  * ContentFrame which sits in the same flow as I do:
727  * - body,
728  * - footnote,
729  * - in headers/footers the notification only needs to be forwarded
730  * inside the section
731  * - same for Flys
732  * - Contents in tabs remain only inside their cell
733  * - in principle tables behave exactly like the Contents
734  * - sections also
735  */
736 // This helper function is an equivalent to the ImplGetNextContentFrame() method,
737 // besides ContentFrames this function also returns TabFrames and SectionFrames.
738 static SwFrame* lcl_NextFrame( SwFrame* pFrame )
739 {
740  SwFrame *pRet = nullptr;
741  bool bGoingUp = false;
742  do {
743  SwFrame *p = nullptr;
744 
745  bool bGoingFwd = false;
746  bool bGoingDown = !bGoingUp && pFrame->IsLayoutFrame();
747  if (bGoingDown)
748  {
749  p = static_cast<SwLayoutFrame*>(pFrame)->Lower();
750  bGoingDown = nullptr != p;
751  }
752  if( !bGoingDown )
753  {
754  p = pFrame->IsFlyFrame() ? static_cast<SwFlyFrame*>(pFrame)->GetNextLink() : pFrame->GetNext();
755  bGoingFwd = nullptr != p;
756  if ( !bGoingFwd )
757  {
758  p = pFrame->GetUpper();
759  bGoingUp = nullptr != p;
760  if ( !bGoingUp )
761  {
762  return nullptr;
763  }
764  }
765  }
766  bGoingUp = !(bGoingFwd || bGoingDown);
767  pFrame = p;
768  } while ( nullptr == (pRet = ( ( pFrame->IsContentFrame() || ( !bGoingUp &&
769  ( pFrame->IsTabFrame() || pFrame->IsSctFrame() ) ) )? pFrame : nullptr ) ) );
770  return pRet;
771 }
772 
774 {
775  bool bIgnoreTab = false;
776  SwFrame *pThis = this;
777 
778  if ( IsTabFrame() )
779  {
780  //The last Content of the table gets picked up and his follower is
781  //returned. To be able to deactivate the special case for tables
782  //(see below) bIgnoreTab will be set.
783  if ( static_cast<SwTabFrame*>(this)->GetFollow() )
784  return static_cast<SwTabFrame*>(this)->GetFollow();
785 
786  pThis = static_cast<SwTabFrame*>(this)->FindLastContentOrTable();
787  if ( !pThis )
788  pThis = this;
789  bIgnoreTab = true;
790  }
791  else if ( IsSctFrame() )
792  {
793  //The last Content of the section gets picked and his follower is returned.
794  if ( static_cast<SwSectionFrame*>(this)->GetFollow() )
795  return static_cast<SwSectionFrame*>(this)->GetFollow();
796 
797  pThis = static_cast<SwSectionFrame*>(this)->FindLastContent();
798  if ( !pThis )
799  pThis = this;
800  }
801  else if ( IsContentFrame() )
802  {
803  if( static_cast<SwContentFrame*>(this)->GetFollow() )
804  return static_cast<SwContentFrame*>(this)->GetFollow();
805  }
806  else if ( IsRowFrame() )
807  {
808  SwFrame* pMyUpper = GetUpper();
809  if ( pMyUpper->IsTabFrame() && static_cast<SwTabFrame*>(pMyUpper)->GetFollow() )
810  return static_cast<SwTabFrame*>(pMyUpper)->GetFollow()->GetLower();
811  else return nullptr;
812  }
813  else
814  return nullptr;
815 
816  SwFrame* pRet = nullptr;
817  const bool bFootnote = pThis->IsInFootnote();
818  if ( !bIgnoreTab && pThis->IsInTab() )
819  {
820  SwLayoutFrame *pUp = pThis->GetUpper();
821  while (pUp && !pUp->IsCellFrame())
822  pUp = pUp->GetUpper();
823  assert(pUp && "Content flag says it's in table but it's not in cell.");
824  SwFrame* pNxt = pUp ? static_cast<SwCellFrame*>(pUp)->GetFollowCell() : nullptr;
825  if ( pNxt )
826  pNxt = static_cast<SwCellFrame*>(pNxt)->ContainsContent();
827  if ( !pNxt )
828  {
829  pNxt = lcl_NextFrame( pThis );
830  if (pUp && pUp->IsAnLower(pNxt))
831  pRet = pNxt;
832  }
833  else
834  pRet = pNxt;
835  }
836  else
837  {
838  const bool bBody = pThis->IsInDocBody();
839  SwFrame *pNxtCnt = lcl_NextFrame( pThis );
840  if ( pNxtCnt )
841  {
842  if ( bBody || bFootnote )
843  {
844  while ( pNxtCnt )
845  {
846  // OD 02.04.2003 #108446# - check for endnote, only if found
847  // next content isn't contained in a section, that collect its
848  // endnotes at its end.
849  bool bEndn = IsInSct() && !IsSctFrame() &&
850  ( !pNxtCnt->IsInSct() ||
851  !pNxtCnt->FindSctFrame()->IsEndnAtEnd()
852  );
853  if ( ( bBody && pNxtCnt->IsInDocBody() ) ||
854  ( pNxtCnt->IsInFootnote() &&
855  ( bFootnote ||
856  ( bEndn && pNxtCnt->FindFootnoteFrame()->GetAttr()->GetFootnote().IsEndNote() )
857  )
858  )
859  )
860  {
861  pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrame()
862  : pNxtCnt;
863  break;
864  }
865  pNxtCnt = lcl_NextFrame( pNxtCnt );
866  }
867  }
868  else if ( pThis->IsInFly() )
869  {
870  pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrame()
871  : pNxtCnt;
872  }
873  else //footer-/or header section
874  {
875  const SwFrame *pUp = pThis->GetUpper();
876  const SwFrame *pCntUp = pNxtCnt->GetUpper();
877  while ( pUp && pUp->GetUpper() &&
878  !pUp->IsHeaderFrame() && !pUp->IsFooterFrame() )
879  pUp = pUp->GetUpper();
880  while ( pCntUp && pCntUp->GetUpper() &&
881  !pCntUp->IsHeaderFrame() && !pCntUp->IsFooterFrame() )
882  pCntUp = pCntUp->GetUpper();
883  if ( pCntUp == pUp )
884  {
885  pRet = pNxtCnt->IsInTab() ? pNxtCnt->FindTabFrame()
886  : pNxtCnt;
887  }
888  }
889  }
890  }
891  if( pRet && pRet->IsInSct() )
892  {
893  SwSectionFrame* pSct = pRet->FindSctFrame();
894  //Footnotes in frames with columns must not return the section which
895  //contains the footnote
896  if( !pSct->IsAnLower( this ) &&
897  (!bFootnote || pSct->IsInFootnote() ) )
898  return pSct;
899  }
900  return pRet;
901 }
902 
903 // #i27138# - add parameter <_bInSameFootnote>
904 SwContentFrame *SwFrame::FindNextCnt_( const bool _bInSameFootnote )
905 {
906  SwFrame *pThis = this;
907 
908  if ( IsTabFrame() )
909  {
910  if ( static_cast<SwTabFrame*>(this)->GetFollow() )
911  {
912  pThis = static_cast<SwTabFrame*>(this)->GetFollow()->ContainsContent();
913  if( pThis )
914  return static_cast<SwContentFrame*>(pThis);
915  }
916  pThis = static_cast<SwTabFrame*>(this)->FindLastContentOrTable();
917  if ( !pThis )
918  return nullptr;
919  }
920  else if ( IsSctFrame() )
921  {
922  if ( static_cast<SwSectionFrame*>(this)->GetFollow() )
923  {
924  pThis = static_cast<SwSectionFrame*>(this)->GetFollow()->ContainsContent();
925  if( pThis )
926  return static_cast<SwContentFrame*>(pThis);
927  }
928  pThis = static_cast<SwSectionFrame*>(this)->FindLastContent();
929  if ( !pThis )
930  return nullptr;
931  }
932  else if ( IsContentFrame() && static_cast<SwContentFrame*>(this)->GetFollow() )
933  return static_cast<SwContentFrame*>(this)->GetFollow();
934 
935  if ( pThis->IsContentFrame() )
936  {
937  const bool bBody = pThis->IsInDocBody();
938  const bool bFootnote = pThis->IsInFootnote();
939  SwContentFrame *pNxtCnt = static_cast<SwContentFrame*>(pThis)->GetNextContentFrame();
940  if ( pNxtCnt )
941  {
942  // #i27138#
943  if ( bBody || ( bFootnote && !_bInSameFootnote ) )
944  {
945  // handling for environments 'footnotes' and 'document body frames':
946  while ( pNxtCnt )
947  {
948  if ( (bBody && pNxtCnt->IsInDocBody()) ||
949  (bFootnote && pNxtCnt->IsInFootnote()) )
950  return pNxtCnt;
951  pNxtCnt = pNxtCnt->GetNextContentFrame();
952  }
953  }
954  // #i27138#
955  else if ( bFootnote && _bInSameFootnote )
956  {
957  // handling for environments 'each footnote':
958  // Assure that found next content frame belongs to the same footnotes
959  const SwFootnoteFrame* pFootnoteFrameOfNext( pNxtCnt->FindFootnoteFrame() );
960  const SwFootnoteFrame* pFootnoteFrameOfCurr( pThis->FindFootnoteFrame() );
961  OSL_ENSURE( pFootnoteFrameOfCurr,
962  "<SwFrame::FindNextCnt_() - unknown layout situation: current frame has to have an upper footnote frame." );
963  if ( pFootnoteFrameOfNext == pFootnoteFrameOfCurr )
964  {
965  return pNxtCnt;
966  }
967  else if ( pFootnoteFrameOfCurr->GetFollow() )
968  {
969  // next content frame has to be the first content frame
970  // in the follow footnote, which contains a content frame.
971  SwFootnoteFrame* pFollowFootnoteFrameOfCurr(
972  const_cast<SwFootnoteFrame*>(pFootnoteFrameOfCurr) );
973  pNxtCnt = nullptr;
974  do {
975  pFollowFootnoteFrameOfCurr = pFollowFootnoteFrameOfCurr->GetFollow();
976  pNxtCnt = pFollowFootnoteFrameOfCurr->ContainsContent();
977  } while ( !pNxtCnt && pFollowFootnoteFrameOfCurr->GetFollow() );
978  return pNxtCnt;
979  }
980  else
981  {
982  // current content frame is the last content frame in the
983  // footnote - no next content frame exists.
984  return nullptr;
985  }
986  }
987  else if ( pThis->IsInFly() )
988  // handling for environments 'unlinked fly frame' and
989  // 'group of linked fly frames':
990  return pNxtCnt;
991  else
992  {
993  // handling for environments 'page header' and 'page footer':
994  const SwFrame *pUp = pThis->GetUpper();
995  const SwFrame *pCntUp = pNxtCnt->GetUpper();
996  while ( pUp && pUp->GetUpper() &&
997  !pUp->IsHeaderFrame() && !pUp->IsFooterFrame() )
998  pUp = pUp->GetUpper();
999  while ( pCntUp && pCntUp->GetUpper() &&
1000  !pCntUp->IsHeaderFrame() && !pCntUp->IsFooterFrame() )
1001  pCntUp = pCntUp->GetUpper();
1002  if ( pCntUp == pUp )
1003  return pNxtCnt;
1004  }
1005  }
1006  }
1007  return nullptr;
1008 }
1009 
1016 {
1017  if ( !IsFlowFrame() )
1018  {
1019  // nothing to do, if current frame isn't a flow frame.
1020  return nullptr;
1021  }
1022 
1023  SwContentFrame* pPrevContentFrame( nullptr );
1024 
1025  // Because method <SwContentFrame::GetPrevContentFrame()> is used to travel
1026  // through the layout, a content frame, at which the travel starts, is needed.
1027  SwContentFrame* pCurrContentFrame = dynamic_cast<SwContentFrame*>(this);
1028 
1029  // perform shortcut, if current frame is a follow, and
1030  // determine <pCurrContentFrame>, if current frame is a table or section frame
1031  if ( pCurrContentFrame && pCurrContentFrame->IsFollow() )
1032  {
1033  // previous content frame is its master content frame
1034  pPrevContentFrame = pCurrContentFrame->FindMaster();
1035  }
1036  else if ( IsTabFrame() )
1037  {
1038  SwTabFrame* pTabFrame( static_cast<SwTabFrame*>(this) );
1039  if ( pTabFrame->IsFollow() )
1040  {
1041  // previous content frame is the last content of its master table frame
1042  pPrevContentFrame = pTabFrame->FindMaster()->FindLastContent();
1043  }
1044  else
1045  {
1046  // start content frame for the search is the first content frame of
1047  // the table frame.
1048  pCurrContentFrame = pTabFrame->ContainsContent();
1049  }
1050  }
1051  else if ( IsSctFrame() )
1052  {
1053  SwSectionFrame* pSectFrame( static_cast<SwSectionFrame*>(this) );
1054  if ( pSectFrame->IsFollow() )
1055  {
1056  // previous content frame is the last content of its master section frame
1057  pPrevContentFrame = pSectFrame->FindMaster()->FindLastContent();
1058  }
1059  else
1060  {
1061  // start content frame for the search is the first content frame of
1062  // the section frame.
1063  pCurrContentFrame = pSectFrame->ContainsContent();
1064  }
1065  }
1066 
1067  // search for next content frame, depending on the environment, in which
1068  // the current frame is in.
1069  if ( !pPrevContentFrame && pCurrContentFrame )
1070  {
1071  pPrevContentFrame = pCurrContentFrame->GetPrevContentFrame();
1072  if ( pPrevContentFrame )
1073  {
1074  if ( pCurrContentFrame->IsInFly() )
1075  {
1076  // handling for environments 'unlinked fly frame' and
1077  // 'group of linked fly frames':
1078  // Nothing to do, <pPrevContentFrame> is the one
1079  }
1080  else
1081  {
1082  const bool bInDocBody = pCurrContentFrame->IsInDocBody();
1083  const bool bInFootnote = pCurrContentFrame->IsInFootnote();
1084  if ( bInDocBody )
1085  {
1086  // handling for environments 'footnotes' and 'document body frames':
1087  // Assure that found previous frame is also in one of these
1088  // environments. Otherwise, travel further
1089  while ( pPrevContentFrame )
1090  {
1091  if ( ( bInDocBody && pPrevContentFrame->IsInDocBody() ) ||
1092  ( bInFootnote && pPrevContentFrame->IsInFootnote() ) )
1093  {
1094  break;
1095  }
1096  pPrevContentFrame = pPrevContentFrame->GetPrevContentFrame();
1097  }
1098  }
1099  else if ( bInFootnote )
1100  {
1101  // handling for environments 'each footnote':
1102  // Assure that found next content frame belongs to the same footnotes
1103  const SwFootnoteFrame* pFootnoteFrameOfPrev( pPrevContentFrame->FindFootnoteFrame() );
1104  const SwFootnoteFrame* pFootnoteFrameOfCurr( pCurrContentFrame->FindFootnoteFrame() );
1105  if ( pFootnoteFrameOfPrev != pFootnoteFrameOfCurr )
1106  {
1107  if ( pFootnoteFrameOfCurr->GetMaster() )
1108  {
1109  SwFootnoteFrame* pMasterFootnoteFrameOfCurr(
1110  const_cast<SwFootnoteFrame*>(pFootnoteFrameOfCurr) );
1111  pPrevContentFrame = nullptr;
1112  // correct wrong loop-condition
1113  do {
1114  pMasterFootnoteFrameOfCurr = pMasterFootnoteFrameOfCurr->GetMaster();
1115  pPrevContentFrame = pMasterFootnoteFrameOfCurr->FindLastContent();
1116  } while ( !pPrevContentFrame &&
1117  pMasterFootnoteFrameOfCurr->GetMaster() );
1118  }
1119  else
1120  {
1121  // current content frame is the first content in the
1122  // footnote - no previous content exists.
1123  pPrevContentFrame = nullptr;
1124  }
1125  }
1126  }
1127  else
1128  {
1129  // handling for environments 'page header' and 'page footer':
1130  // Assure that found previous frame is also in the same
1131  // page header respectively page footer as <pCurrContentFrame>
1132  // Note: At this point it's clear that <pCurrContentFrame> has
1133  // to be inside a page header or page footer and that
1134  // neither <pCurrContentFrame> nor <pPrevContentFrame> are
1135  // inside a fly frame.
1136  // Thus, method <FindFooterOrHeader()> can be used.
1137  OSL_ENSURE( pCurrContentFrame->FindFooterOrHeader(),
1138  "<SwFrame::FindPrevCnt_()> - unknown layout situation: current frame should be in page header or page footer" );
1139  OSL_ENSURE( !pPrevContentFrame->IsInFly(),
1140  "<SwFrame::FindPrevCnt_()> - unknown layout situation: found previous frame should *not* be inside a fly frame." );
1141  if ( pPrevContentFrame->FindFooterOrHeader() !=
1142  pCurrContentFrame->FindFooterOrHeader() )
1143  {
1144  pPrevContentFrame = nullptr;
1145  }
1146  }
1147  }
1148  }
1149  }
1150 
1151  return pPrevContentFrame;
1152 }
1153 
1155 {
1156  bool bIgnoreTab = false;
1157  SwFrame *pThis = this;
1158 
1159  if ( IsTabFrame() )
1160  {
1161  //The first Content of the table gets picked up and his predecessor is
1162  //returned. To be able to deactivate the special case for tables
1163  //(see below) bIgnoreTab will be set.
1164  if ( static_cast<SwTabFrame*>(this)->IsFollow() )
1165  return static_cast<SwTabFrame*>(this)->FindMaster();
1166  else
1167  pThis = static_cast<SwTabFrame*>(this)->ContainsContent();
1168  bIgnoreTab = true;
1169  }
1170 
1171  if ( pThis && pThis->IsContentFrame() )
1172  {
1173  SwContentFrame *pPrvCnt = static_cast<SwContentFrame*>(pThis)->GetPrevContentFrame();
1174  if( !pPrvCnt )
1175  return nullptr;
1176  if ( !bIgnoreTab && pThis->IsInTab() )
1177  {
1178  SwLayoutFrame *pUp = pThis->GetUpper();
1179  while (pUp && !pUp->IsCellFrame())
1180  pUp = pUp->GetUpper();
1181  assert(pUp && "Content flag says it's in table but it's not in cell.");
1182  if (pUp && pUp->IsAnLower(pPrvCnt))
1183  return pPrvCnt;
1184  }
1185  else
1186  {
1187  SwFrame* pRet;
1188  const bool bBody = pThis->IsInDocBody();
1189  const bool bFootnote = !bBody && pThis->IsInFootnote();
1190  if ( bBody || bFootnote )
1191  {
1192  while ( pPrvCnt )
1193  {
1194  if ( (bBody && pPrvCnt->IsInDocBody()) ||
1195  (bFootnote && pPrvCnt->IsInFootnote()) )
1196  {
1197  pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrame()
1198  : static_cast<SwFrame*>(pPrvCnt);
1199  return pRet;
1200  }
1201  pPrvCnt = pPrvCnt->GetPrevContentFrame();
1202  }
1203  }
1204  else if ( pThis->IsInFly() )
1205  {
1206  pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrame()
1207  : static_cast<SwFrame*>(pPrvCnt);
1208  return pRet;
1209  }
1210  else // footer or header or Fly
1211  {
1212  const SwFrame *pUp = pThis->GetUpper();
1213  const SwFrame *pCntUp = pPrvCnt->GetUpper();
1214  while ( pUp && pUp->GetUpper() &&
1215  !pUp->IsHeaderFrame() && !pUp->IsFooterFrame() )
1216  pUp = pUp->GetUpper();
1217  while ( pCntUp && pCntUp->GetUpper() )
1218  pCntUp = pCntUp->GetUpper();
1219  if ( pCntUp == pUp )
1220  {
1221  pRet = pPrvCnt->IsInTab() ? pPrvCnt->FindTabFrame()
1222  : static_cast<SwFrame*>(pPrvCnt);
1223  return pRet;
1224  }
1225  }
1226  }
1227  }
1228  return nullptr;
1229 }
1230 
1231 void SwFrame::ImplInvalidateNextPos( bool bNoFootnote )
1232 {
1233  SwFrame *pFrame = FindNext_();
1234  if ( nullptr == pFrame )
1235  return;
1236 
1237  if( pFrame->IsSctFrame() )
1238  {
1239  while( pFrame && pFrame->IsSctFrame() )
1240  {
1241  if( static_cast<SwSectionFrame*>(pFrame)->GetSection() )
1242  {
1243  SwFrame* pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1244  if( pTmp )
1245  pTmp->InvalidatePos();
1246  else if( !bNoFootnote )
1247  static_cast<SwSectionFrame*>(pFrame)->InvalidateFootnotePos();
1248  if( !IsInSct() || FindSctFrame()->GetFollow() != pFrame )
1249  pFrame->InvalidatePos();
1250  return;
1251  }
1252  pFrame = pFrame->FindNext();
1253  }
1254  if( pFrame )
1255  {
1256  if ( pFrame->IsSctFrame())
1257  {
1258  // We need to invalidate the section's content so it gets
1259  // the chance to flow to a different page.
1260  SwFrame* pTmp = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1261  if( pTmp )
1262  pTmp->InvalidatePos();
1263  if( !IsInSct() || FindSctFrame()->GetFollow() != pFrame )
1264  pFrame->InvalidatePos();
1265  }
1266  else
1267  pFrame->InvalidatePos();
1268  }
1269  }
1270  else
1271  pFrame->InvalidatePos();
1272 }
1273 
1281 {
1282  // determine next frame
1283  SwFrame* pNextFrame = FindNext();
1284  // skip empty section frames and hidden text frames
1285  {
1286  while ( pNextFrame &&
1287  ( ( pNextFrame->IsSctFrame() &&
1288  !static_cast<SwSectionFrame*>(pNextFrame)->GetSection() ) ||
1289  ( pNextFrame->IsTextFrame() &&
1290  static_cast<SwTextFrame*>(pNextFrame)->IsHiddenNow() ) ) )
1291  {
1292  pNextFrame = pNextFrame->FindNext();
1293  }
1294  }
1295 
1296  // Invalidate printing area of found next frame
1297  if ( !pNextFrame )
1298  return;
1299 
1300  if ( pNextFrame->IsSctFrame() )
1301  {
1302  // Invalidate printing area of found section frame, if
1303  // (1) this text frame isn't in a section OR
1304  // (2) found section frame isn't a follow of the section frame this
1305  // text frame is in.
1306  if ( !IsInSct() || FindSctFrame()->GetFollow() != pNextFrame )
1307  {
1308  pNextFrame->InvalidatePrt();
1309  }
1310 
1311  // Invalidate printing area of first content in found section.
1312  SwFrame* pFstContentOfSctFrame =
1313  static_cast<SwSectionFrame*>(pNextFrame)->ContainsAny();
1314  if ( pFstContentOfSctFrame )
1315  {
1316  pFstContentOfSctFrame->InvalidatePrt();
1317  }
1318  }
1319  else
1320  {
1321  pNextFrame->InvalidatePrt();
1322  }
1323 }
1324 
1327 static bool lcl_IsInSectionDirectly( const SwFrame *pUp )
1328 {
1329  bool bSeenColumn = false;
1330 
1331  while( pUp )
1332  {
1333  if( pUp->IsColumnFrame() )
1334  bSeenColumn = true;
1335  else if( pUp->IsSctFrame() )
1336  {
1337  auto pSection = static_cast<const SwSectionFrame*>(pUp);
1338  const SwFrame* pHeaderFooter = pSection->FindFooterOrHeader();
1339  // When the section frame is not in header/footer:
1340  // Allow move of frame in case our only column is not growable.
1341  // Also allow if there is a previous section frame (to move back).
1342  bool bAllowOutsideHeaderFooter = !pSection->Growable() || pSection->GetPrecede();
1343  return bSeenColumn || (!pHeaderFooter && bAllowOutsideHeaderFooter);
1344  }
1345  else if( pUp->IsTabFrame() )
1346  return false;
1347  pUp = pUp->GetUpper();
1348  }
1349  return false;
1350 }
1351 
1360 bool SwFrame::IsMoveable( const SwLayoutFrame* _pLayoutFrame ) const
1361 {
1362  bool bRetVal = false;
1363 
1364  if ( !_pLayoutFrame )
1365  {
1366  _pLayoutFrame = GetUpper();
1367  }
1368 
1369  if ( _pLayoutFrame && IsFlowFrame() )
1370  {
1371  if ( _pLayoutFrame->IsInSct() && lcl_IsInSectionDirectly( _pLayoutFrame ) )
1372  {
1373  bRetVal = true;
1374  }
1375  else if ( _pLayoutFrame->IsInFly() ||
1376  _pLayoutFrame->IsInDocBody() ||
1377  _pLayoutFrame->IsInFootnote() )
1378  {
1379  // If IsMovable() is called before a MoveFwd() the method
1380  // may return false if there is no NextCellLeaf. If
1381  // IsMovable() is called before a MoveBwd() the method may
1382  // return false if there is no PrevCellLeaf.
1383  if ( _pLayoutFrame->IsInTab() && !IsTabFrame() &&
1384  ( !IsContentFrame() || (!const_cast<SwFrame*>(this)->GetNextCellLeaf()
1385  && !const_cast<SwFrame*>(this)->GetPrevCellLeaf()) )
1386  )
1387  {
1388  bRetVal = false;
1389  }
1390  else
1391  {
1392  if ( _pLayoutFrame->IsInFly() )
1393  {
1394  // if fly frame has a follow (next linked fly frame),
1395  // frame is moveable.
1396  if ( const_cast<SwLayoutFrame*>(_pLayoutFrame)->FindFlyFrame()->GetNextLink() )
1397  {
1398  bRetVal = true;
1399  }
1400  else
1401  {
1402  // if environment is columned, frame is moveable, if
1403  // it isn't in last column.
1404  // search for column frame
1405  const SwFrame* pCol = _pLayoutFrame;
1406  while ( pCol && !pCol->IsColumnFrame() )
1407  {
1408  pCol = pCol->GetUpper();
1409  }
1410  // frame is moveable, if found column frame isn't last one.
1411  if ( pCol && pCol->GetNext() )
1412  {
1413  bRetVal = true;
1414  }
1415  }
1416  }
1417  else if (!(_pLayoutFrame->IsInFootnote() && (IsTabFrame() || IsInTab())))
1418  {
1419  bRetVal = true;
1420  }
1421  }
1422  }
1423  }
1424 
1425  return bRetVal;
1426 }
1427 
1429 {
1430  if ( !IsFlyFrame() && !GetUpper() ) //not yet pasted, no information available
1431  return;
1432 
1434 
1435  SwFrame *pFrame = this;
1436  if( IsFootnoteContFrame() )
1437  mbInfFootnote = true;
1438  do
1439  {
1440  // mbInfBody is only set in the page body, but not in the column body
1441  if ( pFrame->IsBodyFrame() && !mbInfFootnote && pFrame->GetUpper()
1442  && pFrame->GetUpper()->IsPageFrame() )
1443  mbInfBody = true;
1444  else if ( pFrame->IsTabFrame() || pFrame->IsCellFrame() )
1445  {
1446  mbInfTab = true;
1447  }
1448  else if ( pFrame->IsFlyFrame() )
1449  mbInfFly = true;
1450  else if ( pFrame->IsSctFrame() )
1451  mbInfSct = true;
1452  else if ( pFrame->IsFootnoteFrame() )
1453  mbInfFootnote = true;
1454 
1455  pFrame = pFrame->GetUpper();
1456 
1457  } while ( pFrame && !pFrame->IsPageFrame() ); //there is nothing above the page
1458 }
1459 
1465 void SwFrame::SetDirFlags( bool bVert )
1466 {
1467  if( bVert )
1468  {
1469  // OD 2004-01-21 #114969# - if derived, valid vertical flag only if
1470  // vertical flag of upper/anchor is valid.
1471  if( mbDerivedVert )
1472  {
1473  const SwFrame* pAsk = IsFlyFrame() ?
1474  static_cast<SwFlyFrame*>(this)->GetAnchorFrame() : GetUpper();
1475 
1476  OSL_ENSURE( pAsk != this, "Autsch! Stack overflow is about to happen" );
1477 
1478  if( pAsk )
1479  {
1480  mbVertical = pAsk->IsVertical();
1481  mbVertLR = pAsk->IsVertLR();
1482  mbVertLRBT = pAsk->IsVertLRBT();
1483 
1484  if ( !pAsk->mbInvalidVert )
1485  mbInvalidVert = false;
1486 
1487  if ( IsCellFrame() )
1488  {
1489  SwCellFrame* pPrv = static_cast<SwCellFrame*>(this)->GetPreviousCell();
1490  if ( pPrv && !mbVertical && pPrv->IsVertical() )
1491  {
1492  mbVertical = pPrv->IsVertical();
1493  mbVertLR = pPrv->IsVertLR();
1494  mbVertLRBT = pPrv->IsVertLRBT();
1495  }
1496  }
1497  }
1498  }
1499  else
1500  CheckDirection( bVert );
1501  }
1502  else
1503  {
1504  bool bInv = false;
1505  if( !mbDerivedR2L ) // CheckDirection is able to set bDerivedR2L!
1506  CheckDirection( bVert );
1507  if( mbDerivedR2L )
1508  {
1509  const SwFrame* pAsk = IsFlyFrame() ?
1510  static_cast<SwFlyFrame*>(this)->GetAnchorFrame() : GetUpper();
1511 
1512  OSL_ENSURE( pAsk != this, "Oops! Stack overflow is about to happen" );
1513 
1514  if( pAsk )
1515  mbRightToLeft = pAsk->IsRightToLeft();
1516  if( !pAsk || pAsk->mbInvalidR2L )
1517  bInv = mbInvalidR2L;
1518  }
1519  mbInvalidR2L = bInv;
1520  }
1521 }
1522 
1524 {
1525  SwFrame* pTmpFrame = this;
1526  while (pTmpFrame && !pTmpFrame->IsCellFrame())
1527  pTmpFrame = pTmpFrame->GetUpper();
1528 
1529  SAL_WARN_IF(!pTmpFrame, "sw.core", "SwFrame::GetNextCellLeaf() without cell");
1530  return pTmpFrame ? static_cast<SwCellFrame*>(pTmpFrame)->GetFollowCell() : nullptr;
1531 }
1532 
1534 {
1535  SwFrame* pTmpFrame = this;
1536  while (pTmpFrame && !pTmpFrame->IsCellFrame())
1537  pTmpFrame = pTmpFrame->GetUpper();
1538 
1539  SAL_WARN_IF(!pTmpFrame, "sw.core", "SwFrame::GetNextPreviousLeaf() without cell");
1540  return pTmpFrame ? static_cast<SwCellFrame*>(pTmpFrame)->GetPreviousCell() : nullptr;
1541 }
1542 
1544  const SwCellFrame& rOrigCell,
1545  const SwRowFrame& rCorrRow,
1546  bool bInFollow )
1547 {
1548  SwCellFrame* pRet = nullptr;
1549  const SwCellFrame* pCell = static_cast<const SwCellFrame*>(rOrigRow.Lower());
1550  SwCellFrame* pCorrCell = const_cast<SwCellFrame*>(static_cast<const SwCellFrame*>(rCorrRow.Lower()));
1551 
1552  while ( pCell != &rOrigCell && !pCell->IsAnLower( &rOrigCell ) )
1553  {
1554  pCell = static_cast<const SwCellFrame*>(pCell->GetNext());
1555  pCorrCell = static_cast<SwCellFrame*>(pCorrCell->GetNext());
1556  }
1557 
1558  assert(pCell && pCorrCell && "lcl_FindCorrespondingCellFrame does not work");
1559 
1560  if ( pCell != &rOrigCell )
1561  {
1562  // rOrigCell must be a lower of pCell. We need to recurse into the rows:
1563  assert(pCell->Lower() && pCell->Lower()->IsRowFrame() &&
1564  "lcl_FindCorrespondingCellFrame does not work");
1565 
1566  const SwRowFrame* pRow = static_cast<const SwRowFrame*>(pCell->Lower());
1567  while ( !pRow->IsAnLower( &rOrigCell ) )
1568  pRow = static_cast<const SwRowFrame*>(pRow->GetNext());
1569 
1570  SwRowFrame* pCorrRow = nullptr;
1571  if ( bInFollow )
1572  pCorrRow = pRow->GetFollowRow();
1573  else
1574  {
1575  SwRowFrame* pTmpRow = static_cast<SwRowFrame*>(pCorrCell->GetLastLower());
1576 
1577  if ( pTmpRow && pTmpRow->GetFollowRow() == pRow )
1578  pCorrRow = pTmpRow;
1579  }
1580 
1581  if ( pCorrRow )
1582  pRet = lcl_FindCorrespondingCellFrame( *pRow, rOrigCell, *pCorrRow, bInFollow );
1583  }
1584  else
1585  pRet = pCorrCell;
1586 
1587  return pRet;
1588 }
1589 
1590 // VERSION OF GetFollowCell() that assumes that we always have a follow flow line:
1592 {
1593  SwCellFrame* pRet = nullptr;
1594 
1595  // NEW TABLES
1596  // Covered cells do not have follow cells!
1597  const tools::Long nRowSpan = GetLayoutRowSpan();
1598  if ( nRowSpan < 1 )
1599  return nullptr;
1600 
1601  // find most upper row frame
1602  const SwFrame* pRow = GetUpper();
1603 
1604  while (pRow && (!pRow->IsRowFrame() || !pRow->GetUpper()->IsTabFrame()))
1605  pRow = pRow->GetUpper();
1606 
1607  if (!pRow)
1608  return nullptr;
1609 
1610  const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pRow->GetUpper());
1611  if (!pTabFrame || !pTabFrame->GetFollow() || !pTabFrame->HasFollowFlowLine())
1612  return nullptr;
1613 
1614  const SwCellFrame* pThisCell = this;
1615 
1616  // Get last cell of the current table frame that belongs to the rowspan:
1617  if ( nRowSpan > 1 )
1618  {
1619  // optimization: Will end of row span be in last row or exceed row?
1620  tools::Long nMax = 0;
1621  while ( pRow->GetNext() && ++nMax < nRowSpan )
1622  pRow = pRow->GetNext();
1623 
1624  if ( !pRow->GetNext() )
1625  {
1626  pThisCell = &pThisCell->FindStartEndOfRowSpanCell( false );
1627  pRow = pThisCell->GetUpper();
1628  }
1629  }
1630 
1631  const SwRowFrame* pFollowRow = nullptr;
1632  if ( !pRow->GetNext() &&
1633  nullptr != ( pFollowRow = pRow->IsInSplitTableRow() ) &&
1634  ( !pFollowRow->IsRowSpanLine() || nRowSpan > 1 ) )
1635  pRet = lcl_FindCorrespondingCellFrame( *static_cast<const SwRowFrame*>(pRow), *pThisCell, *pFollowRow, true );
1636 
1637  return pRet;
1638 }
1639 
1640 // VERSION OF GetPreviousCell() THAT ASSUMES THAT WE ALWAYS HAVE A FFL
1642 {
1643  SwCellFrame* pRet = nullptr;
1644 
1645  // NEW TABLES
1646  // Covered cells do not have previous cells!
1647  if ( GetLayoutRowSpan() < 1 )
1648  return nullptr;
1649 
1650  // find most upper row frame
1651  const SwFrame* pRow = GetUpper();
1652  while( !pRow->IsRowFrame() || (pRow->GetUpper() && !pRow->GetUpper()->IsTabFrame()) )
1653  pRow = pRow->GetUpper();
1654 
1655  OSL_ENSURE( pRow->GetUpper() && pRow->GetUpper()->IsTabFrame(), "GetPreviousCell without Table" );
1656 
1657  const SwTabFrame* pTab = static_cast<const SwTabFrame*>(pRow->GetUpper());
1658 
1659  if ( pTab && pTab->IsFollow() )
1660  {
1661  const SwFrame* pTmp = pTab->GetFirstNonHeadlineRow();
1662  const bool bIsInFirstLine = ( pTmp == pRow );
1663 
1664  if ( bIsInFirstLine )
1665  {
1666  SwTabFrame *pMaster = pTab->FindMaster();
1667  if ( pMaster && pMaster->HasFollowFlowLine() )
1668  {
1669  SwRowFrame* pMasterRow = static_cast<SwRowFrame*>(pMaster->GetLastLower());
1670  if ( pMasterRow )
1671  pRet = lcl_FindCorrespondingCellFrame( *static_cast<const SwRowFrame*>(pRow), *this, *pMasterRow, false );
1672  if ( pRet && pRet->GetTabBox()->getRowSpan() < 1 )
1673  pRet = &const_cast<SwCellFrame&>(pRet->FindStartEndOfRowSpanCell( true ));
1674  }
1675  }
1676  }
1677 
1678  return pRet;
1679 }
1680 
1681 // --> NEW TABLES
1683 {
1684  const SwTabFrame* pTableFrame = dynamic_cast<const SwTabFrame*>(GetUpper()->GetUpper());
1685 
1686  if ( !bStart && pTableFrame && pTableFrame->IsFollow() && pTableFrame->IsInHeadline( *this ) )
1687  return *this;
1688 
1689  OSL_ENSURE( pTableFrame &&
1690  ( (bStart && GetTabBox()->getRowSpan() < 1) ||
1691  (!bStart && GetLayoutRowSpan() > 1) ),
1692  "SwCellFrame::FindStartRowSpanCell: No rowspan, no table, no cookies" );
1693 
1694  if ( pTableFrame )
1695  {
1696  const SwTable* pTable = pTableFrame->GetTable();
1697 
1698  sal_uInt16 nMax = USHRT_MAX;
1699  const SwFrame* pCurrentRow = GetUpper();
1700  const bool bDoNotEnterHeadline = bStart && pTableFrame->IsFollow() &&
1701  !pTableFrame->IsInHeadline( *pCurrentRow );
1702 
1703  // check how many rows we are allowed to go up or down until we reach the end of
1704  // the current table frame:
1705  nMax = 0;
1706  while ( bStart ? pCurrentRow->GetPrev() : pCurrentRow->GetNext() )
1707  {
1708  if ( bStart )
1709  {
1710  // do not enter a repeated headline:
1711  if ( bDoNotEnterHeadline && pTableFrame->IsFollow() &&
1712  pTableFrame->IsInHeadline( *pCurrentRow->GetPrev() ) )
1713  break;
1714 
1715  pCurrentRow = pCurrentRow->GetPrev();
1716  }
1717  else
1718  pCurrentRow = pCurrentRow->GetNext();
1719 
1720  ++nMax;
1721  }
1722 
1723  // By passing the nMax value for Find*OfRowSpan (in case of bCurrentTableOnly
1724  // is set) we assure that we find a rMasterBox that has a SwCellFrame in
1725  // the current table frame:
1726  const SwTableBox& rMasterBox = bStart ?
1727  GetTabBox()->FindStartOfRowSpan( *pTable, nMax ) :
1728  GetTabBox()->FindEndOfRowSpan( *pTable, nMax );
1729 
1730  SwIterator<SwCellFrame,SwFormat> aIter( *rMasterBox.GetFrameFormat() );
1731 
1732  for ( SwCellFrame* pMasterCell = aIter.First(); pMasterCell; pMasterCell = aIter.Next() )
1733  {
1734  if ( pMasterCell->GetTabBox() == &rMasterBox )
1735  {
1736  const SwTabFrame* pMasterTable = static_cast<const SwTabFrame*>(pMasterCell->GetUpper()->GetUpper());
1737 
1738  if ( pMasterTable == pTableFrame )
1739  {
1740  return *pMasterCell;
1741  }
1742  }
1743  }
1744  }
1745 
1746  SAL_WARN("sw.core", "SwCellFrame::FindStartRowSpanCell: No result");
1747 
1748  return *this;
1749 }
1750 
1751 // <-- NEW TABLES
1752 
1754 {
1755  OSL_ENSURE( IsInTab(), "IsInSplitTableRow should only be called for frames in tables" );
1756 
1757  const SwFrame* pRow = this;
1758 
1759  // find most upper row frame
1760  while( pRow && ( !pRow->IsRowFrame() || !pRow->GetUpper()->IsTabFrame() ) )
1761  pRow = pRow->GetUpper();
1762 
1763  if ( !pRow ) return nullptr;
1764 
1765  OSL_ENSURE( pRow->GetUpper()->IsTabFrame(), "Confusion in table layout" );
1766 
1767  const SwTabFrame* pTab = static_cast<const SwTabFrame*>(pRow->GetUpper());
1768 
1769  // If most upper row frame is a headline row, the current frame
1770  // can't be in a split table row. Thus, add corresponding condition.
1771  if ( pRow->GetNext() ||
1772  pTab->GetTable()->IsHeadline(
1773  *(static_cast<const SwRowFrame*>(pRow)->GetTabLine()) ) ||
1774  !pTab->HasFollowFlowLine() ||
1775  !pTab->GetFollow() )
1776  return nullptr;
1777 
1778  // skip headline
1779  const SwRowFrame* pFollowRow = pTab->GetFollow()->GetFirstNonHeadlineRow();
1780 
1781  OSL_ENSURE( pFollowRow, "SwFrame::IsInSplitTableRow() does not work" );
1782 
1783  return pFollowRow;
1784 }
1785 
1787 {
1788  OSL_ENSURE( IsInTab(), "IsInSplitTableRow should only be called for frames in tables" );
1789 
1790  // find most upper row frame
1791  const SwFrame* pRow = this;
1792  while( pRow && ( !pRow->IsRowFrame() || !pRow->GetUpper()->IsTabFrame() ) )
1793  pRow = pRow->GetUpper();
1794 
1795  if ( !pRow ) return nullptr;
1796 
1797  OSL_ENSURE( pRow->GetUpper()->IsTabFrame(), "Confusion in table layout" );
1798 
1799  const SwTabFrame* pTab = static_cast<const SwTabFrame*>(pRow->GetUpper());
1800 
1801  const SwTabFrame* pMaster = pTab->IsFollow() ? pTab->FindMaster() : nullptr;
1802 
1803  if ( !pMaster || !pMaster->HasFollowFlowLine() )
1804  return nullptr;
1805 
1806  const SwFrame* pTmp = pTab->GetFirstNonHeadlineRow();
1807  const bool bIsInFirstLine = ( pTmp == pRow );
1808 
1809  if ( !bIsInFirstLine )
1810  return nullptr;
1811 
1812  const SwRowFrame* pMasterRow = static_cast<const SwRowFrame*>(pMaster->GetLastLower());
1813  return pMasterRow;
1814 }
1815 
1817 {
1818  bool bRet = false;
1819 
1820  if ( IsInSct() )
1821  {
1822  const SwSectionFrame* pSectionFrame = FindSctFrame();
1823  if ( pSectionFrame )
1824  bRet = pSectionFrame->IsBalancedSection();
1825  }
1826  return bRet;
1827 }
1828 
1830 {
1831  const SwFrame* pRet = Lower();
1832  if ( !pRet )
1833  return nullptr;
1834  while ( pRet->GetNext() )
1835  pRet = pRet->GetNext();
1836  return pRet;
1837 }
1838 
1839 /* 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:697
Base class of the Writer layout elements.
Definition: frame.hxx:298
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:151
bool mbInfFootnote
Definition: frame.hxx:425
static bool lcl_IsInSectionDirectly(const SwFrame *pUp)
Definition: findfrm.cxx:1327
void Right(const tools::Long nRight)
Definition: swrect.hxx:200
bool IsFollow() const
Definition: flowfrm.hxx:166
SwFrame * mpNext
Definition: frame.hxx:322
bool IsEndnAtEnd() const
Definition: sectfrm.hxx:148
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:98
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:817
bool IsInDocBody() const
Definition: frame.hxx:924
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:942
bool IsRootFrame() const
Definition: frame.hxx:1155
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
bool IsInSct() const
Definition: frame.hxx:948
drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: findfrm.cxx:692
bool mbInvalidVert
Definition: frame.hxx:404
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:144
void Left(const tools::Long nLeft)
Definition: swrect.hxx:195
bool IsInFootnote() const
Definition: frame.hxx:930
SwFrameType GetType() const
Definition: frame.hxx:503
long Long
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:30
constexpr T MmToTwips(const double mm)
Definition: swtypes.hxx:57
void InvalidatePos()
Definition: frame.hxx:1024
static const SwFrame * lcl_GetLower(const SwFrame *pFrame, bool bFwd)
Definition: findfrm.cxx:293
void Pos(const Point &rNew)
Definition: swrect.hxx:169
bool IsEndNote() const
Definition: fmtftn.hxx:73
const SwCellFrame & FindStartEndOfRowSpanCell(bool bStart) const
Definition: findfrm.cxx:1682
SwFrame * FindNext()
Definition: frame.hxx:1122
bool IsCellFrame() const
Definition: frame.hxx:1207
bool supportsFullDrawingLayerFillAttributeSet() const
Definition: findfrm.cxx:708
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
virtual const SvxFormatBreakItem & GetBreakItem() const
Definition: findfrm.cxx:655
SwContentFrame * FindFirstBodyContent()
Definition: pagefrm.hxx:337
virtual const SwFormatPageDesc & GetPageDescItem() const
Definition: findfrm.cxx:660
bool mbInfBody
Definition: frame.hxx:422
bool mbVertLR
Definition: frame.hxx:408
bool IsFootnoteFrame() const
Definition: frame.hxx:1183
static bool bFootnote
Definition: insfnote.cxx:33
bool IsVertLRBT() const
Definition: frame.hxx:964
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:191
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:409
bool IsFlyFrame() const
Definition: frame.hxx:1191
void InvalidateNextPrtArea()
method to invalidate printing area of next frame #i11859#
Definition: findfrm.cxx:1280
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:1360
const SwTableBox * GetTabBox() const
Definition: cellfrm.hxx:52
const SwRect & getFrameArea() const
Definition: frame.hxx:178
bool mbInfTab
Definition: frame.hxx:423
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool IsInTab() const
Definition: frame.hxx:936
static const SwFrame * lcl_FindLayoutFrame(const SwFrame *pFrame, bool bNext)
Definition: findfrm.cxx:282
SwCellFrame * GetPreviousCell() const
Definition: findfrm.cxx:1641
const SwRowFrame * IsInSplitTableRow() const
Definition: findfrm.cxx:1753
bool IsTextFrame() const
Definition: frame.hxx:1215
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:38
SwRowFrame * FindRowFrame()
Definition: findfrm.cxx:539
bool mbInfInvalid
Definition: frame.hxx:421
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:106
bool IsSctFrame() const
Definition: frame.hxx:1195
SwFrame * FindPrev_()
Definition: findfrm.cxx:1154
bool IsFlowFrame() const
Definition: frame.hxx:1223
SwLayoutFrame * GetNextCellLeaf()
Definition: findfrm.cxx:1523
tools::Long GetLayoutRowSpan() const
Definition: tabfrm.cxx:5475
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame, use GetBreakItem()/GetPageDescItem() instead.
Definition: findfrm.cxx:675
bool IsRowSpanLine() const
Definition: rowfrm.hxx:105
bool IsColumnFrame() const
Definition: frame.hxx:1163
SwContentFrame * FindLastContent()
Definition: tabfrm.cxx:3509
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1088
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:448
SwTabFrame * ImplFindTabFrame()
Definition: findfrm.cxx:469
void SetDirFlags(bool bVert)
Updates the vertical or the righttoleft-flags.
Definition: findfrm.cxx:1465
bool IsBalancedSection() const
Definition: sectfrm.cxx:2907
SwTabFrame * FindMaster(bool bFirstMaster=false) const
Definition: flowfrm.cxx:717
bool IsContentFrame() const
Definition: frame.hxx:1211
void InvalidatePrt()
Definition: frame.hxx:1017
#define FRM_HEADFOOT
Definition: frame.hxx:107
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1829
SwFrame * FindNext_()
Definition: findfrm.cxx:773
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:160
SwPageFrame * FindPageFrame()
Definition: frame.hxx:663
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:1816
bool mbInvalidR2L
Definition: frame.hxx:401
SwLayoutFrame * GetUpper()
Definition: frame.hxx:661
bool mbVertical
Definition: frame.hxx:406
static SwCellFrame * lcl_FindCorrespondingCellFrame(const SwRowFrame &rOrigRow, const SwCellFrame &rOrigCell, const SwRowFrame &rCorrRow, bool bInFollow)
Definition: findfrm.cxx:1543
bool IsRowFrame() const
Definition: frame.hxx:1203
SwFlyFrame * ImplFindFlyFrame()
Definition: findfrm.cxx:517
SwFootnoteBossFrame * FindFootnoteBossFrame(bool bFootnotes=false)
Definition: findfrm.cxx:436
SwFrame * GetPrev()
Definition: frame.hxx:660
const SwRowFrame * IsInFollowFlowRow() const
Definition: findfrm.cxx:1786
bool mbDerivedR2L
Definition: frame.hxx:402
void ImplInvalidateNextPos(bool bNoFootnote)
Definition: findfrm.cxx:1231
SwFrameFormat * GetFrameFormat()
Definition: swtable.hxx:432
SwRowFrame * GetFollowRow() const
Definition: rowfrm.hxx:78
void SSize(const Size &rNew)
Definition: swrect.hxx:178
SwContentFrame * FindLastContent(SwFindMode nMode=SwFindMode::None)
Definition: sectfrm.cxx:908
SwCellFrame * GetFollowCell() const
Definition: findfrm.cxx:1591
A page of the document layout.
Definition: pagefrm.hxx:41
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:200
virtual const SvxFormatBreakItem & GetBreakItem() const override
Definition: findfrm.cxx:665
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:670
SwContentFrame * FindNextCnt_(const bool _bInSameFootnote)
method to determine next content frame in the same environment for a flow frame (content frame...
Definition: findfrm.cxx:904
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1096
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:426
virtual void CheckDirection(bool bVert)
Definition: wsfrm.cxx:391
const SwFootnoteFrame * FindFootNote() const
Definition: findfrm.cxx:565
bool IsLayoutFrame() const
Definition: frame.hxx:1151
void Bottom(const tools::Long nBottom)
Definition: swrect.hxx:209
bool mbDerivedVert
Definition: frame.hxx:405
SwContentFrame * FindLastBodyContent()
Searches the last ContentFrame in BodyText below the page.
Definition: findfrm.cxx:52
bool IsVertLR() const
Definition: frame.hxx:960
SwContentFrame * FindPrevCnt_()
method to determine previous content frame in the same environment for a flow frame (content frame...
Definition: findfrm.cxx:1015
bool IsTabFrame() const
Definition: frame.hxx:1199
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
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:681
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
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
bool IsInside(const Point &rPOINT) const
Definition: swrect.cxx:105
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:76
bool IsNoTextFrame() const
Definition: frame.hxx:1219
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:116
SwLayoutFrame * GetPrevCellLeaf()
Definition: findfrm.cxx:1533
bool IsRightToLeft() const
Definition: frame.hxx:968
void Top(const tools::Long nTop)
Definition: swrect.hxx:204
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:393
SwFrame * GetLower()
Definition: findfrm.cxx:170
bool IsPageFrame() const
Definition: frame.hxx:1159
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:717
void SetInfFlags()
Definition: findfrm.cxx:1428
const SwTabFrame * GetFollow() const
Definition: tabfrm.hxx:243
bool mbRightToLeft
Definition: frame.hxx:403
bool IsVertical() const
Definition: frame.hxx:954
virtual drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: node.cxx:2110
#define SAL_WARN(area, stream)
bool IsFootnoteAtEnd() const
Definition: sectfrm.hxx:147
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:1167
const SwLayoutFrame * GetNextLayoutLeaf() const
Definition: frame.hxx:1001
bool IsFootnoteContFrame() const
Definition: frame.hxx:1179
SwPageFrame * ImplFindPageFrame()
Definition: findfrm.cxx:415
bool IsOver(const SwRect &rRect) const
Definition: swrect.cxx:123
bool IsWhitespaceHidden() const
Definition: viewopt.hxx:474
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:1187
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:208
static SwFrame * lcl_NextFrame(SwFrame *pFrame)
Definition: findfrm.cxx:738
Container of body content (i.e.
Definition: bodyfrm.hxx:28
bool HasFollowFlowLine() const
Definition: tabfrm.hxx:160
bool mbInfFly
Definition: frame.hxx:424
sal_uInt16 GetPageNum() const
Definition: rootfrm.hxx:311
bool IsFooterFrame() const
Definition: frame.hxx:1175
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:1171
bool IsInHeadline(const SwFrame &rFrame) const
Definition: tabfrm.cxx:5521
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1080
SwFrame * GetNext()
Definition: frame.hxx:659
SwContentFrame * FindLastContent()
search for last content in the current footnote frame
Definition: ftnfrm.cxx:2929