LibreOffice Module sw (master) 1
wsfrm.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 <config_wasm_strip.h>
21
22#include <hints.hxx>
23#include <osl/diagnose.h>
24#include <o3tl/safeint.hxx>
25#include <svl/itemiter.hxx>
26#include <editeng/brushitem.hxx>
27#include <sfx2/viewsh.hxx>
28#include <fmtornt.hxx>
29#include <pagefrm.hxx>
30#include <section.hxx>
31#include <rootfrm.hxx>
33#include <fmtanchr.hxx>
34#include <viewimp.hxx>
35#include <viewopt.hxx>
39#include <redline.hxx>
40#include <docsh.hxx>
41#include <ftninfo.hxx>
42#include <ftnidx.hxx>
43#include <fmtclbl.hxx>
44#include <fmtfsize.hxx>
45#include <fmtpdsc.hxx>
46#include <txtftn.hxx>
47#include <fmtftn.hxx>
48#include <fmtsrnd.hxx>
49#include <fmtcntnt.hxx>
50#include <ftnfrm.hxx>
51#include <tabfrm.hxx>
52#include <rowfrm.hxx>
53#include <flyfrm.hxx>
54#include <sectfrm.hxx>
55#include <fmtclds.hxx>
56#include <txtfrm.hxx>
57#include <bodyfrm.hxx>
58#include <cellfrm.hxx>
59#include <dbg_lay.hxx>
61#include <sortedobjs.hxx>
62#include <frmatr.hxx>
63#include <frmtool.hxx>
64#include <layact.hxx>
65#include <ndtxt.hxx>
66#include <swtable.hxx>
67#include <view.hxx>
68
69// RotateFlyFrame3
71
72using namespace ::com::sun::star;
73
75: mbFrameAreaPositionValid(false),
76 mbFrameAreaSizeValid(false),
77 mbFramePrintAreaValid(false),
78 mnFrameId(SwFrameAreaDefinition::snLastFrameId++)
79{
80}
81
83{
84}
85
87{
88 if(mbFrameAreaPositionValid != bNew)
89 {
91 }
92}
93
95{
96 if(mbFrameAreaSizeValid != bNew)
97 {
99 }
100}
101
103{
104 if(mbFramePrintAreaValid != bNew)
105 {
107 }
108}
109
111{
112 if(mrTarget.maFrameArea != *this)
113 {
114 mrTarget.maFrameArea = *this;
115 }
116}
117
119{
120 if(mrTarget.maFramePrintArea != *this)
121 {
122 mrTarget.maFramePrintArea = *this;
123 }
124}
125
126// RotateFlyFrame3 - Support for Transformations
128{
129 // default implementation hands out FrameArea (outer frame)
130 const SwRect& rFrameArea(getFrameArea());
131
133 rFrameArea.Width(), rFrameArea.Height(),
134 rFrameArea.Left(), rFrameArea.Top());
135}
136
138{
139 // default implementation hands out FramePrintArea (outer frame)
140 // Take into account that FramePrintArea is relative to FrameArea
141 const SwRect& rFrameArea(getFrameArea());
142 const SwRect& rFramePrintArea(getFramePrintArea());
143
145 rFramePrintArea.Width(), rFramePrintArea.Height(),
146 rFramePrintArea.Left() + rFrameArea.Left(),
147 rFramePrintArea.Top() + rFrameArea.Top());
148}
149
151{
152 // RotateFlyFrame3: default is to change the FrameArea, FramePrintArea needs no
153 // change since it is relative to FrameArea
155
156 if (aFrm.Pos().X() != FAR_AWAY)
157 {
158 aFrm.Pos().AdjustX(rOffset.X() );
159 }
160
161 if (aFrm.Pos().Y() != FAR_AWAY)
162 {
163 aFrm.Pos().AdjustY(rOffset.Y() );
164 }
165}
166
168{
169 const basegfx::B2DHomMatrix& rSource(getLocalFrameAreaTransformation());
170
171 if(rSource.isIdentity())
172 {
173 return mrSwFrameAreaDefinition.getFrameArea();
174 }
175 else
176 {
177 basegfx::B2DVector aScale, aTranslate;
178 double fRotate, fShearX;
179 rSource.decompose(aScale, aTranslate, fRotate, fShearX);
180 const basegfx::B2DPoint aCenter(rSource * basegfx::B2DPoint(0.5, 0.5));
181 const basegfx::B2DVector aAbsScale(basegfx::absolute(aScale));
182
183 return SwRect(
184 basegfx::fround(aCenter.getX() - (0.5 * aAbsScale.getX())),
185 basegfx::fround(aCenter.getY() - (0.5 * aAbsScale.getY())),
186 basegfx::fround(aAbsScale.getX()),
187 basegfx::fround(aAbsScale.getY()));
188 }
189}
190
192{
193 const basegfx::B2DHomMatrix& rSource(getLocalFramePrintAreaTransformation());
194
195 if(rSource.isIdentity())
196 {
197 return mrSwFrameAreaDefinition.getFramePrintArea();
198 }
199 else
200 {
201 basegfx::B2DVector aScale, aTranslate;
202 double fRotate, fShearX;
203 rSource.decompose(aScale, aTranslate, fRotate, fShearX);
204 const basegfx::B2DPoint aCenter(rSource * basegfx::B2DPoint(0.5, 0.5));
205 const basegfx::B2DVector aAbsScale(basegfx::absolute(aScale));
206 const SwRect aUntransformedFrameArea(getUntransformedFrameArea());
207
208 return SwRect(
209 basegfx::fround(aCenter.getX() - (0.5 * aAbsScale.getX())) - aUntransformedFrameArea.Left(),
210 basegfx::fround(aCenter.getY() - (0.5 * aAbsScale.getY())) - aUntransformedFrameArea.Top(),
211 basegfx::fround(aAbsScale.getX()),
212 basegfx::fround(aAbsScale.getY()));
213 }
214}
215
217 double fRotation,
218 const basegfx::B2DPoint& rCenter)
219{
220 const basegfx::B2DHomMatrix aRotateAroundCenter(
222 rCenter.getX(),
223 rCenter.getY(),
224 fRotation));
225 const SwRect& rFrameArea(mrSwFrameAreaDefinition.getFrameArea());
226 const SwRect& rFramePrintArea(mrSwFrameAreaDefinition.getFramePrintArea());
227
228 maFrameAreaTransformation = aRotateAroundCenter * basegfx::utils::createScaleTranslateB2DHomMatrix(
229 rFrameArea.Width(), rFrameArea.Height(),
230 rFrameArea.Left(), rFrameArea.Top());
231 maFramePrintAreaTransformation = aRotateAroundCenter * basegfx::utils::createScaleTranslateB2DHomMatrix(
232 rFramePrintArea.Width(), rFramePrintArea.Height(),
233 rFramePrintArea.Left() + rFrameArea.Left(), rFramePrintArea.Top() + rFrameArea.Top());
234}
235
237{
238 if(!getLocalFrameAreaTransformation().isIdentity())
239 {
240 basegfx::B2DRange aRangeFrameArea(0.0, 0.0, 1.0, 1.0);
241 aRangeFrameArea.transform(getLocalFrameAreaTransformation());
242 const SwRect aNewFrm(
243 basegfx::fround(aRangeFrameArea.getMinX()), basegfx::fround(aRangeFrameArea.getMinY()),
244 basegfx::fround(aRangeFrameArea.getWidth()), basegfx::fround(aRangeFrameArea.getHeight()));
245
246 if(aNewFrm != mrSwFrameAreaDefinition.getFrameArea())
247 {
248 SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(mrSwFrameAreaDefinition);
249 aFrm.setSwRect(aNewFrm);
250 }
251 }
252
253 if(getLocalFramePrintAreaTransformation().isIdentity())
254 return;
255
256 basegfx::B2DRange aRangeFramePrintArea(0.0, 0.0, 1.0, 1.0);
257 aRangeFramePrintArea.transform(getLocalFramePrintAreaTransformation());
258 const SwRect aNewPrt(
259 basegfx::fround(aRangeFramePrintArea.getMinX()) - mrSwFrameAreaDefinition.getFrameArea().Left(),
260 basegfx::fround(aRangeFramePrintArea.getMinY()) - mrSwFrameAreaDefinition.getFrameArea().Top(),
261 basegfx::fround(aRangeFramePrintArea.getWidth()),
262 basegfx::fround(aRangeFramePrintArea.getHeight()));
263
264 if(aNewPrt != mrSwFrameAreaDefinition.getFramePrintArea())
265 {
266 SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(mrSwFrameAreaDefinition);
267 aPrt.setSwRect(aNewPrt);
268 }
269}
270
272{
273 // This can be done fully based on the Transformations currently
274 // set, so use this. Only needed when transformation *is* used
275 if(!getLocalFrameAreaTransformation().isIdentity())
276 {
277 SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(mrSwFrameAreaDefinition);
278 aFrm.setSwRect(getUntransformedFrameArea());
279 }
280
281 if(!getLocalFramePrintAreaTransformation().isIdentity())
282 {
283 SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(mrSwFrameAreaDefinition);
284 aPrt.setSwRect(getUntransformedFramePrintArea());
285 }
286}
287
288// transform by given B2DHomMatrix
290{
291 maFrameAreaTransformation *= aTransform;
292 maFramePrintAreaTransformation *= aTransform;
293}
294
295SwFrame::SwFrame( sw::BroadcastingModify *pMod, SwFrame* pSib )
296: SwClient( pMod ),
297 mpRoot( pSib ? pSib->getRootFrame() : nullptr ),
298 mpUpper(nullptr),
299 mpNext(nullptr),
300 mpPrev(nullptr),
301 mnFrameType(SwFrameType::None),
302 mbInDtor(false),
303 mbInvalidR2L(true),
304 mbDerivedR2L(false),
305 mbRightToLeft(false),
306 mbInvalidVert(true),
307 mbDerivedVert(false),
308 mbVertical(false),
309 mbVertLR(false),
310 mbVertLRBT(false),
311 mbValidLineNum(false),
312 mbFixSize(false),
313 mbCompletePaint(true),
314 mbRetouche(false),
315 mbInfInvalid(true),
316 mbInfBody( false ),
317 mbInfTab ( false ),
318 mbInfFly ( false ),
319 mbInfFootnote ( false ),
320 mbInfSct ( false ),
321 mbColLocked(false),
322 m_isInDestroy(false),
323 mnForbidDelete(0)
324{
325 OSL_ENSURE( pMod, "No frame format given." );
326}
327
329{
331}
332
333bool SwFrame::KnowsFormat( const SwFormat& rFormat ) const
334{
335 return GetRegisteredIn() == &rFormat;
336}
337
339{
340 rFormat.Add( this );
341}
342
343void SwFrame::CheckDir( SvxFrameDirection nDir, bool bVert, bool bOnlyBiDi, bool bBrowse )
344{
345 if( SvxFrameDirection::Environment == nDir || ( bVert && bOnlyBiDi ) )
346 {
347 mbDerivedVert = true;
348 if( SvxFrameDirection::Environment == nDir )
349 mbDerivedR2L = true;
350 SetDirFlags( bVert );
351 }
352 else if( bVert )
353 {
354 mbInvalidVert = false;
355 if( SvxFrameDirection::Horizontal_LR_TB == nDir || SvxFrameDirection::Horizontal_RL_TB == nDir
356 || bBrowse )
357 {
358 mbVertical = false;
359 mbVertLR = false;
360 mbVertLRBT = false;
361 }
362 else
363 {
364 mbVertical = true;
365 if(SvxFrameDirection::Vertical_RL_TB == nDir)
366 {
367 mbVertLR = false;
368 mbVertLRBT = false;
369 }
370 else if(SvxFrameDirection::Vertical_LR_TB==nDir)
371 {
372 mbVertLR = true;
373 mbVertLRBT = false;
374 }
375 else if (nDir == SvxFrameDirection::Vertical_LR_BT)
376 {
377 mbVertLR = true;
378 mbVertLRBT = true;
379 }
380 else if (nDir == SvxFrameDirection::Vertical_RL_TB90)
381 {
382 // not yet implemented, render as RL_TB
383 mbVertLR = false;
384 mbVertLRBT = false;
385 }
386 }
387 }
388 else
389 {
390 mbInvalidR2L = false;
391 if( SvxFrameDirection::Horizontal_RL_TB == nDir )
392 mbRightToLeft = true;
393 else
394 mbRightToLeft = false;
395 }
396}
397
398void SwFrame::CheckDirection( bool bVert )
399{
400 if( bVert )
401 {
402 if( !IsHeaderFrame() && !IsFooterFrame() )
403 {
404 mbDerivedVert = true;
405 SetDirFlags( bVert );
406 }
407 }
408 else
409 {
410 mbDerivedR2L = true;
411 SetDirFlags( bVert );
412 }
413}
414
416{
417 const SwFrameFormat* pFormat = GetFormat();
418 if( pFormat )
419 {
420 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
421 const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
422 CheckDir(pFormat->GetFormatAttr(RES_FRAMEDIR).GetValue(),
423 bVert, true, bBrowseMode );
424 }
425 else
427}
428
430{
431 const SwFrameFormat* pFormat = GetFormat();
432 if( pFormat )
433 {
434 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
435 const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
436 CheckDir(pFormat->GetFormatAttr(RES_FRAMEDIR).GetValue(),
437 bVert, false, bBrowseMode );
438 }
439 else
441}
442
444{
445 const SwFrameFormat* pFormat = GetFormat();
446 if( pFormat )
447 {
448 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
449 const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
450 CheckDir(pFormat->GetFormatAttr(RES_FRAMEDIR).GetValue(),
451 bVert, true, bBrowseMode );
452 }
453 else
455}
456
458{
459 const SwFrameFormat* pFormat = GetFormat();
460 const SvxFrameDirectionItem* pFrameDirItem;
461 // Check if the item is set, before actually
462 // using it. Otherwise the dynamic pool default is used, which may be set
463 // to LTR in case of OOo 1.0 documents.
464 if( pFormat && (pFrameDirItem = pFormat->GetItemIfSet( RES_FRAMEDIR ) ) )
465 {
466 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
467 const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
468 CheckDir( pFrameDirItem->GetValue(), bVert, false, bBrowseMode );
469 }
470 else
472}
473
475{
476 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
477 const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
478 CheckDir(GetTextNodeForParaProps()->GetSwAttrSet().GetFrameDir().GetValue(),
479 bVert, true, bBrowseMode);
480}
481
482void SwFrame::SwClientNotify(const SwModify&, const SfxHint& rHint)
483{
484 if (rHint.GetId() != SfxHintId::SwLegacyModify)
485 return;
486 auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
488
489 if(pLegacy->m_pOld && pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
490 {
491 SfxItemIter aNIter(*static_cast<const SwAttrSetChg*>(pLegacy->m_pNew)->GetChgSet());
492 SfxItemIter aOIter(*static_cast<const SwAttrSetChg*>(pLegacy->m_pOld)->GetChgSet());
493 const SfxPoolItem* pNItem = aNIter.GetCurItem();
494 const SfxPoolItem* pOItem = aOIter.GetCurItem();
495 do
496 {
497 UpdateAttrFrame(pOItem, pNItem, eInvFlags);
498 pNItem = aNIter.NextItem();
499 pOItem = aOIter.NextItem();
500 } while (pNItem);
501 }
502 else
503 UpdateAttrFrame(pLegacy->m_pOld, pLegacy->m_pNew, eInvFlags);
504
505 if(eInvFlags == SwFrameInvFlags::NONE)
506 return;
507
508 SwPageFrame* pPage = FindPageFrame();
509 InvalidatePage(pPage);
510 if(eInvFlags & SwFrameInvFlags::InvalidatePrt)
511 {
513 if(!GetPrev() && IsTabFrame() && IsInSct())
515 }
516 if(eInvFlags & SwFrameInvFlags::InvalidateSize)
518 if(eInvFlags & SwFrameInvFlags::InvalidatePos)
522 SwFrame *pNxt;
524 && nullptr != (pNxt = GetNext()))
525 {
526 pNxt->InvalidatePage(pPage);
528 pNxt->InvalidatePos_();
530 pNxt->SetCompletePaint();
531 }
532}
533
534void SwFrame::UpdateAttrFrame( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
535 SwFrameInvFlags &rInvFlags )
536{
537 sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
538 switch( nWhich )
539 {
540 case RES_BOX:
541 case RES_SHADOW:
543 [[fallthrough]];
546 case RES_MARGIN_RIGHT:
547 case RES_LR_SPACE:
548 case RES_UL_SPACE:
549 case RES_RTL_GUTTER:
552 break;
553
556 break;
557
558 case RES_BACKGROUND:
561 break;
562
563 case RES_KEEP:
565 break;
566
567 case RES_FRM_SIZE:
571 break;
572
573 case RES_FMT_CHG:
576 break;
577
578 case RES_ROW_SPLIT:
579 {
580 if ( IsRowFrame() )
581 {
582 bool bInFollowFlowRow = nullptr != IsInFollowFlowRow();
583 if ( bInFollowFlowRow || nullptr != IsInSplitTableRow() )
584 {
585 SwTabFrame* pTab = FindTabFrame();
586 if ( bInFollowFlowRow )
587 pTab = pTab->FindMaster();
588 pTab->SetRemoveFollowFlowLinePending( true );
589 }
590 }
591 break;
592 }
593 case RES_COL:
594 OSL_FAIL( "Columns for new FrameType?" );
595 break;
596
597 default:
598 // the new FillStyle has to do the same as previous RES_BACKGROUND
599 if(nWhich >= XATTR_FILL_FIRST && nWhich <= XATTR_FILL_LAST)
600 {
601 rInvFlags
603 }
604 /* do Nothing */;
605 }
606}
607
608bool SwFrame::Prepare( const PrepareHint, const void *, bool )
609{
610 /* Do nothing */
611 return false;
612}
613
618void SwFrame::InvalidatePage( const SwPageFrame *pPage ) const
619{
620 if ( !pPage )
621 {
622 pPage = FindPageFrame();
623 // #i28701# - for at-character and as-character
624 // anchored Writer fly frames additionally invalidate also page frame
625 // its 'anchor character' is on.
626 if ( pPage && pPage->GetUpper() && IsFlyFrame() )
627 {
628 const SwFlyFrame* pFlyFrame = static_cast<const SwFlyFrame*>(this);
629 if ( pFlyFrame->IsAutoPos() || pFlyFrame->IsFlyInContentFrame() )
630 {
631 // #i33751#, #i34060# - method <GetPageFrameOfAnchor()>
632 // is replaced by method <FindPageFrameOfAnchor()>. It's return value
633 // have to be checked.
634 SwPageFrame* pPageFrameOfAnchor =
635 const_cast<SwFlyFrame*>(pFlyFrame)->FindPageFrameOfAnchor();
636 if ( pPageFrameOfAnchor && pPageFrameOfAnchor != pPage )
637 {
638 InvalidatePage( pPageFrameOfAnchor );
639 }
640 }
641 }
642 }
643
644 if ( !(pPage && pPage->GetUpper()) )
645 return;
646
647 if ( pPage->GetFormat()->GetDoc()->IsInDtor() )
648 return;
649
650 SwRootFrame *pRoot = const_cast<SwRootFrame*>(static_cast<const SwRootFrame*>(pPage->GetUpper()));
651 const SwFlyFrame *pFly = FindFlyFrame();
652 if ( IsContentFrame() )
653 {
654 if ( pRoot->IsTurboAllowed() )
655 {
656 // If a ContentFrame wants to register for a second time, make it a TurboAction.
657 if ( !pRoot->GetTurbo() || this == pRoot->GetTurbo() )
658 pRoot->SetTurbo( static_cast<const SwContentFrame*>(this) );
659 else
660 {
661 pRoot->DisallowTurbo();
662 //The page of the Turbo could be a different one then mine,
663 //therefore we have to invalidate it.
664 const SwFrame *pTmp = pRoot->GetTurbo();
665 pRoot->ResetTurbo();
666 pTmp->InvalidatePage();
667 }
668 }
669 if ( !pRoot->GetTurbo() )
670 {
671 if ( pFly )
672 { if( !pFly->IsLocked() )
673 {
674 if ( pFly->IsFlyInContentFrame() )
675 { pPage->InvalidateFlyInCnt();
677 }
678 else
679 pPage->InvalidateFlyContent();
680 }
681 }
682 else
683 pPage->InvalidateContent();
684 }
685 }
686 else
687 {
688 pRoot->DisallowTurbo();
689 if ( pFly )
690 {
691 if ( !pFly->IsLocked() )
692 {
693 if ( pFly->IsFlyInContentFrame() )
694 {
695 pPage->InvalidateFlyInCnt();
697 }
698 else
699 pPage->InvalidateFlyLayout();
700 }
701 }
702 else
703 pPage->InvalidateLayout();
704
705 if ( pRoot->GetTurbo() )
706 { const SwFrame *pTmp = pRoot->GetTurbo();
707 pRoot->ResetTurbo();
708 pTmp->InvalidatePage();
709 }
710 }
711 pRoot->SetIdleFlags();
712
713 if (!IsTextFrame())
714 return;
715
716 SwTextFrame const*const pText(static_cast<SwTextFrame const*>(this));
717 if (sw::MergedPara const*const pMergedPara = pText->GetMergedPara())
718 {
719 SwTextNode const* pNode(nullptr);
720 for (auto const& e : pMergedPara->extents)
721 {
722 if (e.pNode != pNode)
723 {
724 pNode = e.pNode;
725 if (pNode->IsGrammarCheckDirty())
726 {
727 pRoot->SetNeedGrammarCheck( true );
728 break;
729 }
730 }
731 }
732 }
733 else
734 {
736 {
737 pRoot->SetNeedGrammarCheck( true );
738 }
739 }
740}
741
742Size SwFrame::ChgSize( const Size& aNewSize )
743{
744 mbFixSize = true;
745 const Size aOldSize( getFrameArea().SSize() );
746 if ( aNewSize == aOldSize )
747 return aOldSize;
748
749 if ( GetUpper() )
750 {
751 bool bNeighb = IsNeighbourFrame();
752 SwRectFn fnRect = IsVertical() == bNeighb ? fnRectHori : ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert );
753 SwRect aNew( Point(0,0), aNewSize );
754
755 {
757 (aFrm.*fnRect->fnSetWidth)( (aNew.*fnRect->fnGetWidth)() );
758 }
759
760 tools::Long nNew = (aNew.*fnRect->fnGetHeight)();
761 tools::Long nDiff = nNew - (getFrameArea().*fnRect->fnGetHeight)();
762
763 if( nDiff )
764 {
765 if ( GetUpper()->IsFootnoteBossFrame() && HasFixSize() &&
767 static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment() )
768 {
769 {
771 (aFrm.*fnRect->fnSetHeight)( nNew );
772 }
773
774 SwTwips nReal = static_cast<SwLayoutFrame*>(this)->AdjustNeighbourhood(nDiff);
775
776 if ( nReal != nDiff )
777 {
779 (aFrm.*fnRect->fnSetHeight)( nNew - nDiff + nReal );
780 }
781 }
782 else
783 {
784 // OD 24.10.2002 #97265# - grow/shrink not for neighbour frames
785 // NOTE: neighbour frames are cell and column frames.
786 if ( !bNeighb )
787 {
788 if ( nDiff > 0 )
789 Grow( nDiff );
790 else
791 Shrink( -nDiff );
792
793 if ( GetUpper() && (getFrameArea().*fnRect->fnGetHeight)() != nNew )
794 {
796 }
797 }
798
799 // Even if grow/shrink did not yet set the desired width, for
800 // example when called by ChgColumns to set the column width, we
801 // set the right width now.
803 (aFrm.*fnRect->fnSetHeight)( nNew );
804 }
805 }
806 }
807 else
808 {
810 aFrm.SSize( aNewSize );
811 }
812
813 if ( getFrameArea().SSize() != aOldSize )
814 {
815 SwPageFrame *pPage = FindPageFrame();
816 if ( GetNext() )
817 {
819 GetNext()->InvalidatePage( pPage );
820 }
821 if( IsLayoutFrame() )
822 {
823 if( IsRightToLeft() )
825 if( static_cast<SwLayoutFrame*>(this)->Lower() )
826 static_cast<SwLayoutFrame*>(this)->Lower()->InvalidateSize_();
827 }
830 InvalidatePage( pPage );
831 }
832
833 return getFrameArea().SSize();
834}
835
842{
843 OSL_ENSURE( pParent, "No parent for insert." );
844 OSL_ENSURE( (!pBehind || pParent == pBehind->GetUpper()),
845 "Frame tree is inconsistent." );
846
847 mpUpper = pParent;
848 mpNext = pBehind;
849 if( pBehind )
850 { //Insert before pBehind.
851 mpPrev = pBehind->mpPrev;
852 if( nullptr != mpPrev )
853 mpPrev->mpNext = this;
854 else
855 mpUpper->m_pLower = this;
856 pBehind->mpPrev = this;
857 }
858 else
859 { //Insert at the end, or as first node in the sub tree
860 mpPrev = mpUpper->Lower();
861 if ( mpPrev )
862 {
863 while( mpPrev->mpNext )
865 mpPrev->mpNext = this;
866 }
867 else
868 mpUpper->m_pLower = this;
869 }
870}
871
878{
879 OSL_ENSURE( pParent, "No Parent for Insert." );
880 OSL_ENSURE( (!pBefore || pParent == pBefore->GetUpper()),
881 "Frame tree is inconsistent." );
882
883 mpUpper = pParent;
884 mpPrev = pBefore;
885 if ( pBefore )
886 {
887 //Insert after pBefore
888 mpNext = pBefore->mpNext;
889 if ( nullptr != mpNext )
890 mpNext->mpPrev = this;
891 pBefore->mpNext = this;
892 }
893 else
894 {
895 //Insert at the beginning of the chain
896 mpNext = pParent->Lower();
897 if ( pParent->Lower() )
898 pParent->Lower()->mpPrev = this;
899 pParent->m_pLower = this;
900 }
901}
902
916bool SwFrame::InsertGroupBefore( SwFrame* pParent, SwFrame* pBehind, SwFrame* pSct )
917{
918 OSL_ENSURE( pParent, "No parent for insert." );
919 OSL_ENSURE( (!pBehind || ( (pBehind && (pParent == pBehind->GetUpper()))
920 || ((pParent->IsSctFrame() && pBehind->GetUpper()->IsColBodyFrame())) ) ),
921 "Frame tree inconsistent." );
922 if( pSct )
923 {
924 mpUpper = pParent->GetUpper();
925 SwFrame *pLast = this;
926 while( pLast->GetNext() )
927 {
928 pLast = pLast->GetNext();
929 pLast->mpUpper = GetUpper();
930 }
931 if( pBehind )
932 {
933 pLast->mpNext = pSct;
934 pSct->mpPrev = pLast;
935 pSct->mpNext = pParent->GetNext();
936 }
937 else
938 {
939 pLast->mpNext = pParent->GetNext();
940 if( pLast->GetNext() )
941 pLast->GetNext()->mpPrev = pLast;
942 }
943 pParent->mpNext = this;
944 mpPrev = pParent;
945 if( pSct->GetNext() )
946 pSct->GetNext()->mpPrev = pSct;
947 while( pLast->GetNext() )
948 {
949 pLast = pLast->GetNext();
950 pLast->mpUpper = GetUpper();
951 }
952 if( pBehind )
953 { // Insert before pBehind.
954 if( pBehind->GetPrev() )
955 pBehind->GetPrev()->mpNext = nullptr;
956 else
957 pBehind->GetUpper()->m_pLower = nullptr;
958 pBehind->mpPrev = nullptr;
959 SwLayoutFrame* pTmp = static_cast<SwLayoutFrame*>(pSct);
960 if( pTmp->Lower() )
961 {
962 OSL_ENSURE( pTmp->Lower()->IsColumnFrame(), "InsertGrp: Used SectionFrame" );
963 pTmp = static_cast<SwLayoutFrame*>(static_cast<SwLayoutFrame*>(pTmp->Lower())->Lower());
964 OSL_ENSURE( pTmp, "InsertGrp: Missing ColBody" );
965 }
966 pBehind->mpUpper = pTmp;
967 pBehind->GetUpper()->m_pLower = pBehind;
968 pLast = pBehind->GetNext();
969 while ( pLast )
970 {
971 pLast->mpUpper = pBehind->GetUpper();
972 pLast = pLast->GetNext();
973 }
974 }
975 else
976 {
977 OSL_ENSURE( pSct->IsSctFrame(), "InsertGroup: For SectionFrames only" );
979 return false;
980 }
981 }
982 else
983 {
984 mpUpper = static_cast<SwLayoutFrame*>(pParent);
985 SwFrame *pLast = this;
986 while( pLast->GetNext() )
987 {
988 pLast = pLast->GetNext();
989 pLast->mpUpper = GetUpper();
990 }
991 pLast->mpNext = pBehind;
992 if( pBehind )
993 { // Insert before pBehind.
994 mpPrev = pBehind->mpPrev;
995 if( nullptr != mpPrev )
996 mpPrev->mpNext = this;
997 else
998 mpUpper->m_pLower = this;
999 pBehind->mpPrev = pLast;
1000 }
1001 else
1002 {
1003 //Insert at the end, or ... the first node in the subtree
1004 mpPrev = mpUpper->Lower();
1005 if ( mpPrev )
1006 {
1007 while( mpPrev->mpNext )
1008 mpPrev = mpPrev->mpNext;
1009 mpPrev->mpNext = this;
1010 }
1011 else
1012 mpUpper->m_pLower = this;
1013 }
1014 }
1015 return true;
1016}
1017
1019{
1020 OSL_ENSURE( mpUpper, "Remove without upper?" );
1021
1022 if (mpPrev)
1023 // one out of the middle is removed
1024 mpPrev->mpNext = mpNext;
1025 else if (mpUpper)
1026 { // the first in a list is removed //TODO
1027 OSL_ENSURE( mpUpper->m_pLower == this, "Layout is inconsistent." );
1029 }
1030 if( mpNext )
1031 mpNext->mpPrev = mpPrev;
1032
1033 // Remove link
1034 mpNext = mpPrev = nullptr;
1035 mpUpper = nullptr;
1036}
1037
1038void SwContentFrame::Paste( SwFrame* pParent, SwFrame* pSibling)
1039{
1040 OSL_ENSURE( pParent, "No parent for pasting." );
1041 OSL_ENSURE( pParent->IsLayoutFrame(), "Parent is ContentFrame." );
1042 OSL_ENSURE( pParent != this, "I'm the parent." );
1043 OSL_ENSURE( pSibling != this, "I'm my own neighbour." );
1044 OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(),
1045 "I'm still registered somewhere" );
1046 OSL_ENSURE( !pSibling || pSibling->IsFlowFrame(),
1047 "<SwContentFrame::Paste(..)> - sibling not of expected type." );
1048
1049 //Insert in the tree.
1050 InsertBefore( static_cast<SwLayoutFrame*>(pParent), pSibling );
1051
1052 SwPageFrame *pPage = FindPageFrame();
1054 InvalidatePage( pPage );
1055
1056 if( pPage )
1057 {
1058 pPage->InvalidateSpelling();
1059 pPage->InvalidateSmartTags();
1061 pPage->InvalidateWordCount();
1062 }
1063
1064 if ( GetNext() )
1065 {
1066 SwFrame* pNxt = GetNext();
1067 pNxt->InvalidatePrt_();
1068 pNxt->InvalidatePos_();
1069 pNxt->InvalidatePage( pPage );
1070 if( pNxt->IsSctFrame() )
1071 pNxt = static_cast<SwSectionFrame*>(pNxt)->ContainsContent();
1072 if( pNxt && pNxt->IsTextFrame() && pNxt->IsInFootnote() )
1073 pNxt->Prepare( PrepareHint::FootnoteInvalidation, nullptr, false );
1074 }
1075
1076 if ( getFrameArea().Height() )
1077 pParent->Grow( getFrameArea().Height() );
1078
1079 if ( getFrameArea().Width() != pParent->getFramePrintArea().Width() )
1081
1082 if ( GetPrev() )
1083 {
1084 if ( IsFollow() )
1085 //I'm a direct follower of my master now
1087 else
1088 {
1089 if ( GetPrev()->getFrameArea().Height() !=
1091 {
1092 // Take the border into account?
1094 }
1095 // OD 18.02.2003 #104989# - force complete paint of previous frame,
1096 // if frame is inserted at the end of a section frame, in order to
1097 // get subsidiary lines repainted for the section.
1098 if ( pParent->IsSctFrame() && !GetNext() )
1099 {
1100 // force complete paint of previous frame, if new inserted frame
1101 // in the section is the last one.
1103 }
1104 GetPrev()->InvalidatePage( pPage );
1105 }
1106 }
1107 if ( IsInFootnote() )
1108 {
1109 SwFrame* pFrame = GetIndPrev();
1110 if( pFrame && pFrame->IsSctFrame() )
1111 pFrame = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1112 if( pFrame )
1113 pFrame->Prepare( PrepareHint::QuoVadis, nullptr, false );
1114 if( !GetNext() )
1115 {
1116 pFrame = FindFootnoteFrame()->GetNext();
1117 if( pFrame && nullptr != (pFrame=static_cast<SwLayoutFrame*>(pFrame)->ContainsAny()) )
1118 pFrame->InvalidatePrt_();
1119 }
1120 }
1121
1123 SwFrame *pNxt = FindNextCnt();
1124 if ( !pNxt )
1125 return;
1126
1127 while ( pNxt && pNxt->IsInTab() )
1128 {
1129 pNxt = pNxt->FindTabFrame();
1130 if( nullptr != pNxt )
1131 pNxt = pNxt->FindNextCnt();
1132 }
1133 if ( pNxt )
1134 {
1135 pNxt->InvalidateLineNum_();
1136 if ( pNxt != GetNext() )
1137 pNxt->InvalidatePage();
1138 }
1139}
1140
1142{
1143 OSL_ENSURE( GetUpper(), "Cut without Upper()." );
1144
1145 SwPageFrame *pPage = FindPageFrame();
1146 InvalidatePage( pPage );
1147 SwFrame *pFrame = GetIndPrev();
1148 if( pFrame )
1149 {
1150 if( pFrame->IsSctFrame() )
1151 pFrame = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1152 if ( pFrame && pFrame->IsContentFrame() )
1153 {
1154 pFrame->InvalidatePrt_();
1155 if( IsInFootnote() )
1156 pFrame->Prepare( PrepareHint::QuoVadis, nullptr, false );
1157 }
1158 // #i26250# - invalidate printing area of previous
1159 // table frame.
1160 else if ( pFrame && pFrame->IsTabFrame() )
1161 {
1162 pFrame->InvalidatePrt();
1163 }
1164 }
1165
1166 SwFrame *pNxt = FindNextCnt();
1167 if ( pNxt )
1168 {
1169 while ( pNxt && pNxt->IsInTab() )
1170 {
1171 pNxt = pNxt->FindTabFrame();
1172 if( nullptr != pNxt )
1173 pNxt = pNxt->FindNextCnt();
1174 }
1175 if ( pNxt )
1176 {
1177 pNxt->InvalidateLineNum_();
1178 if ( pNxt != GetNext() )
1179 pNxt->InvalidatePage();
1180 }
1181 }
1182
1183 SwTabFrame* pMasterTab(nullptr);
1184 pFrame = GetIndNext();
1185 if( pFrame )
1186 {
1187 // The old follow may have calculated a gap to the predecessor which
1188 // now becomes obsolete or different as it becomes the first one itself
1189 pFrame->InvalidatePrt_();
1190 pFrame->InvalidatePos_();
1191 pFrame->InvalidatePage( pPage );
1192 if( pFrame->IsSctFrame() )
1193 {
1194 pFrame = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1195 if( pFrame )
1196 {
1197 pFrame->InvalidatePrt_();
1198 pFrame->InvalidatePos_();
1199 pFrame->InvalidatePage( pPage );
1200 }
1201 }
1202 if( pFrame && IsInFootnote() )
1203 pFrame->Prepare( PrepareHint::ErgoSum, nullptr, false );
1204 if( IsInSct() && !GetPrev() )
1205 {
1206 SwSectionFrame* pSct = FindSctFrame();
1207 if( !pSct->IsFollow() )
1208 {
1209 pSct->InvalidatePrt_();
1210 pSct->InvalidatePage( pPage );
1211 }
1212 }
1213 }
1214 else
1215 {
1217 //Someone needs to do the retouching: predecessor or upper
1218 pFrame = GetPrev();
1219 if ( nullptr != pFrame )
1220 { pFrame->SetRetouche();
1222 pFrame->InvalidatePos_();
1223 pFrame->InvalidatePage( pPage );
1224 }
1225 // If I'm (was) the only ContentFrame in my upper, it has to do the
1226 // retouching. Also, perhaps a page became empty.
1227 else
1228 { SwRootFrame *pRoot = getRootFrame();
1229 if ( pRoot )
1230 {
1231 pRoot->SetSuperfluous();
1232 // RemoveSuperfluous can only remove empty pages at the end;
1233 // find if there are pages without content following pPage
1234 // and if so request a call to CheckPageDescs()
1235 SwViewShell *pSh = pRoot->GetCurrShell();
1236 // tdf#152983 pPage is null when called from SwHeadFootFrame ctor
1237 if (pPage && pSh && pSh->Imp()->IsAction())
1238 {
1239 SwPageFrame const* pNext(pPage);
1240 while ((pNext = static_cast<SwPageFrame const*>(pNext->GetNext())))
1241 {
1242 if (!sw::IsPageFrameEmpty(*pNext) && !pNext->IsFootnotePage())
1243 {
1244 pSh->Imp()->GetLayAction().SetCheckPageNum(pPage->GetPhyPageNum());
1245 break;
1246 }
1247 }
1248 }
1250 GetUpper()->InvalidatePage( pPage );
1251 }
1252 if( IsInSct() )
1253 {
1254 SwSectionFrame* pSct = FindSctFrame();
1255 if( !pSct->IsFollow() )
1256 {
1257 pSct->InvalidatePrt_();
1258 pSct->InvalidatePage( pPage );
1259 }
1260 }
1261 // #i52253# The master table should take care
1262 // of removing the follow flow line.
1263 if ( IsInTab() )
1264 {
1265 SwTabFrame* pThisTab = FindTabFrame();
1266 if (pThisTab && pThisTab->IsFollow())
1267 {
1268 pMasterTab = pThisTab->FindMaster();
1269 }
1270 }
1271 }
1272 }
1273 //Remove first, then shrink the upper.
1274 SwLayoutFrame *pUp = GetUpper();
1276 if ( !pUp )
1277 {
1278 assert(!pMasterTab);
1279 return;
1280 }
1281
1282 if (pMasterTab
1283 && !pMasterTab->GetFollow()->GetFirstNonHeadlineRow()->ContainsContent())
1284 { // only do this if there's no content in other cells of the row!
1285 pMasterTab->InvalidatePos_();
1286 pMasterTab->SetRemoveFollowFlowLinePending(true);
1287 }
1288
1289 SwSectionFrame *pSct = nullptr;
1290 if ( !pUp->Lower() &&
1291 ( ( pUp->IsFootnoteFrame() && !pUp->IsColLocked() ) ||
1292 ( pUp->IsInSct() &&
1293 // #i29438#
1294 // We have to consider the case that the section may be "empty"
1295 // except from a temporary empty table frame.
1296 // This can happen due to the new cell split feature.
1297 !pUp->IsCellFrame() &&
1298 // #126020# - adjust check for empty section
1299 // #130797# - correct fix #126020#
1300 !(pSct = pUp->FindSctFrame())->ContainsContent() &&
1301 !pSct->ContainsAny( true ) ) ) )
1302 {
1303 if ( pUp->GetUpper() )
1304 {
1305
1306 // prevent delete of <ColLocked> footnote frame
1307 if ( pUp->IsFootnoteFrame() && !pUp->IsColLocked())
1308 {
1309 if( pUp->GetNext() && !pUp->GetPrev() )
1310 {
1311 SwFrame* pTmp = static_cast<SwLayoutFrame*>(pUp->GetNext())->ContainsAny();
1312 if( pTmp )
1313 pTmp->InvalidatePrt_();
1314 }
1315 if (!pUp->IsDeleteForbidden())
1316 {
1317 pUp->Cut();
1319 }
1320 }
1321 else
1322 {
1323
1324 if ( pSct->IsColLocked() || !pSct->IsInFootnote() ||
1325 ( pUp->IsFootnoteFrame() && pUp->IsColLocked() ) )
1326 {
1327 pSct->DelEmpty( false );
1328 // If a locked section may not be deleted then at least
1329 // its size became invalid after removing its last
1330 // content.
1331 pSct->InvalidateSize_();
1332 }
1333 else
1334 {
1335 pSct->DelEmpty( true );
1337 }
1338 }
1339 }
1340 }
1341 else
1342 {
1343 SwRectFnSet aRectFnSet(this);
1344 tools::Long nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
1345 if( nFrameHeight )
1346 pUp->Shrink( nFrameHeight );
1347 }
1348}
1349
1350void SwLayoutFrame::Paste( SwFrame* pParent, SwFrame* pSibling)
1351{
1352 OSL_ENSURE( pParent, "No parent for pasting." );
1353 OSL_ENSURE( pParent->IsLayoutFrame(), "Parent is ContentFrame." );
1354 OSL_ENSURE( pParent != this, "I'm the parent oneself." );
1355 OSL_ENSURE( pSibling != this, "I'm my own neighbour." );
1356 OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(),
1357 "I'm still registered somewhere." );
1358
1359 //Insert in the tree.
1360 InsertBefore( static_cast<SwLayoutFrame*>(pParent), pSibling );
1361
1362 // OD 24.10.2002 #103517# - correct setting of variable <fnRect>
1363 // <fnRect> is used for the following:
1364 // (1) To invalidate the frame's size, if its size, which has to be the
1365 // same as its upper/parent, differs from its upper's/parent's.
1366 // (2) To adjust/grow the frame's upper/parent, if it has a dimension in its
1367 // size, which is not determined by its upper/parent.
1368 // Which size is which depends on the frame type and the layout direction
1369 // (vertical or horizontal).
1370 // There are the following cases:
1371 // (A) Header and footer frames both in vertical and in horizontal layout
1372 // have to size the width to the upper/parent. A dimension in the height
1373 // has to cause an adjustment/grow of the upper/parent.
1374 // --> <fnRect> = fnRectHori
1375 // (B) Cell and column frames in vertical layout, the width has to be the
1376 // same as upper/parent and a dimension in height causes adjustment/grow
1377 // of the upper/parent.
1378 // --> <fnRect> = fnRectHori
1379 // in horizontal layout the other way around
1380 // --> <fnRect> = fnRectVert
1381 // (C) Other frames in vertical layout, the height has to be the
1382 // same as upper/parent and a dimension in width causes adjustment/grow
1383 // of the upper/parent.
1384 // --> <fnRect> = fnRectVert
1385 // in horizontal layout the other way around
1386 // --> <fnRect> = fnRectHori
1387 //SwRectFn fnRect = IsVertical() ? fnRectHori : fnRectVert;
1388 SwRectFn fnRect;
1389 if ( IsHeaderFrame() || IsFooterFrame() )
1390 fnRect = fnRectHori;
1391 else if ( IsCellFrame() || IsColumnFrame() )
1393 else
1395
1396 if( (getFrameArea().*fnRect->fnGetWidth)() != (pParent->getFramePrintArea().*fnRect->fnGetWidth)())
1399 const SwPageFrame *pPage = FindPageFrame();
1400 InvalidatePage( pPage );
1401 if( !IsColumnFrame() )
1402 {
1403 SwFrame *pFrame = GetIndNext();
1404 if( nullptr != pFrame )
1405 {
1406 pFrame->InvalidatePos_();
1407 if( IsInFootnote() )
1408 {
1409 if( pFrame->IsSctFrame() )
1410 pFrame = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1411 if( pFrame )
1412 pFrame->Prepare( PrepareHint::ErgoSum, nullptr, false );
1413 }
1414 }
1415 if ( IsInFootnote() && nullptr != ( pFrame = GetIndPrev() ) )
1416 {
1417 if( pFrame->IsSctFrame() )
1418 pFrame = static_cast<SwSectionFrame*>(pFrame)->ContainsAny();
1419 if( pFrame )
1420 pFrame->Prepare( PrepareHint::QuoVadis, nullptr, false );
1421 }
1422 }
1423
1424 if( !(getFrameArea().*fnRect->fnGetHeight)() )
1425 return;
1426
1427 // AdjustNeighbourhood is now also called in columns which are not
1428 // placed inside a frame
1430 static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment()
1432 SwTwips nGrow = (getFrameArea().*fnRect->fnGetHeight)();
1434 AdjustNeighbourhood( nGrow );
1435 else
1436 {
1437 SwTwips nReal = 0;
1439 nReal = AdjustNeighbourhood( nGrow );
1440 if( nReal < nGrow )
1441 nReal += pParent->Grow( nGrow - nReal );
1442 if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nGrow )
1443 AdjustNeighbourhood( nGrow - nReal );
1444 }
1445}
1446
1448{
1449 if ( GetNext() )
1451
1452 SwRectFnSet aRectFnSet(this);
1453 SwTwips nShrink = aRectFnSet.GetHeight(getFrameArea());
1454
1455 // Remove first, then shrink upper.
1456 SwLayoutFrame *pUp = GetUpper();
1457
1458 // AdjustNeighbourhood is now also called in columns which are not
1459 // placed inside a frame.
1460
1461 // Remove must not be called before an AdjustNeighbourhood, but it has to
1462 // be called before the upper-shrink-call, if the upper-shrink takes care
1463 // of its content.
1464 if ( pUp && nShrink )
1465 {
1466 if( pUp->IsFootnoteBossFrame() )
1467 {
1468 SwNeighbourAdjust nAdjust= static_cast<SwFootnoteBossFrame*>(pUp)->NeighbourhoodAdjustment();
1470 AdjustNeighbourhood( -nShrink );
1471 else
1472 {
1473 SwTwips nReal = 0;
1475 nReal = -AdjustNeighbourhood( -nShrink );
1476 if( nReal < nShrink )
1477 {
1478 const SwTwips nOldHeight = aRectFnSet.GetHeight(getFrameArea());
1479
1480 // seems as if this needs to be forwarded to the SwFrame already here,
1481 // changing to zero seems temporary anyways
1482 {
1484 aRectFnSet.SetHeight( aFrm, 0 );
1485 }
1486
1487 nReal += pUp->Shrink( nShrink - nReal );
1488
1489 {
1491 aRectFnSet.SetHeight( aFrm, nOldHeight );
1492 }
1493 }
1494
1495 if( SwNeighbourAdjust::GrowAdjust == nAdjust && nReal < nShrink )
1496 AdjustNeighbourhood( nReal - nShrink );
1497 }
1499 }
1500 else
1501 {
1503 pUp->Shrink( nShrink );
1504 }
1505 }
1506 else
1508
1509 if( pUp && !pUp->Lower() )
1510 {
1511 pUp->SetCompletePaint();
1512 pUp->InvalidatePage();
1513 }
1514}
1515
1516SwTwips SwFrame::Grow( SwTwips nDist, bool bTst, bool bInfo )
1517{
1518 OSL_ENSURE( nDist >= 0, "Negative growth?" );
1519
1520 PROTOCOL_ENTER( this, bTst ? PROT::GrowTest : PROT::Grow, DbgAction::NONE, &nDist )
1521
1522 if ( nDist )
1523 {
1524 SwRectFnSet aRectFnSet(this);
1525
1526 SwTwips nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
1527 if( nPrtHeight > 0 && nDist > (LONG_MAX - nPrtHeight) )
1528 nDist = LONG_MAX - nPrtHeight;
1529
1530 if ( IsFlyFrame() )
1531 return static_cast<SwFlyFrame*>(this)->Grow_( nDist, bTst );
1532 else if( IsSctFrame() )
1533 return static_cast<SwSectionFrame*>(this)->Grow_( nDist, bTst );
1534 else
1535 {
1536 if (IsCellFrame())
1537 {
1538 const SwCellFrame* pThisCell = static_cast<const SwCellFrame*>(this);
1539 const SwTabFrame* pTab = FindTabFrame();
1540
1541 // NEW TABLES
1542 if ( pTab->IsVertical() != IsVertical() ||
1543 pThisCell->GetLayoutRowSpan() < 1 )
1544 return 0;
1545 }
1546 const SwTwips nReal = GrowFrame( nDist, bTst, bInfo );
1547 if( !bTst )
1548 {
1549 nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
1550
1552 aRectFnSet.SetHeight( aPrt, nPrtHeight + ( IsContentFrame() ? nDist : nReal ) );
1553 }
1554 return nReal;
1555 }
1556 }
1557 return 0;
1558}
1559
1560SwTwips SwFrame::Shrink( SwTwips nDist, bool bTst, bool bInfo )
1561{
1562 OSL_ENSURE( nDist >= 0, "Negative reduction?" );
1563
1565
1566 if ( nDist )
1567 {
1568 if ( IsFlyFrame() )
1569 return static_cast<SwFlyFrame*>(this)->Shrink_( nDist, bTst );
1570 else if( IsSctFrame() )
1571 return static_cast<SwSectionFrame*>(this)->Shrink_( nDist, bTst );
1572 else
1573 {
1574 if (IsCellFrame())
1575 {
1576 const SwCellFrame* pThisCell = static_cast<const SwCellFrame*>(this);
1577 const SwTabFrame* pTab = FindTabFrame();
1578
1579 // NEW TABLES
1580 if ( (pTab && pTab->IsVertical() != IsVertical()) ||
1581 pThisCell->GetLayoutRowSpan() < 1 )
1582 return 0;
1583 }
1584 SwRectFnSet aRectFnSet(this);
1585 SwTwips nReal = aRectFnSet.GetHeight(getFrameArea());
1586 ShrinkFrame( nDist, bTst, bInfo );
1587 nReal -= aRectFnSet.GetHeight(getFrameArea());
1588 if( !bTst )
1589 {
1590 const SwTwips nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
1592 aRectFnSet.SetHeight( aPrt, nPrtHeight - ( IsContentFrame() ? nDist : nReal ) );
1593 }
1594 return nReal;
1595 }
1596 }
1597 return 0;
1598}
1599
1621{
1623
1624 if ( !nDiff || !GetUpper()->IsFootnoteBossFrame() ) // only inside pages/columns
1625 return 0;
1626
1627 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
1628 const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
1629
1630 //The (Page-)Body only changes in BrowseMode, but only if it does not
1631 //contain columns.
1632 if ( IsPageBodyFrame() && (!bBrowse ||
1633 (static_cast<SwLayoutFrame*>(this)->Lower() &&
1634 static_cast<SwLayoutFrame*>(this)->Lower()->IsColumnFrame())) )
1635 return 0;
1636
1637 //In BrowseView mode the PageFrame can handle some of the requests.
1638 tools::Long nBrowseAdd = 0;
1639 if ( bBrowse && GetUpper()->IsPageFrame() ) // only (Page-)BodyFrames
1640 {
1641 SwViewShell *pViewShell = getRootFrame()->GetCurrShell();
1642 SwLayoutFrame *pUp = GetUpper();
1643 tools::Long nChg;
1644 const tools::Long nUpPrtBottom = pUp->getFrameArea().Height() -
1645 pUp->getFramePrintArea().Height() - pUp->getFramePrintArea().Top();
1646 SwRect aInva( pUp->getFrameArea() );
1647 if ( pViewShell )
1648 {
1649 aInva.Pos().setX( pViewShell->VisArea().Left() );
1650 aInva.Width( pViewShell->VisArea().Width() );
1651 }
1652 if ( nDiff > 0 )
1653 {
1654 nChg = BROWSE_HEIGHT - pUp->getFrameArea().Height();
1655 nChg = std::min( nDiff, SwTwips(nChg) );
1656
1657 if ( !IsBodyFrame() )
1658 {
1660 if ( !pViewShell || pViewShell->VisArea().Height() >= pUp->getFrameArea().Height() )
1661 {
1662 //First minimize Body, it will grow again later.
1663 SwFrame *pBody = static_cast<SwFootnoteBossFrame*>(pUp)->FindBodyCont();
1664 const tools::Long nTmp = nChg - pBody->getFramePrintArea().Height();
1665 if ( !bTst )
1666 {
1667 {
1669 aFrm.Height(std::max( tools::Long(0), aFrm.Height() - nChg ));
1670 }
1671
1672 pBody->InvalidatePrt_();
1673 pBody->InvalidateSize_();
1674 if ( pBody->GetNext() )
1675 pBody->GetNext()->InvalidatePos_();
1676 if ( !IsHeaderFrame() )
1677 pBody->SetCompletePaint();
1678 }
1679 nChg = nTmp <= 0 ? 0 : nTmp;
1680 }
1681 }
1682
1683 const tools::Long nTmp = nUpPrtBottom + 20;
1684 aInva.Top( aInva.Bottom() - nTmp );
1685 aInva.Height( nChg + nTmp );
1686 }
1687 else
1688 {
1689 //The page can shrink to 0. The first page keeps the same size like
1690 //VisArea.
1691 nChg = nDiff;
1692 tools::Long nInvaAdd = 0;
1693 if ( pViewShell && !pUp->GetPrev() &&
1694 pUp->getFrameArea().Height() + nDiff < pViewShell->VisArea().Height() )
1695 {
1696 // This means that we have to invalidate adequately.
1697 nChg = pViewShell->VisArea().Height() - pUp->getFrameArea().Height();
1698 nInvaAdd = -(nDiff - nChg);
1699 }
1700
1701 //Invalidate including bottom border.
1702 tools::Long nBorder = nUpPrtBottom + 20;
1703 nBorder -= nChg;
1704 aInva.Top( aInva.Bottom() - (nBorder+nInvaAdd) );
1705 if ( !IsBodyFrame() )
1706 {
1708 if ( !IsHeaderFrame() )
1709 static_cast<SwFootnoteBossFrame*>(pUp)->FindBodyCont()->SetCompletePaint();
1710 }
1711 //Invalidate the page because of the frames. Thereby the page becomes
1712 //the right size again if a frame didn't fit. This only works
1713 //randomly for paragraph bound frames otherwise (NotifyFlys).
1714 pUp->InvalidateSize();
1715 }
1716 if ( !bTst )
1717 {
1718 //Independent from nChg
1719 if ( pViewShell && aInva.HasArea() && pUp->GetUpper() )
1720 pViewShell->InvalidateWindows( aInva );
1721 }
1722 if ( !bTst && nChg )
1723 {
1724 {
1726 aFrm.AddHeight(nChg );
1727 }
1728
1729 {
1731 aPrt.AddHeight(nChg );
1732 }
1733
1734 if ( pViewShell )
1735 pViewShell->Imp()->SetFirstVisPageInvalid();
1736
1737 if ( GetNext() )
1739
1740 //Trigger a repaint if necessary.
1741 std::unique_ptr<SvxBrushItem> aBack(pUp->GetFormat()->makeBackgroundBrushItem());
1742 const SvxGraphicPosition ePos = aBack->GetGraphicPos();
1743 if ( ePos != GPOS_NONE && ePos != GPOS_TILED )
1744 pViewShell->InvalidateWindows( pUp->getFrameArea() );
1745
1746 if ( pUp->GetUpper() )
1747 {
1748 if ( pUp->GetNext() )
1749 pUp->GetNext()->InvalidatePos();
1750
1751 //Sad but true: during notify on ViewImp a Calc on the page and
1752 //its Lower may be called. The values should not be changed
1753 //because the caller takes care of the adjustment of Frame and
1754 //Prt.
1755 const tools::Long nOldFrameHeight = getFrameArea().Height();
1756 const tools::Long nOldPrtHeight = getFramePrintArea().Height();
1757 const bool bOldComplete = IsCompletePaint();
1758
1759 if ( IsBodyFrame() )
1760 {
1762 aPrt.Height( nOldFrameHeight );
1763 }
1764
1765 if ( pUp->GetUpper() )
1766 {
1767 static_cast<SwRootFrame*>(pUp->GetUpper())->CheckViewLayout( nullptr, nullptr );
1768 }
1769
1771 aFrm.Height( nOldFrameHeight );
1772
1774 aPrt.Height( nOldPrtHeight );
1775
1776 mbCompletePaint = bOldComplete;
1777 }
1778 if ( !IsBodyFrame() )
1779 pUp->InvalidateSize_();
1780 InvalidatePage( static_cast<SwPageFrame*>(pUp) );
1781 }
1782 nDiff -= nChg;
1783 if ( !nDiff )
1784 return nChg;
1785 else
1786 nBrowseAdd = nChg;
1787 }
1788
1789 const SwFootnoteBossFrame *pBoss = static_cast<SwFootnoteBossFrame*>(GetUpper());
1790
1791 SwTwips nReal = 0,
1792 nAdd = 0;
1793 SwFrame *pFrame = nullptr;
1794 SwRectFnSet aRectFnSet(this);
1795
1796 if( IsBodyFrame() )
1797 {
1798 if( IsInSct() )
1799 {
1800 SwSectionFrame *pSect = FindSctFrame();
1801 if( nDiff > 0 && pSect->IsEndnAtEnd() && GetNext() &&
1803 {
1804 SwFootnoteContFrame* pCont = static_cast<SwFootnoteContFrame*>(GetNext());
1805 SwTwips nMinH = 0;
1806 SwFootnoteFrame* pFootnote = static_cast<SwFootnoteFrame*>(pCont->Lower());
1807 bool bFootnote = false;
1808 while( pFootnote )
1809 {
1810 if( !pFootnote->GetAttr()->GetFootnote().IsEndNote() )
1811 {
1812 nMinH += aRectFnSet.GetHeight(pFootnote->getFrameArea());
1813 bFootnote = true;
1814 }
1815 pFootnote = static_cast<SwFootnoteFrame*>(pFootnote->GetNext());
1816 }
1817 if( bFootnote )
1818 nMinH += aRectFnSet.GetTop(pCont->getFramePrintArea());
1819 nReal = aRectFnSet.GetHeight(pCont->getFrameArea()) - nMinH;
1820 if( nReal > nDiff )
1821 nReal = nDiff;
1822 if( nReal > 0 )
1823 pFrame = GetNext();
1824 else
1825 nReal = 0;
1826 }
1827 if( !bTst && !pSect->IsColLocked() )
1828 pSect->InvalidateSize();
1829 }
1830 if( !pFrame )
1831 return nBrowseAdd;
1832 }
1833 else
1834 {
1835 const bool bFootnotePage = pBoss->IsPageFrame() && static_cast<const SwPageFrame*>(pBoss)->IsFootnotePage();
1836 if ( bFootnotePage && !IsFootnoteContFrame() )
1837 pFrame = const_cast<SwFrame*>(static_cast<SwFrame const *>(pBoss->FindFootnoteCont()));
1838 if ( !pFrame )
1839 pFrame = const_cast<SwFrame*>(static_cast<SwFrame const *>(pBoss->FindBodyCont()));
1840
1841 if ( !pFrame )
1842 return 0;
1843
1844 //If not one is found, everything else is solved.
1845 nReal = aRectFnSet.GetHeight(pFrame->getFrameArea());
1846 if( nReal > nDiff )
1847 nReal = nDiff;
1848 if( !bFootnotePage )
1849 {
1850 //Respect the minimal boundary!
1851 if( nReal )
1852 {
1853 const SwTwips nMax = pBoss->GetVarSpace();
1854 if ( nReal > nMax )
1855 nReal = nMax;
1856 }
1857 if( !IsFootnoteContFrame() && nDiff > nReal &&
1858 pFrame->GetNext() && pFrame->GetNext()->IsFootnoteContFrame()
1859 && ( pFrame->GetNext()->IsVertical() == IsVertical() )
1860 )
1861 {
1862 //If the Body doesn't return enough, we look for a footnote, if
1863 //there is one, we steal there accordingly.
1864 const SwTwips nAddMax = aRectFnSet.GetHeight(pFrame->GetNext()->getFrameArea());
1865 nAdd = nDiff - nReal;
1866 if ( nAdd > nAddMax )
1867 nAdd = nAddMax;
1868 if ( !bTst )
1869 {
1870 {
1872 aRectFnSet.SetHeight(aFrm, nAddMax-nAdd);
1873
1874 if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() )
1875 {
1876 aFrm.Pos().AdjustX(nAdd );
1877 }
1878 }
1879
1880 pFrame->GetNext()->InvalidatePrt();
1881
1882 if ( pFrame->GetNext()->GetNext() )
1883 {
1884 pFrame->GetNext()->GetNext()->InvalidatePos_();
1885 }
1886 }
1887 }
1888 }
1889 }
1890
1891 if ( !bTst && nReal )
1892 {
1893 SwTwips nTmp = aRectFnSet.GetHeight(pFrame->getFrameArea());
1894
1895 {
1897 aRectFnSet.SetHeight( aFrm, nTmp - nReal );
1898
1899 if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() )
1900 {
1901 aFrm.Pos().AdjustX(nReal );
1902 }
1903 }
1904
1905 pFrame->InvalidatePrt();
1906
1907 if ( pFrame->GetNext() )
1908 pFrame->GetNext()->InvalidatePos_();
1909
1910 if( nReal < 0 && pFrame->IsInSct() )
1911 {
1912 SwLayoutFrame* pUp = pFrame->GetUpper();
1913 if( pUp && nullptr != ( pUp = pUp->GetUpper() ) && pUp->IsSctFrame() &&
1914 !pUp->IsColLocked() )
1915 pUp->InvalidateSize();
1916 }
1917 if( ( IsHeaderFrame() || IsFooterFrame() ) && pBoss->GetDrawObjs() )
1918 {
1919 const SwSortedObjs &rObjs = *pBoss->GetDrawObjs();
1920 OSL_ENSURE( pBoss->IsPageFrame(), "Header/Footer out of page?" );
1921 for (SwAnchoredObject* pAnchoredObj : rObjs)
1922 {
1923 if ( auto pFly = pAnchoredObj->DynCastFlyFrame() )
1924 {
1925 OSL_ENSURE( !pFly->IsFlyInContentFrame(), "FlyInCnt at Page?" );
1926 const SwFormatVertOrient &rVert =
1927 pFly->GetFormat()->GetVertOrient();
1928 // When do we have to invalidate?
1929 // If a frame is aligned on a PageTextArea and the header
1930 // changes a TOP, MIDDLE or NONE aligned frame needs to
1931 // recalculate it's position; if the footer changes a BOTTOM
1932 // or MIDDLE aligned frame needs to recalculate it's
1933 // position.
1934 if( ( rVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA ||
1935 rVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA ) &&
1936 ((IsHeaderFrame() && rVert.GetVertOrient()!=text::VertOrientation::BOTTOM) ||
1938 rVert.GetVertOrient() != text::VertOrientation::TOP)) )
1939 {
1940 pFly->InvalidatePos_();
1941 pFly->Invalidate_();
1942 }
1943 }
1944 }
1945 }
1946 }
1947 return (nBrowseAdd + nReal + nAdd);
1948}
1949
1952{
1953 // default behaviour is to perform no additional action
1954}
1955
1958{
1959 // default behaviour is to allow invalidation
1960 return true;
1961}
1962
1964{
1966 {
1967 setFrameAreaSizeValid(false);
1968
1969 if ( IsFlyFrame() )
1970 static_cast<SwFlyFrame*>(this)->Invalidate_();
1971 else
1973
1974 // OD 2004-05-19 #i28701#
1976 }
1977}
1978
1980{
1982 {
1984
1985 if ( IsFlyFrame() )
1986 static_cast<SwFlyFrame*>(this)->Invalidate_();
1987 else
1989
1990 // OD 2004-05-19 #i28701#
1992 }
1993}
1994
1996{
1998 return;
1999
2001
2002 if ( IsFlyFrame() )
2003 {
2004 static_cast<SwFlyFrame*>(this)->Invalidate_();
2005 }
2006 else
2007 {
2009 }
2010
2011 // OD 2004-05-19 #i28701#
2013}
2014
2016{
2018 {
2019 mbValidLineNum = false;
2020 OSL_ENSURE( IsTextFrame(), "line numbers are implemented for text only" );
2022
2023 // OD 2004-05-19 #i28701#
2025 }
2026}
2027
2029{
2030 const SwFormatFrameSize &rFormatSize = GetAttrSet()->GetFrameSize();
2031 if ( SwFrameSize::Variable == rFormatSize.GetHeightSizeType() ||
2032 SwFrameSize::Minimum == rFormatSize.GetHeightSizeType())
2033 {
2034 mbFixSize = false;
2036 {
2037 SwFrame *pFrame = static_cast<SwLayoutFrame*>(this)->Lower();
2038 while ( pFrame )
2039 { pFrame->InvalidateSize_();
2040 pFrame->InvalidatePrt_();
2041 pFrame = pFrame->GetNext();
2042 }
2043 SwContentFrame *pCnt = static_cast<SwLayoutFrame*>(this)->ContainsContent();
2044 // #i36991# - be save.
2045 // E.g., a row can contain *no* content.
2046 if ( pCnt )
2047 {
2048 pCnt->InvalidatePage();
2049 do
2050 {
2052 pCnt->InvalidateSize_();
2053 pCnt = pCnt->GetNextContentFrame();
2054 } while ( static_cast<SwLayoutFrame*>(this)->IsAnLower( pCnt ) );
2055 }
2056 }
2057 }
2058 else if ( rFormatSize.GetHeightSizeType() == SwFrameSize::Fixed )
2059 {
2060 if( IsVertical() )
2061 ChgSize( Size( rFormatSize.GetWidth(), getFrameArea().Height()));
2062 else
2063 ChgSize( Size( getFrameArea().Width(), rFormatSize.GetHeight()));
2064 }
2065}
2066
2067void SwFrame::ValidateThisAndAllLowers( const sal_uInt16 nStage )
2068{
2069 // Stage 0: Only validate frames. Do not process any objects.
2070 // Stage 1: Only validate fly frames and all of their contents.
2071 // Stage 2: Validate all.
2072
2073 const bool bOnlyObject = 1 == nStage;
2074 const bool bIncludeObjects = 1 <= nStage;
2075
2076 if ( !bOnlyObject || IsFlyFrame() )
2077 {
2081 }
2082
2083 if ( bIncludeObjects )
2084 {
2085 const SwSortedObjs* pObjs = GetDrawObjs();
2086 if ( pObjs )
2087 {
2088 const size_t nCnt = pObjs->size();
2089 for ( size_t i = 0; i < nCnt; ++i )
2090 {
2091 SwAnchoredObject* pAnchObj = (*pObjs)[i];
2092 if ( auto pFlyFrame = pAnchObj->DynCastFlyFrame() )
2093 pFlyFrame->ValidateThisAndAllLowers( 2 );
2094 else if ( auto pAnchoredDrawObj = dynamic_cast<SwAnchoredDrawObject *>( pAnchObj ) )
2095 pAnchoredDrawObj->ValidateThis();
2096 }
2097 }
2098 }
2099
2100 if ( IsLayoutFrame() )
2101 {
2102 SwFrame* pLower = static_cast<SwLayoutFrame*>(this)->Lower();
2103 while ( pLower )
2104 {
2105 pLower->ValidateThisAndAllLowers( nStage );
2106 pLower = pLower->GetNext();
2107 }
2108 }
2109}
2110
2111SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
2112{
2113 SwRectFnSet aRectFnSet(this);
2114
2115 SwTwips nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
2116 if( nFrameHeight > 0 &&
2117 nDist > (LONG_MAX - nFrameHeight ) )
2118 nDist = LONG_MAX - nFrameHeight;
2119
2120 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
2121 const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
2123 if (bBrowse)
2124 nTmpType |= SwFrameType::Body;
2125 if( !(GetUpper()->GetType() & nTmpType) && GetUpper()->HasFixSize() )
2126 {
2127 if ( !bTst )
2128 {
2129 {
2131 aRectFnSet.SetHeight( aFrm, nFrameHeight + nDist );
2132
2133 if( IsVertical() && !IsVertLR() )
2134 {
2135 aFrm.Pos().AdjustX( -nDist );
2136 }
2137 }
2138
2139 if ( GetNext() )
2140 {
2142 }
2143 // #i28701# - Due to the new object positioning the
2144 // frame on the next page/column can flow backward (e.g. it was moved forward
2145 // due to the positioning of its objects ). Thus, invalivate this next frame,
2146 // if document compatibility option 'Consider wrapping style influence on
2147 // object positioning' is ON.
2148 else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) )
2149 {
2151 }
2152 }
2153 return 0;
2154 }
2155
2156 SwTwips nReal = aRectFnSet.GetHeight(GetUpper()->getFramePrintArea());
2157 SwFrame *pFrame = GetUpper()->Lower();
2158 while( pFrame && nReal > 0 )
2159 { nReal -= aRectFnSet.GetHeight(pFrame->getFrameArea());
2160 pFrame = pFrame->GetNext();
2161 }
2162
2163 if ( !bTst )
2164 {
2165 //Contents are always resized to the wished value.
2166 tools::Long nOld = aRectFnSet.GetHeight(getFrameArea());
2167
2168 {
2170
2171 aRectFnSet.SetHeight( aFrm, nOld + nDist );
2172
2173 if( IsVertical()&& !IsVertLR() )
2174 {
2175 aFrm.Pos().AdjustX( -nDist );
2176 }
2177 }
2178
2179 SwTabFrame *pTab = (nOld && IsInTab()) ? FindTabFrame() : nullptr;
2180 if (pTab)
2181 {
2182 if ( pTab->GetTable()->GetHTMLTableLayout() &&
2183 !pTab->IsJoinLocked() &&
2184 !pTab->GetFormat()->GetDoc()->GetDocShell()->IsReadOnly() )
2185 {
2186 pTab->InvalidatePos();
2187 pTab->SetResizeHTMLTable();
2188 }
2189 }
2190 }
2191
2192 //Only grow Upper if necessary.
2193 if ( nReal < nDist )
2194 {
2195 if( GetUpper() )
2196 {
2197 if( bTst || !GetUpper()->IsFooterFrame() )
2198 nReal = GetUpper()->Grow( nDist - std::max<tools::Long>(nReal, 0),
2199 bTst, bInfo );
2200 else
2201 {
2202 nReal = 0;
2204 }
2205 }
2206 else
2207 nReal = 0;
2208 }
2209 else
2210 nReal = nDist;
2211
2212 // #i28701# - Due to the new object positioning the
2213 // frame on the next page/column can flow backward (e.g. it was moved forward
2214 // due to the positioning of its objects ). Thus, invalivate this next frame,
2215 // if document compatibility option 'Consider wrapping style influence on
2216 // object positioning' is ON.
2217 if ( !bTst )
2218 {
2219 if ( GetNext() )
2220 {
2222 }
2223 else if ( GetUpper()->GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) )
2224 {
2226 }
2227 }
2228
2229 return nReal;
2230}
2231
2232SwTwips SwContentFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
2233{
2234 SwRectFnSet aRectFnSet(this);
2235 OSL_ENSURE( nDist >= 0, "nDist < 0" );
2236 OSL_ENSURE( nDist <= aRectFnSet.GetHeight(getFrameArea()),
2237 "nDist > than current size." );
2238
2239 if ( !bTst )
2240 {
2241 SwTwips nRstHeight;
2242 if( GetUpper() )
2243 nRstHeight = aRectFnSet.BottomDist( getFrameArea(), aRectFnSet.GetPrtBottom(*GetUpper()) );
2244 else
2245 nRstHeight = 0;
2246 if( nRstHeight < 0 )
2247 {
2248 SwTwips nNextHeight = 0;
2249 if( GetUpper()->IsSctFrame() && nDist > LONG_MAX/2 )
2250 {
2251 SwFrame *pNxt = GetNext();
2252 while( pNxt )
2253 {
2254 nNextHeight += aRectFnSet.GetHeight(pNxt->getFrameArea());
2255 pNxt = pNxt->GetNext();
2256 }
2257 }
2258 nRstHeight = nDist + nRstHeight - nNextHeight;
2259 }
2260 else
2261 {
2262 nRstHeight = nDist;
2263 }
2264
2265 {
2267 aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) - nDist );
2268
2269 if( IsVertical() && !IsVertLR() )
2270 {
2271 aFrm.Pos().AdjustX(nDist );
2272 }
2273 }
2274
2275 nDist = nRstHeight;
2276 SwTabFrame *pTab = IsInTab() ? FindTabFrame() : nullptr;
2277 if (pTab)
2278 {
2279 if ( pTab->GetTable()->GetHTMLTableLayout() &&
2280 !pTab->IsJoinLocked() &&
2281 !pTab->GetFormat()->GetDoc()->GetDocShell()->IsReadOnly() )
2282 {
2283 pTab->InvalidatePos();
2284 pTab->SetResizeHTMLTable();
2285 }
2286 }
2287 }
2288
2289 SwTwips nReal;
2290 if( GetUpper() && nDist > 0 )
2291 {
2292 if( bTst || !GetUpper()->IsFooterFrame() )
2293 nReal = GetUpper()->Shrink( nDist, bTst, bInfo );
2294 else
2295 {
2296 nReal = 0;
2297
2298 // #108745# Sorry, dear old footer friend, I'm not gonna invalidate you,
2299 // if there are any objects anchored inside your content, which
2300 // overlap with the shrinking frame.
2301 // This may lead to a footer frame that is too big, but this is better
2302 // than looping.
2303 // #109722# : The fix for #108745# was too strict.
2304
2305 bool bInvalidate = true;
2306 const SwRect aRect( getFrameArea() );
2307 const SwPageFrame* pPage = FindPageFrame();
2308 const SwSortedObjs* pSorted = pPage ? pPage->GetSortedObjs() : nullptr;
2309 if( pSorted )
2310 {
2311 for (SwAnchoredObject* pAnchoredObj : *pSorted)
2312 {
2313 const SwRect aBound( pAnchoredObj->GetObjRectWithSpaces() );
2314
2315 if( aBound.Left() > aRect.Right() )
2316 continue;
2317
2318 if( aBound.Overlaps( aRect ) )
2319 {
2320 const SwFrameFormat& rFormat = pAnchoredObj->GetFrameFormat();
2321 if( css::text::WrapTextMode_THROUGH != rFormat.GetSurround().GetSurround() )
2322 {
2323 const SwFrame* pAnchor = pAnchoredObj->GetAnchorFrame();
2324 if ( pAnchor && pAnchor->FindFooterOrHeader() == GetUpper() )
2325 {
2326 bInvalidate = false;
2327 break;
2328 }
2329 }
2330 }
2331 }
2332 }
2333
2334 if ( bInvalidate )
2336 }
2337 }
2338 else
2339 nReal = 0;
2340
2341 if ( !bTst )
2342 {
2343 //The position of the next Frame changes for sure.
2345
2346 //If I don't have a successor I have to do the retouch by myself.
2347 if ( !GetNext() )
2348 SetRetouche();
2349 }
2350 return nReal;
2351}
2352
2353void SwContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
2354{
2355 if (rHint.GetId() != SfxHintId::SwLegacyModify)
2356 return;
2357 auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
2359 if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which() && pLegacy->m_pOld)
2360 {
2361 auto& rOldSetChg = *static_cast<const SwAttrSetChg*>(pLegacy->m_pOld);
2362 auto& rNewSetChg = *static_cast<const SwAttrSetChg*>(pLegacy->m_pNew);
2363 SfxItemIter aOIter(*rOldSetChg.GetChgSet());
2364 SfxItemIter aNIter(*rNewSetChg.GetChgSet());
2365 const SfxPoolItem* pNItem = aNIter.GetCurItem();
2366 const SfxPoolItem* pOItem = aOIter.GetCurItem();
2367 SwAttrSetChg aOldSet(rOldSetChg);
2368 SwAttrSetChg aNewSet(rNewSetChg);
2369 do
2370 {
2371 UpdateAttr_(pOItem, pNItem, eInvFlags, &aOldSet, &aNewSet);
2372 pNItem = aNIter.NextItem();
2373 pOItem = aOIter.NextItem();
2374 } while(pNItem);
2375 if(aOldSet.Count() || aNewSet.Count())
2376 SwFrame::SwClientNotify(rMod, sw::LegacyModifyHint(&aOldSet, &aNewSet));
2377 }
2378 else
2379 UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, eInvFlags);
2380
2381 if(eInvFlags == SwContentFrameInvFlags::NONE)
2382 return;
2383
2384 SwPageFrame* pPage = FindPageFrame();
2385 InvalidatePage(pPage);
2393 {
2394 if(IsInSct() && !GetPrev())
2395 {
2396 SwSectionFrame* pSect = FindSctFrame();
2397 if(pSect->ContainsAny() == this)
2398 {
2399 pSect->InvalidatePrt_();
2400 pSect->InvalidatePage(pPage);
2401 }
2402 }
2404 }
2405 SwFrame* pNextFrame = GetIndNext();
2406 if(pNextFrame && eInvFlags & SwContentFrameInvFlags::InvalidateNextPrt)
2407 {
2408 pNextFrame->InvalidatePrt_();
2409 pNextFrame->InvalidatePage(pPage);
2410 }
2411 if(pNextFrame && eInvFlags & SwContentFrameInvFlags::SetNextCompletePaint)
2412 {
2413 pNextFrame->SetCompletePaint();
2414 }
2416 {
2417 SwFrame* pPrevFrame = GetPrev();
2418 if(pPrevFrame)
2419 {
2420 pPrevFrame->InvalidatePrt_();
2421 pPrevFrame->InvalidatePage(pPage);
2422 }
2423 }
2426}
2427
2429 SwContentFrameInvFlags &rInvFlags,
2430 SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
2431{
2432 bool bClear = true;
2433 sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
2434 switch ( nWhich )
2435 {
2436 case RES_FMT_CHG:
2445 [[fallthrough]];
2446
2447 case RES_PAGEDESC: //attribute changes (on/off)
2448 if ( IsInDocBody() && !IsInTab() )
2449 {
2451 SwPageFrame *pPage = FindPageFrame();
2452 if ( !GetPrev() )
2453 CheckPageDescs( pPage );
2454 if (GetPageDescItem().GetNumOffset())
2455 static_cast<SwRootFrame*>(pPage->GetUpper())->SetVirtPageNum( true );
2457 }
2458 break;
2459
2460 case RES_UL_SPACE:
2461 {
2462 // OD 2004-02-18 #106629# - correction
2463 // Invalidation of the printing area of next frame, not only
2464 // for footnote content.
2465 if ( !GetIndNext() )
2466 {
2467 SwFrame* pNxt = FindNext();
2468 if ( pNxt )
2469 {
2470 SwPageFrame* pPg = pNxt->FindPageFrame();
2471 pNxt->InvalidatePage( pPg );
2472 pNxt->InvalidatePrt_();
2473 if( pNxt->IsSctFrame() )
2474 {
2475 SwFrame* pCnt = static_cast<SwSectionFrame*>(pNxt)->ContainsAny();
2476 if( pCnt )
2477 {
2478 pCnt->InvalidatePrt_();
2479 pCnt->InvalidatePage( pPg );
2480 }
2481 }
2482 pNxt->SetCompletePaint();
2483 }
2484 }
2485 // OD 2004-03-17 #i11860#
2486 if ( GetIndNext() &&
2488 {
2489 // OD 2004-07-01 #i28701# - use new method <InvalidateObjs(..)>
2491 }
2492 Prepare( PrepareHint::ULSpaceChanged ); //TextFrame has to correct line spacing.
2494 [[fallthrough]];
2495 }
2498 case RES_MARGIN_RIGHT:
2499 case RES_LR_SPACE:
2500 case RES_BOX:
2501 case RES_SHADOW:
2502 {
2504 SwModify aMod;
2507 break;
2508 }
2509 case RES_BREAK:
2510 {
2515 {
2517 SwFrame* pNxt = FindNext();
2518 if( pNxt )
2519 {
2520 SwPageFrame* pPg = pNxt->FindPageFrame();
2521 pNxt->InvalidatePage( pPg );
2522 pNxt->InvalidatePrt_();
2523 if( pNxt->IsSctFrame() )
2524 {
2525 SwFrame* pCnt = static_cast<SwSectionFrame*>(pNxt)->ContainsAny();
2526 if( pCnt )
2527 {
2528 pCnt->InvalidatePrt_();
2529 pCnt->InvalidatePage( pPg );
2530 }
2531 }
2532 pNxt->SetCompletePaint();
2533 }
2534 }
2535 }
2536 break;
2537
2538 // OD 2004-02-26 #i25029#
2540 {
2542 if ( IsTextFrame() )
2543 {
2545 }
2546 if ( !GetIndNext() && IsInTab() && IsInSplitTableRow() )
2547 {
2549 }
2550 }
2551 break;
2552
2553 case RES_PARATR_TABSTOP:
2558 case RES_CHRATR_KERNING:
2559 case RES_CHRATR_FONT:
2562 case RES_CHRATR_CONTOUR:
2563 case RES_PARATR_NUMRULE:
2565 break;
2566
2567 case RES_FRM_SIZE:
2569 [[fallthrough]];
2570
2571 default:
2572 bClear = false;
2573 }
2574 if ( !bClear )
2575 return;
2576
2577 if ( pOldSet || pNewSet )
2578 {
2579 if ( pOldSet )
2580 pOldSet->ClearItem( nWhich );
2581 if ( pNewSet )
2582 pNewSet->ClearItem( nWhich );
2583 }
2584 else
2585 {
2586 SwModify aMod;
2588 }
2589}
2590
2592 : SwFrame(pFormat, pSib)
2593 , m_pLower(nullptr)
2594{
2595 const SwFormatFrameSize &rFormatSize = pFormat->GetFrameSize();
2596 if ( rFormatSize.GetHeightSizeType() == SwFrameSize::Fixed )
2597 mbFixSize = true;
2598}
2599
2600// #i28701#
2601
2603{
2604 const SwFrame* pCnt = Lower();
2605 if (!pCnt)
2606 return 0;
2607
2608 SwRectFnSet aRectFnSet(this);
2609 SwTwips nRet = 0;
2610 if( pCnt->IsColumnFrame() || pCnt->IsCellFrame() )
2611 {
2612 do
2613 {
2614 SwTwips nTmp = static_cast<const SwLayoutFrame*>(pCnt)->InnerHeight();
2615 if( pCnt->isFramePrintAreaValid() )
2616 nTmp += aRectFnSet.GetHeight(pCnt->getFrameArea()) -
2617 aRectFnSet.GetHeight(pCnt->getFramePrintArea());
2618 if( nRet < nTmp )
2619 nRet = nTmp;
2620 pCnt = pCnt->GetNext();
2621 } while ( pCnt );
2622 }
2623 else
2624 {
2625 do
2626 {
2627 nRet += aRectFnSet.GetHeight(pCnt->getFrameArea());
2628 if( pCnt->IsContentFrame() && static_cast<const SwTextFrame*>(pCnt)->IsUndersized() )
2629 nRet += static_cast<const SwTextFrame*>(pCnt)->GetParHeight() -
2630 aRectFnSet.GetHeight(pCnt->getFramePrintArea());
2631 if( pCnt->IsLayoutFrame() && !pCnt->IsTabFrame() )
2632 nRet += static_cast<const SwLayoutFrame*>(pCnt)->InnerHeight() -
2633 aRectFnSet.GetHeight(pCnt->getFramePrintArea());
2634 pCnt = pCnt->GetNext();
2635 } while( pCnt );
2636
2637 }
2638 return nRet;
2639}
2640
2641SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
2642{
2643 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
2644 const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
2646 if (bBrowse)
2647 nTmpType |= SwFrameType::Body;
2648 if( !(GetType() & nTmpType) && HasFixSize() )
2649 return 0;
2650
2651 SwRectFnSet aRectFnSet(this);
2652 const SwTwips nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
2653 const SwTwips nFramePos = getFrameArea().Pos().X();
2654
2655 if ( nFrameHeight > 0 && nDist > (LONG_MAX - nFrameHeight) )
2656 nDist = LONG_MAX - nFrameHeight;
2657
2658 SwTwips nMin = 0;
2659 if ( GetUpper() && !IsCellFrame() )
2660 {
2661 SwFrame *pFrame = GetUpper()->Lower();
2662 while( pFrame )
2663 { nMin += aRectFnSet.GetHeight(pFrame->getFrameArea());
2664 pFrame = pFrame->GetNext();
2665 }
2666 nMin = aRectFnSet.GetHeight(GetUpper()->getFramePrintArea()) - nMin;
2667 if ( nMin < 0 )
2668 nMin = 0;
2669 }
2670
2671 SwRect aOldFrame( getFrameArea() );
2672 bool bMoveAccFrame = false;
2673
2674 bool bChgPos = IsVertical();
2675 if ( !bTst )
2676 {
2678 aRectFnSet.SetHeight( aFrm, nFrameHeight + nDist );
2679
2680 if( bChgPos && !IsVertLR() )
2681 {
2682 aFrm.Pos().AdjustX( -nDist );
2683 }
2684
2685 bMoveAccFrame = true;
2686 }
2687
2688 SwTwips nReal = nDist - nMin;
2689 if ( nReal > 0 )
2690 {
2691 if ( GetUpper() )
2692 { // AdjustNeighbourhood now only for the columns (but not in frames)
2694 static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment()
2697 nReal = AdjustNeighbourhood( nReal, bTst );
2698 else
2699 {
2701 nReal += AdjustNeighbourhood( nReal, bTst );
2702
2703 SwTwips nGrow = 0;
2704 if( 0 < nReal )
2705 {
2706 SwFrame* pToGrow = GetUpper();
2707 // NEW TABLES
2708 // A cell with a row span of > 1 is allowed to grow the
2709 // line containing the end of the row span if it is
2710 // located in the same table frame:
2711 if (IsCellFrame())
2712 {
2713 const SwCellFrame* pThisCell = static_cast<const SwCellFrame*>(this);
2714 if ( pThisCell->GetLayoutRowSpan() > 1 )
2715 {
2716 SwCellFrame& rEndCell = const_cast<SwCellFrame&>(pThisCell->FindStartEndOfRowSpanCell( false ));
2717 if ( -1 == rEndCell.GetTabBox()->getRowSpan() )
2718 pToGrow = rEndCell.GetUpper();
2719 else
2720 pToGrow = nullptr;
2721 }
2722 }
2723 nGrow = pToGrow ? pToGrow->Grow( nReal, bTst, bInfo ) : 0;
2724 }
2725
2726 if( SwNeighbourAdjust::GrowAdjust == nAdjust && nGrow < nReal )
2727 nReal = o3tl::saturating_add(nReal, AdjustNeighbourhood( nReal - nGrow, bTst ));
2728
2729 if ( IsFootnoteFrame() && (nGrow != nReal) && GetNext() )
2730 {
2731 //Footnotes can replace their successor.
2732 SwTwips nSpace = bTst ? 0 : -nDist;
2733 const SwFrame *pFrame = GetUpper()->Lower();
2734 do
2735 { nSpace += aRectFnSet.GetHeight(pFrame->getFrameArea());
2736 pFrame = pFrame->GetNext();
2737 } while ( pFrame != GetNext() );
2738 nSpace = aRectFnSet.GetHeight(GetUpper()->getFramePrintArea()) -nSpace;
2739 if ( nSpace < 0 )
2740 nSpace = 0;
2741 nSpace += nGrow;
2742 if ( nReal > nSpace )
2743 nReal = nSpace;
2744 if ( nReal && !bTst )
2745 static_cast<SwFootnoteFrame*>(this)->InvalidateNxtFootnoteCnts( FindPageFrame() );
2746 }
2747 else
2748 nReal = nGrow;
2749 }
2750 }
2751 else
2752 nReal = 0;
2753
2754 nReal += nMin;
2755 }
2756 else
2757 nReal = nDist;
2758
2759 if ( !bTst )
2760 {
2761 if( nReal != nDist &&
2762 // NEW TABLES
2763 ( !IsCellFrame() || static_cast<SwCellFrame*>(this)->GetLayoutRowSpan() > 1 ) )
2764 {
2766 aRectFnSet.SetHeight( aFrm, nFrameHeight + nReal );
2767
2768 if( bChgPos && !IsVertLR() )
2769 {
2770 aFrm.Pos().setX( nFramePos - nReal );
2771 }
2772
2773 bMoveAccFrame = true;
2774 }
2775
2776 if ( nReal )
2777 {
2778 SwPageFrame *pPage = FindPageFrame();
2779 if ( GetNext() )
2780 {
2781 SwFrame * pNext = GetNext();
2782 do
2783 {
2784 pNext->InvalidatePos_();
2785 if (pNext->IsRowFrame())
2786 { // also invalidate first cell
2787 static_cast<SwLayoutFrame*>(pNext)->Lower()->InvalidatePos_();
2788 }
2789 else if (pNext->IsContentFrame())
2790 {
2791 pNext->InvalidatePage(pPage);
2792 }
2793 if (pNext->HasFixSize())
2794 { // continue to invalidate because growing pNext won't do it!
2795 pNext = pNext->GetNext();
2796 }
2797 else
2798 {
2799 break;
2800 }
2801 }
2802 while (pNext);
2803 }
2804 if ( !IsPageBodyFrame() )
2805 {
2807 InvalidatePage( pPage );
2808 }
2811
2812 if( IsCellFrame() )
2813 InvaPercentLowers( nReal );
2814
2815 std::unique_ptr<SvxBrushItem> aBack(GetFormat()->makeBackgroundBrushItem());
2816 const SvxGraphicPosition ePos = aBack->GetGraphicPos();
2817 if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
2819 }
2820 }
2821
2822#if !ENABLE_WASM_STRIP_ACCESSIBILITY
2823 if( bMoveAccFrame && IsAccessibleFrame() )
2824 {
2825 SwRootFrame *pRootFrame = getRootFrame();
2826 if( pRootFrame && pRootFrame->IsAnyShellAccessible() &&
2827 pRootFrame->GetCurrShell() )
2828 {
2829 pRootFrame->GetCurrShell()->Imp()->MoveAccessibleFrame( this, aOldFrame );
2830 }
2831 }
2832#else
2833 (void)bMoveAccFrame;
2834 (void)aOldFrame;
2835#endif
2836
2837 return nReal;
2838}
2839
2840SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
2841{
2842 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
2843 const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
2845 if (bBrowse)
2846 nTmpType |= SwFrameType::Body;
2847
2848 if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden())
2849 {
2850 if (IsBodyFrame())
2851 {
2852 // Whitespace is hidden and this body frame will not shrink, as it
2853 // has a fix size.
2854 // Invalidate the page frame size, so in case the reason for the
2855 // shrink was that there is more whitespace on this page, the size
2856 // without whitespace will be recalculated correctly.
2857 SwPageFrame* pPageFrame = FindPageFrame();
2858 pPageFrame->InvalidateSize();
2859 }
2860 }
2861
2862 if( !(GetType() & nTmpType) && HasFixSize() )
2863 return 0;
2864
2865 OSL_ENSURE( nDist >= 0, "nDist < 0" );
2866 SwRectFnSet aRectFnSet(this);
2867 SwTwips nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
2868 if ( nDist > nFrameHeight )
2869 nDist = nFrameHeight;
2870
2871 SwTwips nMin = 0;
2872 bool bChgPos = IsVertical();
2873 if ( Lower() )
2874 {
2875 if( !Lower()->IsNeighbourFrame() )
2876 { const SwFrame *pFrame = Lower();
2877 const tools::Long nTmp = aRectFnSet.GetHeight(getFramePrintArea());
2878 while( pFrame && nMin < nTmp )
2879 { nMin += aRectFnSet.GetHeight(pFrame->getFrameArea());
2880 pFrame = pFrame->GetNext();
2881 }
2882 }
2883 }
2884 SwTwips nReal = nDist;
2885 SwTwips nMinDiff = aRectFnSet.GetHeight(getFramePrintArea()) - nMin;
2886 if( nReal > nMinDiff )
2887 nReal = nMinDiff;
2888 if( nReal <= 0 )
2889 return nDist;
2890
2891 SwRect aOldFrame( getFrameArea() );
2892 bool bMoveAccFrame = false;
2893
2894 SwTwips nRealDist = nReal;
2895 if ( !bTst )
2896 {
2898 aRectFnSet.SetHeight( aFrm, nFrameHeight - nReal );
2899
2900 if( bChgPos && !IsVertLR() )
2901 {
2902 aFrm.Pos().AdjustX(nReal );
2903 }
2904
2905 bMoveAccFrame = true;
2906 }
2907
2909 static_cast<SwFootnoteBossFrame*>(GetUpper())->NeighbourhoodAdjustment()
2911
2912 // AdjustNeighbourhood also in columns (but not in frames)
2914 {
2915 if ( IsPageBodyFrame() && !bBrowse )
2916 nReal = nDist;
2917 else
2918 { nReal = AdjustNeighbourhood( -nReal, bTst );
2919 nReal *= -1;
2920 if ( !bTst && IsBodyFrame() && nReal < nRealDist )
2921 {
2923 aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) + nRealDist - nReal );
2924
2925 if( bChgPos && !IsVertLR() )
2926 {
2927 aFrm.Pos().AdjustX(nRealDist - nReal );
2928 }
2929
2930 OSL_ENSURE( !IsAccessibleFrame(), "bMoveAccFrame has to be set!" );
2931 }
2932 }
2933 }
2934 else if( IsColumnFrame() || IsColBodyFrame() )
2935 {
2936 SwTwips nTmp = GetUpper()->Shrink( nReal, bTst, bInfo );
2937 if ( nTmp != nReal )
2938 {
2940 aRectFnSet.SetHeight( aFrm, aRectFnSet.GetHeight(aFrm) + nReal - nTmp );
2941
2942 if( bChgPos && !IsVertLR() )
2943 {
2944 aFrm.Pos().AdjustX(nTmp - nReal );
2945 }
2946
2947 OSL_ENSURE( !IsAccessibleFrame(), "bMoveAccFrame has to be set!" );
2948 nReal = nTmp;
2949 }
2950 }
2951 else
2952 {
2953 SwTwips nShrink = nReal;
2954 SwFrame* pToShrink = GetUpper();
2955 // NEW TABLES
2956 if ( IsCellFrame() )
2957 {
2958 const SwCellFrame* pThisCell = static_cast<const SwCellFrame*>(this);
2959 if ( pThisCell->GetLayoutRowSpan() > 1 )
2960 {
2961 SwCellFrame& rEndCell = const_cast<SwCellFrame&>(pThisCell->FindStartEndOfRowSpanCell( false ));
2962 pToShrink = rEndCell.GetUpper();
2963 }
2964 }
2965
2966 nReal = pToShrink ? pToShrink->Shrink( nShrink, bTst, bInfo ) : 0;
2968 && nReal < nShrink )
2969 AdjustNeighbourhood( nReal - nShrink );
2970 }
2971
2972#if !ENABLE_WASM_STRIP_ACCESSIBILITY
2973 if( bMoveAccFrame && IsAccessibleFrame() )
2974 {
2975 SwRootFrame *pRootFrame = getRootFrame();
2976 if( pRootFrame && pRootFrame->IsAnyShellAccessible() &&
2977 pRootFrame->GetCurrShell() )
2978 {
2979 pRootFrame->GetCurrShell()->Imp()->MoveAccessibleFrame( this, aOldFrame );
2980 }
2981 }
2982#else
2983 (void)aOldFrame;
2984 (void)bMoveAccFrame;
2985#endif
2986
2987 if ( !bTst && (IsCellFrame() || IsColumnFrame() ? nReal : nRealDist) )
2988 {
2989 SwPageFrame *pPage = FindPageFrame();
2990 if ( GetNext() )
2991 {
2993 if ( GetNext()->IsContentFrame() )
2994 GetNext()->InvalidatePage( pPage );
2995 if ( IsTabFrame() )
2996 static_cast<SwTabFrame*>(this)->SetComplete();
2997 }
2998 else
2999 { if ( IsRetoucheFrame() )
3000 SetRetouche();
3001 if ( IsTabFrame() )
3002 {
3003 static_cast<SwTabFrame*>(this)->SetComplete();
3004 if ( Lower() ) // Can also be in the Join and be empty!
3006 }
3007 }
3008 if ( !IsBodyFrame() )
3009 {
3011 InvalidatePage( pPage );
3012 bool bCompletePaint = true;
3013 const SwFrameFormat* pFormat = GetFormat();
3014 if (pFormat)
3015 {
3016 std::unique_ptr<SvxBrushItem> aBack(pFormat->makeBackgroundBrushItem());
3017 const SvxGraphicPosition ePos = aBack->GetGraphicPos();
3018 if ( GPOS_NONE == ePos || GPOS_TILED == ePos )
3019 bCompletePaint = false;
3020 }
3021 if (bCompletePaint)
3023 }
3024
3027
3028 if( IsCellFrame() )
3029 InvaPercentLowers( nReal );
3030
3031 SwContentFrame *pCnt;
3032 if( IsFootnoteFrame() && !static_cast<SwFootnoteFrame*>(this)->GetAttr()->GetFootnote().IsEndNote() &&
3033 ( GetFormat()->GetDoc()->GetFootnoteInfo().m_ePos != FTNPOS_CHAPTER ||
3034 ( IsInSct() && FindSctFrame()->IsFootnoteAtEnd() ) ) &&
3035 nullptr != (pCnt = static_cast<SwFootnoteFrame*>(this)->GetRefFromAttr() ) )
3036 {
3037 if ( pCnt->IsFollow() )
3038 { // If we are in another column/page than the frame with the
3039 // reference, we don't need to invalidate its master.
3040 SwFrame *pTmp = pCnt->FindFootnoteBossFrame(true) == FindFootnoteBossFrame(true)
3041 ? &pCnt->FindMaster()->GetFrame() : pCnt;
3043 pTmp->InvalidateSize();
3044 }
3045 else
3046 {
3047 if (pCnt->FindPageFrame() == FindPageFrame())
3048 {
3049 pCnt->InvalidatePos();
3050 }
3051 else
3052 {
3053 SAL_WARN("sw.layout", "footnote frame on different page than ref frame?");
3054 }
3055 }
3056 }
3057 }
3058 return nReal;
3059}
3060
3067void SwLayoutFrame::ChgLowersProp( const Size& rOldSize )
3068{
3069 // no change of lower properties for root frame or if no lower exists.
3070 if ( IsRootFrame() || !Lower() )
3071 return;
3072
3073 // declare and init <SwFrame* pLowerFrame> with first lower
3074 SwFrame *pLowerFrame = Lower();
3075
3076 // declare and init const booleans <bHeightChgd> and <bWidthChg>
3077 const bool bHeightChgd = rOldSize.Height() != getFramePrintArea().Height();
3078 const bool bWidthChgd = rOldSize.Width() != getFramePrintArea().Width();
3079
3080 SwRectFnSet aRectFnSet(this);
3081
3082 // This shortcut basically tries to handle only lower frames that
3083 // are affected by the size change. Otherwise much more lower frames
3084 // are invalidated.
3085 if ( !( aRectFnSet.IsVert() ? bHeightChgd : bWidthChgd ) &&
3086 ! Lower()->IsColumnFrame() &&
3087 ( ( IsBodyFrame() && IsInDocBody() && ( !IsInSct() || !FindSctFrame()->IsColLocked() ) ) ||
3088 // #i10826# Section frames without columns should not
3089 // invalidate all lowers!
3090 IsSctFrame() ) )
3091 {
3092 // Determine page frame the body frame resp. the section frame belongs to.
3093 SwPageFrame *pPage = FindPageFrame();
3094 // Determine last lower by traveling through them using <GetNext()>.
3095 // During travel check each section frame, if it will be sized to
3096 // maximum. If Yes, invalidate size of section frame and set
3097 // corresponding flags at the page.
3098 do
3099 {
3100 if( pLowerFrame->IsSctFrame() && static_cast<SwSectionFrame*>(pLowerFrame)->ToMaximize_() )
3101 {
3102 pLowerFrame->InvalidateSize_();
3103 pLowerFrame->InvalidatePage( pPage );
3104 }
3105 if( pLowerFrame->GetNext() )
3106 pLowerFrame = pLowerFrame->GetNext();
3107 else
3108 break;
3109 } while( true );
3110 // If found last lower is a section frame containing no section
3111 // (section frame isn't valid and will be deleted in the future),
3112 // travel backwards.
3113 while( pLowerFrame->IsSctFrame() && !static_cast<SwSectionFrame*>(pLowerFrame)->GetSection() &&
3114 pLowerFrame->GetPrev() )
3115 pLowerFrame = pLowerFrame->GetPrev();
3116 // If found last lower is a section frame, set <pLowerFrame> to its last
3117 // content, if the section frame is valid and is not sized to maximum.
3118 // Otherwise set <pLowerFrame> to NULL - In this case body frame only
3119 // contains invalid section frames.
3120 if( pLowerFrame->IsSctFrame() )
3121 pLowerFrame = static_cast<SwSectionFrame*>(pLowerFrame)->GetSection() &&
3122 !static_cast<SwSectionFrame*>(pLowerFrame)->ToMaximize( false ) ?
3123 static_cast<SwSectionFrame*>(pLowerFrame)->FindLastContent() : nullptr;
3124
3125 // continue with found last lower, probably the last content of a section
3126 if ( pLowerFrame )
3127 {
3128 // If <pLowerFrame> is in a table frame, set <pLowerFrame> to this table
3129 // frame and continue.
3130 if ( pLowerFrame->IsInTab() )
3131 {
3132 // OD 28.10.2002 #97265# - safeguard for setting <pLowerFrame> to
3133 // its table frame - check, if the table frame is also a lower
3134 // of the body frame, in order to assure that <pLowerFrame> is not
3135 // set to a frame, which is an *upper* of the body frame.
3136 SwFrame* pTableFrame = pLowerFrame->FindTabFrame();
3137 if ( IsAnLower( pTableFrame ) )
3138 {
3139 pLowerFrame = pTableFrame;
3140 }
3141 }
3142 // Check, if variable size of body frame resp. section frame has grown
3143 // OD 28.10.2002 #97265# - correct check, if variable size has grown.
3144 SwTwips nOldHeight = aRectFnSet.IsVert() ? rOldSize.Width() : rOldSize.Height();
3145 if( nOldHeight < aRectFnSet.GetHeight(getFramePrintArea()) )
3146 {
3147 // If variable size of body|section frame has grown, only found
3148 // last lower and the position of the its next have to be invalidated.
3149 pLowerFrame->InvalidateAll_();
3150 pLowerFrame->InvalidatePage( pPage );
3151 if( !pLowerFrame->IsFlowFrame() ||
3152 !SwFlowFrame::CastFlowFrame( pLowerFrame )->HasFollow() )
3153 pLowerFrame->InvalidateNextPos( true );
3154 if ( pLowerFrame->IsTextFrame() )
3156 }
3157 else
3158 {
3159 // variable size of body|section frame has shrunk. Thus,
3160 // invalidate all lowers not matching the new body|section size
3161 // and the dedicated new last lower.
3162 if( aRectFnSet.IsVert() )
3163 {
3165 while ( pLowerFrame && pLowerFrame->GetPrev() && pLowerFrame->getFrameArea().Left() < nBot )
3166 {
3167 pLowerFrame->InvalidateAll_();
3168 pLowerFrame->InvalidatePage( pPage );
3169 pLowerFrame = pLowerFrame->GetPrev();
3170 }
3171 }
3172 else
3173 {
3175 while ( pLowerFrame && pLowerFrame->GetPrev() && pLowerFrame->getFrameArea().Top() > nBot )
3176 {
3177 pLowerFrame->InvalidateAll_();
3178 pLowerFrame->InvalidatePage( pPage );
3179 pLowerFrame = pLowerFrame->GetPrev();
3180 }
3181 }
3182 if ( pLowerFrame )
3183 {
3184 pLowerFrame->InvalidateSize_();
3185 pLowerFrame->InvalidatePage( pPage );
3186 if ( pLowerFrame->IsTextFrame() )
3188 }
3189 }
3190 // #i41694# - improvement by removing duplicates
3191 if ( pLowerFrame )
3192 {
3193 if ( pLowerFrame->IsInSct() )
3194 {
3195 // #i41694# - follow-up of issue #i10826#
3196 // No invalidation of section frame, if it's the this.
3197 SwFrame* pSectFrame = pLowerFrame->FindSctFrame();
3198 if( pSectFrame != this && IsAnLower( pSectFrame ) )
3199 {
3200 pSectFrame->InvalidateSize_();
3201 pSectFrame->InvalidatePage( pPage );
3202 }
3203 }
3204 }
3205 }
3206 return;
3207 } // end of { special case }
3208
3209 // Invalidate page for content only once.
3210 bool bInvaPageForContent = true;
3211
3212 // Declare booleans <bFixChgd> and <bVarChgd>, indicating for text frame
3213 // adjustment, if fixed/variable size has changed.
3214 bool bFixChgd, bVarChgd;
3215 if( aRectFnSet.IsVert() == pLowerFrame->IsNeighbourFrame() )
3216 {
3217 bFixChgd = bWidthChgd;
3218 bVarChgd = bHeightChgd;
3219 }
3220 else
3221 {
3222 bFixChgd = bHeightChgd;
3223 bVarChgd = bWidthChgd;
3224 }
3225
3226 // Declare const unsigned short <nFixWidth> and init it this frame types
3227 // which has fixed width in vertical respectively horizontal layout.
3228 // In vertical layout these are neighbour frames (cell and column frames),
3229 // header frames and footer frames.
3230 // In horizontal layout these are all frames, which aren't neighbour frames.
3231 const SwFrameType nFixWidth = aRectFnSet.IsVert() ? (FRM_NEIGHBOUR | FRM_HEADFOOT)
3233
3234 // Declare const unsigned short <nFixHeight> and init it this frame types
3235 // which has fixed height in vertical respectively horizontal layout.
3236 // In vertical layout these are all frames, which aren't neighbour frames,
3237 // header frames, footer frames, body frames or foot note container frames.
3238 // In horizontal layout these are neighbour frames.
3239 const SwFrameType nFixHeight = aRectFnSet.IsVert() ? ~SwFrameType(FRM_NEIGHBOUR | FRM_HEADFOOT | FRM_BODYFTNC)
3240 : FRM_NEIGHBOUR;
3241
3242 // Travel through all lowers using <GetNext()>
3243 while ( pLowerFrame )
3244 {
3245 if ( pLowerFrame->IsTextFrame() )
3246 {
3247 // Text frames will only be invalidated - prepare invalidation
3248 if ( bFixChgd )
3249 static_cast<SwContentFrame*>(pLowerFrame)->Prepare( PrepareHint::FixSizeChanged );
3250 if ( bVarChgd )
3252 }
3253 else
3254 {
3255 // If lower isn't a table, row, cell or section frame, adjust its
3256 // frame size.
3257 const SwFrameType nLowerType = pLowerFrame->GetType();
3259 {
3260 if ( bWidthChgd )
3261 {
3262 if( nLowerType & nFixWidth )
3263 {
3264 // Considering previous conditions:
3265 // In vertical layout set width of column, header and
3266 // footer frames to its upper width.
3267 // In horizontal layout set width of header, footer,
3268 // foot note container, foot note, body and no-text
3269 // frames to its upper width.
3271 aFrm.Width( getFramePrintArea().Width() );
3272 }
3273 else if( rOldSize.Width() && !pLowerFrame->IsFootnoteFrame() )
3274 {
3275 // Adjust frame width proportional, if lower isn't a
3276 // foot note frame and condition <nLowerType & nFixWidth>
3277 // isn't true.
3278 // Considering previous conditions:
3279 // In vertical layout these are foot note container,
3280 // body and no-text frames.
3281 // In horizontal layout these are column and no-text frames.
3282 // OD 24.10.2002 #97265# - <double> calculation
3283 // Perform <double> calculation of new width, if
3284 // one of the coefficients is greater than 50000
3285 SwTwips nNewWidth;
3286 if ( (pLowerFrame->getFrameArea().Width() > 50000) ||
3287 (getFramePrintArea().Width() > 50000) )
3288 {
3289 double nNewWidthTmp =
3290 ( double(pLowerFrame->getFrameArea().Width())
3291 * double(getFramePrintArea().Width()) )
3292 / double(rOldSize.Width());
3293 nNewWidth = SwTwips(nNewWidthTmp);
3294 }
3295 else
3296 {
3297 nNewWidth =
3298 (pLowerFrame->getFrameArea().Width() * getFramePrintArea().Width()) / rOldSize.Width();
3299 }
3300
3302 aFrm.Width( nNewWidth );
3303 }
3304 }
3305 if ( bHeightChgd )
3306 {
3307 if( nLowerType & nFixHeight )
3308 {
3309 // Considering previous conditions:
3310 // In vertical layout set height of foot note and
3311 // no-text frames to its upper height.
3312 // In horizontal layout set height of column frames
3313 // to its upper height.
3315 aFrm.Height( getFramePrintArea().Height() );
3316 }
3317 // OD 01.10.2002 #102211#
3318 // add conditions <!pLowerFrame->IsHeaderFrame()> and
3319 // <!pLowerFrame->IsFooterFrame()> in order to avoid that
3320 // the <Grow> of header or footer are overwritten.
3321 // NOTE: Height of header/footer frame is determined by contents.
3322 else if ( rOldSize.Height() &&
3323 !pLowerFrame->IsFootnoteFrame() &&
3324 !pLowerFrame->IsHeaderFrame() &&
3325 !pLowerFrame->IsFooterFrame()
3326 )
3327 {
3328 // Adjust frame height proportional, if lower isn't a
3329 // foot note, a header or a footer frame and
3330 // condition <nLowerType & nFixHeight> isn't true.
3331 // Considering previous conditions:
3332 // In vertical layout these are column, foot note container,
3333 // body and no-text frames.
3334 // In horizontal layout these are column, foot note
3335 // container, body and no-text frames.
3336
3337 // OD 29.10.2002 #97265# - special case for page lowers
3338 // The page lowers that have to be adjusted on page height
3339 // change are the body frame and the foot note container
3340 // frame.
3341 // In vertical layout the height of both is directly
3342 // adjusted to the page height change.
3343 // In horizontal layout the height of the body frame is
3344 // directly adjusted to the page height change and the
3345 // foot note frame height isn't touched, because its
3346 // determined by its content.
3347 // OD 31.03.2003 #108446# - apply special case for page
3348 // lowers - see description above - also for section columns.
3349 if ( IsPageFrame() ||
3350 ( IsColumnFrame() && IsInSct() )
3351 )
3352 {
3353 OSL_ENSURE( pLowerFrame->IsBodyFrame() || pLowerFrame->IsFootnoteContFrame(),
3354 "ChgLowersProp - only for body or foot note container" );
3355 if ( pLowerFrame->IsBodyFrame() || pLowerFrame->IsFootnoteContFrame() )
3356 {
3357 if ( IsVertical() || pLowerFrame->IsBodyFrame() )
3358 {
3359 SwTwips nNewHeight =
3360 pLowerFrame->getFrameArea().Height() +
3361 ( getFramePrintArea().Height() - rOldSize.Height() );
3362 if ( nNewHeight < 0)
3363 {
3364 // OD 01.04.2003 #108446# - adjust assertion condition and text
3365 OSL_ENSURE( !( IsPageFrame() &&
3366 (pLowerFrame->getFrameArea().Height()>0) &&
3367 (pLowerFrame->isFrameAreaDefinitionValid()) ),
3368 "ChgLowersProg - negative height for lower.");
3369 nNewHeight = 0;
3370 }
3371
3373 aFrm.Height( nNewHeight );
3374 }
3375 }
3376 }
3377 else
3378 {
3379 SwTwips nNewHeight;
3380 // OD 24.10.2002 #97265# - <double> calculation
3381 // Perform <double> calculation of new height, if
3382 // one of the coefficients is greater than 50000
3383 if ( (pLowerFrame->getFrameArea().Height() > 50000) ||
3384 (getFramePrintArea().Height() > 50000) )
3385 {
3386 double nNewHeightTmp =
3387 ( double(pLowerFrame->getFrameArea().Height())
3388 * double(getFramePrintArea().Height()) )
3389 / double(rOldSize.Height());
3390 nNewHeight = SwTwips(nNewHeightTmp);
3391 }
3392 else
3393 {
3394 nNewHeight = ( pLowerFrame->getFrameArea().Height()
3395 * getFramePrintArea().Height() ) / rOldSize.Height();
3396 }
3397 if( !pLowerFrame->GetNext() )
3398 {
3399 SwTwips nSum = getFramePrintArea().Height();
3400 SwFrame* pTmp = Lower();
3401 while( pTmp->GetNext() )
3402 {
3403 if( !pTmp->IsFootnoteContFrame() || !pTmp->IsVertical() )
3404 nSum -= pTmp->getFrameArea().Height();
3405 pTmp = pTmp->GetNext();
3406 }
3407 if( nSum - nNewHeight == 1 &&
3408 nSum == pLowerFrame->getFrameArea().Height() )
3409 nNewHeight = nSum;
3410 }
3411
3413 aFrm.Height( nNewHeight );
3414 }
3415 }
3416 }
3417 }
3418 } // end of else { NOT text frame }
3419
3420 pLowerFrame->InvalidateAll_();
3421 if ( bInvaPageForContent && pLowerFrame->IsContentFrame() )
3422 {
3423 pLowerFrame->InvalidatePage();
3424 bInvaPageForContent = false;
3425 }
3426
3427 if ( !pLowerFrame->GetNext() && pLowerFrame->IsRetoucheFrame() )
3428 {
3429 //If a growth took place and the subordinate elements can retouch
3430 //itself (currently Tabs, Sections and Content) we trigger it.
3431 if ( rOldSize.Height() < getFramePrintArea().SSize().Height() ||
3432 rOldSize.Width() < getFramePrintArea().SSize().Width() )
3433 pLowerFrame->SetRetouche();
3434 }
3435 pLowerFrame = pLowerFrame->GetNext();
3436 }
3437
3438 // Finally adjust the columns if width is set to auto
3439 // Possible optimization: execute this code earlier in this function and
3440 // return???
3441 if ( !(( (aRectFnSet.IsVert() && bHeightChgd) || (! aRectFnSet.IsVert() && bWidthChgd) ) &&
3442 Lower()->IsColumnFrame()) )
3443 return;
3444
3445 // get column attribute
3446 const SwFormatCol* pColAttr = nullptr;
3447 if ( IsPageBodyFrame() )
3448 {
3449 OSL_ENSURE( GetUpper()->IsPageFrame(), "Upper is not page frame" );
3450 pColAttr = &GetUpper()->GetFormat()->GetCol();
3451 }
3452 else
3453 {
3454 OSL_ENSURE( IsFlyFrame() || IsSctFrame(), "Columns not in fly or section" );
3455 pColAttr = &GetFormat()->GetCol();
3456 }
3457
3458 if ( pColAttr->IsOrtho() && pColAttr->GetNumCols() > 1 )
3459 AdjustColumns( pColAttr, false );
3460}
3461
3466void SwLayoutFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAttrs *pAttrs )
3467{
3468 OSL_ENSURE( pAttrs, "LayoutFrame::Format, pAttrs is 0." );
3469
3471 return;
3472
3473 bool bHideWhitespace = false;
3474 if (IsPageFrame())
3475 {
3476 SwViewShell* pShell = getRootFrame()->GetCurrShell();
3477 if (pShell && pShell->GetViewOptions()->IsWhitespaceHidden())
3478 {
3479 // This is needed so that no space is reserved for the margin on
3480 // the last page of the document. Other pages would have no margin
3481 // set even without this, as their frame height is the content
3482 // height already.
3483 bHideWhitespace = true;
3484 }
3485 }
3486
3487 const sal_uInt16 nLeft = o3tl::narrowing<sal_uInt16>(pAttrs->CalcLeft(this));
3488 const sal_uInt16 nUpper = bHideWhitespace ? 0 : pAttrs->CalcTop();
3489
3490 const sal_uInt16 nRight = o3tl::narrowing<sal_uInt16>(pAttrs->CalcRight(this));
3491 const sal_uInt16 nLower = bHideWhitespace ? 0 : pAttrs->CalcBottom();
3492
3493 const bool bVert = IsVertical() && !IsPageFrame();
3494 SwRectFn fnRect = bVert ? ( IsVertLR() ? (IsVertLRBT() ? fnRectVertL2RB2T : fnRectVertL2R) : fnRectVert ) : fnRectHori;
3495 if ( !isFramePrintAreaValid() )
3496 {
3498 (this->*fnRect->fnSetXMargins)( nLeft, nRight );
3499 (this->*fnRect->fnSetYMargins)( nUpper, nLower );
3500 }
3501
3502 if ( isFrameAreaSizeValid() )
3503 return;
3504
3505 if ( !HasFixSize() )
3506 {
3507 const SwTwips nBorder = nUpper + nLower;
3508 const SwFormatFrameSize &rSz = GetFormat()->GetFrameSize();
3509 SwTwips nMinHeight = rSz.GetHeightSizeType() == SwFrameSize::Minimum ? rSz.GetHeight() : 0;
3510 do
3511 {
3513
3514 //The size in VarSize is calculated using the content plus the
3515 // borders.
3516 SwTwips nRemaining = 0;
3517 SwFrame *pFrame = Lower();
3518 while ( pFrame )
3519 { nRemaining += (pFrame->getFrameArea().*fnRect->fnGetHeight)();
3520 if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsUndersized() )
3521 // This TextFrame would like to be a bit bigger
3522 nRemaining += static_cast<SwTextFrame*>(pFrame)->GetParHeight()
3523 - (pFrame->getFramePrintArea().*fnRect->fnGetHeight)();
3524 else if( pFrame->IsSctFrame() && static_cast<SwSectionFrame*>(pFrame)->IsUndersized() )
3525 nRemaining += static_cast<SwSectionFrame*>(pFrame)->Undersize();
3526 pFrame = pFrame->GetNext();
3527 }
3528 nRemaining += nBorder;
3529 nRemaining = std::max( nRemaining, nMinHeight );
3530 const SwTwips nDiff = nRemaining-(getFrameArea().*fnRect->fnGetHeight)();
3531 const tools::Long nOldLeft = (getFrameArea().*fnRect->fnGetLeft)();
3532 const tools::Long nOldTop = (getFrameArea().*fnRect->fnGetTop)();
3533 if ( nDiff )
3534 {
3535 if ( nDiff > 0 )
3536 Grow( nDiff );
3537 else
3538 Shrink( -nDiff );
3539 //Updates the positions using the fast channel.
3540 MakePos();
3541 }
3542 //Don't exceed the bottom edge of the Upper.
3543 if ( GetUpper() && (getFrameArea().*fnRect->fnGetHeight)() )
3544 {
3545 const SwTwips nLimit = (GetUpper()->*fnRect->fnGetPrtBottom)();
3546 if( (this->*fnRect->fnSetLimit)( nLimit ) &&
3547 nOldLeft == (getFrameArea().*fnRect->fnGetLeft)() &&
3548 nOldTop == (getFrameArea().*fnRect->fnGetTop)() )
3549 {
3552 }
3553 }
3554 } while ( !isFrameAreaSizeValid() );
3555 }
3556 else if (GetType() & FRM_HEADFOOT)
3557 {
3558 do
3559 { if ( getFrameArea().Height() != pAttrs->GetSize().Height() )
3560 {
3561 ChgSize( Size( getFrameArea().Width(), pAttrs->GetSize().Height()));
3562 }
3563
3565 MakePos();
3566 } while ( !isFrameAreaSizeValid() );
3567 }
3568 else
3569 {
3571 }
3572
3573 // While updating the size, PrtArea might be invalidated.
3574 if (!isFramePrintAreaValid())
3575 {
3577 (this->*fnRect->fnSetXMargins)(nLeft, nRight);
3578 (this->*fnRect->fnSetYMargins)(nUpper, nLower);
3579 }
3580}
3581
3582static void InvaPercentFlys( SwFrame *pFrame, SwTwips nDiff )
3583{
3584 OSL_ENSURE( pFrame->GetDrawObjs(), "Can't find any Objects" );
3585 for (SwAnchoredObject* pAnchoredObj : *pFrame->GetDrawObjs())
3586 {
3587 if ( auto pFly = pAnchoredObj->DynCastFlyFrame() )
3588 {
3589 const SwFormatFrameSize &rSz = pFly->GetFormat()->GetFrameSize();
3590 if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
3591 {
3592 bool bNotify = true;
3593 // If we've a fly with more than 90% relative height...
3594 if( rSz.GetHeightPercent() > 90 && pFly->GetAnchorFrame() &&
3596 {
3597 const SwFrame *pRel = pFly->IsFlyLayFrame() ? pFly->GetAnchorFrame():
3598 pFly->GetAnchorFrame()->GetUpper();
3599 // ... and we have already more than 90% height and we
3600 // not allow the text to go through...
3601 // then a notification could cause an endless loop, e.g.
3602 // 100% height and no text wrap inside a cell of a table.
3603 if( pFly->getFrameArea().Height()*10 >
3604 ( nDiff + pRel->getFramePrintArea().Height() )*9 &&
3605 pFly->GetFormat()->GetSurround().GetSurround() !=
3606 css::text::WrapTextMode_THROUGH )
3607 bNotify = false;
3608 }
3609 if( bNotify )
3610 pFly->InvalidateSize();
3611 }
3612 }
3613 }
3614}
3615
3617{
3618 if ( GetDrawObjs() )
3619 ::InvaPercentFlys( this, nDiff );
3620
3621 SwFrame *pFrame = ContainsContent();
3622 if ( !pFrame )
3623 return;
3624
3625 do
3626 {
3627 if ( pFrame->IsInTab() && !IsTabFrame() )
3628 {
3629 SwFrame *pTmp = pFrame->FindTabFrame();
3630 OSL_ENSURE( pTmp, "Where's my TabFrame?" );
3631 if( IsAnLower( pTmp ) )
3632 pFrame = pTmp;
3633 }
3634
3635 if ( pFrame->IsTabFrame() )
3636 {
3637 const SwFormatFrameSize &rSz = static_cast<SwLayoutFrame*>(pFrame)->GetFormat()->GetFrameSize();
3638 if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
3639 pFrame->InvalidatePrt();
3640 }
3641 else if ( pFrame->GetDrawObjs() )
3642 ::InvaPercentFlys( pFrame, nDiff );
3643 pFrame = pFrame->FindNextCnt();
3644 } while ( pFrame && IsAnLower( pFrame ) ) ;
3645}
3646
3648{
3649 tools::Long nRet = rSz.GetWidth(),
3650 nPercent = rSz.GetWidthPercent();
3651
3652 if ( nPercent )
3653 {
3654 const SwFrame *pRel = GetUpper();
3655 tools::Long nRel = LONG_MAX;
3656 const SwViewShell *pSh = getRootFrame()->GetCurrShell();
3657 const bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
3658 if( pRel->IsPageBodyFrame() && pSh && bBrowseMode && pSh->VisArea().Width() )
3659 {
3660 nRel = pSh->GetBrowseWidth();
3661 tools::Long nDiff = nRel - pRel->getFramePrintArea().Width();
3662 if ( nDiff > 0 )
3663 nRel -= nDiff;
3664 }
3665 nRel = std::min( nRel, pRel->getFramePrintArea().Width() );
3666 nRet = nRel * nPercent / 100;
3667 }
3668 return nRet;
3669}
3670
3671// Local helpers for SwLayoutFrame::FormatWidthCols()
3672
3674{
3675 tools::Long nDiff = 0, nFirstDiff = 0;
3676 SwLayoutFrame *pCol = static_cast<SwLayoutFrame*>(pLayFrame->Lower());
3677 OSL_ENSURE( pCol, "Where's the columnframe?" );
3678 SwFrame *pFrame = pCol->Lower();
3679 do
3680 {
3681 if( pFrame && pFrame->IsBodyFrame() )
3682 pFrame = static_cast<SwBodyFrame*>(pFrame)->Lower();
3683 if ( pFrame && pFrame->IsTextFrame() )
3684 {
3685 const tools::Long nTmp = static_cast<SwTextFrame*>(pFrame)->FirstLineHeight();
3686 if ( nTmp != USHRT_MAX )
3687 {
3688 if ( pCol == pLayFrame->Lower() )
3689 nFirstDiff = nTmp;
3690 else
3691 nDiff = nDiff ? std::min( nDiff, nTmp ) : nTmp;
3692 }
3693 }
3694 //Skip empty columns!
3695 pCol = static_cast<SwLayoutFrame*>(pCol->GetNext());
3696 while ( pCol && nullptr == (pFrame = pCol->Lower()) )
3697 pCol = static_cast<SwLayoutFrame*>(pCol->GetNext());
3698
3699 } while ( pFrame && pCol );
3700
3701 return nDiff ? nDiff : nFirstDiff ? nFirstDiff : 240;
3702}
3703
3705{
3706 SwFrame *pFrame = pLay->ContainsContent();
3707 while ( pFrame )
3708 {
3709 if ( pFrame->IsInTab() )
3710 pFrame = pFrame->FindTabFrame();
3711
3712 if ( pFrame->GetDrawObjs() )
3713 {
3714 const size_t nCnt = pFrame->GetDrawObjs()->size();
3715 for ( size_t i = 0; i < nCnt; ++i )
3716 {
3717 SwAnchoredObject* pAnchoredObj = (*pFrame->GetDrawObjs())[i];
3718 if ( auto pFly = pAnchoredObj->DynCastFlyFrame() )
3719 {
3720 if ( pFly->IsHeightClipped() &&
3721 ( !pFly->IsFlyFreeFrame() || pFly->GetPageFrame() ) )
3722 return true;
3723 }
3724 }
3725 }
3726 pFrame = pFrame->FindNextCnt();
3727 }
3728 return false;
3729}
3730
3732 const SwTwips nBorder, const SwTwips nMinHeight )
3733{
3734 //If there are columns involved, the size is adjusted using the last column.
3735 //1. Format content.
3736 //2. Calculate height of the last column: if it's too big, the Fly has to
3737 // grow. The amount by which the Fly grows is not the amount of the
3738 // overhang because we have to act on the assumption that some text flows
3739 // back which will generate some more space.
3740 // The amount which we grow by equals the overhang
3741 // divided by the amount of columns or the overhang itself if it's smaller
3742 // than the amount of columns.
3743 //3. Go back to 1. until everything is stable.
3744
3745 const SwFormatCol &rCol = rAttrs.GetAttrSet().GetCol();
3746 const sal_uInt16 nNumCols = rCol.GetNumCols();
3747
3748 bool bEnd = false;
3749 bool bBackLock = false;
3751 SwViewShellImp *pImp = pSh ? pSh->Imp() : nullptr;
3752 vcl::RenderContext* pRenderContext = pSh ? pSh->GetOut() : nullptr;
3753 {
3754 // Underlying algorithm
3755 // We try to find the optimal height for the column.
3756 // nMinimum starts with the passed minimum height and is then remembered
3757 // as the maximum height on which column content still juts out of a
3758 // column.
3759 // nMaximum starts with LONG_MAX and is then remembered as the minimum
3760 // width on which the content fitted.
3761 // In column based sections nMaximum starts at the maximum value which
3762 // the surrounding defines, this can certainly be a value on which
3763 // content still juts out.
3764 // The columns are formatted. If content still juts out, nMinimum is
3765 // adjusted accordingly, then we grow, at least by uMinDiff but not
3766 // over a certain nMaximum. If no content juts out but there is still
3767 // some space left in the column, shrinking is done accordingly, at
3768 // least by nMindIff but not below the nMinimum.
3769 // Cancel as soon as no content juts out and the difference from minimum
3770 // to maximum is less than MinDiff or the maximum which was defined by
3771 // the surrounding is reached even if some content still juts out.
3772
3773 // Criticism of this implementation
3774 // 1. Theoretically situations are possible in which the content fits in
3775 // a lower height but not in a higher height. To ensure that the code
3776 // handles such situations the code contains a few checks concerning
3777 // minimum and maximum which probably are never triggered.
3778 // 2. We use the same nMinDiff for shrinking and growing, but nMinDiff
3779 // is more or less the smallest first line height and doesn't seem ideal
3780 // as minimum value.
3781
3782 tools::Long nMinimum = nMinHeight;
3783 tools::Long nMaximum;
3784 bool bNoBalance = false;
3785 SwRectFnSet aRectFnSet(this);
3786 if( IsSctFrame() )
3787 {
3788 nMaximum = aRectFnSet.GetHeight(getFrameArea()) - nBorder +
3789 aRectFnSet.BottomDist(getFrameArea(), aRectFnSet.GetPrtBottom(*GetUpper()));
3790 nMaximum += GetUpper()->Grow( LONG_MAX, true );
3791 if( nMaximum < nMinimum )
3792 {
3793 if( nMaximum < 0 )
3794 nMinimum = nMaximum = 0;
3795 else
3796 nMinimum = nMaximum;
3797 }
3798 if( nMaximum > BROWSE_HEIGHT )
3799 nMaximum = BROWSE_HEIGHT;
3800
3801 bNoBalance = static_cast<SwSectionFrame*>(this)->GetSection()->GetFormat()->
3802 GetBalancedColumns().GetValue();
3803 SwFrame* pAny = ContainsAny();
3804 if( bNoBalance ||
3805 ( !aRectFnSet.GetHeight(getFrameArea()) && pAny ) )
3806 {
3807 tools::Long nTop = aRectFnSet.GetTopMargin(*this);
3808 // #i23129# - correction
3809 // to the calculated maximum height.
3810 {
3812 aRectFnSet.AddBottom( aFrm, nMaximum - aRectFnSet.GetHeight(getFrameArea()) );
3813 }
3814
3815 if( nTop > nMaximum )
3816 nTop = nMaximum;
3817 aRectFnSet.SetYMargins( *this, nTop, 0 );
3818 }
3819 if( !pAny && !static_cast<SwSectionFrame*>(this)->IsFootnoteLock() )
3820 {
3821 SwFootnoteContFrame* pFootnoteCont = static_cast<SwSectionFrame*>(this)->ContainsFootnoteCont();
3822 if( pFootnoteCont )
3823 {
3824 SwFrame* pFootnoteAny = pFootnoteCont->ContainsAny();
3825 if( pFootnoteAny && pFootnoteAny->isFrameAreaDefinitionValid() )
3826 {
3827 bBackLock = true;
3828 static_cast<SwSectionFrame*>(this)->SetFootnoteLock( true );
3829 }
3830 }
3831 }
3832 }
3833 else
3834 nMaximum = LONG_MAX;
3835
3836 // #i3317# - reset temporarily consideration
3837 // of wrapping style influence
3838 SwPageFrame* pPageFrame = FindPageFrame();
3839 SwSortedObjs* pObjs = pPageFrame ? pPageFrame->GetSortedObjs() : nullptr;
3840 if ( pObjs )
3841 {
3842 for (SwAnchoredObject* pAnchoredObj : *pObjs)
3843 {
3844 if ( IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
3845 {
3846 pAnchoredObj->SetTmpConsiderWrapInfluence( false );
3847 }
3848 }
3849 }
3850 do
3851 {
3852 //Could take a while therefore check for Waitcrsr here.
3853 if ( pImp )
3854 pImp->CheckWaitCursor();
3855
3857 //First format the column as this will relieve the stack a bit.
3858 //Also set width and height of the column (if they are wrong)
3859 //while we are at it.
3860 SwLayoutFrame *pCol = static_cast<SwLayoutFrame*>(Lower());
3861
3862 // #i27399#
3863 // Simply setting the column width based on the values returned by
3864 // CalcColWidth does not work for automatic column width.
3865 AdjustColumns( &rCol, false );
3866
3867 for ( sal_uInt16 i = 0; i < nNumCols; ++i )
3868 {
3869 pCol->Calc(pRenderContext);
3870 // ColumnFrames have a BodyFrame now, which needs to be calculated
3871 pCol->Lower()->Calc(pRenderContext);
3872 if( pCol->Lower()->GetNext() )
3873 pCol->Lower()->GetNext()->Calc(pRenderContext); // SwFootnoteCont
3874 pCol = static_cast<SwLayoutFrame*>(pCol->GetNext());
3875 }
3876
3877 ::CalcContent( this );
3878
3879 pCol = static_cast<SwLayoutFrame*>(Lower());
3880 OSL_ENSURE( pCol && pCol->GetNext(), ":-( column making holidays?");
3881 // set bMinDiff if no empty columns exist
3882 bool bMinDiff = true;
3883 // OD 28.03.2003 #108446# - check for all column content and all columns
3884 while ( bMinDiff && pCol )
3885 {
3886 bMinDiff = nullptr != pCol->ContainsContent();
3887 pCol = static_cast<SwLayoutFrame*>(pCol->GetNext());
3888 }
3889 pCol = static_cast<SwLayoutFrame*>(Lower());
3890 // OD 28.03.2003 #108446# - initialize local variable
3891 SwTwips nDiff = 0;
3892 SwTwips nMaxFree = 0;
3893 SwTwips nAllFree = LONG_MAX;
3894 // set bFoundLower if there is at least one non-empty column
3895 bool bFoundLower = false;
3896 while( pCol )
3897 {
3898 SwLayoutFrame* pLay = static_cast<SwLayoutFrame*>(pCol->Lower());
3899 SwTwips nInnerHeight = aRectFnSet.GetHeight(pLay->getFrameArea()) -
3900 aRectFnSet.GetHeight(pLay->getFramePrintArea());
3901 if( pLay->Lower() )
3902 {
3903 bFoundLower = true;
3904 nInnerHeight += pLay->InnerHeight();
3905 }
3906 else if( nInnerHeight < 0 )
3907 nInnerHeight = 0;
3908
3909 if( pLay->GetNext() )
3910 {
3911 bFoundLower = true;
3912 pLay = static_cast<SwLayoutFrame*>(pLay->GetNext());
3913 OSL_ENSURE( pLay->IsFootnoteContFrame(),"FootnoteContainer expected" );
3914 nInnerHeight += pLay->InnerHeight();
3915 nInnerHeight += aRectFnSet.GetHeight(pLay->getFrameArea()) -
3916 aRectFnSet.GetHeight(pLay->getFramePrintArea());
3917 }
3918 nInnerHeight -= aRectFnSet.GetHeight(pCol->getFramePrintArea());
3919 if( nInnerHeight > nDiff )
3920 {
3921 nDiff = nInnerHeight;
3922 nAllFree = 0;
3923 }
3924 else
3925 {
3926 if( nMaxFree < -nInnerHeight )
3927 nMaxFree = -nInnerHeight;
3928 if( nAllFree > -nInnerHeight )
3929 nAllFree = -nInnerHeight;
3930 }
3931 pCol = static_cast<SwLayoutFrame*>(pCol->GetNext());
3932 }
3933
3934 if ( bFoundLower || ( IsSctFrame() && static_cast<SwSectionFrame*>(this)->HasFollow() ) )
3935 {
3936 SwTwips nMinDiff = ::lcl_CalcMinColDiff( this );
3937 // Here we decide if growing is needed - this is the case, if
3938 // column content (nDiff) or a Fly juts over.
3939 // In sections with columns we take into account to set the size
3940 // when having a non-empty Follow.
3941 if ( nDiff || ::lcl_IsFlyHeightClipped( this ) ||
3942 ( IsSctFrame() && static_cast<SwSectionFrame*>(this)->CalcMinDiff( nMinDiff ) ) )
3943 {
3944 tools::Long nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
3945 // The minimum must not be smaller than our PrtHeight as
3946 // long as something juts over.
3947 if( nMinimum < nPrtHeight )
3948 nMinimum = nPrtHeight;
3949 // The maximum must not be smaller than PrtHeight if
3950 // something still juts over.
3951 if( nMaximum < nPrtHeight )
3952 nMaximum = nPrtHeight; // Robust, but will this ever happen?
3953 if( !nDiff ) // If only Flys jut over, we grow by nMinDiff
3954 nDiff = nMinDiff;
3955 // If we should grow more than by nMinDiff we split it over
3956 // the columns
3957 if ( std::abs(nDiff - nMinDiff) > nNumCols && nDiff > static_cast<tools::Long>(nNumCols) )
3958 nDiff /= nNumCols;
3959
3960 if ( bMinDiff )
3961 { // If no empty column exists, we want to grow at least
3962 // by nMinDiff. Special case: If we are smaller than the
3963 // minimal FrameHeight and PrtHeight is smaller than
3964 // nMindiff we grow in a way that PrtHeight is exactly
3965 // nMinDiff afterwards.
3966 tools::Long nFrameHeight = aRectFnSet.GetHeight(getFrameArea());
3967 if ( nFrameHeight > nMinHeight || nPrtHeight >= nMinDiff )
3968 nDiff = std::max( nDiff, nMinDiff );
3969 else if( nDiff < nMinDiff )
3970 nDiff = nMinDiff - nPrtHeight + 1;
3971 }
3972 // nMaximum has a size which fits the content or the
3973 // requested value from the surrounding therefore we don't
3974 // need to exceed this value.
3975 if( nDiff + nPrtHeight > nMaximum )
3976 nDiff = nMaximum - nPrtHeight;
3977 }
3978 else if( nMaximum > nMinimum ) // We fit, do we still have some margin?
3979 {
3980 tools::Long nPrtHeight = aRectFnSet.GetHeight(getFramePrintArea());
3981 if ( nMaximum < nPrtHeight )
3982 nDiff = nMaximum - nPrtHeight; // We grew over a working
3983 // height and shrink back to it, but will this ever
3984 // happen?
3985 else
3986 { // We have a new maximum, a size which fits for the content.
3987 nMaximum = nPrtHeight;
3988 // If the margin in the column is bigger than nMinDiff
3989 // and we therefore drop under the minimum, we deflate
3990 // a bit.
3991 if ( !bNoBalance &&
3992 // #i23129# - <nMinDiff> can be
3993 // big, because of an object at the beginning of
3994 // a column. Thus, decrease optimization here.
3995 //nMaxFree >= nMinDiff &&
3996 nMaxFree > 0 &&
3997 ( !nAllFree ||
3998 nMinimum < nPrtHeight - nMinDiff ) )
3999 {
4000 nMaxFree /= nNumCols; // disperse over the columns
4001 nDiff = nMaxFree < nMinDiff ? -nMinDiff : -nMaxFree; // min nMinDiff
4002 if( nPrtHeight + nDiff <= nMinimum ) // below the minimum?
4003 nDiff = ( nMinimum - nMaximum ) / 2; // Take the center
4004 }
4005 else if( nAllFree )
4006 {
4007 nDiff = -nAllFree;
4008 if( nPrtHeight + nDiff <= nMinimum ) // Less than minimum?
4009 nDiff = ( nMinimum - nMaximum ) / 2; // Take the center
4010 }
4011 }
4012 }
4013 if( nDiff ) // now we shrink or grow...
4014 {
4015 Size aOldSz( getFramePrintArea().SSize() );
4016 tools::Long nTop = aRectFnSet.GetTopMargin(*this);
4017 nDiff = aRectFnSet.GetHeight(getFramePrintArea()) + nDiff + nBorder - aRectFnSet.GetHeight(getFrameArea());
4018
4019 {
4021 aRectFnSet.AddBottom( aFrm, nDiff );
4022 }
4023
4024 // #i68520#
4025 SwFlyFrame *pFlyFrame = IsFlyFrame() ? static_cast<SwFlyFrame*>(this) : nullptr;
4026 if (pFlyFrame)
4027 {
4028 pFlyFrame->InvalidateObjRectWithSpaces();
4029 }
4030 aRectFnSet.SetYMargins( *this, nTop, nBorder - nTop );
4031 ChgLowersProp( aOldSz );
4033
4034 // #i3317# - reset temporarily consideration
4035 // of wrapping style influence
4036 SwPageFrame* pTmpPageFrame = FindPageFrame();
4037 SwSortedObjs* pTmpObjs = pTmpPageFrame ? pTmpPageFrame->GetSortedObjs() : nullptr;
4038 if ( pTmpObjs )
4039 {
4040 for (SwAnchoredObject* pAnchoredObj : *pTmpObjs)
4041 {
4042 if ( IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
4043 {
4044 pAnchoredObj->SetTmpConsiderWrapInfluence( false );
4045 }
4046 }
4047 }
4048 //Invalidate suitable to nicely balance the Frames.
4049 //- Every first one after the second column gets a
4050 // InvalidatePos();
4051 pCol = static_cast<SwLayoutFrame*>(Lower()->GetNext());
4052 while ( pCol )
4053 {
4054 SwFrame *pLow = pCol->Lower();
4055 if ( pLow )
4056 pLow->InvalidatePos_();
4057 pCol = static_cast<SwLayoutFrame*>(pCol->GetNext());
4058 }
4059 if( IsSctFrame() && static_cast<SwSectionFrame*>(this)->HasFollow() )
4060 {
4061 // If we created a Follow, we need to give its content
4062 // the opportunity to flow back inside the CalcContent
4063 SwContentFrame* pTmpContent =
4064 static_cast<SwSectionFrame*>(this)->GetFollow()->ContainsContent();
4065 if( pTmpContent )
4066 pTmpContent->InvalidatePos_();
4067 }
4068 }
4069 else
4070 bEnd = true;
4071 }
4072 else
4073 bEnd = true;
4074
4075 } while ( !bEnd || !isFrameAreaSizeValid() );
4076 }
4077 // OD 01.04.2003 #108446# - Don't collect endnotes for sections. Thus, set
4078 // 2nd parameter to <true>.
4079 ::CalcContent( this, true );
4080 if( IsSctFrame() )
4081 {
4082 // OD 14.03.2003 #i11760# - adjust 2nd parameter - sal_True --> true
4084 ::CalcContent( this, true );
4085 if( bBackLock )
4086 static_cast<SwSectionFrame*>(this)->SetFootnoteLock( false );
4087 }
4088}
4089
4091{
4092 SwSectionFrame* pSect = pCnt->FindSctFrame();
4093 // If our ContentFrame is placed inside a table or a footnote, only sections
4094 // which are also placed inside are meant.
4095 // Exception: If a table is directly passed.
4096 if( ( ( pCnt->IsInTab() && !pSect->IsInTab() ) ||
4097 ( pCnt->IsInFootnote() && !pSect->IsInFootnote() ) ) && !pCnt->IsTabFrame() )
4098 return nullptr;
4099 if( nInv & SwInvalidateFlags::Size )
4100 pSect->InvalidateSize_();
4101 if( nInv & SwInvalidateFlags::Pos )
4102 pSect->InvalidatePos_();
4103 if( nInv & SwInvalidateFlags::PrtArea )
4104 pSect->InvalidatePrt_();
4105 SwFlowFrame *pFoll = pSect->GetFollow();
4106 // Temporary separation from follow
4107 pSect->SetFollow( nullptr );
4108 SwContentFrame* pRet = pSect->FindLastContent();
4109 pSect->SetFollow( pFoll );
4110 return pRet;
4111}
4112
4114{
4115 if( ( nInv & SwInvalidateFlags::Section ) && pTable->IsInSct() )
4116 lcl_InvalidateSection( pTable, nInv );
4117 if( nInv & SwInvalidateFlags::Size )
4118 pTable->InvalidateSize_();
4119 if( nInv & SwInvalidateFlags::Pos )
4120 pTable->InvalidatePos_();
4121 if( nInv & SwInvalidateFlags::PrtArea )
4122 pTable->InvalidatePrt_();
4123 return pTable->FindLastContent();
4124}
4125
4127
4129{
4130 SwContentFrame *pLastTabCnt = nullptr;
4131 SwContentFrame *pLastSctCnt = nullptr;
4132 while ( pCnt )
4133 {
4134 if( nInv & SwInvalidateFlags::Section )
4135 {
4136 if( pCnt->IsInSct() )
4137 {
4138 // See above at tables
4139 if( !pLastSctCnt )
4140 pLastSctCnt = lcl_InvalidateSection( pCnt, nInv );
4141 if( pLastSctCnt == pCnt )
4142 pLastSctCnt = nullptr;
4143 }
4144#if OSL_DEBUG_LEVEL > 0
4145 else
4146 OSL_ENSURE( !pLastSctCnt, "Where's the last SctContent?" );
4147#endif
4148 }
4149 if( nInv & SwInvalidateFlags::Table )
4150 {
4151 if( pCnt->IsInTab() )
4152 {
4153 // To not call FindTabFrame() for each ContentFrame of a table and
4154 // then invalidate the table, we remember the last ContentFrame of
4155 // the table and ignore IsInTab() until we are past it.
4156 // When entering the table, LastSctCnt is set to null, so
4157 // sections inside the table are correctly invalidated.
4158 // If the table itself is in a section the
4159 // invalidation is done three times, which is acceptable.
4160 if( !pLastTabCnt )
4161 {
4162 pLastTabCnt = lcl_InvalidateTable( pCnt->FindTabFrame(), nInv );
4163 pLastSctCnt = nullptr;
4164 }
4165 if( pLastTabCnt == pCnt )
4166 {
4167 pLastTabCnt = nullptr;
4168 pLastSctCnt = nullptr;
4169 }
4170 }
4171#if OSL_DEBUG_LEVEL > 0
4172 else
4173 OSL_ENSURE( !pLastTabCnt, "Where's the last TabContent?" );
4174#endif
4175 }
4176
4177 if( nInv & SwInvalidateFlags::Size )
4178 pCnt->Prepare( PrepareHint::Clear, nullptr, false );
4179 if( nInv & SwInvalidateFlags::Pos )
4180 pCnt->InvalidatePos_();
4181 if( nInv & SwInvalidateFlags::PrtArea )
4182 pCnt->InvalidatePrt_();
4183 if ( nInv & SwInvalidateFlags::LineNum )
4184 pCnt->InvalidateLineNum();
4185 if ( pCnt->GetDrawObjs() )
4186 lcl_InvalidateAllContent( pCnt, nInv );
4187 pCnt = pCnt->GetNextContentFrame();
4188 }
4189}
4190
4192{
4193 SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
4194 for (SwAnchoredObject* pAnchoredObj : rObjs)
4195 {
4196 if ( auto pFly = pAnchoredObj->DynCastFlyFrame() )
4197 {
4198 if ( pFly->IsFlyInContentFrame() )
4199 {
4200 ::lcl_InvalidateContent( pFly->ContainsContent(), nInv );
4201 if( nInv & SwInvalidateFlags::Direction )
4202 pFly->CheckDirChange();
4203 }
4204 }
4205 }
4206}
4207
4209{
4210 // First process all page bound FlyFrames.
4211 SwPageFrame *pPage = static_cast<SwPageFrame*>(Lower());
4212 while( pPage )
4213 {
4214 pPage->InvalidateFlyLayout();
4215 pPage->InvalidateFlyContent();
4216 pPage->InvalidateFlyInCnt();
4217 pPage->InvalidateLayout();
4218 pPage->InvalidateContent();
4219 pPage->InvalidatePage( pPage ); // So even the Turbo disappears if applicable
4220
4221 if ( pPage->GetSortedObjs() )
4222 {
4223 const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
4224 for (SwAnchoredObject* pAnchoredObj : rObjs)
4225 {
4226 if ( auto pFly = pAnchoredObj->DynCastFlyFrame() )
4227 {
4228 ::lcl_InvalidateContent( pFly->ContainsContent(), nInv );
4229 if ( nInv & SwInvalidateFlags::Direction )
4230 pFly->CheckDirChange();
4231 }
4232 }
4233 }
4234 if( nInv & SwInvalidateFlags::Direction )
4235 pPage->CheckDirChange();
4236 pPage = static_cast<SwPageFrame*>(pPage->GetNext());
4237 }
4238
4239 //Invalidate the whole document content and the character bound Flys here.
4241
4242 if( nInv & SwInvalidateFlags::PrtArea )
4243 {
4245 if( pSh )
4247 }
4248}
4249
4255{
4256 const SwPageFrame* pPageFrame = static_cast<const SwPageFrame*>(Lower());
4257 while( pPageFrame )
4258 {
4259 pPageFrame->InvalidateFlyLayout();
4260
4261 if ( pPageFrame->GetSortedObjs() )
4262 {
4263 const SwSortedObjs& rObjs = *(pPageFrame->GetSortedObjs());
4264 for (SwAnchoredObject* pAnchoredObj : rObjs)
4265 {
4266 const SwFormatAnchor& rAnch = pAnchoredObj->GetFrameFormat().GetAnchor();
4267 if ((rAnch.GetAnchorId() != RndStdIds::FLY_AT_PARA) &&
4268 (rAnch.GetAnchorId() != RndStdIds::FLY_AT_CHAR))
4269 {
4270 // only to paragraph and to character anchored objects are considered.
4271 continue;
4272 }
4273 // #i28701# - special invalidation for anchored
4274 // objects, whose wrapping style influence has to be considered.
4275 if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
4276 pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence();
4277 else
4278 pAnchoredObj->InvalidateObjPos();
4279 }
4280 }
4281
4282 pPageFrame = static_cast<const SwPageFrame*>(pPageFrame->GetNext());
4283 }
4284}
4285
4287 SwTextFrame & rFrame, SwTextNode & rTextNode,
4288 std::set<SwNodeOffset> *const pSkipped,
4290 SwPageFrame *const pPage,
4291 SwTextNode const*const pNode,
4292 std::vector<sw::Extent>::const_iterator const& rIterFirst,
4293 std::vector<sw::Extent>::const_iterator const& rIterEnd,
4294 SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
4295{
4296 if (pNode == &rTextNode)
4297 { // remove existing hidden at-char anchored flys
4298 RemoveHiddenObjsOfNode(rTextNode, &rIterFirst, &rIterEnd, pFirstNode, pLastNode);
4299 }
4300 else if (rTextNode.GetIndex() < pNode->GetIndex())
4301 {
4302 // pNode's frame has been deleted by CheckParaRedlineMerge()
4303 AppendObjsOfNode(&rTable,
4304 pNode->GetIndex(), &rFrame, pPage, &rTextNode.GetDoc(),
4305 &rIterFirst, &rIterEnd, pFirstNode, pLastNode);
4306 if (pSkipped)
4307 {
4308 // if a fly has been added by AppendObjsOfNode, it must be skipped; if not, then it doesn't matter if it's skipped or not because it has no frames and because of that it would be skipped anyway
4309 for (auto const pFly : pNode->GetAnchoredFlys())
4310 {
4311 if (pFly->Which() != RES_DRAWFRMFMT)
4312 {
4313 pSkipped->insert(pFly->GetContent().GetContentIdx()->GetIndex());
4314 }
4315 }
4316 }
4317 }
4318}
4319
4320namespace sw {
4321
4326 SwTextFrame & rFrame, SwTextNode & rTextNode,
4327 std::set<SwNodeOffset> *const pSkipped)
4328{
4329 auto const pMerged(rFrame.GetMergedPara());
4330 if (!pMerged
4331 // do this only *once*, for the *last* frame
4332 // otherwise AppendObj would create multiple frames for fly-frames!
4333 || rFrame.GetFollow())
4334 return;
4335
4336 assert(pMerged->pFirstNode->GetIndex() <= rTextNode.GetIndex()
4337 && rTextNode.GetIndex() <= pMerged->pLastNode->GetIndex());
4338 // add visible flys in non-first node to merged frame
4339 // (hidden flys remain and are deleted via DelFrames())
4340 sw::SpzFrameFormats& rTable(*rTextNode.GetDoc().GetSpzFrameFormats());
4341 SwPageFrame *const pPage(rFrame.FindPageFrame());
4342 std::vector<sw::Extent>::const_iterator iterFirst(pMerged->extents.begin());
4343 std::vector<sw::Extent>::const_iterator iter(iterFirst);
4344 SwTextNode const* pNode(pMerged->pFirstNode);
4345 for ( ; ; ++iter)
4346 {
4347 if (iter == pMerged->extents.end()
4348 || iter->pNode != pNode)
4349 {
4350 AddRemoveFlysForNode(rFrame, rTextNode, pSkipped, rTable, pPage,
4351 pNode, iterFirst, iter,
4352 pMerged->pFirstNode, pMerged->pLastNode);
4353 SwNodeOffset const until = iter == pMerged->extents.end()
4354 ? pMerged->pLastNode->GetIndex() + 1
4355 : iter->pNode->GetIndex();
4356 for (SwNodeOffset i = pNode->GetIndex() + 1; i < until; ++i)
4357 {
4358 // let's show at-para flys on nodes that contain start/end of
4359 // redline too, even if there's no text there
4360 SwNode const*const pTmp(pNode->GetNodes()[i]);
4362 {
4363 AddRemoveFlysForNode(rFrame, rTextNode, pSkipped,
4364 rTable, pPage, pTmp->GetTextNode(), iter, iter,
4365 pMerged->pFirstNode, pMerged->pLastNode);
4366 }
4367 }
4368 if (iter == pMerged->extents.end())
4369 {
4370 break;
4371 }
4372 pNode = iter->pNode;
4373 iterFirst = iter;
4374 }
4375 }
4376}
4377
4378} // namespace sw
4379
4380static void UnHideRedlines(SwRootFrame & rLayout,
4381 SwNodes & rNodes, SwNode const& rEndOfSectionNode,
4382 std::set<SwNodeOffset> *const pSkipped)
4383{
4384 assert(rEndOfSectionNode.IsEndNode());
4385 assert(rNodes[rEndOfSectionNode.StartOfSectionNode()->GetIndex() + 1]->IsCreateFrameWhenHidingRedlines()); // first node is never hidden
4386 for (SwNodeOffset i = rEndOfSectionNode.StartOfSectionNode()->GetIndex() + 1;
4387 i < rEndOfSectionNode.GetIndex(); ++i)
4388 {
4389 SwNode & rNode(*rNodes[i]);
4390 if (rNode.IsTextNode()) // only text nodes are 1st node of a merge
4391 {
4392 SwTextNode & rTextNode(*rNode.GetTextNode());
4394 std::vector<SwTextFrame*> frames;
4395 for (SwTextFrame * pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
4396 {
4397 if (pFrame->getRootFrame() == &rLayout)
4398 {
4399 if (pFrame->IsFollow())
4400 {
4401 frames.push_back(pFrame);
4402 } // when hiding, the loop must remove the anchored flys
4403 else // *before* resetting SetMergedPara anywhere - else
4404 { // the fly deletion code will access multiple of the
4405 // frames with inconsistent MergedPara and assert
4406 frames.insert(frames.begin(), pFrame);
4407 }
4408 }
4409 }
4410 // this messes with pRegisteredIn so do it outside SwIterator
4412 for (SwTextFrame * pFrame : frames)
4413 {
4414 if (rLayout.HasMergedParas())
4415 {
4416 assert(!pFrame->GetMergedPara() ||
4418 // FIXME: skip this assert in tables with deleted rows
4419 pFrame->IsInTab());
4421 {
4422 {
4423 auto pMerged(CheckParaRedlineMerge(*pFrame,
4424 rTextNode, eMode));
4425 pFrame->SetMergedPara(std::move(pMerged));
4426 }
4427 auto const pMerged(pFrame->GetMergedPara());
4428 if (pMerged)
4429 {
4430 // invalidate SwInvalidateFlags::Size
4431 pFrame->Prepare(PrepareHint::Clear, nullptr, false);
4432 pFrame->InvalidatePage();
4433 if (auto const pObjs = pFrame->GetDrawObjs())
4434 { // also invalidate position of existing flys
4435 // because they may need to be moved
4436 for (auto const pObject : *pObjs)
4437 {
4438 pObject->InvalidateObjPos();
4439 }
4440 }
4441 }
4442 sw::AddRemoveFlysAnchoredToFrameStartingAtNode(*pFrame, rTextNode, pSkipped);
4443 // only *first* frame of node gets Existing because it
4444 eMode = sw::FrameMode::New; // is not idempotent!
4445 }
4446 }
4447 else
4448 {
4449 if (auto const& pMergedPara = pFrame->GetMergedPara())
4450 {
4451 // invalidate SwInvalidateFlags::Size
4452 pFrame->Prepare(PrepareHint::Clear, nullptr, false);
4453 pFrame->InvalidatePage();
4454 if (auto const pObjs = pFrame->GetDrawObjs())
4455 { // also invalidate position of existing flys
4456 for (auto const pObject : *pObjs)
4457 {
4458 pObject->InvalidateObjPos();
4459 }
4460 }
4461 // SwFlyAtContentFrame::SwClientNotify() always appends to
4462 // the master frame, so do the same here.
4463 // (RemoveFootnotesForNode must be called at least once)
4464 if (!pFrame->IsFollow())
4465 {
4466 // the new text frames don't exist yet, so at this point
4467 // we can only delete the footnote frames so they don't
4468 // point to the merged SwTextFrame any more...
4469 assert(&rTextNode == pMergedPara->pFirstNode);
4470 // iterate over nodes, not extents: if a node has
4471 // no extents now but did have extents initially,
4472 // its flys need their frames deleted too!
4473 for (SwNodeOffset j = rTextNode.GetIndex() + 1;
4474 j <= pMergedPara->pLastNode->GetIndex(); ++j)
4475 {
4476 SwNode *const pNode(rTextNode.GetNodes()[j]);
4477 assert(!pNode->IsEndNode());
4478 if (pNode->IsStartNode())
4479 {
4480 j = pNode->EndOfSectionIndex();
4481 }
4482 else if (pNode->IsTextNode())
4483 {
4484 sw::RemoveFootnotesForNode(rLayout, *pNode->GetTextNode(), nullptr);
4485 // similarly, remove the anchored flys
4486 for (SwFrameFormat * pFormat : pNode->GetAnchoredFlys())
4487 {
4488 pFormat->DelFrames(/*&rLayout*/);
4489 }
4490 }
4491 }
4492 // rely on AppendAllObjs call at the end to add
4493 // all flys in first node that are hidden
4494 }
4495 pFrame->SetMergedPara(nullptr);
4496 }
4497 }
4498 pFrame->Broadcast(SfxHint()); // notify SwAccessibleParagraph
4499 }
4500 // all nodes, not just merged ones! it may be in the same list as
4501 if (rTextNode.IsNumbered(nullptr)) // a preceding merged one...
4502 { // notify frames so they reformat numbering portions
4503 rTextNode.NumRuleChgd();
4504 }
4505 }
4506 else if (rNode.IsTableNode() && rLayout.IsHideRedlines())
4507 {
4508 SwTableNode * pTableNd = rNode.GetTableNode();
4509 SwPosition const tmp(rNode);
4510 SwRangeRedline const*const pRedline(
4511 rLayout.GetFormat()->GetDoc()->getIDocumentRedlineAccess().GetRedline(tmp, nullptr));
4512 // pathology: redline that starts on a TableNode; cannot
4513 // be created in UI but by import filters...
4514 if (pRedline
4515 && pRedline->GetType() == RedlineType::Delete
4516 && &pRedline->Start()->GetNode() == &rNode)
4517 {
4518 for (SwNodeOffset j = rNode.GetIndex(); j <= rNode.EndOfSectionIndex(); ++j)
4519 {
4520 rNode.GetNodes()[j]->SetRedlineMergeFlag(SwNode::Merge::Hidden);
4521 }
4522 pTableNd->DelFrames(&rLayout);
4523 }
4524 else if ( pTableNd->GetTable().HasDeletedRowOrCell() )
4525 {
4526 pTableNd->DelFrames(&rLayout);
4527 if ( !pTableNd->GetTable().IsDeleted() )
4528 {
4529 pTableNd->MakeOwnFrames();
4530 }
4531 }
4532 }
4533 else if (rNode.IsTableNode() && !rLayout.IsHideRedlines() &&
4535 {
4536 SwTableNode * pTableNd = rNode.GetTableNode();
4537 pTableNd->DelFrames(&rLayout);
4538 pTableNd->MakeOwnFrames();
4539 }
4540
4542 {
4543 if (rLayout.HasMergedParas())
4544 {
4545 if (rNode.IsContentNode())
4546 {
4547 // note: nothing to do here, already done
4548#ifndef NDEBUG
4549 auto const pFrame(static_cast<SwContentNode&>(rNode).getLayoutFrame(&rLayout));
4550 assert(!pFrame || static_cast<SwTextFrame*>(pFrame)->GetMergedPara()->pFirstNode != &rNode);
4551#endif
4552 }
4553 }
4554 else
4555 {
4556 assert(!rNode.IsContentNode() || !rNode.GetContentNode()->getLayoutFrame(&rLayout) ||
4557 // FIXME: skip this assert in tables with deleted rows
4558 rNode.GetContentNode()->getLayoutFrame(&rLayout)->IsInTab());
4559 SwNodeOffset j = i + 1;
4560 for ( ; j < rEndOfSectionNode.GetIndex(); ++j)
4561 {
4562 if (rNodes[j]->IsCreateFrameWhenHidingRedlines())
4563 {
4564 break;
4565 }
4566 }
4567 // call MakeFrames once, because sections/tables
4568 // InsertCnt_ also checks for hidden sections
4569 {
4570 sw::FlyCreationSuppressor aSuppressor(false);
4571 ::MakeFrames(rLayout.GetFormat()->GetDoc(), *rNodes[i], *rNodes[j]);
4572 }
4573 i = j - 1; // will be incremented again
4574 }
4575 }
4576 }
4577}
4578
4579static void UnHideRedlinesExtras(SwRootFrame & rLayout,
4580 SwNodes & rNodes, SwNode const& rEndOfExtraSectionNode,
4581 std::set<SwNodeOffset> *const pSkipped)
4582{
4583 assert(rEndOfExtraSectionNode.IsEndNode());
4584 for (SwNodeOffset i = rEndOfExtraSectionNode.StartOfSectionNode()->GetIndex()
4585 + 1; i < rEndOfExtraSectionNode.GetIndex(); ++i)
4586 {
4587 SwNode const& rStartNode(*rNodes[i]);
4588 assert(rStartNode.IsStartNode());
4589 assert(rStartNode.GetRedlineMergeFlag() == SwNode::Merge::None);
4590 SwNode const& rEndNode(*rStartNode.EndOfSectionNode());
4591 bool bSkip(pSkipped && pSkipped->find(i) != pSkipped->end());
4592 i = rEndNode.GetIndex();
4593 for (SwNodeOffset j = rStartNode.GetIndex() + 1; j < i; ++j)
4594 {
4595 // note: SwStartNode has no way to access the frames, so check
4596 // whether the first content-node inside the section has frames
4597 SwNode const& rNode(*rNodes[j]);
4598 if (rNode.IsSectionNode() &&
4599 static_cast<SwSectionNode const&>(rNode).GetSection().IsHiddenFlag())
4600 { // skip hidden sections - they can be inserted in fly-frames :(
4601 j = rNode.EndOfSectionNode()->GetIndex();
4602 continue;
4603 }
4604 if (rNode.IsContentNode())
4605 {
4606 SwContentNode const& rCNode(static_cast<SwContentNode const&>(rNode));
4607 if (!rCNode.getLayoutFrame(&rLayout))
4608 { // ignore footnote/fly/header/footer with no layout frame
4609 bSkip = true; // they will be created from scratch later if needed
4610 }
4611 break;
4612 }
4613 }
4614 if (!bSkip)
4615 {
4616 UnHideRedlines(rLayout, rNodes, rEndNode, pSkipped);
4617 }
4618 }
4619}
4620
4621static void UnHide(SwRootFrame & rLayout)
4622{
4623 assert(rLayout.GetCurrShell()->ActionPend()); // tdf#125754 avoid recursive layout
4624 SwDoc & rDoc(*rLayout.GetFormat()->GetDoc());
4625 // don't do early return if there are no redlines:
4626 // Show->Hide must init hidden number trees
4627 // Hide->Show may be called after all redlines have been deleted but there
4628 // may still be MergedParas because those aren't deleted yet...
4629#if 0
4630 if (!bHideRedlines
4632 {
4633 return;
4634 }
4635#endif
4636 // Hide->Show: clear MergedPara, create frames
4637 // Show->Hide: call CheckParaRedlineMerge, delete frames
4638 // Traverse the document via the nodes-array; traversing via the layout
4639 // wouldn't find the nodes that don't have frames in the ->Show case.
4640 // In-order traversal of each nodes array section should init the flags
4641 // in nodes before they are iterated.
4642 // Actual creation of frames should be done with existing functions
4643 // if possible, particularly InsertCnt_() or its wrapper ::MakeFrames().
4644 SwNodes /*const*/& rNodes(rDoc.GetNodes());
4645 // Flys/footnotes: must iterate and find all the ones that already exist
4646 // with frames and have redlines inside them; if any don't have frames at
4647 // all, they will be created (if necessary) from scratch and completely by
4648 // MakeFrames().
4649 //
4650 // Flys before footnotes: because footnotes may contain flys but not
4651 // vice-versa; alas flys may contain flys, so we skip some of them
4652 // if they have already been created from scratch via their anchor flys.
4653 std::set<SwNodeOffset> skippedFlys;
4654 UnHideRedlinesExtras(rLayout, rNodes, rNodes.GetEndOfAutotext(),
4655 // when un-hiding, delay all fly frame creation to AppendAllObjs below
4656 rLayout.HasMergedParas() ? &skippedFlys : nullptr);
4657 // Footnotes are created automatically (after invalidation etc.) by
4658 // ConnectFootnote(), but need to be deleted manually. Footnotes do not
4659 // occur in flys or headers/footers.
4660 UnHideRedlinesExtras(rLayout, rNodes, rNodes.GetEndOfInserts(), nullptr);
4661 UnHideRedlines(rLayout, rNodes, rNodes.GetEndOfContent(), nullptr);
4662
4663 if (!rLayout.HasMergedParas())
4664 { // create all previously hidden flys at once:
4665 // * Flys on first node of pre-existing merged frames that are hidden
4666 // (in delete redline), to be added to the existing frame
4667 // * Flys on non-first (hidden/merged) nodes of pre-existing merged
4668 // frames, to be added to the new frame of their node
4669 // * Flys anchored in other flys that are hidden
4670 AppendAllObjs(rDoc.GetSpzFrameFormats(), &rLayout);
4671 }
4672
4673 const bool bIsShowChangesInMargin = rLayout.GetCurrShell()->GetViewOptions()->IsShowChangesInMargin();
4674 for (auto const pRedline : rDoc.getIDocumentRedlineAccess().GetRedlineTable())
4675 { // DELETE are handled by the code above; for other types, need to
4676 // trigger repaint of text frames to add/remove the redline color font
4677 // (handle deletions showed in margin also here)
4678 if (bIsShowChangesInMargin || pRedline->GetType() != RedlineType::Delete)
4679 {
4680 pRedline->InvalidateRange(SwRangeRedline::Invalidation::Add);
4681 }
4682 }
4683
4684 SwFootnoteIdxs & rFootnotes(rDoc.GetFootnoteIdxs());
4686 {
4687 // sadly determining which node is outline node requires hidden layout
4688 rFootnotes.UpdateAllFootnote();
4689 }
4690 // invalidate all footnotes to reformat their numbers
4691 for (SwTextFootnote *const pFootnote : rFootnotes)
4692 {
4693 SwFormatFootnote const& rFootnote(pFootnote->GetFootnote());
4694 if (rFootnote.GetNumber() != rFootnote.GetNumberRLHidden()
4695 && rFootnote.GetNumStr().isEmpty())
4696 {
4697 pFootnote->InvalidateNumberInLayout();
4698 }
4699 }
4700 // update various fields to re-expand them with the new layout
4702 auto const pAuthType(rIDFA.GetFieldType(
4703 SwFieldIds::TableOfAuthorities, OUString(), false));
4704 if (pAuthType) // created on demand...
4705 { // calling DelSequenceArray() should be unnecessary here since the
4706 // sequence doesn't depend on frames
4707 pAuthType->UpdateFields();
4708 }
4709 rIDFA.GetFieldType(SwFieldIds::RefPageGet, OUString(), false)->UpdateFields();
4711 rIDFA.UpdateExpFields(nullptr, false);
4712 rIDFA.UpdateRefFields();
4713
4714 // update SwPostItMgr / notes in the margin
4715 // note: as long as all shells share layout, broadcast to all shells!
4716 rDoc.GetDocShell()->Broadcast( SwFormatFieldHint(nullptr, rLayout.HasMergedParas()
4719
4720
4721// InvalidateAllContent(SwInvalidateFlags::Size); // ??? TODO what to invalidate? this is the big hammer
4722}
4723
4724void SwRootFrame::SetHideRedlines(bool const bHideRedlines)
4725{
4726 if (bHideRedlines == mbHideRedlines)
4727 {
4728 return;
4729 }
4730 // TODO: remove temporary ShowBoth
4733 if (HasMergedParas())
4734 {
4737 mbHideRedlines = false;
4738 UnHide(*this);
4739 }
4740 if (bHideRedlines || eMode != m_FieldmarkMode || ePBMode != m_ParagraphBreakMode)
4741 {
4743 m_ParagraphBreakMode = ePBMode;
4744 mbHideRedlines = bHideRedlines;
4745 UnHide(*this);
4746 }
4747}
4748
4750{
4751 if (eFMMode == m_FieldmarkMode && ePBMode == m_ParagraphBreakMode)
4752 {
4753 return;
4754 }
4755 // TODO: remove temporary ShowBoth
4756 bool const isHideRedlines(mbHideRedlines);
4757 if (HasMergedParas())
4758 {
4759 mbHideRedlines = false;
4762 UnHide(*this);
4763 }
4764 if (isHideRedlines || eFMMode != sw::FieldmarkMode::ShowBoth || ePBMode == sw::ParagraphBreakMode::Hidden)
4765 {
4766 mbHideRedlines = isHideRedlines;
4767 m_FieldmarkMode = eFMMode;
4768 m_ParagraphBreakMode = ePBMode;
4769 UnHide(*this);
4770 }
4771}
4772
4774{
4775 return IsHideRedlines()
4778}
4779
4780namespace {
4781 xmlTextWriterPtr lcl_createDefaultWriter()
4782 {
4783 xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 );
4784 xmlTextWriterSetIndent(writer,1);
4785 (void)xmlTextWriterSetIndentString(writer, BAD_CAST(" "));
4786 (void)xmlTextWriterStartDocument( writer, nullptr, nullptr, nullptr );
4787 return writer;
4788 }
4789
4790 void lcl_freeWriter( xmlTextWriterPtr writer )
4791 {
4792 (void)xmlTextWriterEndDocument( writer );
4793 xmlFreeTextWriter( writer );
4794 }
4795}
4796
4798{
4799 bool bCreateWriter = (nullptr == writer);
4800 if (bCreateWriter)
4801 writer = lcl_createDefaultWriter();
4802
4803 (void)xmlTextWriterStartElement(writer, reinterpret_cast<const xmlChar*>("root"));
4804 dumpAsXmlAttributes(writer);
4805
4806 (void)xmlTextWriterStartElement(writer, BAD_CAST("sfxViewShells"));
4807 SwView* pView = static_cast<SwView*>(SfxViewShell::GetFirst(true, checkSfxViewShell<SwView>));
4808 while (pView)
4809 {
4811 pView->dumpAsXml(writer);
4812 pView = static_cast<SwView*>(SfxViewShell::GetNext(*pView, true, checkSfxViewShell<SwView>));
4813 }
4814 (void)xmlTextWriterEndElement(writer);
4815
4816 (void)xmlTextWriterStartElement(writer, BAD_CAST("infos"));
4817 dumpInfosAsXml(writer);
4818 (void)xmlTextWriterEndElement(writer);
4819 dumpChildrenAsXml(writer);
4820 (void)xmlTextWriterEndElement(writer);
4821
4822 if (bCreateWriter)
4823 lcl_freeWriter(writer);
4824}
4825
4826/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::chart::ChartAxisLabelPosition ePos
@ CONSIDER_WRAP_ON_OBJECT_POSITION
EdgeEntry * mpNext
static sal_uInt8 nFramePos
Definition: basesh.cxx:129
SvxGraphicPosition
GPOS_NONE
GPOS_TILED
Document fields related interfaces.
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
virtual void UpdateRefFields()=0
virtual void UpdatePageFields(const SwTwips)=0
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields)=0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
constexpr tools::Long Y() const
constexpr tools::Long X() const
SfxHintId GetId() const
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
bool IsReadOnly() const
sal_uInt16 Which() const
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
virtual SfxObjectShell * GetObjectShell() override
constexpr tools::Long Height() const
constexpr tools::Long Width() const
tools::Long GetHeight() const
tools::Long GetWidth() const
class for the positioning of drawing objects
wrapper class for the positioning of Writer fly frames and drawing objects
const SwFrame * GetAnchorFrame() const
virtual const SwFlyFrame * DynCastFlyFrame() const
void InvalidateObjRectWithSpaces() const
sal_uInt16 Count() const
Definition: hints.hxx:353
void ClearItem(sal_uInt16 nWhichL)
Definition: hints.cxx:122
const SwAttrSet * GetChgSet() const
What has changed.
Definition: hints.hxx:347
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:165
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:101
Container of body content (i.e.
Definition: bodyfrm.hxx:29
const Size & GetSize() const
Definition: frmtool.hxx:414
tools::Long CalcLeft(const SwFrame *pCaller) const
Definition: frmtool.cxx:2382
sal_uInt16 CalcTop() const
Definition: frmtool.hxx:536
const SwAttrSet & GetAttrSet() const
Definition: frmtool.hxx:397
tools::Long CalcRight(const SwFrame *pCaller) const
Definition: frmtool.cxx:2311
sal_uInt16 CalcBottom() const
Definition: frmtool.hxx:542
SwCellFrame is one table cell in the document layout.
Definition: cellfrm.hxx:31
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:457
const SwCellFrame & FindStartEndOfRowSpanCell(bool bStart) const
Definition: findfrm.cxx:1770
tools::Long GetLayoutRowSpan() const
Definition: tabfrm.cxx:5820
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
virtual void Cut() override
Definition: wsfrm.cxx:1141
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: wsfrm.cxx:1038
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:120
SwTextFrame * FindMaster() const
Definition: flowfrm.cxx:762
void UpdateAttr_(const SfxPoolItem *, const SfxPoolItem *, SwContentFrameInvFlags &, SwAttrSetChg *pa=nullptr, SwAttrSetChg *pb=nullptr)
Definition: wsfrm.cxx:2428
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:2353
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: wsfrm.cxx:2232
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: wsfrm.cxx:2111
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1223
Definition: doc.hxx:197
const SwFootnoteInfo & GetFootnoteInfo() const
Definition: doc.hxx:645
bool IsInDtor() const
Definition: doc.hxx:417
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:349
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:649
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
Definition: doc.hxx:759
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
virtual void UpdateFields()
Definition: fldbas.cxx:219
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:3119
bool IsLocked() const
Definition: flyfrm.hxx:215
bool IsFlyInContentFrame() const
Definition: flyfrm.hxx:217
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:429
bool IsAutoPos() const
Definition: flyfrm.hxx:216
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:48
SwFootnoteContFrame * FindFootnoteCont()
Definition: ftnfrm.cxx:1038
SwTwips GetVarSpace() const
Definition: ftnfrm.cxx:2539
Represents one footnote or endnote in the layout.
Definition: ftnfrm.hxx:84
const SwTextFootnote * GetAttr() const
Definition: ftnfrm.hxx:126
void UpdateAllFootnote()
Definition: ftnidx.cxx:266
SwFootnoteNum m_eNum
Definition: ftninfo.hxx:98
FlyAnchors.
Definition: fmtanchr.hxx:37
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
bool IsOrtho() const
Definition: fmtclds.hxx:121
sal_uInt16 GetNumCols() const
Definition: fmtclds.hxx:114
SfxPoolItem subclass for footnotes and endnotes, stored in the anchor text node.
Definition: fmtftn.hxx:47
sal_uInt16 GetNumber() const
Definition: fmtftn.hxx:73
const OUString & GetNumStr() const
Definition: fmtftn.hxx:72
sal_uInt16 GetNumberRLHidden() const
Definition: fmtftn.hxx:74
bool IsEndNote() const
Definition: fmtftn.hxx:75
sal_uInt8 GetWidthPercent() const
Definition: fmtfsize.hxx:91
SwFrameSize GetHeightSizeType() const
Definition: fmtfsize.hxx:80
sal_uInt8 GetHeightPercent() const
Definition: fmtfsize.hxx:88
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
Defines the vertical position of a fly frame.
Definition: fmtornt.hxx:37
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:58
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:57
Base class for various Writer styles.
Definition: format.hxx:47
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:712
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:366
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:711
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:736
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
Templatized version of GetItemState() to directly return the correct type.
Definition: format.hxx:111
SwFrameAreaDefinition & mrTarget
Definition: frame.hxx:190
void setSwRect(const SwRect &rNew)
Definition: frame.hxx:198
Helper class to isolate geometry-defining members of SwFrame and to control their accesses.
Definition: frame.hxx:133
const SwRect & getFrameArea() const
Definition: frame.hxx:179
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:171
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
Definition: wsfrm.cxx:127
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
void setFramePrintAreaValid(bool bNew)
Definition: wsfrm.cxx:102
void setFrameAreaPositionValid(bool bNew)
Definition: wsfrm.cxx:86
bool mbFrameAreaPositionValid
Definition: frame.hxx:146
virtual void transform_translate(const Point &rOffset)
Definition: wsfrm.cxx:150
bool isFramePrintAreaValid() const
Definition: frame.hxx:168
virtual ~SwFrameAreaDefinition()
Definition: wsfrm.cxx:82
bool isFrameAreaSizeValid() const
Definition: frame.hxx:167
bool mbFramePrintAreaValid
Definition: frame.hxx:148
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const
Definition: wsfrm.cxx:137
void setFrameAreaSizeValid(bool bNew)
Definition: wsfrm.cxx:94
Style of a layout element.
Definition: frmfmt.hxx:72
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool mbFixSize
Definition: frame.hxx:428
bool IsRowFrame() const
Definition: frame.hxx:1228
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1516
bool IsCellFrame() const
Definition: frame.hxx:1232
SwFrame * mpPrev
Definition: frame.hxx:339
bool mbDerivedVert
Definition: frame.hxx:421
bool mbDerivedR2L
Definition: frame.hxx:418
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:166
bool IsFootnoteContFrame() const
Definition: frame.hxx:1204
void InsertBehind(SwLayoutFrame *pParent, SwFrame *pBefore)
Insert SwFrame into existing structure.
Definition: wsfrm.cxx:877
void ValidateThisAndAllLowers(const sal_uInt16 nStage)
Definition: wsfrm.cxx:2067
void ImplInvalidatePrt()
Definition: wsfrm.cxx:1979
void InvalidateLineNum_()
Definition: frame.hxx:801
bool IsTextFrame() const
Definition: frame.hxx:1240
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true)
Definition: wsfrm.cxx:608
void RegisterToFormat(SwFormat &rFormat)
Definition: wsfrm.cxx:338
SwFrame * GetIndPrev() const
Definition: frame.hxx:730
void ImplInvalidatePos()
Definition: wsfrm.cxx:1995
void InvalidateLineNum()
Definition: frame.hxx:1056
void CheckDirChange()
checks the layout direction and invalidates the lower frames recursively, if necessary.
Definition: ssfrm.cxx:195
bool IsInDocBody() const
Definition: frame.hxx:949
SwTwips Shrink(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1560
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1117
bool IsAccessibleFrame() const
Definition: frame.hxx:1256
void ImplInvalidateSize()
Definition: wsfrm.cxx:1963
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1121
bool mbValidLineNum
Definition: frame.hxx:427
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1105
SwFrame * FindNext()
Definition: frame.hxx:1147
SwFrame * GetNext()
Definition: frame.hxx:682
bool InsertGroupBefore(SwFrame *pParent, SwFrame *pWhere, SwFrame *pSct)
Insert a chain of SwFrames into an existing structure.
Definition: wsfrm.cxx:916
bool HasFixSize() const
Definition: frame.hxx:676
void SetDirFlags(bool bVert)
Updates the vertical or the righttoleft-flags.
Definition: findfrm.cxx:1553
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
bool IsPageFrame() const
Definition: frame.hxx:1184
bool IsColLocked() const
Definition: frame.hxx:892
bool IsColumnFrame() const
Definition: frame.hxx:1188
bool mbCompletePaint
Definition: frame.hxx:433
void ReinitializeFrameSizeAttrFlags()
Definition: wsfrm.cxx:2028
void InvalidateNextPos(bool bNoFootnote=false)
Definition: frame.hxx:1078
bool IsVertLRBT() const
Definition: frame.hxx:989
InvalidationType
enumeration for the different invalidations #i28701#
Definition: frame.hxx:491
@ INVALID_PRTAREA
Definition: frame.hxx:492
@ INVALID_SIZE
Definition: frame.hxx:492
@ INVALID_LINENUM
Definition: frame.hxx:492
@ INVALID_POS
Definition: frame.hxx:492
bool IsTabFrame() const
Definition: frame.hxx:1224
virtual bool InvalidationAllowed(const InvalidationType _nInvalid) const
method to determine, if an invalidation is allowed.
Definition: wsfrm.cxx:1957
void InvalidatePos_()
Definition: frame.hxx:793
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
void ImplInvalidateLineNum()
Definition: wsfrm.cxx:2015
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1799
void InvalidateObjs(const bool _bNoInvaOfAsCharAnchoredObjs=true)
Definition: fly.cxx:2582
bool IsRetoucheFrame() const
Definition: frame.hxx:1252
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:568
bool IsInTab() const
Definition: frame.hxx:961
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: wsfrm.cxx:482
virtual void MakePos()
Calculates the frame area position, in case it's invalid.
Definition: calcmove.cxx:526
bool mbVertical
Definition: frame.hxx:422
SwLayoutFrame * mpUpper
Definition: frame.hxx:337
bool KnowsFormat(const SwFormat &rFormat) const
Definition: wsfrm.cxx:333
bool IsRightToLeft() const
Definition: frame.hxx:993
void InsertBefore(SwLayoutFrame *pParent, SwFrame *pBehind)
Insert SwFrame into existing structure.
Definition: wsfrm.cxx:841
static void CheckPageDescs(SwPageFrame *pStart, bool bNotifyFields=true, SwPageFrame **ppPrev=nullptr)
Check all pages (starting from the given one) if they use the appropriate frame format.
Definition: pagechg.cxx:1078
virtual bool IsDeleteForbidden() const
Definition: frame.hxx:893
bool IsPageBodyFrame() const
Definition: layfrm.hxx:215
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
friend class SwLayoutFrame
Definition: frame.hxx:318
void dumpInfosAsXml(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:171
void RemoveFromLayout()
Definition: wsfrm.cxx:1018
bool IsFlowFrame() const
Definition: frame.hxx:1248
void InvalidatePrt()
Definition: frame.hxx:1042
void UpdateAttrFrame(const SfxPoolItem *, const SfxPoolItem *, SwFrameInvFlags &)
Definition: wsfrm.cxx:534
bool mbRightToLeft
Definition: frame.hxx:419
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
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:188
bool IsCompletePaint() const
Definition: frame.hxx:605
bool IsVertical() const
Definition: frame.hxx:979
SwFrame * mpNext
Definition: frame.hxx:338
void InvalidatePage(const SwPageFrame *pPage=nullptr) const
Invalidates the page in which the Frame is currently placed.
Definition: wsfrm.cxx:618
SwRootFrame * getRootFrame()
Definition: frame.hxx:685
void SetCompletePaint() const
Definition: frame.hxx:1000
bool IsFlyFrame() const
Definition: frame.hxx:1216
bool IsContentFrame() const
Definition: frame.hxx:1236
void CheckDir(SvxFrameDirection nDir, bool bVert, bool bOnlyBiDi, bool bBrowse)
Definition: wsfrm.cxx:343
virtual void CheckDirection(bool bVert)
Definition: wsfrm.cxx:398
bool mbInvalidR2L
Definition: frame.hxx:417
void InvalidatePrt_()
Definition: frame.hxx:785
bool IsFootnoteBossFrame() const
Definition: frame.hxx:1192
SwFrame * GetPrev()
Definition: frame.hxx:683
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false)=0
void InvalidateSize_()
Definition: frame.hxx:777
bool IsSctFrame() const
Definition: frame.hxx:1220
bool IsVertLR() const
Definition: frame.hxx:985
void InvalidateSize()
Definition: frame.hxx:1035
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:217
SwTwips AdjustNeighbourhood(SwTwips nDiff, bool bTst=false)
Adjust surrounding neighbourhood after insertion.
Definition: wsfrm.cxx:1620
bool mbVertLRBT
Definition: frame.hxx:425
SwPageFrame * FindPageFrame()
Definition: frame.hxx:686
const SwRowFrame * IsInSplitTableRow() const
Definition: findfrm.cxx:1841
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:633
bool mbVertLR
Definition: frame.hxx:424
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1113
virtual const IDocumentDrawModelAccess & getIDocumentDrawModelAccess()
Definition: wsfrm.cxx:328
virtual const SwFormatPageDesc & GetPageDescItem() const
Definition: findfrm.cxx:747
SwFrame * GetIndNext()
Definition: frame.hxx:733
virtual void ActionOnInvalidation(const InvalidationType _nInvalid)
method to perform additional actions on an invalidation
Definition: wsfrm.cxx:1951
SwFootnoteBossFrame * FindFootnoteBossFrame(bool bFootnotes=false)
Definition: findfrm.cxx:491
virtual Size ChgSize(const Size &aNewSize)
Definition: wsfrm.cxx:742
void InvalidateAll_()
Definition: frame.hxx:809
SwFrame(sw::BroadcastingModify *, SwFrame *)
Definition: wsfrm.cxx:295
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:390
void SetRetouche() const
Definition: frame.hxx:1009
void dumpChildrenAsXml(xmlTextWriterPtr writer) const
Definition: xmldump.cxx:246
bool IsLayoutFrame() const
Definition: frame.hxx:1176
bool IsBodyFrame() const
Definition: frame.hxx:1212
bool IsNeighbourFrame() const
Definition: frame.hxx:918
bool IsColBodyFrame() const
These SwFrame inlines are here, so that frame.hxx does not need to include layfrm....
Definition: layfrm.hxx:210
bool IsInSct() const
Definition: frame.hxx:973
TElementType * Next()
Definition: calbck.hxx:380
TElementType * First()
Definition: calbck.hxx:372
void SetCheckPageNum(sal_uInt16 nNew)
Definition: layact.hxx:227
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame.
Definition: layfrm.hxx:36
void ChgLowersProp(const Size &rOldSize)
Change size of lowers proportionally.
Definition: wsfrm.cxx:3067
void AdjustColumns(const SwFormatCol *pCol, bool bAdjustAttributes)
Definition: colfrm.cxx:313
virtual void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
"Formats" the Frame; Frame and PrtArea.
Definition: wsfrm.cxx:3466
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:233
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:401
virtual SwTwips GrowFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: wsfrm.cxx:2641
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method <ContainsAny()> doesn't investigate content of footnotes by default.
Definition: findfrm.cxx:131
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: wsfrm.cxx:1350
virtual SwTwips ShrinkFrame(SwTwips, bool bTst=false, bool bInfo=false) override
Definition: wsfrm.cxx:2840
void NotifyLowerObjs(const bool _bUnlockPosOfObjs=false)
force an unlockposition call for the lower objects.
Definition: fly.cxx:2649
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
SwFrame * m_pLower
Definition: layfrm.hxx:53
tools::Long CalcRel(const SwFormatFrameSize &rSz) const
Definition: wsfrm.cxx:3647
void InvaPercentLowers(SwTwips nDiff=0)
Invalidates the inner Frames, whose width and/or height are calculated using percentages.
Definition: wsfrm.cxx:3616
SwTwips InnerHeight() const
InnerHeight returns the height of the content and may be bigger or less than the PrtArea-Height of th...
Definition: wsfrm.cxx:2602
const SwFrame * Lower() const
Definition: layfrm.hxx:101
virtual void Cut() override
Definition: wsfrm.cxx:1447
void FormatWidthCols(const SwBorderAttrs &, const SwTwips nBorder, const SwTwips nMinHeight)
Called by Format for Frames and Areas with columns.
Definition: wsfrm.cxx:3731
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:706
bool IsContentNode() const
Definition: node.hxx:188
SwDoc & GetDoc()
Definition: node.hxx:233
bool IsEndNode() const
Definition: node.hxx:189
bool IsStartNode() const
Definition: node.hxx:187
bool IsSectionNode() const
Definition: node.hxx:192
bool IsTableNode() const
Definition: node.hxx:191
bool IsTextNode() const
Definition: node.hxx:190
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
Merge GetRedlineMergeFlag() const
Definition: node.hxx:116
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:691
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:112
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwTableNode * GetTableNode()
Definition: node.hxx:650
std::vector< SwFrameFormat * > const & GetAnchoredFlys() const
Definition: node.hxx:318
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
SwNode & GetEndOfAutotext() const
Section for all Flys/Header/Footers.
Definition: ndarr.hxx:158
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
SwNode & GetEndOfInserts() const
Section for all footnotes.
Definition: ndarr.hxx:156
const SwPosition * Start() const
Definition: pam.hxx:258
A page of the document layout.
Definition: pagefrm.hxx:60
void InvalidateContent() const
Definition: pagefrm.hxx:389
void InvalidateWordCount() const
Definition: pagefrm.hxx:406
void InvalidateFlyLayout() const
Validate, invalidate and query the Page status Layout/Content and Fly/non-Fly respectively are inspec...
Definition: pagefrm.hxx:373
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:402
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:209
void InvalidateFlyInCnt() const
Definition: pagefrm.hxx:381
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:136
void InvalidateSmartTags() const
Definition: pagefrm.hxx:398
void InvalidateSpelling() const
Definition: pagefrm.hxx:393
void InvalidateLayout() const
Definition: pagefrm.hxx:385
bool IsFootnotePage() const
Foot note interface.
Definition: pagefrm.hxx:204
void InvalidateFlyContent() const
Definition: pagefrm.hxx:377
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1975
bool IsVert() const
Definition: frame.hxx:1372
tools::Long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1387
tools::Long GetTopMargin(const SwFrame &rFrame) const
Definition: frame.hxx:1408
void SetYMargins(SwFrame &rFrame, tools::Long nTop, tools::Long nBottom) const
Definition: frame.hxx:1413
void SetHeight(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1396
tools::Long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1382
bool IsVertL2R() const
Definition: frame.hxx:1373
void AddBottom(SwRect &rRect, tools::Long nNew) const
Definition: frame.hxx:1399
tools::Long BottomDist(const SwRect &rRect, tools::Long nPos) const
Definition: frame.hxx:1419
tools::Long GetPrtBottom(const SwFrame &rFrame) const
Definition: frame.hxx:1415
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
bool HasArea() const
Definition: swrect.hxx:300
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
void AddHeight(const tools::Long nAdd)
Definition: swrect.cxx:124
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374
void Left(const tools::Long nLeft)
Definition: swrect.hxx:197
void Width(tools::Long nNew)
Definition: swrect.hxx:189
bool empty() const
Definition: docary.hxx:267
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:215
const SwContentFrame * GetTurbo() const
Definition: rootfrm.hxx:361
void SetSuperfluous()
Remove superfluous Pages.
Definition: rootfrm.hxx:310
bool HasMergedParas() const
Definition: wsfrm.cxx:4773
bool IsAnyShellAccessible() const
Definition: rootfrm.hxx:402
void SetHideRedlines(bool)
Definition: wsfrm.cxx:4724
void SetTurbo(const SwContentFrame *pContent)
Definition: rootfrm.hxx:359
void SetIdleFlags()
Definition: rootfrm.hxx:257
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:434
void SetNeedGrammarCheck(bool bVal)
Definition: rootfrm.hxx:271
void InvalidateAllContent(SwInvalidateFlags nInvalidate)
Invalidate all Content, Size or PrtArea.
Definition: wsfrm.cxx:4208
sw::FieldmarkMode GetFieldmarkMode() const
Definition: rootfrm.hxx:436
void DisallowTurbo() const
Definition: rootfrm.hxx:356
void InvalidateAllObjPos()
Invalidate/re-calculate the position of all floating screen objects (Writer fly frames and drawing ob...
Definition: wsfrm.cxx:4254
bool IsTurboAllowed() const
Definition: rootfrm.hxx:358
sw::FieldmarkMode m_FieldmarkMode
Definition: rootfrm.hxx:128
void ResetTurbo()
Definition: rootfrm.hxx:360
void SetFieldmarkMode(sw::FieldmarkMode, sw::ParagraphBreakMode)
Definition: wsfrm.cxx:4749
sw::ParagraphBreakMode GetParagraphBreakMode() const
Definition: rootfrm.hxx:438
void dumpAsXml(xmlTextWriterPtr writer=nullptr) const override
Definition: wsfrm.cxx:4797
sw::ParagraphBreakMode m_ParagraphBreakMode
Definition: rootfrm.hxx:129
bool mbHideRedlines
Definition: rootfrm.hxx:127
SwSection * GetSection()
Definition: sectfrm.hxx:97
bool IsEndnAtEnd() const
Definition: sectfrm.hxx:162
void DelEmpty(bool bRemove)
Definition: sectfrm.cxx:192
SwTwips Shrink_(SwTwips, bool bTst)
Definition: sectfrm.cxx:2315
SwTwips Grow_(SwTwips, bool bTst)
Definition: sectfrm.cxx:2180
bool ToMaximize_() const
Definition: sectfrm.hxx:125
SwContentFrame * FindLastContent(SwFindMode nMode=SwFindMode::None)
Definition: sectfrm.cxx:935
SwTwips Undersize()
Returns the size delta that the section would like to be greater if it has undersized TextFrames in i...
Definition: sectfrm.cxx:2848
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:415
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:174
A section node represents the start of a section on the UI, i.e.
Definition: node.hxx:575
const SwSection & GetSection() const
Definition: node.hxx:590
bool IsHiddenFlag() const
Definition: section.hxx:190
class for collecting anchored objects
Definition: sortedobjs.hxx:49
size_t size() const
Definition: sortedobjs.cxx:43
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:49
SwContentFrame * FindLastContent()
Definition: tabfrm.cxx:3722
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:443
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
void SetResizeHTMLTable()
Definition: tabfrm.hxx:173
const SwTable * GetTable() const
Definition: tabfrm.hxx:162
void SetRemoveFollowFlowLinePending(bool bNew)
Definition: tabfrm.hxx:188
sal_Int32 getRowSpan() const
Definition: swtable.hxx:540
const SwTable & GetTable() const
Definition: node.hxx:542
void MakeOwnFrames(SwPosition *pIdxBehind=nullptr)
Creates the frms for the table node (i.e.
Definition: ndtbl.cxx:2414
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
Definition: ndtbl.cxx:2461
bool IsDeleted() const
Definition: swtable.cxx:1611
bool HasDeletedRowOrCell() const
Definition: swtable.cxx:1587
SwHTMLTableLayout * GetHTMLTableLayout()
Definition: swtable.hxx:182
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:208
SwTextAttr subclass for footnotes and endnotes.
Definition: txtftn.hxx:34
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
SwTextFrame * GetFollow()
Definition: txtfrm.hxx:889
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:465
SwTwips GetParHeight() const
Returns the sum of line height in pLine.
Definition: txtfrm.cxx:3453
virtual void CheckDirection(bool bVert) override
Definition: wsfrm.cxx:474
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:472
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1390
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
bool IsGrammarCheckDirty() const
Definition: txtedt.cxx:2365
bool IsNumbered(SwRootFrame const *pLayout=nullptr) const
Returns is this text node is numbered.
Definition: ndtxt.cxx:2989
void NumRuleChgd()
Notify this textnode that its numbering rule has changed.
Definition: ndtxt.cxx:2961
bool getBrowseMode() const
Definition: viewopt.hxx:636
bool IsWhitespaceHidden() const
Definition: viewopt.hxx:652
bool IsShowChangesInMargin() const
Definition: viewopt.hxx:455
void CheckWaitCursor()
If an Action is running we ask it to check whether it's time to enable the WaitCursor.
Definition: viewimp.cxx:183
void SetFirstVisPageInvalid()
Definition: viewimp.hxx:149
bool IsAction() const
SS for the Lay-/IdleAction and relatives.
Definition: viewimp.hxx:196
SwLayAction & GetLayAction()
Definition: viewimp.hxx:198
void MoveAccessibleFrame(const SwFrame *pFrame, const SwRect &rOldFrame)
Definition: viewimp.hxx:298
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:365
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
SwViewShellImp * Imp()
Definition: viewsh.hxx:211
bool ActionPend() const
Definition: viewsh.hxx:225
const SwRect & VisArea() const
Definition: viewsh.cxx:642
sal_Int32 GetBrowseWidth() const
Definition: viewsh.cxx:2092
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:568
SfxViewShell * GetSfxViewShell() const
Definition: viewsh.hxx:470
Definition: view.hxx:146
void dumpAsXml(xmlTextWriterPtr pWriter) const override
See SfxViewShell::dumpAsXml().
Definition: viewprt.cxx:270
SwRect getUntransformedFramePrintArea() const
Definition: wsfrm.cxx:191
void adaptFrameAreasToTransformations()
Definition: wsfrm.cxx:236
void restoreFrameAreas()
Definition: wsfrm.cxx:271
void transform(const basegfx::B2DHomMatrix &aTransform)
Definition: wsfrm.cxx:289
SwRect getUntransformedFrameArea() const
Definition: wsfrm.cxx:167
void createFrameAreaTransformations(double fRotation, const basegfx::B2DPoint &rCenter)
Definition: wsfrm.cxx:216
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
bool isIdentity() const
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
TYPE getWidth() const
TYPE getMinX() const
TYPE getMinY() const
TYPE getHeight() const
TYPE getX() const
TYPE getY() const
SwContentFrameInvFlags
Definition: cntfrm.hxx:38
@ Shrink
@ GrowTest
@ AdjustN
@ ShrinkTest
#define PROTOCOL_ENTER(pFrame, nFunc, nAct, pPar)
Definition: dbg_lay.hxx:92
struct _xmlTextWriter * xmlTextWriterPtr
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
EmbeddedObjectRef * pObject
@ TableOfAuthorities
@ Fixed
Frame cannot be moved in Var-direction.
@ Variable
Frame is variable in Var-direction.
@ Minimum
Value in Var-direction gives minimum (can be exceeded but not be less).
FormulaTreeNodeRef mpRoot
SwRectFn fnRectVert
Definition: frame.hxx:1353
#define FRM_HEADFOOT
Definition: frame.hxx:108
SwFrameInvFlags
Definition: frame.hxx:293
SwFrameType
Definition: frame.hxx:75
#define FRM_NEIGHBOUR
Definition: frame.hxx:106
SwRectFn fnRectVertL2RB2T
Definition: frame.hxx:1353
#define FRM_BODYFTNC
Definition: frame.hxx:109
SwRectFn fnRectHori
Definition: newfrm.cxx:287
SwRectFn fnRectVertL2R
Definition: frame.hxx:1353
SvxFrameDirection
void RemoveHiddenObjsOfNode(SwTextNode const &rNode, std::vector< sw::Extent >::const_iterator const *pIter, std::vector< sw::Extent >::const_iterator const *pEnd, SwTextNode const *pFirstNode, SwTextNode const *pLastNode)
Definition: frmtool.cxx:1212
void MakeFrames(SwDoc *pDoc, SwNode &rSttIdx, SwNode &rEndIdx)
Definition: frmtool.cxx:2026
constexpr tools::Long BROWSE_HEIGHT
Definition: frmtool.hxx:54
void CalcContent(SwLayoutFrame *pLay, bool bNoColl=false)
Definition: fly.cxx:1550
#define FAR_AWAY
Definition: frmtool.hxx:53
void AppendObjsOfNode(sw::FrameFormats< sw::SpzFrameFormat * > const *pTable, SwNodeOffset nIndex, SwFrame *pFrame, SwPageFrame *pPage, SwDoc *pDoc, std::vector< sw::Extent >::const_iterator const *pIter, std::vector< sw::Extent >::const_iterator const *pEnd, SwTextNode const *pFirstNode, SwTextNode const *pLastNode)
Definition: frmtool.cxx:1233
void AppendAllObjs(const sw::FrameFormats< sw::SpzFrameFormat * > *pSpzs, const SwFrame *pSib)
Definition: frmtool.cxx:1382
SwNeighbourAdjust
Definition: ftnboss.hxx:43
@ FTNNUM_CHAPTER
Definition: ftninfo.hxx:87
@ FTNPOS_CHAPTER
Definition: ftninfo.hxx:82
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr TypedWhichId< SvxFormatKeepItem > RES_KEEP(116)
constexpr TypedWhichId< SvxUnderlineItem > RES_CHRATR_UNDERLINE(14)
constexpr TypedWhichId< SvxAutoKernItem > RES_CHRATR_AUTOKERN(17)
constexpr TypedWhichId< SvxFontHeightItem > RES_CHRATR_FONTSIZE(8)
constexpr TypedWhichId< SwFormatRowSplit > RES_ROW_SPLIT(128)
constexpr TypedWhichId< SvxFirstLineIndentItem > RES_MARGIN_FIRSTLINE(91)
constexpr TypedWhichId< SvxShadowedItem > RES_CHRATR_SHADOWED(13)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatCol > RES_COL(115)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SfxBoolItem > RES_RTL_GUTTER(139)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(99)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SvxContourItem > RES_CHRATR_CONTOUR(4)
constexpr TypedWhichId< SvxEscapementItem > RES_CHRATR_ESCAPEMENT(6)
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr TypedWhichId< SwHeaderAndFooterEatSpacingItem > RES_HEADER_FOOTER_EAT_SPACING(127)
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
constexpr TypedWhichId< SvxOverlineItem > RES_CHRATR_OVERLINE(38)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SvxBoxItem > RES_BOX(112)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SvxRightMarginItem > RES_MARGIN_RIGHT(93)
constexpr TypedWhichId< SvxTextLeftMarginItem > RES_MARGIN_TEXTLEFT(92)
constexpr TypedWhichId< SwParaConnectBorderItem > RES_PARATR_CONNECT_BORDER(78)
constexpr TypedWhichId< SvxKerningItem > RES_CHRATR_KERNING(9)
constexpr TypedWhichId< SvxFontItem > RES_CHRATR_FONT(7)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr TypedWhichId< SfxBoolItem > RES_BACKGROUND_FULL_SIZE(138)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(168)
static bool bFootnote
Definition: insfnote.cxx:33
Mode eMode
sal_Int16 nAdjust
const long LONG_MAX
#define SAL_WARN(area, stream)
tools::Long const nBorder
B2DHomMatrix createScaleTranslateB2DHomMatrix(double fScaleX, double fScaleY, double fTranslateX, double fTranslateY)
B2DHomMatrix createRotateAroundPoint(double fPointX, double fPointY, double fRadiant)
B2DTuple absolute(const B2DTuple &rTup)
B2IRange fround(const B2DRange &rRange)
int i
constexpr T saturating_add(T a, T b)
None
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Dialog to specify the properties of date form field.
ParagraphBreakMode
Definition: rootfrm.hxx:50
void RemoveFootnotesForNode(SwRootFrame const &rLayout, SwTextNode const &rTextNode, std::vector< std::pair< sal_Int32, sal_Int32 > > const *const pExtents)
Definition: txtfrm.cxx:891
FieldmarkMode
Definition: rootfrm.hxx:49
bool IsPageFrameEmpty(SwPageFrame const &rPage)
check if there's content on the page that requires it to exist
Definition: pagechg.cxx:1015
void AddRemoveFlysAnchoredToFrameStartingAtNode(SwTextFrame &rFrame, SwTextNode &rTextNode, std::set< SwNodeOffset > *pSkipped)
rTextNode is the first one of the "new" merge - if rTextNode isn't the same as MergedPara::pFirstNode...
Definition: wsfrm.cxx:4325
std::unique_ptr< sw::MergedPara > CheckParaRedlineMerge(SwTextFrame &rFrame, SwTextNode &rTextNode, FrameMode eMode)
Definition: redlnitr.cxx:268
long Long
SwNodeOffset min(const SwNodeOffset &a, const SwNodeOffset &b)
Definition: nodeoffset.hxx:35
SwNodeOffset abs(const SwNodeOffset &a)
Definition: nodeoffset.hxx:34
const char GetValue[]
SwInvalidateFlags
Definition: rootfrm.hxx:54
Marks a position in the document model.
Definition: pam.hxx:38
SwNode & GetNode() const
Definition: pam.hxx:81
SwRectSet fnSetWidth
Definition: frame.hxx:1309
SwRectGet fnGetWidth
Definition: frame.hxx:1300
SwRectGet fnGetLeft
Definition: frame.hxx:1298
SwFrameMax fnSetLimit
Definition: frame.hxx:1336
SwFrameSet fnSetYMargins
Definition: frame.hxx:1327
SwRectGet fnGetHeight
Definition: frame.hxx:1301
SwRectSet fnSetHeight
Definition: frame.hxx:1310
SwFrameSet fnSetXMargins
Definition: frame.hxx:1326
SwFrameGet fnGetPrtBottom
Definition: frame.hxx:1329
SwRectGet fnGetTop
Definition: frame.hxx:1296
Describes parts of multiple text nodes, which will form a text frame, even when redlines are hidden a...
Definition: txtfrm.hxx:991
tools::Long SwTwips
Definition: swtypes.hxx:51
PrepareHint
Definition: swtypes.hxx:206
@ FootnoteInvalidation
@ AdjustSizeWithoutFormatting
static void lcl_InvalidateAllContent(SwContentFrame *pCnt, SwInvalidateFlags nInv)
Definition: wsfrm.cxx:4191
static void lcl_InvalidateContent(SwContentFrame *pCnt, SwInvalidateFlags nInv)
Definition: wsfrm.cxx:4128
static void UnHideRedlines(SwRootFrame &rLayout, SwNodes &rNodes, SwNode const &rEndOfSectionNode, std::set< SwNodeOffset > *const pSkipped)
Definition: wsfrm.cxx:4380
static bool lcl_IsFlyHeightClipped(SwLayoutFrame *pLay)
Definition: wsfrm.cxx:3704
static SwContentFrame * lcl_InvalidateSection(SwFrame *pCnt, SwInvalidateFlags nInv)
Definition: wsfrm.cxx:4090
static tools::Long lcl_CalcMinColDiff(SwLayoutFrame *pLayFrame)
Definition: wsfrm.cxx:3673
static void UnHideRedlinesExtras(SwRootFrame &rLayout, SwNodes &rNodes, SwNode const &rEndOfExtraSectionNode, std::set< SwNodeOffset > *const pSkipped)
Definition: wsfrm.cxx:4579
static SwContentFrame * lcl_InvalidateTable(SwTabFrame *pTable, SwInvalidateFlags nInv)
Definition: wsfrm.cxx:4113
static void InvaPercentFlys(SwFrame *pFrame, SwTwips nDiff)
Definition: wsfrm.cxx:3582
static void AddRemoveFlysForNode(SwTextFrame &rFrame, SwTextNode &rTextNode, std::set< SwNodeOffset > *const pSkipped, const sw::FrameFormats< sw::SpzFrameFormat * > &rTable, SwPageFrame *const pPage, SwTextNode const *const pNode, std::vector< sw::Extent >::const_iterator const &rIterFirst, std::vector< sw::Extent >::const_iterator const &rIterEnd, SwTextNode const *const pFirstNode, SwTextNode const *const pLastNode)
Definition: wsfrm.cxx:4286
static void UnHide(SwRootFrame &rLayout)
Definition: wsfrm.cxx:4621
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)