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