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