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