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