LibreOffice Module sw (master) 1
frmtool.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 <svx/svdpage.hxx>
23#include <editeng/brushitem.hxx>
24#include <editeng/shaditem.hxx>
25#include <editeng/ulspitem.hxx>
26#include <editeng/boxitem.hxx>
27#include <editeng/lspcitem.hxx>
28#include <editeng/fhgtitem.hxx>
29#include <sal/log.hxx>
30#include <o3tl/deleter.hxx>
31#include <osl/diagnose.h>
32
33#include <drawdoc.hxx>
34#include <fmtornt.hxx>
35#include <fmthdft.hxx>
36#include <fmtfsize.hxx>
37#include <fmtsrnd.hxx>
38#include <docary.hxx>
39#include <lineinfo.hxx>
40#include <swmodule.hxx>
41#include <pagefrm.hxx>
42#include <colfrm.hxx>
43#include <fesh.hxx>
44#include <viewimp.hxx>
45#include <viewopt.hxx>
46#include <dflyobj.hxx>
47#include <dcontact.hxx>
48#include <frmatr.hxx>
49#include <frmtool.hxx>
50#include <tabfrm.hxx>
51#include <rowfrm.hxx>
52#include <ftnfrm.hxx>
53#include <txtfrm.hxx>
54#include <notxtfrm.hxx>
55#include <flyfrms.hxx>
56#include <layact.hxx>
57#include <pagedesc.hxx>
58#include <section.hxx>
59#include <sectfrm.hxx>
60#include <node2lay.hxx>
61#include <ndole.hxx>
62#include <hints.hxx>
63#include "layhelp.hxx"
64#include <laycache.hxx>
65#include <rootfrm.hxx>
66#include <paratr.hxx>
67#include <redline.hxx>
68#include <sortedobjs.hxx>
69#include <objectformatter.hxx>
70#include <calbck.hxx>
71#include <ndtxt.hxx>
72#include <undobj.hxx>
79#include <IDocumentState.hxx>
80#include <frameformats.hxx>
81#include <boost/circular_buffer.hpp>
83
84using namespace ::com::sun::star;
85
86namespace {
87 // FIXME: would likely better be a member of SwRootFrame instead of a global flag
88 bool isFlyCreationSuppressed = false;
89}
90namespace sw {
91 FlyCreationSuppressor::FlyCreationSuppressor(bool wasAlreadySuppressedAllowed)
92 : m_wasAlreadySuppressed(isFlyCreationSuppressed)
93 {
94 (void)wasAlreadySuppressedAllowed;
95 assert(wasAlreadySuppressedAllowed || !isFlyCreationSuppressed);
96 isFlyCreationSuppressed = true;
97 }
99 {
100 isFlyCreationSuppressed = m_wasAlreadySuppressed;
101 }
102}
103
104bool bObjsDirect = true;
106
108bool StackHack::s_bLocked = false;
109
111 mpFrame( pF ),
112 maFrame( pF->getFrameArea() ),
113 maPrt( pF->getFramePrintArea() ),
114 mbInvaKeep( false ),
115 mbValidSize( pF->isFrameAreaSizeValid() )
116{
117 if ( pF->IsTextFrame() )
118 {
119 mnFlyAnchorOfst = static_cast<SwTextFrame*>(pF)->GetBaseOffsetForFly( true );
120 mnFlyAnchorOfstNoWrap = static_cast<SwTextFrame*>(pF)->GetBaseOffsetForFly( false );
121 }
122 else
123 {
124 mnFlyAnchorOfst = 0;
126 }
127
128 mbHadFollow = pF->IsContentFrame() && static_cast<SwContentFrame*>(pF)->GetFollow();
129}
130
132{
134}
135
137{
138 SwRectFnSet aRectFnSet(mpFrame);
139 const bool bAbsP = aRectFnSet.PosDiff(maFrame, mpFrame->getFrameArea());
140 const bool bChgWidth =
141 aRectFnSet.GetWidth(maFrame) != aRectFnSet.GetWidth(mpFrame->getFrameArea());
142 const bool bChgHeight =
143 aRectFnSet.GetHeight(maFrame)!=aRectFnSet.GetHeight(mpFrame->getFrameArea());
144 const bool bChgFlyBasePos = mpFrame->IsTextFrame() &&
145 ( ( mnFlyAnchorOfst != static_cast<SwTextFrame*>(mpFrame)->GetBaseOffsetForFly( true ) ) ||
146 ( mnFlyAnchorOfstNoWrap != static_cast<SwTextFrame*>(mpFrame)->GetBaseOffsetForFly( false ) ) );
147
148 if ( mpFrame->IsFlowFrame() && !mpFrame->IsInFootnote() )
149 {
151
152 if ( !pFlow->IsFollow() )
153 {
154 if ( !mpFrame->GetIndPrev() )
155 {
156 if ( mbInvaKeep )
157 {
158 SwFrame *pPre = mpFrame->FindPrev();
159 if ( pPre && pPre->IsFlowFrame() )
160 {
161 // 1. pPre wants to keep with me:
162 bool bInvalidPrePos = SwFlowFrame::CastFlowFrame(pPre)->IsKeep(pPre->GetAttrSet()->GetKeep(), pPre->GetBreakItem())
163 && pPre->GetIndPrev();
164
165 // 2. pPre is a table and the last row wants to keep with me:
166 if ( !bInvalidPrePos && pPre->IsTabFrame() )
167 {
168 SwTabFrame* pPreTab = static_cast<SwTabFrame*>(pPre);
170 {
171 SwRowFrame* pLastRow = static_cast<SwRowFrame*>(pPreTab->GetLastLower());
172 if ( pLastRow && pLastRow->ShouldRowKeepWithNext() )
173 bInvalidPrePos = true;
174 }
175 }
176
177 if ( bInvalidPrePos )
178 pPre->InvalidatePos();
179 }
180 }
181 }
182 else if ( !pFlow->HasFollow() )
183 {
184 tools::Long nOldHeight = aRectFnSet.GetHeight(maFrame);
185 tools::Long nNewHeight = aRectFnSet.GetHeight(mpFrame->getFrameArea());
186 if( (nOldHeight > nNewHeight) || (!nOldHeight && nNewHeight) )
187 pFlow->CheckKeep();
188 }
189 }
190 }
191
192 if ( bAbsP )
193 {
195
196 SwFrame* pNxt = mpFrame->GetIndNext();
197 // #121888# - skip empty section frames
198 while ( pNxt &&
199 pNxt->IsSctFrame() && !static_cast<SwSectionFrame*>(pNxt)->GetSection() )
200 {
201 pNxt = pNxt->GetIndNext();
202 }
203
204 if ( pNxt )
205 pNxt->InvalidatePos();
206 else
207 {
208 // #104100# - correct condition for setting retouche
209 // flag for vertical layout.
210 if( mpFrame->IsRetoucheFrame() &&
211 aRectFnSet.TopDist( maFrame, aRectFnSet.GetTop(mpFrame->getFrameArea()) ) > 0 )
212 {
214 }
215
216 // A fresh follow frame does not have to be invalidated, because
217 // it is already formatted:
218 if ( mbHadFollow || !mpFrame->IsContentFrame() || !static_cast<SwContentFrame*>(mpFrame)->GetFollow() )
219 {
220 if ( !mpFrame->IsTabFrame() || !static_cast<SwTabFrame*>(mpFrame)->GetFollow() )
222 }
223 }
224 }
225
226 //For each resize of the background graphics is a repaint necessary.
227 const bool bPrtWidth =
228 aRectFnSet.GetWidth(maPrt) != aRectFnSet.GetWidth(mpFrame->getFramePrintArea());
229 const bool bPrtHeight =
230 aRectFnSet.GetHeight(maPrt)!=aRectFnSet.GetHeight(mpFrame->getFramePrintArea());
231 if ( bPrtWidth || bPrtHeight )
232 {
233 bool bUseNewFillProperties(false);
235 {
237 if(aFillAttributes && aFillAttributes->isUsed())
238 {
239 bUseNewFillProperties = true;
240 // use SetCompletePaint if needed
241 if(aFillAttributes->needCompleteRepaint())
242 {
244 }
245 }
246 }
247 if (!bUseNewFillProperties)
248 {
250 if(GPOS_NONE != ePos && GPOS_TILED != ePos)
252 }
253 }
254 else
255 {
256 // #97597# - consider case that *only* margins between
257 // frame and printing area has changed. Then, frame has to be repainted,
258 // in order to force paint of the margin areas.
259 if ( !bAbsP && (bChgWidth || bChgHeight) )
260 {
262 }
263 }
264
265 const bool bPrtP = aRectFnSet.PosDiff( maPrt, mpFrame->getFramePrintArea() );
266 if ( bAbsP || bPrtP || bChgWidth || bChgHeight ||
267 bPrtWidth || bPrtHeight || bChgFlyBasePos )
268 {
269#if !ENABLE_WASM_STRIP_ACCESSIBILITY
271 {
272 SwRootFrame *pRootFrame = mpFrame->getRootFrame();
273 if( pRootFrame && pRootFrame->IsAnyShellAccessible() &&
274 pRootFrame->GetCurrShell() )
275 {
276 pRootFrame->GetCurrShell()->Imp()->MoveAccessibleFrame( mpFrame, maFrame );
277 }
278 }
279#endif
280
281 // Notification of anchored objects
282 if ( mpFrame->GetDrawObjs() )
283 {
284 const SwSortedObjs &rObjs = *mpFrame->GetDrawObjs();
285 SwPageFrame* pPageFrame = nullptr;
286 for (SwAnchoredObject* pObj : rObjs)
287 {
288 // OD 2004-03-31 #i26791# - no general distinction between
289 // Writer fly frames and drawing objects
290 bool bNotify = false;
291 bool bNotifySize = false;
292 SwContact* pContact = ::GetUserCall( pObj->GetDrawObj() );
293 const bool bAnchoredAsChar = pContact->ObjAnchoredAsChar();
294 if ( !bAnchoredAsChar )
295 {
296 // Notify object, which aren't anchored as-character:
297
298 // always notify objects, if frame position has changed
299 // or if the object is to-page|to-fly anchored.
300 if ( bAbsP ||
301 pContact->ObjAnchoredAtPage() ||
302 pContact->ObjAnchoredAtFly() )
303 {
304 bNotify = true;
305
306 // assure that to-fly anchored Writer fly frames are
307 // registered at the correct page frame, if frame
308 // position has changed.
309 if ( bAbsP && pContact->ObjAnchoredAtFly() &&
310 pObj->DynCastFlyFrame() != nullptr )
311 {
312 // determine to-fly anchored Writer fly frame
313 SwFlyFrame* pFlyFrame = static_cast<SwFlyFrame*>(pObj);
314 // determine page frame of to-fly anchored
315 // Writer fly frame
316 SwPageFrame* pFlyPageFrame = pFlyFrame->FindPageFrame();
317 // determine page frame, if needed.
318 if ( !pPageFrame )
319 {
320 pPageFrame = mpFrame->FindPageFrame();
321 }
322 if ( pPageFrame != pFlyPageFrame )
323 {
324 OSL_ENSURE( pFlyPageFrame, "~SwFrameNotify: Fly from Nowhere" );
325 if( pFlyPageFrame )
326 pFlyPageFrame->MoveFly( pFlyFrame, pPageFrame );
327 else
328 pPageFrame->AppendFlyToPage( pFlyFrame );
329 }
330 }
331 }
332 // otherwise the objects are notified in dependence to
333 // its positioning and alignment
334 else
335 {
336 const SwFormatVertOrient& rVert =
337 pContact->GetFormat()->GetVertOrient();
338 if ( ( rVert.GetVertOrient() == text::VertOrientation::CENTER ||
339 rVert.GetVertOrient() == text::VertOrientation::BOTTOM ||
340 rVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA ) &&
341 ( bChgHeight || bPrtHeight ) )
342 {
343 bNotify = true;
344 }
345 if ( !bNotify )
346 {
347 const SwFormatHoriOrient& rHori =
348 pContact->GetFormat()->GetHoriOrient();
349 if ( ( rHori.GetHoriOrient() != text::HoriOrientation::NONE ||
350 rHori.GetRelationOrient()== text::RelOrientation::PRINT_AREA ||
351 rHori.GetRelationOrient()== text::RelOrientation::FRAME ) &&
352 ( bChgWidth || bPrtWidth || bChgFlyBasePos ) )
353 {
354 bNotify = true;
355 }
356 }
357 }
358 }
359 else if ( bPrtWidth )
360 {
361 // Notify as-character anchored objects, if printing area
362 // width has changed.
363 bNotify = true;
364 bNotifySize = true;
365 }
366
367 // perform notification via the corresponding invalidations
368 if ( bNotify )
369 {
370 if ( auto pFlyFrame = pObj->DynCastFlyFrame() )
371 {
372 if ( bNotifySize )
373 pFlyFrame->InvalidateSize_();
374 // #115759# - no invalidation of
375 // position for as-character anchored objects.
376 if ( !bAnchoredAsChar )
377 {
378 pFlyFrame->InvalidatePos_();
379 }
380 pFlyFrame->Invalidate_();
381 }
382 else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr )
383 {
384 // #115759# - no invalidation of
385 // position for as-character anchored objects.
386 if ( !bAnchoredAsChar )
387 {
388 pObj->InvalidateObjPos();
389 }
390 }
391 else
392 {
393 OSL_FAIL( "<SwContentNotify::~SwContentNotify()> - unknown anchored object type." );
394 }
395 }
396 }
397 }
398 }
399#if !ENABLE_WASM_STRIP_ACCESSIBILITY
401 {
402 SwRootFrame *pRootFrame = mpFrame->getRootFrame();
403 if( pRootFrame && pRootFrame->IsAnyShellAccessible() &&
404 pRootFrame->GetCurrShell() )
405 {
407 }
408 }
409#endif
410
411 // #i9046# Automatic frame width
412 SwFlyFrame* pFly = nullptr;
413 // #i35879# Do not trust the inf flags. pFrame does not
414 // necessarily have to have an upper!
415 if ( mpFrame->IsFlyFrame() || nullptr == ( pFly = mpFrame->ImplFindFlyFrame() ))
416 return;
417
418 // #i61999#
419 // no invalidation of columned Writer fly frames, because automatic
420 // width doesn't make sense for such Writer fly frames.
421 if ( !pFly->Lower() || pFly->Lower()->IsColumnFrame() )
422 return;
423
424 const SwFormatFrameSize &rFrameSz = pFly->GetFormat()->GetFrameSize();
425
426 // This could be optimized. Basically the fly frame only has to
427 // be invalidated, if the first line of pFrame (if pFrame is a content
428 // frame, for other frame types it's the print area) has changed its
429 // size and pFrame was responsible for the current width of pFly. On
430 // the other hand, this is only rarely used and re-calculation of
431 // the fly frame does not cause too much trouble. So we keep it this
432 // way:
433 if ( SwFrameSize::Fixed != rFrameSz.GetWidthSizeType() )
434 {
435 // #i50668#, #i50998# - invalidation of position
436 // of as-character anchored fly frames not needed and can cause
437 // layout loops
438 if ( dynamic_cast<const SwFlyInContentFrame*>( pFly) == nullptr )
439 {
440 pFly->InvalidatePos();
441 }
442 pFly->InvalidateSize();
443 }
444}
445
447 SwFrameNotify( pLayFrame ),
448 m_bLowersComplete( false )
449{
450}
451
452// OD 2004-05-11 #i28701# - local method to invalidate the position of all
453// frames inclusive its floating screen objects, which are lowers of the given
454// layout frame
455static void lcl_InvalidatePosOfLowers( SwLayoutFrame& _rLayoutFrame )
456{
457 if( _rLayoutFrame.IsFlyFrame() && _rLayoutFrame.GetDrawObjs() )
458 {
459 _rLayoutFrame.InvalidateObjs( false );
460 }
461
462 SwFrame* pLowerFrame = _rLayoutFrame.Lower();
463 while ( pLowerFrame )
464 {
465 pLowerFrame->InvalidatePos();
466 if ( pLowerFrame->IsTextFrame() )
467 {
468 static_cast<SwTextFrame*>(pLowerFrame)->Prepare( PrepareHint::FramePositionChanged );
469 }
470 else if ( pLowerFrame->IsTabFrame() )
471 {
472 pLowerFrame->InvalidatePrt();
473 }
474
475 pLowerFrame->InvalidateObjs( false );
476
477 pLowerFrame = pLowerFrame->GetNext();
478 }
479}
480
482{
483 SwLayoutFrame *pLay = static_cast<SwLayoutFrame*>(mpFrame);
484 SwRectFnSet aRectFnSet(pLay);
485 bool bNotify = false;
486 if ( pLay->getFramePrintArea().SSize() != maPrt.SSize() )
487 {
488 if ( !IsLowersComplete() )
489 {
490 bool bInvaPercent;
491
492 if ( pLay->IsRowFrame() )
493 {
494 bInvaPercent = true;
495 tools::Long nNew = aRectFnSet.GetHeight(pLay->getFramePrintArea());
496 if( nNew != aRectFnSet.GetHeight(maPrt) )
497 static_cast<SwRowFrame*>(pLay)->AdjustCells( nNew, true);
498 if( aRectFnSet.GetWidth(pLay->getFramePrintArea())
499 != aRectFnSet.GetWidth(maPrt) )
500 static_cast<SwRowFrame*>(pLay)->AdjustCells( 0, false );
501 }
502 else
503 {
504 //Proportional adoption of the internal.
505 //1. If the formatted is no Fly
506 //2. If he contains no columns
507 //3. If the Fly has a fixed height and the columns
508 // are next to be.
509 // Hoehe danebenliegen.
510 //4. Never at SectionFrames.
511 bool bLow;
512 if( pLay->IsFlyFrame() )
513 {
514 if ( pLay->Lower() )
515 {
516 bLow = !pLay->Lower()->IsColumnFrame() ||
517 aRectFnSet.GetHeight(pLay->Lower()->getFrameArea())
518 != aRectFnSet.GetHeight(pLay->getFramePrintArea());
519 }
520 else
521 bLow = false;
522 }
523 else if( pLay->IsSctFrame() )
524 {
525 if ( pLay->Lower() )
526 {
527 if( pLay->Lower()->IsColumnFrame() && pLay->Lower()->GetNext() )
528 bLow = pLay->Lower()->getFrameArea().Height() != pLay->getFramePrintArea().Height();
529 else
530 bLow = pLay->getFramePrintArea().Width() != maPrt.Width();
531 }
532 else
533 bLow = false;
534 }
535 else if( pLay->IsFooterFrame() && !pLay->HasFixSize() )
536 bLow = pLay->getFramePrintArea().Width() != maPrt.Width();
537 else
538 bLow = true;
539 bInvaPercent = bLow;
540 if ( bLow )
541 {
542 pLay->ChgLowersProp( maPrt.SSize() );
543 }
544 // If the PrtArea has been extended, it might be possible that the chain of parts
545 // can take another frame. As a result, the "possible right one" needs to be
546 // invalidated. This only pays off if this or its Uppers are moveable sections.
547 // A PrtArea has been extended if width or height are larger than before.
548 if ( (pLay->getFramePrintArea().Height() > maPrt.Height() ||
549 pLay->getFramePrintArea().Width() > maPrt.Width()) &&
550 (pLay->IsMoveable() || pLay->IsFlyFrame()) )
551 {
552 SwFrame *pTmpFrame = pLay->Lower();
553 if ( pTmpFrame && pTmpFrame->IsFlowFrame() )
554 {
555 while ( pTmpFrame->GetNext() )
556 pTmpFrame = pTmpFrame->GetNext();
557 pTmpFrame->InvalidateNextPos();
558 }
559 }
560 }
561 bNotify = true;
562 //EXPENSIVE!! But how we do it more elegant?
563 if( bInvaPercent )
565 }
566 if ( pLay->IsTabFrame() )
567 //So that _only_ the shadow is drawn while resizing.
568 static_cast<SwTabFrame*>(pLay)->SetComplete();
569 else
570 {
571 const SwViewShell *pSh = pLay->getRootFrame()->GetCurrShell();
572 if( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) ||
574 //Thereby the subordinates are retouched clean.
575 //Example problem: Take the Flys with the handles and downsize.
576 //Not for body and page, otherwise it flickers when loading HTML.
577 pLay->SetCompletePaint();
578 }
579 }
580 //Notify Lower if the position has changed.
581 const bool bPrtPos = aRectFnSet.PosDiff( maPrt, pLay->getFramePrintArea() );
582 const bool bPos = bPrtPos || aRectFnSet.PosDiff( maFrame, pLay->getFrameArea() );
583 const bool bSize = pLay->getFrameArea().SSize() != maFrame.SSize();
584
585 if ( bPos && pLay->Lower() && !IsLowersComplete() )
586 {
587 pLay->Lower()->InvalidatePos();
588 SwFootnoteFrame* pFtnFrame = pLay->Lower()->IsFootnoteFrame() ?
589 static_cast<SwFootnoteFrame*>(pLay->Lower()) : nullptr;
590 SwFrame* pFtnLower = pFtnFrame ? pFtnFrame->Lower() : nullptr;
591 if (pFtnLower)
592 pFtnLower->InvalidatePos();
593 }
594
595 if ( bPrtPos )
596 pLay->SetCompletePaint();
597
598 //Inform the Follower if the SSize has changed.
599 if ( bSize )
600 {
601 if( pLay->GetNext() )
602 {
603 if ( pLay->GetNext()->IsLayoutFrame() )
604 pLay->GetNext()->InvalidatePos_();
605 else
606 pLay->GetNext()->InvalidatePos();
607 }
608 else if( pLay->IsSctFrame() )
609 pLay->InvalidateNextPos();
610 }
611 if ( !IsLowersComplete() &&
613 pLay->Lower() && pLay->Lower()->IsColumnFrame()) &&
614 (bPos || bNotify) &&
616 {
617 // #i44016# - force unlock of position of lower objects.
618 // #i43913# - no unlock of position of objects,
619 // if <pLay> is a cell frame, and its table frame resp. its parent table
620 // frame is locked.
621 // #i47458# - force unlock of position of lower objects,
622 // only if position of layout frame has changed.
623 bool bUnlockPosOfObjs( bPos );
624 if ( bUnlockPosOfObjs && pLay->IsCellFrame() )
625 {
626 SwTabFrame* pTabFrame( pLay->FindTabFrame() );
627 if ( pTabFrame &&
628 ( pTabFrame->IsJoinLocked() ||
629 ( pTabFrame->IsFollow() &&
630 pTabFrame->FindMaster()->IsJoinLocked() ) ) )
631 {
632 bUnlockPosOfObjs = false;
633 }
634 }
635 // #i49383# - check for footnote frame, if unlock
636 // of position of lower objects is allowed.
637 else if ( bUnlockPosOfObjs && pLay->IsFootnoteFrame() )
638 {
639 bUnlockPosOfObjs = static_cast<SwFootnoteFrame*>(pLay)->IsUnlockPosOfLowerObjs();
640 }
641 // #i51303# - no unlock of object positions for sections
642 else if ( bUnlockPosOfObjs && pLay->IsSctFrame() )
643 {
644 bUnlockPosOfObjs = false;
645 }
646 pLay->NotifyLowerObjs( bUnlockPosOfObjs );
647 }
648 if ( bPos && pLay->IsFootnoteFrame() && pLay->Lower() )
649 {
650 // OD 2004-05-11 #i28701#
652 }
653 if( ( bPos || bSize ) && pLay->IsFlyFrame() && static_cast<SwFlyFrame*>(pLay)->GetAnchorFrame()
654 && static_cast<SwFlyFrame*>(pLay)->GetAnchorFrame()->IsFlyFrame() )
655 static_cast<SwFlyFrame*>(pLay)->AnchorFrame()->InvalidateSize();
656}
657
659{
661}
662
664 SwLayNotify( pFlyFrame ),
665 // #115759# - keep correct page frame - the page frame
666 // the Writer fly frame is currently registered at.
667 m_pOldPage( pFlyFrame->GetPageFrame() ),
668 m_aFrameAndSpace( pFlyFrame->GetObjRectWithSpaces() )
669{
670}
671
673{
674 SwFlyFrame *pFly = static_cast<SwFlyFrame*>(mpFrame);
675 if ( pFly->IsNotifyBack() )
676 {
677 SwViewShell *pSh = pFly->getRootFrame()->GetCurrShell();
678 SwViewShellImp *pImp = pSh ? pSh->Imp() : nullptr;
679 if ( !pImp || !pImp->IsAction() || !pImp->GetLayAction().IsAgain() )
680 {
681 //If in the LayAction the IsAgain is set it can be
682 //that the old page is destroyed in the meantime!
684 // #i35640# - additional notify anchor text frame,
685 // if Writer fly frame has changed its page
686 if ( pFly->GetAnchorFrame()->IsTextFrame() &&
687 pFly->GetPageFrame() != m_pOldPage )
688 {
690 }
691 }
692 pFly->ResetNotifyBack();
693 }
694
695 //Have the size or the position changed,
696 //so should the view know this.
697 SwRectFnSet aRectFnSet(pFly);
698 const bool bPosChgd = aRectFnSet.PosDiff( maFrame, pFly->getFrameArea() );
699 const bool bFrameChgd = pFly->getFrameArea().SSize() != maFrame.SSize();
700 const bool bPrtChgd = maPrt != pFly->getFramePrintArea();
701 if ( bPosChgd || bFrameChgd || bPrtChgd )
702 {
703 pFly->NotifyDrawObj();
704 }
705 if ( bPosChgd && maFrame.Pos().X() != FAR_AWAY )
706 {
707 // OD 2004-05-10 #i28701# - no direct move of lower Writer fly frames.
708 // reason: New positioning and alignment (e.g. to-paragraph anchored,
709 // but aligned at page) are introduced.
710 // <SwLayNotify::~SwLayNotify()> takes care of invalidation of lower
711 // floating screen objects by calling method <SwLayoutFrame::NotifyLowerObjs()>.
712
713 if ( pFly->IsFlyAtContentFrame() )
714 {
715 SwFrame *pNxt = pFly->AnchorFrame()->FindNext();
716 while (pNxt)
717 {
718 pNxt->InvalidatePos();
719 if (!pNxt->IsSctFrame())
720 {
721 break;
722 }
723 // invalidating pos of a section frame doesn't have much
724 // effect, so try again with its lower
725 pNxt = static_cast<SwSectionFrame*>(pNxt)->Lower();
726 }
727 }
728
729 // #i26945# - notify anchor.
730 // Needed for negative positioned Writer fly frames
731 if ( pFly->GetAnchorFrame()->IsTextFrame() )
732 {
734 }
735 }
736
737 // OD 2004-05-13 #i28701#
738 // #i45180# - no adjustment of layout process flags and
739 // further notifications/invalidations, if format is called by grow/shrink
741 return;
742 if (pFly->IsFlyFreeFrame())
743 {
744 if (static_cast<SwFlyFreeFrame*>(pFly)->IsNoMoveOnCheckClip())
745 return;
746 }
747
748 // #i54138# - suppress restart of the layout process
749 // on changed frame height.
750 // Note: It doesn't seem to be necessary and can cause layout loops.
751 if ( bPosChgd )
752 {
753 // indicate a restart of the layout process
754 pFly->SetRestartLayoutProcess( true );
755 }
756 else
757 {
758 // lock position
759 pFly->LockPosition();
760 }
761
762 if ( pFly->ConsiderForTextWrap() )
763 return;
764
765 // indicate that object has to be considered for text wrap
766 pFly->SetConsiderForTextWrap( true );
767 // invalidate 'background' in order to allow its 'background'
768 // to wrap around it.
769 pFly->NotifyBackground( pFly->GetPageFrame(),
770 pFly->GetObjRectWithSpaces(),
772 // invalidate position of anchor frame in order to force
773 // a re-format of the anchor frame, which also causes a
774 // re-format of the invalid previous frames of the anchor frame.
775 pFly->AnchorFrame()->InvalidatePos();
776}
777
779{
781}
782
784 SwFrameNotify( pContentFrame ),
785 // OD 08.01.2004 #i11859#
786 mbChkHeightOfLastLine( false ),
787 mnHeightOfLastLine( 0 ),
788 // OD 2004-02-26 #i25029#
789 mbInvalidatePrevPrtArea( false ),
790 mbBordersJoinedWithPrev( false )
791{
792 // OD 08.01.2004 #i11859#
793 if ( !pContentFrame->IsTextFrame() )
794 return;
795
796 SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pContentFrame);
798 {
799 const SvxLineSpacingItem &rSpace = pTextFrame->GetAttrSet()->GetLineSpacing();
800 if ( rSpace.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop )
801 {
804 }
805 }
806}
807
809{
810 SwContentFrame *pCnt = static_cast<SwContentFrame*>(mpFrame);
812 pCnt->SetCompletePaint();
813
814 SwRectFnSet aRectFnSet(pCnt);
815 if ( pCnt->IsInTab() && ( aRectFnSet.PosDiff( pCnt->getFrameArea(), maFrame ) ||
816 pCnt->getFrameArea().SSize() != maFrame.SSize()))
817 {
818 SwLayoutFrame* pCell = pCnt->GetUpper();
819 while( !pCell->IsCellFrame() && pCell->GetUpper() )
820 pCell = pCell->GetUpper();
821 OSL_ENSURE( pCell->IsCellFrame(), "Where's my cell?" );
823 pCell->InvalidatePrt(); //for the vertical align.
824 }
825
826 // OD 2004-02-26 #i25029#
828 pCnt->IsTextFrame() &&
829 !pCnt->IsFollow() && !pCnt->GetIndPrev() )
830 {
831 // determine previous frame
832 SwFrame* pPrevFrame = pCnt->FindPrev();
833 // skip empty section frames and hidden text frames
834 {
835 while ( pPrevFrame &&
836 ( ( pPrevFrame->IsSctFrame() &&
837 !static_cast<SwSectionFrame*>(pPrevFrame)->GetSection() ) ||
838 ( pPrevFrame->IsTextFrame() &&
839 static_cast<SwTextFrame*>(pPrevFrame)->IsHiddenNow() ) ) )
840 {
841 pPrevFrame = pPrevFrame->FindPrev();
842 }
843 }
844
845 // Invalidate printing area of found previous frame
846 if ( pPrevFrame )
847 {
848 if ( pPrevFrame->IsSctFrame() )
849 {
850 if ( pCnt->IsInSct() )
851 {
852 // Note: found previous frame is a section frame and
853 // <pCnt> is also inside a section.
854 // Thus due to <mbBordersJoinedWithPrev>,
855 // <pCnt> had joined its borders/shadow with the
856 // last content of the found section.
857 // Invalidate printing area of last content in found section.
858 SwFrame* pLstContentOfSctFrame =
859 static_cast<SwSectionFrame*>(pPrevFrame)->FindLastContent();
860 if ( pLstContentOfSctFrame )
861 {
862 pLstContentOfSctFrame->InvalidatePrt();
863 }
864 }
865 }
866 else
867 {
868 pPrevFrame->InvalidatePrt();
869 }
870 }
871 }
872
873 const bool bFirst = aRectFnSet.GetWidth(maFrame) == 0;
874
875 if ( pCnt->IsNoTextFrame() )
876 {
877 //Active PlugIn's or OLE-Objects should know something of the change
878 //thereby they move their window appropriate.
879 SwViewShell *pSh = pCnt->getRootFrame()->GetCurrShell();
880 if ( pSh )
881 {
882 SwOLENode *const pNd(static_cast<SwNoTextFrame*>(pCnt)->GetNode()->GetOLENode());
883 if (nullptr != pNd &&
884 (pNd->GetOLEObj().IsOleRef() ||
885 pNd->IsOLESizeInvalid()) )
886 {
887 const bool bNoTextFramePrtAreaChanged =
888 ( maPrt.SSize().Width() != 0 &&
889 maPrt.SSize().Height() != 0 ) &&
890 maPrt.SSize() != pCnt->getFramePrintArea().SSize();
891 OSL_ENSURE( pCnt->IsInFly(), "OLE not in FlyFrame" );
892 SwFlyFrame *pFly = pCnt->FindFlyFrame();
894 SwFEShell *pFESh = nullptr;
895 for(SwViewShell& rCurrentShell : pSh->GetRingContainer())
896 { if ( dynamic_cast<const SwCursorShell*>( &rCurrentShell) != nullptr )
897 {
898 pFESh = static_cast<SwFEShell*>(&rCurrentShell);
899 // #108369#: Here used to be the condition if (!bFirst).
900 // I think this should mean "do not call CalcAndSetScale"
901 // if the frame is formatted for the first time.
902 // Unfortunately this is not valid anymore since the
903 // SwNoTextFrame already gets a width during CalcLowerPreps.
904 // Nevertheless, the indention of !bFirst seemed to be
905 // to assure that the OLE objects have already been notified
906 // if necessary before calling CalcAndSetScale.
907 // So I replaced !bFirst by !IsOLESizeInvalid. There is
908 // one additional problem specific to the word import:
909 // The layout is calculated _before_ calling PrtOLENotify,
910 // and the OLE objects are not invalidated during import.
911 // Therefore I added the condition !IsUpdateExpField,
912 // have a look at the occurrence of CalcLayout in
913 // uiview/view.cxx.
914 if ( !pNd->IsOLESizeInvalid() &&
916 pFESh->CalcAndSetScale( xObj,
917 &pFly->getFramePrintArea(), &pFly->getFrameArea(),
918 bNoTextFramePrtAreaChanged );
919 }
920 }
921
922 if ( pFESh && pNd->IsOLESizeInvalid() )
923 {
924 pNd->SetOLESizeInvalid( false );
925 pFESh->CalcAndSetScale( xObj ); // create client
926 }
927 }
928 // ditto animated graphics
929 if ( getFrameArea().HasArea() && static_cast<SwNoTextFrame*>(pCnt)->HasAnimation() )
930 {
931 static_cast<SwNoTextFrame*>(pCnt)->StopAnimation();
933 }
934 }
935 }
936
937 if ( bFirst )
938 {
939 pCnt->SetRetouche(); //fix(13870)
940
941 SwDoc& rDoc = pCnt->IsTextFrame()
942 ? static_cast<SwTextFrame*>(pCnt)->GetDoc()
943 : static_cast<SwNoTextFrame*>(pCnt)->GetNode()->GetDoc();
944 if ( !rDoc.GetSpzFrameFormats()->empty() &&
946 {
947 // If certain import filters for foreign file format import
948 // AT_PAGE anchored objects, the corresponding page number is
949 // typically not known. In this case the content position is
950 // stored at which the anchored object is found in the
951 // imported document.
952 // When this content is formatted it is the time at which
953 // the page is known. Thus, this data can be corrected now.
954
955 const SwPageFrame *pPage = nullptr;
956 SwFrameFormats *pTable = rDoc.GetSpzFrameFormats();
957
958 for ( size_t i = 0; i < pTable->size(); ++i )
959 {
960 SwFrameFormat *pFormat = (*pTable)[i];
961 const SwFormatAnchor &rAnch = pFormat->GetAnchor();
962 if ( RndStdIds::FLY_AT_PAGE != rAnch.GetAnchorId() ||
963 rAnch.GetContentAnchor() == nullptr )
964 {
965 continue;
966 }
967
968 if (FrameContainsNode(*pCnt, rAnch.GetContentAnchor()->nNode.GetIndex()))
969 {
970 OSL_FAIL( "<SwContentNotify::~SwContentNotify()> - to page anchored object with content position." );
971 if ( !pPage )
972 {
973 pPage = pCnt->FindPageFrame();
974 }
975 SwFormatAnchor aAnch( rAnch );
976 aAnch.SetAnchor( nullptr );
977 aAnch.SetPageNum( pPage->GetPhyPageNum() );
978 pFormat->SetFormatAttr( aAnch );
979 if ( RES_DRAWFRMFMT != pFormat->Which() )
980 {
981 pFormat->MakeFrames();
982 }
983 }
984 }
985 }
986 }
987
988 // OD 12.01.2004 #i11859# - invalidate printing area of following frame,
989 // if height of last line has changed.
990 if ( pCnt->IsTextFrame() && mbChkHeightOfLastLine )
991 {
992 if ( mnHeightOfLastLine != static_cast<SwTextFrame*>(pCnt)->GetHeightOfLastLine() )
993 {
994 pCnt->InvalidateNextPrtArea();
995 }
996 }
997
998 // #i44049#
999 if ( pCnt->IsTextFrame() && aRectFnSet.PosDiff( maFrame, pCnt->getFrameArea() ) )
1000 {
1001 pCnt->InvalidateObjs();
1002 }
1003
1004 // #i43255# - move code to invalidate at-character
1005 // anchored objects due to a change of its anchor character from
1006 // method <SwTextFrame::Format(..)>.
1007 if ( !pCnt->IsTextFrame() )
1008 return;
1009
1010 SwTextFrame* pMasterFrame = pCnt->IsFollow()
1011 ? static_cast<SwTextFrame*>(pCnt)->FindMaster()
1012 : static_cast<SwTextFrame*>(pCnt);
1013 if ( pMasterFrame && !pMasterFrame->IsFlyLock() &&
1014 pMasterFrame->GetDrawObjs() )
1015 {
1016 SwSortedObjs* pObjs = pMasterFrame->GetDrawObjs();
1017 for (SwAnchoredObject* pAnchoredObj : *pObjs)
1018 {
1019 if ( pAnchoredObj->GetFrameFormat().GetAnchor().GetAnchorId()
1020 == RndStdIds::FLY_AT_CHAR )
1021 {
1022 pAnchoredObj->CheckCharRectAndTopOfLine( !pMasterFrame->IsEmpty() );
1023 }
1024 }
1025 }
1026}
1027
1029{
1031}
1032
1033// note this *cannot* be static because it's a friend
1034void AppendObj(SwFrame *const pFrame, SwPageFrame *const pPage, SwFrameFormat *const pFormat, const SwFormatAnchor & rAnch)
1035{
1036 const bool bFlyAtFly = rAnch.GetAnchorId() == RndStdIds::FLY_AT_FLY; // LAYER_IMPL
1037 //Is a frame or a SdrObject described?
1038 const bool bSdrObj = RES_DRAWFRMFMT == pFormat->Which();
1039 // OD 23.06.2003 #108784# - append also drawing objects anchored
1040 // as character.
1041 const bool bDrawObjInContent = bSdrObj &&
1042 (rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR);
1043
1044 if( !(bFlyAtFly ||
1045 (rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA) ||
1046 (rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR) ||
1047 bDrawObjInContent) )
1048 return;
1049
1050 SdrObject* pSdrObj = nullptr;
1051 if ( bSdrObj && nullptr == (pSdrObj = pFormat->FindSdrObject()) )
1052 {
1053 OSL_ENSURE( !bSdrObj, "DrawObject not found." );
1054 pFormat->GetDoc()->DelFrameFormat( pFormat );
1055 return;
1056 }
1057 if ( pSdrObj )
1058 {
1059 if ( !pSdrObj->getSdrPageFromSdrObject() )
1060 {
1062 InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect());
1063 }
1064
1065 SwDrawContact* pNew =
1066 static_cast<SwDrawContact*>(GetUserCall( pSdrObj ));
1067 if ( !pNew->GetAnchorFrame() )
1068 {
1069 pFrame->AppendDrawObj( *(pNew->GetAnchoredObj( nullptr )) );
1070 }
1071 // OD 19.06.2003 #108784# - add 'virtual' drawing object,
1072 // if necessary. But control objects have to be excluded.
1073 else if ( !::CheckControlLayer( pSdrObj ) &&
1074 pNew->GetAnchorFrame() != pFrame &&
1075 !pNew->GetDrawObjectByAnchorFrame( *pFrame ) )
1076 {
1077 SwDrawVirtObj* pDrawVirtObj = pNew->AddVirtObj(*pFrame);
1078 pFrame->AppendDrawObj( *(pNew->GetAnchoredObj( pDrawVirtObj )) );
1079
1080 pDrawVirtObj->ActionChanged();
1081 }
1082 }
1083 else
1084 {
1085 SwFlyFrame *pFly;
1086 if( bFlyAtFly )
1087 pFly = new SwFlyLayFrame( static_cast<SwFlyFrameFormat*>(pFormat), pFrame, pFrame );
1088 else
1089 pFly = new SwFlyAtContentFrame( static_cast<SwFlyFrameFormat*>(pFormat), pFrame, pFrame );
1090 pFly->Lock();
1091 pFrame->AppendFly( pFly );
1092 pFly->Unlock();
1093 if ( pPage )
1094 ::RegistFlys( pPage, pFly );
1095 }
1096}
1097
1098static bool IsShown(SwNodeOffset const nIndex,
1099 const SwFormatAnchor & rAnch,
1100 std::vector<sw::Extent>::const_iterator const*const pIter,
1101 std::vector<sw::Extent>::const_iterator const*const pEnd,
1102 SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
1103{
1104 assert(!pIter || *pIter == *pEnd || (*pIter)->pNode->GetIndex() == nIndex);
1105 SwPosition const& rAnchor(*rAnch.GetContentAnchor());
1106 if (rAnchor.nNode.GetIndex() != nIndex)
1107 {
1108 return false;
1109 }
1110 if (rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA)
1111 {
1112 return pIter == nullptr // not merged
1113 || pIter != pEnd // at least one char visible in node
1114 || !IsSelectFrameAnchoredAtPara(rAnchor,
1115 SwPosition(const_cast<SwTextNode&>(*pFirstNode), 0),
1116 SwPosition(const_cast<SwTextNode&>(*pLastNode), pLastNode->Len()));
1117 }
1118 if (pIter)
1119 {
1120 // note: frames are not sorted by anchor position.
1121 assert(pEnd);
1122 assert(pFirstNode);
1123 assert(pLastNode);
1124 assert(rAnch.GetAnchorId() != RndStdIds::FLY_AT_FLY);
1125 for (auto iter = *pIter; iter != *pEnd; ++iter)
1126 {
1127 assert(iter->nStart != iter->nEnd); // TODO possible?
1128 assert(iter->pNode->GetIndex() == nIndex);
1129 if (rAnchor.nContent.GetIndex() < iter->nStart)
1130 {
1131 return false;
1132 }
1133 if (rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)
1134 {
1135 // if there is an extent then obviously the node was not
1136 // deleted fully...
1137 // show if start <= pos <= end
1138 // *or* if first-node/0 *and* not StartOfSection
1139 // *or* if last-node/Len *and* not EndOfSection
1140
1141 // first determine the extent to compare to, then
1142 // construct start/end positions for the deletion *before* the
1143 // extent and compare once.
1144 // the interesting corner cases are on the edge of the extent!
1145 // no need to check for > the last extent because those
1146 // are never visible.
1147 if (rAnchor.nContent.GetIndex() <= iter->nEnd)
1148 {
1149 if (iter->nStart == 0)
1150 {
1151 return true;
1152 }
1153 else
1154 {
1155 SwPosition const start(
1156 const_cast<SwTextNode&>(
1157 iter == *pIter
1158 ? *pFirstNode // simplification
1159 : *iter->pNode),
1160 iter == *pIter // first extent?
1161 ? iter->pNode == pFirstNode
1162 ? 0 // at start of 1st node
1163 : pFirstNode->Len() // previous node; simplification but should get right result
1164 : (iter-1)->nEnd); // previous extent
1165 SwPosition const end(*iter->pNode, iter->nStart);
1166 return !IsDestroyFrameAnchoredAtChar(rAnchor, start, end);
1167 }
1168 }
1169 else if (iter == *pEnd - 1) // special case: after last extent
1170 {
1171 if (iter->nEnd == iter->pNode->Len())
1172 {
1173 return true; // special case: end of node
1174 }
1175 else
1176 {
1177 SwPosition const start(*iter->pNode, iter->nEnd);
1178 SwPosition const end(
1179 const_cast<SwTextNode&>(*pLastNode), // simplification
1180 iter->pNode == pLastNode
1181 ? iter->pNode->Len()
1182 : 0);
1183 return !IsDestroyFrameAnchoredAtChar(rAnchor, start, end);
1184 }
1185 }
1186 }
1187 else
1188 {
1189 assert(rAnch.GetAnchorId() == RndStdIds::FLY_AS_CHAR);
1190 // for AS_CHAR obviously must be <
1191 if (rAnchor.nContent.GetIndex() < iter->nEnd)
1192 {
1193 return true;
1194 }
1195 }
1196 }
1197 return false;
1198 }
1199 else
1200 {
1201 return true;
1202 }
1203}
1204
1206 std::vector<sw::Extent>::const_iterator const*const pIter,
1207 std::vector<sw::Extent>::const_iterator const*const pEnd,
1208 SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
1209{
1210 std::vector<SwFrameFormat*> const & rFlys(rNode.GetAnchoredFlys());
1211 for (SwFrameFormat * pFrameFormat : rFlys)
1212 {
1213 SwFormatAnchor const& rAnchor = pFrameFormat->GetAnchor();
1214 if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR
1215 || rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1216 {
1217 assert(rAnchor.GetContentAnchor()->nNode.GetIndex() == rNode.GetIndex());
1218 if (!IsShown(rNode.GetIndex(), rAnchor, pIter, pEnd, pFirstNode, pLastNode))
1219 {
1220 pFrameFormat->DelFrames();
1221 }
1222 }
1223 }
1224}
1225
1226void AppendObjsOfNode(SwFrameFormats const*const pTable, SwNodeOffset const nIndex,
1227 SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc,
1228 std::vector<sw::Extent>::const_iterator const*const pIter,
1229 std::vector<sw::Extent>::const_iterator const*const pEnd,
1230 SwTextNode const*const pFirstNode, SwTextNode const*const pLastNode)
1231{
1232#if OSL_DEBUG_LEVEL > 0
1233 std::vector<SwFrameFormat*> checkFormats;
1234 for ( size_t i = 0; i < pTable->size(); ++i )
1235 {
1236 SwFrameFormat *pFormat = (*pTable)[i];
1237 const SwFormatAnchor &rAnch = pFormat->GetAnchor();
1238 if ( rAnch.GetContentAnchor() &&
1239 IsShown(nIndex, rAnch, pIter, pEnd, pFirstNode, pLastNode))
1240 {
1241 checkFormats.push_back( pFormat );
1242 }
1243 }
1244#else
1245 (void)pTable;
1246#endif
1247
1248 SwNode const& rNode(*pDoc->GetNodes()[nIndex]);
1249 std::vector<SwFrameFormat*> const & rFlys(rNode.GetAnchoredFlys());
1250 for (size_t it = 0; it != rFlys.size(); )
1251 {
1252 SwFrameFormat *const pFormat = rFlys[it];
1253 const SwFormatAnchor &rAnch = pFormat->GetAnchor();
1254 if ( rAnch.GetContentAnchor() &&
1255 IsShown(nIndex, rAnch, pIter, pEnd, pFirstNode, pLastNode))
1256 {
1257#if OSL_DEBUG_LEVEL > 0
1258 std::vector<SwFrameFormat*>::iterator checkPos = std::find( checkFormats.begin(), checkFormats.end(), pFormat );
1259 assert( checkPos != checkFormats.end());
1260 checkFormats.erase( checkPos );
1261#endif
1262 AppendObj(pFrame, pPage, pFormat, rAnch);
1263 }
1264 ++it;
1265 }
1266
1267#if OSL_DEBUG_LEVEL > 0
1268 assert( checkFormats.empty());
1269#endif
1270}
1271
1272
1273void AppendObjs(const SwFrameFormats *const pTable, SwNodeOffset const nIndex,
1274 SwFrame *const pFrame, SwPageFrame *const pPage, SwDoc *const pDoc)
1275{
1276 if (pFrame->IsTextFrame())
1277 {
1278 SwTextFrame const*const pTextFrame(static_cast<SwTextFrame const*>(pFrame));
1279 if (sw::MergedPara const*const pMerged = pTextFrame->GetMergedPara())
1280 {
1281 std::vector<sw::Extent>::const_iterator iterFirst(pMerged->extents.begin());
1282 std::vector<sw::Extent>::const_iterator iter(iterFirst);
1283 SwTextNode const* pNode(pMerged->pFirstNode);
1284 for ( ; ; ++iter)
1285 {
1286 if (iter == pMerged->extents.end()
1287 || iter->pNode != pNode)
1288 {
1289 AppendObjsOfNode(pTable, pNode->GetIndex(), pFrame, pPage, pDoc,
1290 &iterFirst, &iter, pMerged->pFirstNode, pMerged->pLastNode);
1291 SwNodeOffset const until = iter == pMerged->extents.end()
1292 ? pMerged->pLastNode->GetIndex() + 1
1293 : iter->pNode->GetIndex();
1294 for (SwNodeOffset i = pNode->GetIndex() + 1; i < until; ++i)
1295 {
1296 // let's show at-para flys on nodes that contain start/end of
1297 // redline too, even if there's no text there
1298 SwNode const*const pTmp(pNode->GetNodes()[i]);
1300 {
1301 AppendObjsOfNode(pTable, pTmp->GetIndex(), pFrame, pPage, pDoc, &iter, &iter, pMerged->pFirstNode, pMerged->pLastNode);
1302 }
1303 }
1304 if (iter == pMerged->extents.end())
1305 {
1306 break;
1307 }
1308 pNode = iter->pNode;
1309 iterFirst = iter;
1310 }
1311 }
1312 }
1313 else
1314 {
1315 return AppendObjsOfNode(pTable, nIndex, pFrame, pPage, pDoc, nullptr, nullptr, nullptr, nullptr);
1316 }
1317 }
1318 else
1319 {
1320 return AppendObjsOfNode(pTable, nIndex, pFrame, pPage, pDoc, nullptr, nullptr, nullptr, nullptr);
1321 }
1322}
1323
1324bool IsAnchoredObjShown(SwTextFrame const& rFrame, SwFormatAnchor const& rAnchor)
1325{
1326 assert(rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA ||
1327 rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR ||
1328 rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR);
1329 bool ret(true);
1330 if (auto const pMergedPara = rFrame.GetMergedPara())
1331 {
1332 ret = false;
1333 auto const pAnchor(rAnchor.GetContentAnchor());
1334 auto iterFirst(pMergedPara->extents.cbegin());
1335 if (iterFirst == pMergedPara->extents.end()
1336 && (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
1337 || rAnchor.GetAnchorId() == RndStdIds::FLY_AT_CHAR))
1338 {
1339 ret = (&pAnchor->nNode.GetNode() == pMergedPara->pFirstNode
1340 && (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
1341 || pAnchor->nContent == 0))
1342 || (&pAnchor->nNode.GetNode() == pMergedPara->pLastNode
1343 && (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
1344 || pAnchor->nContent == pMergedPara->pLastNode->Len()));
1345 }
1346 auto iter(iterFirst);
1347 SwTextNode const* pNode(pMergedPara->pFirstNode);
1348 for ( ; ; ++iter)
1349 {
1350 if (iter == pMergedPara->extents.end()
1351 || iter->pNode != pNode)
1352 {
1353 assert(pNode->GetRedlineMergeFlag() != SwNode::Merge::Hidden);
1354 if (pNode == &pAnchor->nNode.GetNode())
1355 {
1356 ret = IsShown(pNode->GetIndex(), rAnchor, &iterFirst, &iter,
1357 pMergedPara->pFirstNode, pMergedPara->pLastNode);
1358 break;
1359 }
1360 if (iter == pMergedPara->extents.end())
1361 {
1362 break;
1363 }
1364 pNode = iter->pNode;
1365 if (pAnchor->nNode.GetIndex() < pNode->GetIndex())
1366 {
1367 break;
1368 }
1369 iterFirst = iter;
1370 }
1371 }
1372 }
1373 return ret;
1374}
1375
1376void AppendAllObjs(const SwFrameFormats* pTable, const SwFrame* pSib)
1377{
1378 //Connecting of all Objects, which are described in the SpzTable with the
1379 //layout.
1380
1381 boost::circular_buffer<SwFrameFormat*> vFormatsToConnect(pTable->size());
1382 for(const auto& pFormat : *pTable)
1383 {
1384 const auto& rAnch = pFormat->GetAnchor();
1385 // Formats can still remain, because we neither use character bound
1386 // frames nor objects which are anchored to character bounds.
1387 if ((rAnch.GetAnchorId() != RndStdIds::FLY_AT_PAGE) && (rAnch.GetAnchorId() != RndStdIds::FLY_AS_CHAR))
1388 {
1389 auto pContentAnchor = rAnch.GetContentAnchor();
1390 // formats in header/footer have no dependencies
1391 if(pContentAnchor && pFormat->GetDoc()->IsInHeaderFooter(pContentAnchor->nNode))
1392 pFormat->MakeFrames();
1393 else
1394 vFormatsToConnect.push_back(pFormat);
1395 }
1396 }
1397 const SwRootFrame* pRoot = pSib ? pSib->getRootFrame() : nullptr;
1398 const SwFrameFormat* pFirstRequeued(nullptr);
1399 while(!vFormatsToConnect.empty())
1400 {
1401 auto& pFormat = vFormatsToConnect.front();
1402 bool isConnected(false);
1403 pFormat->CallSwClientNotify(sw::GetObjectConnectedHint(isConnected, pRoot));
1404 if(!isConnected)
1405 {
1406 pFormat->MakeFrames();
1407 pFormat->CallSwClientNotify(sw::GetObjectConnectedHint(isConnected, pRoot));
1408 }
1409 // do this *before* push_back! the circular_buffer can be "full"!
1410 vFormatsToConnect.pop_front();
1411 if (!isConnected)
1412 {
1413 if(pFirstRequeued == pFormat)
1414 // If nothing happens anymore we can stop.
1415 break;
1416 if(!pFirstRequeued)
1417 pFirstRequeued = pFormat;
1418 assert(!vFormatsToConnect.full());
1419 vFormatsToConnect.push_back(pFormat);
1420 }
1421 else
1422 {
1423 pFirstRequeued = nullptr;
1424 }
1425 }
1426}
1427
1428namespace sw {
1429
1431{
1432 std::vector<SwTextFrame*> frames;
1434 for (SwTextFrame* pFrame = aIter.First(); pFrame; pFrame = aIter.Next())
1435 {
1436 if (pFrame->getRootFrame()->HasMergedParas())
1437 {
1438 frames.push_back(pFrame);
1439 }
1440 }
1442 for (SwTextFrame * pFrame : frames)
1443 {
1444 // SplitNode could have moved the original frame to the start node
1445 // & created a new one on end, or could have created new frame on
1446 // start node... grab start node's frame and recreate MergedPara.
1447 SwTextNode & rFirstNode(pFrame->GetMergedPara()
1448 ? *pFrame->GetMergedPara()->pFirstNode
1449 : rNode);
1450 assert(rFirstNode.GetIndex() <= rNode.GetIndex());
1451 // clear old one first to avoid DelFrames confusing updates & asserts...
1452 pFrame->SetMergedPara(nullptr);
1453 pFrame->SetMergedPara(sw::CheckParaRedlineMerge(
1454 *pFrame, rFirstNode, eMode));
1455 eMode = sw::FrameMode::New; // Existing is not idempotent!
1456 // note: this may or may not delete frames on the end node
1457 }
1458}
1459
1460} // namespace sw
1461
1466static void lcl_SetPos( SwFrame& _rNewFrame,
1467 const SwLayoutFrame& _rLayFrame )
1468{
1469 SwRectFnSet aRectFnSet(&_rLayFrame);
1471 aRectFnSet.SetPos( aFrm, aRectFnSet.GetPos(_rLayFrame.getFrameArea()) );
1472
1473 // move position by one SwTwip in text flow direction in order to get
1474 // notifications for a new calculated position after its formatting.
1475 if ( aRectFnSet.IsVert() )
1476 {
1477 aFrm.Pos().AdjustX( -1 );
1478 }
1479 else
1480 {
1481 aFrm.Pos().AdjustY(1 );
1482 }
1483}
1484
1485void InsertCnt_( SwLayoutFrame *pLay, SwDoc *pDoc,
1486 SwNodeOffset nIndex, bool bPages, SwNodeOffset nEndIndex,
1487 SwFrame *pPrv, sw::FrameMode const eMode )
1488{
1490 SwRootFrame* pLayout = pLay->getRootFrame();
1491 const bool bOldCallbackActionEnabled = pLayout && pLayout->IsCallbackActionEnabled();
1492 if( bOldCallbackActionEnabled )
1493 pLayout->SetCallbackActionEnabled( false );
1494
1495 //In the generation of the Layout bPages=true will be handed over.
1496 //Then will be new pages generated all x paragraphs already times in advance.
1497 //On breaks and/or pagedescriptorchanges the corresponding will be generated
1498 //immediately.
1499 //The advantage is, that on one hand already a nearly realistic number of
1500 //pages are created, but above all there are no almost endless long chain
1501 //of paragraphs, which must be moved expensively until it reaches a tolerable
1502 //reduced level.
1503 //We'd like to think that 20 Paragraphs fit on one page.
1504 //So that it does not become in extreme situations so violent we calculate depending
1505 //on the node something to it.
1506 //If in the DocStatistic a usable given pagenumber
1507 //(Will be cared for while writing), so it will be presumed that this will be
1508 //number of pages.
1509 const bool bStartPercent = bPages && !nEndIndex;
1510
1511 SwPageFrame *pPage = pLay->FindPageFrame();
1512 const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
1513 SwFrame *pFrame = nullptr;
1514 std::unique_ptr<SwActualSection> pActualSection;
1515 std::unique_ptr<SwLayHelper> pPageMaker;
1516
1517 //If the layout will be created (bPages == true) we do head on the progress
1518 //Flys and DrawObjects are not connected immediately, this
1519 //happens only at the end of the function.
1520 if ( bPages )
1521 {
1522 // Attention: the SwLayHelper class uses references to the content-,
1523 // page-, layout-frame etc. and may change them!
1524 pPageMaker.reset(new SwLayHelper( pDoc, pFrame, pPrv, pPage, pLay,
1525 pActualSection, nIndex, SwNodeOffset(0) == nEndIndex ));
1526 if( bStartPercent )
1527 {
1528 const sal_uLong nPageCount = pPageMaker->CalcPageCount();
1529 if( nPageCount )
1530 bObjsDirect = false;
1531 }
1532 }
1533 else
1534 pPageMaker = nullptr;
1535
1536 if( pLay->IsInSct() &&
1537 ( pLay->IsSctFrame() || pLay->GetUpper() ) ) // Hereby will newbies
1538 // be intercepted, of which flags could not determined yet,
1539 // for e.g. while inserting a table
1540 {
1541 SwSectionFrame* pSct = pLay->FindSctFrame();
1542 // If content will be inserted in a footnote, which in a column area,
1543 // the column area it is not allowed to be broken up.
1544 // Only if in the inner of the footnote lies an area, is this a candidate
1545 // for pActualSection.
1546 // The same applies for areas in tables, if inside the table will be
1547 // something inserted, it's only allowed to break up areas, which
1548 // lies in the inside also.
1549 if( ( !pLay->IsInFootnote() || pSct->IsInFootnote() ) &&
1550 ( !pLay->IsInTab() || pSct->IsInTab() ) )
1551 {
1552 pActualSection.reset(new SwActualSection(nullptr, pSct, pSct->GetSection()->GetFormat()->GetSectionNode()));
1553 // tdf#132236 for SwUndoDelete: find outer sections whose start
1554 // nodes aren't contained in the range but whose end nodes are,
1555 // because section frames may need to be created for them
1556 SwActualSection * pUpperSection(pActualSection.get());
1557 while (pUpperSection->GetSectionNode()->EndOfSectionIndex() < nEndIndex)
1558 {
1559 SwStartNode *const pStart(pUpperSection->GetSectionNode()->StartOfSectionNode());
1560 if (!pStart->IsSectionNode())
1561 {
1562 break;
1563 }
1564 // note: these don't have a section frame, check it in EndNode case!
1565 auto const pTmp(new SwActualSection(nullptr, nullptr, static_cast<SwSectionNode*>(pStart)));
1566 pUpperSection->SetUpper(pTmp);
1567 pUpperSection = pTmp;
1568 }
1569 OSL_ENSURE( !pLay->Lower() || !pLay->Lower()->IsColumnFrame(),
1570 "InsertCnt_: Wrong Call" );
1571 }
1572 }
1573
1574 //If a section is "open", the pActualSection points to an SwActualSection.
1575 //If the page breaks, for "open" sections a follow will created.
1576 //For nested sections (which have, however, not a nested layout),
1577 //the SwActualSection class has a member, which points to an upper(section).
1578 //When the "inner" section finishes, the upper will used instead.
1579
1580 // Do not consider the end node. The caller (Section/MakeFrames()) has to
1581 // ensure that the end of this range is positioned before EndIndex!
1582 for ( ; nEndIndex == SwNodeOffset(0) || nIndex < nEndIndex; ++nIndex)
1583 {
1584 SwNode *pNd = pDoc->GetNodes()[nIndex];
1585 if ( pNd->IsContentNode() )
1586 {
1587 SwContentNode* pNode = static_cast<SwContentNode*>(pNd);
1588 if (pLayout->HasMergedParas() && !pNd->IsCreateFrameWhenHidingRedlines())
1589 {
1590 if (pNd->IsTextNode()
1592 { // must have a frame already
1593 assert(static_cast<SwTextFrame*>(pNode->getLayoutFrame(pLayout))->GetMergedPara());
1594 }
1595 continue; // skip it
1596 }
1597 pFrame = pNode->IsTextNode()
1598 ? sw::MakeTextFrame(*pNode->GetTextNode(), pLay, eMode)
1599 : pNode->MakeFrame(pLay);
1600 if( pPageMaker )
1601 pPageMaker->CheckInsert( nIndex );
1602
1603 pFrame->InsertBehind( pLay, pPrv );
1604 // #i27138#
1605 // notify accessibility paragraphs objects about changed
1606 // CONTENT_FLOWS_FROM/_TO relation.
1607 // Relation CONTENT_FLOWS_FROM for next paragraph will change
1608 // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1609#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1610 if ( pFrame->IsTextFrame() )
1611 {
1612 SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1613 // no notification, if <SwViewShell> is in construction
1614 if ( pViewShell && !pViewShell->IsInConstructor() &&
1615 pViewShell->GetLayout() &&
1616 pViewShell->GetLayout()->IsAnyShellAccessible() &&
1617 pFrame->FindPageFrame() != nullptr)
1618 {
1619 auto pNext = pFrame->FindNextCnt( true );
1620 auto pPrev = pFrame->FindPrevCnt();
1622 pNext ? pNext->DynCastTextFrame() : nullptr,
1623 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1624 // #i68958#
1625 // The information flags of the text frame are validated
1626 // in methods <FindNextCnt(..)> and <FindPrevCnt(..)>.
1627 // The information flags have to be invalidated, because
1628 // it is possible, that the one of its upper frames
1629 // isn't inserted into the layout.
1630 pFrame->InvalidateInfFlags();
1631 }
1632 }
1633#endif
1634 // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1635 // for setting position at newly inserted frame
1636 lcl_SetPos( *pFrame, *pLay );
1637 pPrv = pFrame;
1638
1639 if ( !pTable->empty() && bObjsDirect && !isFlyCreationSuppressed )
1640 AppendObjs( pTable, nIndex, pFrame, pPage, pDoc );
1641 }
1642 else if ( pNd->IsTableNode() )
1643 { //Should we have encountered a table?
1644 SwTableNode *pTableNode = static_cast<SwTableNode*>(pNd);
1645 if (pLayout->IsHideRedlines())
1646 {
1647 // in the problematic case, there can be only 1 redline...
1648 SwPosition const tmp(*pNd);
1649 SwRangeRedline const*const pRedline(
1650 pDoc->getIDocumentRedlineAccess().GetRedline(tmp, nullptr));
1651 // pathology: redline that starts on a TableNode; cannot
1652 // be created in UI but by import filters...
1653 if (pRedline
1654 && pRedline->GetType() == RedlineType::Delete
1655 && &pRedline->Start()->nNode.GetNode() == pNd)
1656 {
1657 SAL_WARN("sw.pageframe", "skipping table frame creation on bizarre redline");
1658 while (true)
1659 {
1660 pTableNode->GetNodes()[nIndex]->SetRedlineMergeFlag(SwNode::Merge::Hidden);
1661 if (nIndex == pTableNode->EndOfSectionIndex())
1662 {
1663 break;
1664 }
1665 ++nIndex;
1666 }
1667 continue;
1668 }
1669 }
1670 if (pLayout->HasMergedParas() && !pNd->IsCreateFrameWhenHidingRedlines())
1671 {
1673 nIndex = pTableNode->EndOfSectionIndex();
1674 continue; // skip it
1675 }
1676
1677 pFrame = pTableNode->MakeFrame( pLay );
1678
1679 // skip tables deleted with track changes
1680 if ( !static_cast<SwTabFrame*>(pFrame)->Lower() )
1681 {
1682 nIndex = pTableNode->EndOfSectionIndex();
1683 continue; // skip it
1684 }
1685
1686 // #108116# loading may produce table structures that GCLines
1687 // needs to clean up. To keep table formulas correct, change
1688 // all table formulas to internal (BOXPTR) representation.
1689 SwTableFormulaUpdate aMsgHint( &pTableNode->GetTable() );
1690 aMsgHint.m_eFlags = TBL_BOXPTR;
1691 pDoc->getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
1692 pTableNode->GetTable().GCLines();
1693
1694 if( pPageMaker )
1695 pPageMaker->CheckInsert( nIndex );
1696
1697 pFrame->InsertBehind( pLay, pPrv );
1698 if (pPage) // would null in SwCellFrame ctor
1699 { // tdf#134931 call ResetTurbo(); not sure if Paste() would be
1700 pFrame->InvalidatePage(pPage); // better than InsertBehind()?
1701 }
1702 // #i27138#
1703 // notify accessibility paragraphs objects about changed
1704 // CONTENT_FLOWS_FROM/_TO relation.
1705 // Relation CONTENT_FLOWS_FROM for next paragraph will change
1706 // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1707#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1708 {
1709 SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1710 // no notification, if <SwViewShell> is in construction
1711 if ( pViewShell && !pViewShell->IsInConstructor() &&
1712 pViewShell->GetLayout() &&
1713 pViewShell->GetLayout()->IsAnyShellAccessible() &&
1714 pFrame->FindPageFrame() != nullptr)
1715 {
1716 auto pNext = pFrame->FindNextCnt( true );
1717 auto pPrev = pFrame->FindPrevCnt();
1719 pNext ? pNext->DynCastTextFrame() : nullptr,
1720 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1721 }
1722 }
1723#endif
1724 if ( bObjsDirect && !pTable->empty() )
1725 static_cast<SwTabFrame*>(pFrame)->RegistFlys();
1726 // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1727 // for setting position at newly inserted frame
1728 lcl_SetPos( *pFrame, *pLay );
1729
1730 pPrv = pFrame;
1731 //Set the index to the endnode of the table section.
1732 nIndex = pTableNode->EndOfSectionIndex();
1733
1734 SwTabFrame* pTmpFrame = static_cast<SwTabFrame*>(pFrame);
1735 while ( pTmpFrame )
1736 {
1737 pTmpFrame->CheckDirChange();
1738 pTmpFrame = pTmpFrame->IsFollow() ? pTmpFrame->FindMaster() : nullptr;
1739 }
1740
1741 }
1742 else if ( pNd->IsSectionNode() )
1743 {
1744 if (pLayout->HasMergedParas() && !pNd->IsCreateFrameWhenHidingRedlines())
1745 {
1747 continue; // skip it
1748 }
1749 SwSectionNode *pNode = static_cast<SwSectionNode*>(pNd);
1750 if( pNode->GetSection().CalcHiddenFlag() )
1751 // is hidden, skip the area
1752 nIndex = pNode->EndOfSectionIndex();
1753 else
1754 {
1755 pFrame = pNode->MakeFrame( pLay );
1756 pActualSection.reset( new SwActualSection( pActualSection.release(),
1757 static_cast<SwSectionFrame*>(pFrame), pNode ) );
1758 if ( pActualSection->GetUpper() )
1759 {
1760 //Insert behind the Upper, the "Follow" of the Upper will be
1761 //generated at the EndNode.
1762 SwSectionFrame *pTmp = pActualSection->GetUpper()->GetSectionFrame();
1763 pFrame->InsertBehind( pTmp->GetUpper(), pTmp );
1764 // OD 25.03.2003 #108339# - direct initialization of section
1765 // after insertion in the layout
1766 static_cast<SwSectionFrame*>(pFrame)->Init();
1767 }
1768 else
1769 {
1770 pFrame->InsertBehind( pLay, pPrv );
1771 // OD 25.03.2003 #108339# - direct initialization of section
1772 // after insertion in the layout
1773 static_cast<SwSectionFrame*>(pFrame)->Init();
1774
1775 // #i33963#
1776 // Do not trust the IsInFootnote flag. If we are currently
1777 // building up a table, the upper of pPrv may be a cell
1778 // frame, but the cell frame does not have an upper yet.
1779 if( pPrv && nullptr != pPrv->ImplFindFootnoteFrame() )
1780 {
1781 if( pPrv->IsSctFrame() )
1782 pPrv = static_cast<SwSectionFrame*>(pPrv)->ContainsContent();
1783 if( pPrv && pPrv->IsTextFrame() )
1784 static_cast<SwTextFrame*>(pPrv)->Prepare( PrepareHint::QuoVadis, nullptr, false );
1785 }
1786 }
1787
1788 if (nIndex + 1 == nEndIndex
1789 // tdf#136452 may also be needed at end of section
1790 || pNode->EndOfSectionIndex() - 1 == nEndIndex)
1791 { // tdf#131684 tdf#132236 fix upper of frame moved in
1792 // SwUndoDelete; can't be done there unfortunately
1793 // because empty section frames are deleted here
1794 SwFrame *const pNext(
1795 // if there's a parent section, it has been split
1796 // into 2 SwSectionFrame already :(
1797 ( pFrame->GetNext()
1798 && pFrame->GetNext()->IsSctFrame()
1799 && pActualSection->GetUpper()
1800 && pActualSection->GetUpper()->GetSectionNode() ==
1801 static_cast<SwSectionFrame const*>(pFrame->GetNext())->GetSection()->GetFormat()->GetSectionNode())
1802 ? static_cast<SwSectionFrame *>(pFrame->GetNext())->ContainsContent()
1803 : pFrame->GetNext());
1804 if (pNext
1805 && pNext->IsTextFrame()
1806 && static_cast<SwTextFrame*>(pNext)->GetTextNodeFirst() == pDoc->GetNodes()[nEndIndex]
1807 && (pNext->GetUpper() == pFrame->GetUpper()
1808 || pFrame->GetNext()->IsSctFrame())) // checked above
1809 {
1810 pNext->Cut();
1811 pNext->InvalidateInfFlags(); // mbInfSct changed
1812 // could have columns
1813 SwSectionFrame *const pSection(static_cast<SwSectionFrame*>(pFrame));
1814 assert(!pSection->Lower() || pSection->Lower()->IsLayoutFrame());
1815 SwLayoutFrame *const pParent(pSection->Lower() ? pSection->GetNextLayoutLeaf() : pSection);
1816 assert(!pParent->Lower());
1817 // paste invalidates, section could have indent...
1818 pNext->Paste(pParent, nullptr);
1819 }
1820 }
1821 // #i27138#
1822 // notify accessibility paragraphs objects about changed
1823 // CONTENT_FLOWS_FROM/_TO relation.
1824 // Relation CONTENT_FLOWS_FROM for next paragraph will change
1825 // and relation CONTENT_FLOWS_TO for previous paragraph will change.
1826#if !ENABLE_WASM_STRIP_ACCESSIBILITY
1827 {
1828 SwViewShell* pViewShell( pFrame->getRootFrame()->GetCurrShell() );
1829 // no notification, if <SwViewShell> is in construction
1830 if ( pViewShell && !pViewShell->IsInConstructor() &&
1831 pViewShell->GetLayout() &&
1832 pViewShell->GetLayout()->IsAnyShellAccessible() &&
1833 pFrame->FindPageFrame() != nullptr)
1834 {
1835 auto pNext = pFrame->FindNextCnt( true );
1836 auto pPrev = pFrame->FindPrevCnt();
1838 pNext ? pNext->DynCastTextFrame() : nullptr,
1839 pPrev ? pPrev->DynCastTextFrame() : nullptr );
1840 }
1841 }
1842#endif
1843 pFrame->CheckDirChange();
1844
1845 // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1846 // for setting position at newly inserted frame
1847 lcl_SetPos( *pFrame, *pLay );
1848
1849 // OD 20.11.2002 #105405# - no page, no invalidate.
1850 if ( pPage )
1851 {
1852 // OD 18.09.2002 #100522#
1853 // invalidate page in order to force format and paint of
1854 // inserted section frame
1855 pFrame->InvalidatePage( pPage );
1856
1857 // FME 10.11.2003 #112243#
1858 // Invalidate fly content flag:
1859 if ( pFrame->IsInFly() )
1860 pPage->InvalidateFlyContent();
1861
1862 // OD 14.11.2002 #104684# - invalidate page content in order to
1863 // force format and paint of section content.
1864 pPage->InvalidateContent();
1865 }
1866
1867 pLay = static_cast<SwLayoutFrame*>(pFrame);
1868 if ( pLay->Lower() && pLay->Lower()->IsLayoutFrame() )
1869 pLay = pLay->GetNextLayoutLeaf();
1870 pPrv = nullptr;
1871 }
1872 }
1873 else if ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsSectionNode() )
1874 {
1875 if (pLayout->HasMergedParas() && !pNd->IsCreateFrameWhenHidingRedlines())
1876 {
1878 continue; // skip it
1879 }
1881 { // tdf#135014 section break in fieldmark (start inside, end outside)
1883 continue; // skip it
1884 }
1885 assert(pActualSection && "Section end without section start?");
1886 assert(pActualSection->GetSectionNode() == pNd->StartOfSectionNode());
1887
1888 //Close the section, where appropriate activate the surrounding
1889 //section again.
1890 pActualSection.reset(pActualSection->GetUpper());
1891 pLay = pLay->FindSctFrame();
1892 if ( pActualSection )
1893 {
1894 //Could be, that the last SectionFrame remains empty.
1895 //Then now is the time to remove them.
1896 if ( !pLay->ContainsContent() )
1897 {
1898 SwFrame *pTmpFrame = pLay;
1899 pLay = pTmpFrame->GetUpper();
1900 pPrv = pTmpFrame->GetPrev();
1901 pTmpFrame->RemoveFromLayout();
1902 SwFrame::DestroyFrame(pTmpFrame);
1903 }
1904 else
1905 {
1906 pPrv = pLay;
1907 pLay = pLay->GetUpper();
1908 }
1909
1910 // new section frame
1911 pFrame = pActualSection->GetSectionNode()->MakeFrame( pLay );
1912 pFrame->InsertBehind( pLay, pPrv );
1913 static_cast<SwSectionFrame*>(pFrame)->Init();
1914
1915 // OD 12.08.2003 #i17969# - consider horizontal/vertical layout
1916 // for setting position at newly inserted frame
1917 lcl_SetPos( *pFrame, *pLay );
1918
1919 SwSectionFrame* pOuterSectionFrame = pActualSection->GetSectionFrame();
1920
1921 // a follow has to be appended to the new section frame
1922 SwSectionFrame* pFollow = pOuterSectionFrame ? pOuterSectionFrame->GetFollow() : nullptr;
1923 if ( pFollow )
1924 {
1925 pOuterSectionFrame->SetFollow( nullptr );
1926 pOuterSectionFrame->InvalidateSize();
1927 static_cast<SwSectionFrame*>(pFrame)->SetFollow( pFollow );
1928 }
1929
1930 // We don't want to leave empty parts back.
1931 if (pOuterSectionFrame &&
1932 ! pOuterSectionFrame->IsColLocked() &&
1933 ! pOuterSectionFrame->ContainsContent() )
1934 {
1935 pOuterSectionFrame->DelEmpty( true );
1936 SwFrame::DestroyFrame(pOuterSectionFrame);
1937 }
1938 pActualSection->SetSectionFrame( static_cast<SwSectionFrame*>(pFrame) );
1939
1940 pLay = static_cast<SwLayoutFrame*>(pFrame);
1941 if ( pLay->Lower() && pLay->Lower()->IsLayoutFrame() )
1942 pLay = pLay->GetNextLayoutLeaf();
1943 pPrv = nullptr;
1944 }
1945 else
1946 {
1947 //Nothing more with sections, it goes on right behind
1948 //the SectionFrame.
1949 pPrv = pLay;
1950 pLay = pLay->GetUpper();
1951 }
1952 }
1953 else if( pNd->IsStartNode() &&
1954 SwFlyStartNode == static_cast<SwStartNode*>(pNd)->GetStartNodeType() )
1955 {
1956 if (pLayout->HasMergedParas() && !pNd->IsCreateFrameWhenHidingRedlines())
1957 {
1959 assert(false); // actually a fly-section can't be deleted?
1960 continue; // skip it
1961 }
1962 if ( !pTable->empty() && bObjsDirect && !isFlyCreationSuppressed )
1963 {
1964 SwFlyFrame* pFly = pLay->FindFlyFrame();
1965 if( pFly )
1966 AppendObjs( pTable, nIndex, pFly, pPage, pDoc );
1967 }
1968 }
1969 else
1970 {
1971 assert(!pLayout->HasMergedParas()
1973 // Neither Content nor table nor section, so we are done.
1974 break;
1975 }
1976 }
1977
1978 if ( pActualSection )
1979 {
1980 // Might happen that an empty (Follow-)Section is left over.
1981 if ( !(pLay = pActualSection->GetSectionFrame())->ContainsContent() )
1982 {
1983 pLay->RemoveFromLayout();
1985 }
1986 pActualSection.reset();
1987 }
1988
1989 if ( bPages ) // let the Flys connect to each other
1990 {
1991 if ( !isFlyCreationSuppressed )
1992 AppendAllObjs( pTable, pLayout );
1993 bObjsDirect = true;
1994 }
1995
1996 if( pPageMaker )
1997 {
1998 pPageMaker->CheckFlyCache( pPage );
1999 pPageMaker.reset();
2000 if( pDoc->GetLayoutCache() )
2001 {
2002#ifdef DBG_UTIL
2003 pDoc->GetLayoutCache()->CompareLayout( *pDoc );
2004#endif
2005 pDoc->GetLayoutCache()->ClearImpl();
2006 }
2007 }
2008
2010 if( bOldCallbackActionEnabled )
2011 pLayout->SetCallbackActionEnabled( bOldCallbackActionEnabled );
2012}
2013
2014void MakeFrames( SwDoc *pDoc, const SwNodeIndex &rSttIdx,
2015 const SwNodeIndex &rEndIdx )
2016{
2017 bObjsDirect = false;
2018
2019 SwNodeIndex aTmp( rSttIdx );
2020 SwNodeOffset nEndIdx = rEndIdx.GetIndex();
2021 // TODO for multiple layouts there should be a loop here
2022 SwNode* pNd = pDoc->GetNodes().FindPrvNxtFrameNode( aTmp,
2023 pDoc->GetNodes()[ nEndIdx-1 ],
2025 if ( pNd )
2026 {
2027 bool bApres = aTmp < rSttIdx;
2028 SwNode2Layout aNode2Layout( *pNd, rSttIdx.GetIndex() );
2029 SwFrame* pFrame;
2031 while( nullptr != (pFrame = aNode2Layout.NextFrame()) )
2032 {
2033 SwLayoutFrame *pUpper = pFrame->GetUpper();
2034 SwFootnoteFrame* pFootnoteFrame = pUpper->FindFootnoteFrame();
2035 bool bOldLock, bOldFootnote;
2036 if( pFootnoteFrame )
2037 {
2038 bOldFootnote = pFootnoteFrame->IsColLocked();
2039 pFootnoteFrame->ColLock();
2040 }
2041 else
2042 bOldFootnote = true;
2043 SwSectionFrame* pSct = pUpper->FindSctFrame();
2044 // Inside of footnotes only those areas are interesting that are inside of them. But
2045 // not the ones (e.g. column areas) in which are the footnote containers positioned.
2046 // #109767# Table frame is in section, insert section in cell frame.
2047 if( pSct && ((pFootnoteFrame && !pSct->IsInFootnote()) || pUpper->IsCellFrame()) )
2048 pSct = nullptr;
2049 if( pSct )
2050 { // to prevent pTmp->MoveFwd from destroying the SectionFrame
2051 bOldLock = pSct->IsColLocked();
2052 pSct->ColLock();
2053 }
2054 else
2055 bOldLock = true;
2056
2057 // If pFrame cannot be moved, it is not possible to move it to the next page. This applies
2058 // also for frames (in the first column of a frame pFrame is moveable) and column
2059 // sections of tables (also here pFrame is moveable).
2060 bool bMoveNext = nEndIdx - rSttIdx.GetIndex() > SwNodeOffset(120);
2061 bool bAllowMove = !pFrame->IsInFly() && pFrame->IsMoveable() &&
2062 (!pFrame->IsInTab() || pFrame->IsTabFrame() );
2063 if ( bMoveNext && bAllowMove )
2064 {
2065 SwFrame *pMove = pFrame;
2066 SwFrame *pPrev = pFrame->GetPrev();
2067 SwFlowFrame *pTmp = SwFlowFrame::CastFlowFrame( pMove );
2068 assert(pTmp);
2069
2070 if ( bApres )
2071 {
2072 // The rest of this page should be empty. Thus, the following one has to move to
2073 // the next page (it might also be located in the following column).
2074 assert(!pTmp->HasFollow() && "prev. node's frame is not last");
2075 pPrev = pFrame;
2076 // If the surrounding SectionFrame has a "next" one,
2077 // so this one needs to be moved as well.
2078 pMove = pFrame->GetIndNext();
2079 SwColumnFrame* pCol = static_cast<SwColumnFrame*>(pFrame->FindColFrame());
2080 if( pCol )
2081 pCol = static_cast<SwColumnFrame*>(pCol->GetNext());
2082 do
2083 {
2084 if( pCol && !pMove )
2085 { // No successor so far, look into the next column
2086 pMove = pCol->ContainsAny();
2087 if( pCol->GetNext() )
2088 pCol = static_cast<SwColumnFrame*>(pCol->GetNext());
2089 else if( pCol->IsInSct() )
2090 { // If there is no following column but we are in a column frame,
2091 // there might be (page) columns outside of it.
2092 pCol = static_cast<SwColumnFrame*>(pCol->FindSctFrame()->FindColFrame());
2093 if( pCol )
2094 pCol = static_cast<SwColumnFrame*>(pCol->GetNext());
2095 }
2096 else
2097 pCol = nullptr;
2098 }
2099 // skip invalid SectionFrames
2100 while( pMove && pMove->IsSctFrame() &&
2101 !static_cast<SwSectionFrame*>(pMove)->GetSection() )
2102 pMove = pMove->GetNext();
2103 } while( !pMove && pCol );
2104
2105 if( pMove )
2106 {
2107 if ( pMove->IsContentFrame() )
2108 pTmp = static_cast<SwContentFrame*>(pMove);
2109 else if ( pMove->IsTabFrame() )
2110 pTmp = static_cast<SwTabFrame*>(pMove);
2111 else if ( pMove->IsSctFrame() )
2112 {
2113 pMove = static_cast<SwSectionFrame*>(pMove)->ContainsAny();
2114 if( pMove )
2115 pTmp = SwFlowFrame::CastFlowFrame( pMove );
2116 else
2117 pTmp = nullptr;
2118 }
2119 }
2120 else
2121 pTmp = nullptr;
2122 }
2123 else
2124 {
2125 assert(!pTmp->IsFollow() && "next node's frame is not master");
2126 // move the _content_ of a section frame
2127 if( pMove->IsSctFrame() )
2128 {
2129 while( pMove && pMove->IsSctFrame() &&
2130 !static_cast<SwSectionFrame*>(pMove)->GetSection() )
2131 pMove = pMove->GetNext();
2132 if( pMove && pMove->IsSctFrame() )
2133 pMove = static_cast<SwSectionFrame*>(pMove)->ContainsAny();
2134 if( pMove )
2135 pTmp = SwFlowFrame::CastFlowFrame( pMove );
2136 else
2137 pTmp = nullptr;
2138 }
2139 }
2140
2141 if( pTmp )
2142 {
2143 SwFrame* pOldUp = pTmp->GetFrame().GetUpper();
2144 // MoveFwd==true means that we are still on the same page.
2145 // But since we want to move if possible!
2146 bool bTmpOldLock = pTmp->IsJoinLocked();
2147 pTmp->LockJoin();
2148 while( pTmp->MoveFwd( true, false, true ) )
2149 {
2150 if( pOldUp == pTmp->GetFrame().GetUpper() )
2151 break;
2152 pOldUp = pTmp->GetFrame().GetUpper();
2153 }
2154 if( !bTmpOldLock )
2155 pTmp->UnlockJoin();
2156 }
2157 ::InsertCnt_( pUpper, pDoc, rSttIdx.GetIndex(),
2158 pFrame->IsInDocBody(), nEndIdx, pPrev, eMode );
2159 }
2160 else
2161 {
2162 bool bSplit;
2163 SwFrame* pPrv = bApres ? pFrame : pFrame->GetPrev();
2164 // If the section frame is inserted into another one, it must be split.
2165 if( pSct && rSttIdx.GetNode().IsSectionNode() )
2166 {
2167 bSplit = pSct->SplitSect( pFrame, bApres );
2168 if( !bSplit && !bApres )
2169 {
2170 pUpper = pSct->GetUpper();
2171 pPrv = pSct->GetPrev();
2172 }
2173 }
2174 else
2175 bSplit = false;
2176
2177 ::InsertCnt_( pUpper, pDoc, rSttIdx.GetIndex(), false,
2178 nEndIdx, pPrv, eMode );
2179 // OD 23.06.2003 #108784# - correction: append objects doesn't
2180 // depend on value of <bAllowMove>
2181 if( !isFlyCreationSuppressed )
2182 {
2183 const SwFrameFormats *pTable = pDoc->GetSpzFrameFormats();
2184 if( !pTable->empty() )
2185 AppendAllObjs( pTable, pUpper );
2186 }
2187
2188 // If nothing was added (e.g. a hidden section), the split must be reversed.
2189 if( bSplit && pSct && pSct->GetNext()
2190 && pSct->GetNext()->IsSctFrame() )
2191 pSct->MergeNext( static_cast<SwSectionFrame*>(pSct->GetNext()) );
2192 if( pFrame->IsInFly() )
2193 pFrame->FindFlyFrame()->Invalidate_();
2194 if( pFrame->IsInTab() )
2195 pFrame->InvalidateSize();
2196 }
2197
2198 SwPageFrame *pPage = pUpper->FindPageFrame();
2199 SwFrame::CheckPageDescs( pPage, false );
2200 if( !bOldFootnote )
2201 pFootnoteFrame->ColUnlock();
2202 if( !bOldLock )
2203 {
2204 pSct->ColUnlock();
2205 // pSct might be empty (e.g. when inserting linked section containing further
2206 // sections) and can be destroyed in such cases.
2207 if( !pSct->ContainsContent() )
2208 {
2209 pSct->DelEmpty( true );
2210 pUpper->getRootFrame()->RemoveFromList( pSct );
2212 }
2213 }
2214 eMode = sw::FrameMode::New; // use Existing only once!
2215 }
2216 }
2217
2218 bObjsDirect = true;
2219}
2220
2223 , m_rAttrSet(pConstructor->IsContentFrame()
2224 ? pConstructor->IsTextFrame()
2225 ? static_cast<const SwTextFrame*>(pConstructor)->GetTextNodeForParaProps()->GetSwAttrSet()
2226 : static_cast<const SwNoTextFrame*>(pConstructor)->GetNode()->GetSwAttrSet()
2227 : static_cast<const SwLayoutFrame*>(pConstructor)->GetFormat()->GetAttrSet())
2228 , m_rUL(m_rAttrSet.GetULSpace())
2229 // #i96772#
2230 // LRSpaceItem is copied due to the possibility that it is adjusted - see below
2231 , m_rLR(m_rAttrSet.GetLRSpace().Clone())
2232 , m_rBox(m_rAttrSet.GetBox())
2233 , m_rShadow(m_rAttrSet.GetShadow())
2234 , m_aFrameSize(m_rAttrSet.GetFrameSize().GetSize())
2235 , m_bIsLine(false)
2236 , m_bJoinedWithPrev(false)
2237 , m_bJoinedWithNext(false)
2238 , m_nTopLine(0)
2239 , m_nBottomLine(0)
2240 , m_nLeftLine(0)
2241 , m_nRightLine(0)
2242 , m_nTop(0)
2243 , m_nBottom(0)
2244 , m_nGetTopLine(0)
2245 , m_nGetBottomLine(0)
2246 , m_nLineSpacing(0)
2247{
2248 // #i96772#
2249 const SwTextFrame* pTextFrame = pConstructor->DynCastTextFrame();
2250 if ( pTextFrame )
2251 {
2253 }
2254 else if ( pConstructor->IsNoTextFrame() )
2255 {
2256 m_rLR = std::make_shared<SvxLRSpaceItem>(RES_LR_SPACE);
2257 }
2258
2259 // Caution: The USHORTs for the cached values are not initialized by intention!
2260
2261 // everything needs to be calculated at least once:
2263 m_bTop = m_bBottom = m_bLine = true;
2264
2265 // except this one: calculate line spacing before cell border only for text frames
2266 m_bLineSpacing = bool(pTextFrame);
2267
2269 // OD 21.05.2003 #108789# - init cache status for values <m_bJoinedWithPrev>
2270 // and <m_bJoinedWithNext>, which aren't initialized by default.
2273}
2274
2276{
2277 const_cast<sw::BorderCacheOwner*>(static_cast<sw::BorderCacheOwner const *>(m_pOwner))->m_bInCache = false;
2278}
2279
2280/* All calc methods calculate a safety distance in addition to the values given by the attributes.
2281 * This safety distance is only added when working with borders and/or shadows to prevent that
2282 * e.g. borders are painted over.
2283 */
2284
2286{
2288
2289 if (m_rLR)
2290 {
2291 bool bGutterAtTop = m_rAttrSet.GetDoc()->getIDocumentSettingAccess().get(
2293 if (bGutterAtTop)
2294 {
2295 // Decrease the print area: the top space is the sum of top and gutter margins.
2296 m_nTop += m_rLR->GetGutterMargin();
2297 }
2298 }
2299
2300 m_bTop = false;
2301}
2302
2304{
2306 m_bBottom = false;
2307}
2308
2310{
2311 tools::Long nRight=0;
2312
2313 if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING)) {
2314 // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
2315 // and right border are painted on the right respectively left.
2316 if ( pCaller->IsCellFrame() && pCaller->IsRightToLeft() )
2317 nRight = CalcLeftLine();
2318 else
2319 nRight = CalcRightLine();
2320
2321 }
2322 // for paragraphs, "left" is "before text" and "right" is "after text"
2323 if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
2324 nRight += m_rLR->GetLeft();
2325 else
2326 nRight += m_rLR->GetRight();
2327
2328 // correction: retrieve left margin for numbering in R2L-layout
2329 if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
2330 {
2331 nRight += static_cast<const SwTextFrame*>(pCaller)->GetTextNodeForParaProps()->GetLeftMarginWithNum();
2332 }
2333
2334 if (pCaller->IsPageFrame() && m_rLR)
2335 {
2336 const auto pPageFrame = static_cast<const SwPageFrame*>(pCaller);
2337 bool bGutterAtTop = pPageFrame->GetFormat()->getIDocumentSettingAccess().get(
2339 if (!bGutterAtTop)
2340 {
2341 bool bRtlGutter = pPageFrame->GetAttrSet()->GetItem<SfxBoolItem>(RES_RTL_GUTTER)->GetValue();
2342 tools::Long nGutterMargin = bRtlGutter ? m_rLR->GetGutterMargin() : m_rLR->GetRightGutterMargin();
2343 // Decrease the print area: the right space is the sum of right and right gutter
2344 // margins.
2345 nRight += nGutterMargin;
2346 }
2347 }
2348
2349 return nRight;
2350}
2351
2353static bool lcl_hasTabFrame(const SwTextFrame* pTextFrame)
2354{
2355 if (pTextFrame->GetDrawObjs())
2356 {
2357 const SwSortedObjs* pSortedObjs = pTextFrame->GetDrawObjs();
2358 if (pSortedObjs->size() > 0)
2359 {
2360 SwAnchoredObject* pObject = (*pSortedObjs)[0];
2361 if (auto pFly = pObject->DynCastFlyFrame())
2362 {
2363 if (pFly->Lower() && pFly->Lower()->IsTabFrame())
2364 return true;
2365 }
2366 }
2367 }
2368 return false;
2369}
2370
2372{
2373 tools::Long nLeft=0;
2374
2375 if (!pCaller->IsTextFrame() || !static_cast<const SwTextFrame*>(pCaller)->GetDoc().GetDocumentSettingManager().get(DocumentSettingId::INVERT_BORDER_SPACING))
2376 {
2377 // OD 23.01.2003 #106895# - for cell frame in R2L text direction the left
2378 // and right border are painted on the right respectively left.
2379 if ( pCaller->IsCellFrame() && pCaller->IsRightToLeft() )
2380 nLeft = CalcRightLine();
2381 else
2382 nLeft = CalcLeftLine();
2383 }
2384
2385 // for paragraphs, "left" is "before text" and "right" is "after text"
2386 if ( pCaller->IsTextFrame() && pCaller->IsRightToLeft() )
2387 nLeft += m_rLR->GetRight();
2388 else
2389 {
2390 bool bIgnoreMargin = false;
2391 if (pCaller->IsTextFrame())
2392 {
2393 const SwTextFrame* pTextFrame = static_cast<const SwTextFrame*>(pCaller);
2395 {
2396 // If this is explicitly requested, ignore the margins next to the floating table.
2397 if (lcl_hasTabFrame(pTextFrame))
2398 bIgnoreMargin = true;
2399 // TODO here we only handle the first two paragraphs, would be nice to generalize this.
2400 else if (pTextFrame->FindPrev() && pTextFrame->FindPrev()->IsTextFrame() && lcl_hasTabFrame(static_cast<const SwTextFrame*>(pTextFrame->FindPrev())))
2401 bIgnoreMargin = true;
2402 }
2403 }
2404 if (!bIgnoreMargin)
2405 nLeft += m_rLR->GetLeft();
2406 }
2407
2408 // correction: do not retrieve left margin for numbering in R2L-layout
2409 if ( pCaller->IsTextFrame() && !pCaller->IsRightToLeft() )
2410 {
2411 nLeft += static_cast<const SwTextFrame*>(pCaller)->GetTextNodeForParaProps()->GetLeftMarginWithNum();
2412 }
2413
2414 if (pCaller->IsPageFrame() && m_rLR)
2415 {
2416 const auto pPageFrame = static_cast<const SwPageFrame*>(pCaller);
2417 bool bGutterAtTop = pPageFrame->GetFormat()->getIDocumentSettingAccess().get(
2419 if (!bGutterAtTop)
2420 {
2421 bool bRtlGutter = pPageFrame->GetAttrSet()->GetItem<SfxBoolItem>(RES_RTL_GUTTER)->GetValue();
2422 tools::Long nGutterMargin = bRtlGutter ? m_rLR->GetRightGutterMargin() : m_rLR->GetGutterMargin();
2423 // Decrease the print area: the left space is the sum of left and gutter margins.
2424 nLeft += nGutterMargin;
2425 }
2426 }
2427
2428 return nLeft;
2429}
2430
2431/* Calculated values for borders and shadows.
2432 * It might be that a distance is wanted even without lines. This will be
2433 * considered here and not by the attribute (e.g. bBorderDist for cells).
2434 */
2435
2437{
2438 m_nTopLine = m_rBox.CalcLineSpace( SvxBoxItemLine::TOP, /*bEvenIfNoLine*/true );
2439 m_nTopLine = m_nTopLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::TOP);
2440 m_bTopLine = false;
2441}
2442
2444{
2445 m_nBottomLine = m_rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM, true );
2446 m_nBottomLine = m_nBottomLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::BOTTOM);
2447 m_bBottomLine = false;
2448}
2449
2451{
2452 m_nLeftLine = m_rBox.CalcLineSpace( SvxBoxItemLine::LEFT, true);
2453 m_nLeftLine = m_nLeftLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::LEFT);
2454 m_bLeftLine = false;
2455}
2456
2458{
2459 m_nRightLine = m_rBox.CalcLineSpace( SvxBoxItemLine::RIGHT, true );
2460 m_nRightLine = m_nRightLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::RIGHT);
2461 m_bRightLine = false;
2462}
2463
2465{
2468 m_bLine = false;
2469}
2470
2471/* The borders of neighboring paragraphs are condensed by following algorithm:
2472 *
2473 * 1. No top border if the predecessor has the same top border and (3) applies.
2474 * In addition, the paragraph needs to have a border at least one side (left/right/bottom).
2475 * 2. No bottom border if the successor has the same bottom border and (3) applies.
2476 * In addition, the paragraph needs to have a border at least one side (left/right/top).
2477 * 3. The borders on the left and right side are identical between the current and the
2478 * pre-/succeeding paragraph.
2479 */
2480
2481static bool CmpLines( const editeng::SvxBorderLine *pL1, const editeng::SvxBorderLine *pL2 )
2482{
2483 return ( ((pL1 && pL2) && (*pL1 == *pL2)) || (!pL1 && !pL2) );
2484}
2485
2486// OD 21.05.2003 #108789# - change name of 1st parameter - "rAttrs" -> "rCmpAttrs"
2487// OD 21.05.2003 #108789# - compare <CalcRight()> and <rCmpAttrs.CalcRight()>
2488// instead of only the right LR-spacing, because R2L-layout has to be
2489// considered.
2491 const SwFrame *pCaller,
2492 const SwFrame *pCmp ) const
2493{
2494 return ( CmpLines( rCmpAttrs.GetBox().GetLeft(), GetBox().GetLeft() ) &&
2495 CmpLines( rCmpAttrs.GetBox().GetRight(),GetBox().GetRight() ) &&
2496 CalcLeft( pCaller ) == rCmpAttrs.CalcLeft( pCmp ) &&
2497 // OD 21.05.2003 #108789# - compare <CalcRight> with <rCmpAttrs.CalcRight>.
2498 CalcRight( pCaller ) == rCmpAttrs.CalcRight( pCmp ) );
2499}
2500
2501bool SwBorderAttrs::JoinWithCmp( const SwFrame& _rCallerFrame,
2502 const SwFrame& _rCmpFrame ) const
2503{
2504 bool bReturnVal = false;
2505
2506 SwBorderAttrAccess aCmpAccess( SwFrame::GetCache(), &_rCmpFrame );
2507 const SwBorderAttrs &rCmpAttrs = *aCmpAccess.Get();
2508 if ( m_rShadow == rCmpAttrs.GetShadow() &&
2509 CmpLines( m_rBox.GetTop(), rCmpAttrs.GetBox().GetTop() ) &&
2510 CmpLines( m_rBox.GetBottom(), rCmpAttrs.GetBox().GetBottom() ) &&
2511 CmpLeftRight( rCmpAttrs, &_rCallerFrame, &_rCmpFrame )
2512 )
2513 {
2514 bReturnVal = true;
2515 }
2516
2517 return bReturnVal;
2518}
2519
2520// OD 21.05.2003 #108789# - method to determine, if borders are joined with
2521// previous frame. Calculated value saved in cached value <m_bJoinedWithPrev>
2522// OD 2004-02-26 #i25029# - add 2nd parameter <_pPrevFrame>
2524 const SwFrame* _pPrevFrame )
2525{
2526 // set default
2527 m_bJoinedWithPrev = false;
2528
2529 if ( _rFrame.IsTextFrame() )
2530 {
2531 // text frame can potentially join with previous text frame, if
2532 // corresponding attribute set is set at previous text frame.
2533 // OD 2004-02-26 #i25029# - If parameter <_pPrevFrame> is set, take this
2534 // one as previous frame.
2535 const SwFrame* pPrevFrame = _pPrevFrame ? _pPrevFrame : _rFrame.GetPrev();
2536 // OD 2004-02-13 #i25029# - skip hidden text frames.
2537 while ( pPrevFrame && pPrevFrame->IsTextFrame() &&
2538 static_cast<const SwTextFrame*>(pPrevFrame)->IsHiddenNow() )
2539 {
2540 pPrevFrame = pPrevFrame->GetPrev();
2541 }
2542 if ( pPrevFrame && pPrevFrame->IsTextFrame() &&
2543 pPrevFrame->GetAttrSet()->GetParaConnectBorder().GetValue()
2544 )
2545 {
2546 m_bJoinedWithPrev = JoinWithCmp( _rFrame, *pPrevFrame );
2547 }
2548 }
2549
2550 // valid cache status, if demanded
2551 // OD 2004-02-26 #i25029# - Do not validate cache, if parameter <_pPrevFrame>
2552 // is set.
2553 m_bCachedJoinedWithPrev = m_bCacheGetLine && !_pPrevFrame;
2554}
2555
2556// OD 21.05.2003 #108789# - method to determine, if borders are joined with
2557// next frame. Calculated value saved in cached value <m_bJoinedWithNext>
2559{
2560 // set default
2561 m_bJoinedWithNext = false;
2562
2563 if ( _rFrame.IsTextFrame() )
2564 {
2565 // text frame can potentially join with next text frame, if
2566 // corresponding attribute set is set at current text frame.
2567 // OD 2004-02-13 #i25029# - get next frame, but skip hidden text frames.
2568 const SwFrame* pNextFrame = _rFrame.GetNext();
2569 while ( pNextFrame && pNextFrame->IsTextFrame() &&
2570 static_cast<const SwTextFrame*>(pNextFrame)->IsHiddenNow() )
2571 {
2572 pNextFrame = pNextFrame->GetNext();
2573 }
2574 if ( pNextFrame && pNextFrame->IsTextFrame() &&
2576 )
2577 {
2578 m_bJoinedWithNext = JoinWithCmp( _rFrame, *pNextFrame );
2579 }
2580 }
2581
2582 // valid cache status, if demanded
2584}
2585
2586// OD 21.05.2003 #108789# - accessor for cached values <m_bJoinedWithPrev>
2587// OD 2004-02-26 #i25029# - add 2nd parameter <_pPrevFrame>, which is passed to
2588// method <_CalcJoindWithPrev(..)>.
2590 const SwFrame* _pPrevFrame ) const
2591{
2592 if ( !m_bCachedJoinedWithPrev || _pPrevFrame )
2593 {
2594 // OD 2004-02-26 #i25029# - pass <_pPrevFrame> as 2nd parameter
2595 const_cast<SwBorderAttrs*>(this)->CalcJoinedWithPrev( _rFrame, _pPrevFrame );
2596 }
2597
2598 return m_bJoinedWithPrev;
2599}
2600
2601bool SwBorderAttrs::JoinedWithNext( const SwFrame& _rFrame ) const
2602{
2604 {
2605 const_cast<SwBorderAttrs*>(this)->CalcJoinedWithNext( _rFrame );
2606 }
2607
2608 return m_bJoinedWithNext;
2609}
2610
2611// OD 2004-02-26 #i25029# - added 2nd parameter <_pPrevFrame>, which is passed to
2612// method <JoinedWithPrev>
2614 const SwFrame* _pPrevFrame )
2615{
2616 sal_uInt16 nRet = CalcTopLine();
2617
2618 // OD 21.05.2003 #108789# - use new method <JoinWithPrev()>
2619 // OD 2004-02-26 #i25029# - add 2nd parameter
2620 if ( JoinedWithPrev( _rFrame, _pPrevFrame ) )
2621 {
2622 nRet = 0;
2623 }
2624
2626
2627 m_nGetTopLine = nRet;
2628}
2629
2631{
2632 sal_uInt16 nRet = CalcBottomLine();
2633
2634 // OD 21.05.2003 #108789# - use new method <JoinWithPrev()>
2635 if ( JoinedWithNext( _rFrame ) )
2636 {
2637 nRet = 0;
2638 }
2639
2641
2642 m_nGetBottomLine = nRet;
2643}
2644
2646{
2647 // tdf#125300 compatibility option AddParaLineSpacingToTableCells needs also line spacing
2649 if ( rSpace.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop && rSpace.GetPropLineSpace() > 100 )
2650 {
2651 sal_Int32 nFontSize = m_rAttrSet.Get(RES_CHRATR_FONTSIZE).GetHeight();
2652 m_nLineSpacing = nFontSize * (rSpace.GetPropLineSpace() - 100) * 1.15 / 100;
2653 }
2654 m_bLineSpacing = false;
2655}
2656
2658{
2659 return rFrame.IsContentFrame()
2660 ? static_cast<sw::BorderCacheOwner const*>(rFrame.IsTextFrame()
2661 // sw_redlinehide: presumably this caches the border attrs at the model level and can be shared across different layouts so we want the ParaProps node here
2662 ? static_cast<const SwTextFrame&>(rFrame).GetTextNodeForParaProps()
2663 : static_cast<const SwNoTextFrame&>(rFrame).GetNode())
2664 : static_cast<sw::BorderCacheOwner const*>(static_cast<const SwLayoutFrame&>(rFrame).GetFormat());
2665}
2666
2668 SwCacheAccess( rCach,
2669 static_cast<void const *>(GetBorderCacheOwner(*pFrame)),
2670 GetBorderCacheOwner(*pFrame)->IsInCache()),
2671 m_pConstructor( pFrame )
2672{
2673}
2674
2676{
2677 const_cast<sw::BorderCacheOwner *>(static_cast<sw::BorderCacheOwner const *>(m_pOwner))->m_bInCache = true;
2678 return new SwBorderAttrs( static_cast<sw::BorderCacheOwner const *>(m_pOwner), m_pConstructor );
2679}
2680
2682{
2683 return static_cast<SwBorderAttrs*>(SwCacheAccess::Get());
2684}
2685
2687 m_pPage( pPg ),
2688 m_pCurrent( nullptr )
2689{
2690}
2691
2693{
2694 m_pCurrent = nullptr;
2695 if ( !m_pPage->GetSortedObjs() )
2696 return;
2697
2698 const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
2699 if ( !pObjs->size() )
2700 return;
2701
2702 sal_uInt32 nTopOrd = 0;
2703 (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
2704 for (SwAnchoredObject* i : *pObjs)
2705 {
2706 const SdrObject* pObj = i->GetDrawObj();
2707 if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
2708 continue;
2709 sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2710 if ( nTmp >= nTopOrd )
2711 {
2712 nTopOrd = nTmp;
2713 m_pCurrent = pObj;
2714 }
2715 }
2716}
2717
2719{
2720 m_pCurrent = nullptr;
2721 if ( m_pPage->GetSortedObjs() )
2722 {
2723 sal_uInt32 nBotOrd = USHRT_MAX;
2724 const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
2725 if ( pObjs->size() )
2726 {
2727 (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
2728 for (SwAnchoredObject* i : *pObjs)
2729 {
2730 const SdrObject* pObj = i->GetDrawObj();
2731 if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
2732 continue;
2733 sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2734 if ( nTmp < nBotOrd )
2735 {
2736 nBotOrd = nTmp;
2737 m_pCurrent = pObj;
2738 }
2739 }
2740 }
2741 }
2742 return m_pCurrent;
2743}
2744
2746{
2747 const sal_uInt32 nCurOrd = m_pCurrent ? m_pCurrent->GetOrdNumDirect() : 0;
2748 m_pCurrent = nullptr;
2749 if ( m_pPage->GetSortedObjs() )
2750 {
2751 sal_uInt32 nOrd = USHRT_MAX;
2752 const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
2753 if ( pObjs->size() )
2754 {
2755 (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
2756 for (SwAnchoredObject* i : *pObjs)
2757 {
2758 const SdrObject* pObj = i->GetDrawObj();
2759 if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
2760 continue;
2761 sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2762 if ( nTmp > nCurOrd && nTmp < nOrd )
2763 {
2764 nOrd = nTmp;
2765 m_pCurrent = pObj;
2766 }
2767 }
2768 }
2769 }
2770 return m_pCurrent;
2771}
2772
2774{
2775 const sal_uInt32 nCurOrd = m_pCurrent ? m_pCurrent->GetOrdNumDirect() : 0;
2776 m_pCurrent = nullptr;
2777 if ( !m_pPage->GetSortedObjs() )
2778 return;
2779
2780 const SwSortedObjs *pObjs = m_pPage->GetSortedObjs();
2781 if ( !pObjs->size() )
2782 return;
2783
2784 sal_uInt32 nOrd = 0;
2785 (*pObjs)[0]->GetDrawObj()->GetOrdNum(); // force updating
2786 for (SwAnchoredObject* i : *pObjs)
2787 {
2788 const SdrObject* pObj = i->GetDrawObj();
2789 if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
2790 continue;
2791 sal_uInt32 nTmp = pObj->GetOrdNumDirect();
2792 if ( nTmp < nCurOrd && nTmp >= nOrd )
2793 {
2794 nOrd = nTmp;
2795 m_pCurrent = pObj;
2796 }
2797 }
2798}
2799
2801// New algorithm:
2802// Do not look at each neighbor one by one to set all pointers correctly.
2803// It is sufficient to detach a part of a chain and check if another chain needs to be added
2804// when attaching it again. Only the pointers necessary for the chain connection need to be
2805// adjusted. The correction happens in RestoreContent(). In between all access is restricted.
2806// During this action, the Flys are detached from the page.
2807
2808// #115759# - 'remove' also drawing object from page and
2809// at-fly anchored objects from page
2810static void lcl_RemoveObjsFromPage( SwFrame* _pFrame )
2811{
2812 OSL_ENSURE( _pFrame->GetDrawObjs(), "no DrawObjs in lcl_RemoveObjsFromPage." );
2813 SwSortedObjs &rObjs = *_pFrame->GetDrawObjs();
2814 for (SwAnchoredObject* pObj : rObjs)
2815 {
2816 // #115759# - reset member, at which the anchored
2817 // object orients its vertical position
2818 pObj->ClearVertPosOrientFrame();
2819 // #i43913#
2820 pObj->ResetLayoutProcessBools();
2821 // #115759# - remove also lower objects of as-character
2822 // anchored Writer fly frames from page
2823 if ( auto pFlyFrame = pObj->DynCastFlyFrame() )
2824 {
2825 // #115759# - remove also direct lowers of Writer
2826 // fly frame from page
2827 if ( pFlyFrame->GetDrawObjs() )
2828 {
2829 ::lcl_RemoveObjsFromPage( pFlyFrame );
2830 }
2831
2832 SwContentFrame* pCnt = pFlyFrame->ContainsContent();
2833 while ( pCnt )
2834 {
2835 if ( pCnt->GetDrawObjs() )
2837 pCnt = pCnt->GetNextContentFrame();
2838 }
2839 if ( pFlyFrame->IsFlyFreeFrame() )
2840 {
2841 // #i28701# - use new method <GetPageFrame()>
2842 if (SwPageFrame *pPg = pFlyFrame->GetPageFrame())
2843 pPg->RemoveFlyFromPage(pFlyFrame);
2844 }
2845 }
2846 // #115759# - remove also drawing objects from page
2847 else if ( auto pDrawObj = dynamic_cast<SwAnchoredDrawObject*>( pObj) )
2848 {
2849 if (pObj->GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR)
2850 {
2851 if (SwPageFrame *pPg = pObj->GetPageFrame())
2852 pPg->RemoveDrawObjFromPage( *pDrawObj );
2853 }
2854 }
2855 }
2856}
2857
2859{
2860 if( pLay->IsSctFrame() && pLay->Lower() && pLay->Lower()->IsColumnFrame() )
2861 sw_RemoveFootnotes( static_cast<SwColumnFrame*>(pLay->Lower()), true, true );
2862
2863 SwFrame *pSav = pLay->ContainsAny();
2864 if ( nullptr == pSav )
2865 return nullptr;
2866
2867 if( pSav->IsInFootnote() && !pLay->IsInFootnote() )
2868 {
2869 do
2870 pSav = pSav->FindNext();
2871 while( pSav && pSav->IsInFootnote() );
2872 if( !pSav || !pLay->IsAnLower( pSav ) )
2873 return nullptr;
2874 }
2875
2876 // Tables should be saved as a whole, exception:
2877 // The contents of a section or a cell inside a table should be saved
2878 if ( pSav->IsInTab() && !( ( pLay->IsSctFrame() || pLay->IsCellFrame() ) && pLay->IsInTab() ) )
2879 while ( !pSav->IsTabFrame() )
2880 pSav = pSav->GetUpper();
2881
2882 if( pSav->IsInSct() )
2883 { // search the upmost section inside of pLay
2884 SwFrame* pSect = pLay->FindSctFrame();
2885 SwFrame *pTmp = pSav;
2886 do
2887 {
2888 pSav = pTmp;
2889 pTmp = (pSav && pSav->GetUpper()) ? pSav->GetUpper()->FindSctFrame() : nullptr;
2890 } while ( pTmp != pSect );
2891 }
2892
2893 SwFrame *pFloat = pSav;
2894 if( !pStart )
2895 pStart = pSav;
2896 bool bGo = pStart == pSav;
2897 do
2898 {
2899 if( bGo )
2900 pFloat->GetUpper()->m_pLower = nullptr; // detach the chain part
2901
2902 // search the end of the chain part, remove Flys on the way
2903 do
2904 {
2905 if( bGo )
2906 {
2907 if ( pFloat->IsContentFrame() )
2908 {
2909 if ( pFloat->GetDrawObjs() )
2910 ::lcl_RemoveObjsFromPage( static_cast<SwContentFrame*>(pFloat) );
2911 }
2912 else if ( pFloat->IsTabFrame() || pFloat->IsSctFrame() )
2913 {
2914 SwContentFrame *pCnt = static_cast<SwLayoutFrame*>(pFloat)->ContainsContent();
2915 if( pCnt )
2916 {
2917 do
2918 { if ( pCnt->GetDrawObjs() )
2920 pCnt = pCnt->GetNextContentFrame();
2921 } while ( pCnt && static_cast<SwLayoutFrame*>(pFloat)->IsAnLower( pCnt ) );
2922 }
2923 }
2924 else {
2925 OSL_ENSURE( !pFloat, "new FloatFrame?" );
2926 }
2927 }
2928 if ( pFloat->GetNext() )
2929 {
2930 if( bGo )
2931 pFloat->mpUpper = nullptr;
2932 pFloat = pFloat->GetNext();
2933 if( !bGo && pFloat == pStart )
2934 {
2935 bGo = true;
2936 pFloat->mpPrev->mpNext = nullptr;
2937 pFloat->mpPrev = nullptr;
2938 }
2939 }
2940 else
2941 break;
2942
2943 } while ( pFloat );
2944
2945 // search next chain part and connect both chains
2946 SwFrame *pTmp = pFloat->FindNext();
2947 if( bGo )
2948 pFloat->mpUpper = nullptr;
2949
2950 if( !pLay->IsInFootnote() )
2951 while( pTmp && pTmp->IsInFootnote() )
2952 pTmp = pTmp->FindNext();
2953
2954 if ( !pLay->IsAnLower( pTmp ) )
2955 pTmp = nullptr;
2956
2957 if ( pTmp && bGo )
2958 {
2959 pFloat->mpNext = pTmp; // connect both chains
2960 pFloat->mpNext->mpPrev = pFloat;
2961 }
2962 pFloat = pTmp;
2963 bGo = bGo || ( pStart == pFloat );
2964 } while ( pFloat );
2965
2966 return bGo ? pStart : nullptr;
2967}
2968
2969// #115759# - add also drawing objects to page and at-fly
2970// anchored objects to page
2971static void lcl_AddObjsToPage( SwFrame* _pFrame, SwPageFrame* _pPage )
2972{
2973 OSL_ENSURE( _pFrame->GetDrawObjs(), "no DrawObjs in lcl_AddObjsToPage." );
2974 SwSortedObjs &rObjs = *_pFrame->GetDrawObjs();
2975 for (SwAnchoredObject* pObj : rObjs)
2976 {
2977 // #115759# - unlock position of anchored object
2978 // in order to get the object's position calculated.
2979 pObj->UnlockPosition();
2980 // #115759# - add also lower objects of as-character
2981 // anchored Writer fly frames from page
2982 if ( auto pFlyFrame = pObj->DynCastFlyFrame() )
2983 {
2984 if (pFlyFrame->IsFlyFreeFrame())
2985 {
2986 _pPage->AppendFlyToPage( pFlyFrame );
2987 }
2988 pFlyFrame->InvalidatePos_();
2989 pFlyFrame->InvalidateSize_();
2990 pFlyFrame->InvalidatePage( _pPage );
2991
2992 // #115759# - add also at-fly anchored objects
2993 // to page
2994 if ( pFlyFrame->GetDrawObjs() )
2995 {
2996 ::lcl_AddObjsToPage( pFlyFrame, _pPage );
2997 }
2998
2999 SwContentFrame *pCnt = pFlyFrame->ContainsContent();
3000 while ( pCnt )
3001 {
3002 if ( pCnt->GetDrawObjs() )
3003 ::lcl_AddObjsToPage( pCnt, _pPage );
3004 pCnt = pCnt->GetNextContentFrame();
3005 }
3006 }
3007 // #115759# - remove also drawing objects from page
3008 else if ( dynamic_cast<const SwAnchoredDrawObject*>( pObj) != nullptr )
3009 {
3010 if (pObj->GetFrameFormat().GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR)
3011 {
3012 pObj->InvalidateObjPos();
3013 _pPage->AppendDrawObjToPage(
3014 *static_cast<SwAnchoredDrawObject*>(pObj) );
3015 }
3016 }
3017 }
3018}
3019
3020void RestoreContent( SwFrame *pSav, SwLayoutFrame *pParent, SwFrame *pSibling )
3021{
3022 OSL_ENSURE( pSav && pParent, "no Save or Parent provided for RestoreContent." );
3023 SwRectFnSet aRectFnSet(pParent);
3024
3025 // If there are already FlowFrames below the new parent, so add the chain (starting with pSav)
3026 // after the last one. The parts are inserted and invalidated if needed.
3027 // On the way, the Flys of the ContentFrames are registered at the page.
3028
3029 SwPageFrame *pPage = pParent->FindPageFrame();
3030
3031 if ( pPage )
3032 pPage->InvalidatePage( pPage );
3033
3034 // determine predecessor and establish connection or initialize
3035 pSav->mpPrev = pSibling;
3036 SwFrame* pNxt;
3037 if ( pSibling )
3038 {
3039 pNxt = pSibling->mpNext;
3040 pSibling->mpNext = pSav;
3041 pSibling->InvalidatePrt_();
3042 pSibling->InvalidatePage( pPage );
3043 SwFlowFrame *pFlowFrame = dynamic_cast<SwFlowFrame*>(pSibling);
3044 if (pFlowFrame && pFlowFrame->GetFollow())
3045 pSibling->Prepare( PrepareHint::Clear, nullptr, false );
3046 }
3047 else
3048 { pNxt = pParent->m_pLower;
3049 pParent->m_pLower = pSav;
3050 pSav->mpUpper = pParent; // set here already, so that it is explicit when invalidating
3051
3052 if ( pSav->IsContentFrame() )
3053 static_cast<SwContentFrame*>(pSav)->InvalidatePage( pPage );
3054 else
3055 { // pSav might be an empty SectFrame
3056 SwContentFrame* pCnt = pParent->ContainsContent();
3057 if( pCnt )
3058 pCnt->InvalidatePage( pPage );
3059 }
3060 }
3061
3062 // the parent needs to grow appropriately
3063 SwTwips nGrowVal = 0;
3064 SwFrame* pLast;
3065 do
3066 { pSav->mpUpper = pParent;
3067 nGrowVal += aRectFnSet.GetHeight(pSav->getFrameArea());
3068 pSav->InvalidateAll_();
3069
3070 // register Flys, if TextFrames than also invalidate appropriately
3071 if ( pSav->IsContentFrame() )
3072 {
3073 if ( pSav->IsTextFrame() &&
3074 static_cast<SwTextFrame*>(pSav)->GetCacheIdx() != USHRT_MAX )
3075 static_cast<SwTextFrame*>(pSav)->Init(); // I am its friend
3076
3077 if ( pPage && pSav->GetDrawObjs() )
3078 ::lcl_AddObjsToPage( static_cast<SwContentFrame*>(pSav), pPage );
3079 }
3080 else
3081 { SwContentFrame *pBlub = static_cast<SwLayoutFrame*>(pSav)->ContainsContent();
3082 if( pBlub )
3083 {
3084 do
3085 { if ( pPage && pBlub->GetDrawObjs() )
3086 ::lcl_AddObjsToPage( pBlub, pPage );
3087 if( pBlub->IsTextFrame() && static_cast<SwTextFrame*>(pBlub)->HasFootnote() &&
3088 static_cast<SwTextFrame*>(pBlub)->GetCacheIdx() != USHRT_MAX )
3089 static_cast<SwTextFrame*>(pBlub)->Init(); // I am its friend
3090 pBlub = pBlub->GetNextContentFrame();
3091 } while ( pBlub && static_cast<SwLayoutFrame*>(pSav)->IsAnLower( pBlub ));
3092 }
3093 }
3094 pLast = pSav;
3095 pSav = pSav->GetNext();
3096
3097 } while ( pSav );
3098
3099 if( pNxt )
3100 {
3101 pLast->mpNext = pNxt;
3102 pNxt->mpPrev = pLast;
3103 }
3104
3105 pParent->Grow( nGrowVal );
3106}
3107
3108namespace sw {
3109
3110bool IsRightPageByNumber(SwRootFrame const& rLayout, sal_uInt16 const nPageNum)
3111{
3112 assert(rLayout.GetLower());
3113 // unfortunately can only get SwPageDesc, not SwFormatPageDesc here...
3114 auto const nFirstVirtPageNum(rLayout.GetLower()->GetVirtPageNum());
3115 bool const isFirstPageOfLayoutOdd(nFirstVirtPageNum % 2 == 1);
3116 return ((nPageNum % 2) == 1) == isFirstPageOfLayoutOdd;
3117}
3118
3119} // namespace sw
3120
3122 bool const isRightPage, bool const bFirst, bool bInsertEmpty,
3123 bool const bFootnote,
3124 SwFrame *pSibling,
3125 bool const bVeryFirstPage )
3126{
3127 assert(pUpper);
3128 assert(pUpper->IsRootFrame());
3129 assert(!pSibling || static_cast<SwLayoutFrame const*>(pUpper)->Lower() != pSibling); // currently no insert before 1st page
3130 SwPageFrame *pRet;
3131 SwDoc *pDoc = static_cast<SwLayoutFrame*>(pUpper)->GetFormat()->GetDoc();
3132 if (bFirst)
3133 {
3134 if (rDesc.IsFirstShared())
3135 {
3136 // We need to fallback to left or right page format, decide it now.
3137 // FIXME: is this still needed?
3138 if (isRightPage)
3139 {
3140 rDesc.GetFirstMaster().SetFormatAttr( rDesc.GetMaster().GetHeader() );
3141 rDesc.GetFirstMaster().SetFormatAttr( rDesc.GetMaster().GetFooter() );
3142 // fdo#60250 copy margins for mirrored pages
3143 rDesc.GetFirstMaster().SetFormatAttr( rDesc.GetMaster().GetLRSpace() );
3144 }
3145 else
3146 {
3147 rDesc.GetFirstLeft().SetFormatAttr( rDesc.GetLeft().GetHeader() );
3148 rDesc.GetFirstLeft().SetFormatAttr( rDesc.GetLeft().GetFooter() );
3149 rDesc.GetFirstLeft().SetFormatAttr( rDesc.GetLeft().GetLRSpace() );
3150 }
3151 }
3152 }
3153 SwFrameFormat *pFormat(isRightPage ? rDesc.GetRightFormat(bFirst) : rDesc.GetLeftFormat(bFirst));
3154 // If there is no FrameFormat for this page, add an empty page
3155 if ( !pFormat )
3156 {
3157 pFormat = isRightPage ? rDesc.GetLeftFormat(bVeryFirstPage) : rDesc.GetRightFormat(bVeryFirstPage);
3158 OSL_ENSURE( pFormat, "Descriptor without any format?!" );
3159 bInsertEmpty = !bInsertEmpty;
3160 }
3161 if( bInsertEmpty )
3162 {
3163 SwPageDesc *pTmpDesc = pSibling && pSibling->GetPrev() ?
3164 static_cast<SwPageFrame*>(pSibling->GetPrev())->GetPageDesc() : &rDesc;
3165 pRet = new SwPageFrame( pDoc->GetEmptyPageFormat(), pUpper, pTmpDesc );
3166 SAL_INFO( "sw.pageframe", "InsertNewPage - insert empty p: " << pRet << " d: " << pTmpDesc );
3167 pRet->Paste( pUpper, pSibling );
3168 pRet->PreparePage( bFootnote );
3169 }
3170 pRet = new SwPageFrame( pFormat, pUpper, &rDesc );
3171 SAL_INFO( "sw.pageframe", "InsertNewPage p: " << pRet << " d: " << &rDesc << " f: " << pFormat );
3172 pRet->Paste( pUpper, pSibling );
3173 pRet->PreparePage( bFootnote );
3174 if ( pRet->GetNext() )
3176 return pRet;
3177}
3178
3179/* The following two methods search the layout structure recursively and
3180 * register all Flys at the page that have a Frame in this structure as an anchor.
3181 */
3182
3183static void lcl_Regist( SwPageFrame *pPage, const SwFrame *pAnch )
3184{
3185 SwSortedObjs *pObjs = const_cast<SwSortedObjs*>(pAnch->GetDrawObjs());
3186 for (SwAnchoredObject* pObj : *pObjs)
3187 {
3188 if (SwFlyFrame* pFly = pObj->DynCastFlyFrame())
3189 {
3190 // register (not if already known)
3191 // #i28701# - use new method <GetPageFrame()>
3192 SwPageFrame *pPg = pFly->IsFlyFreeFrame()
3193 ? pFly->GetPageFrame() : pFly->FindPageFrame();
3194 if ( pPg != pPage )
3195 {
3196 if ( pPg )
3197 pPg->RemoveFlyFromPage( pFly );
3198 pPage->AppendFlyToPage( pFly );
3199 }
3200 ::RegistFlys( pPage, pFly );
3201 }
3202 else
3203 {
3204 // #i87493#
3205 if ( pPage != pObj->GetPageFrame() )
3206 {
3207 // #i28701#
3208 if (SwPageFrame *pPg = pObj->GetPageFrame())
3209 pPg->RemoveDrawObjFromPage( *pObj );
3210 pPage->AppendDrawObjToPage( *pObj );
3211 }
3212 }
3213
3214 const SwFlyFrame* pFly = pAnch->FindFlyFrame();
3215 if ( pFly &&
3216 pObj->GetDrawObj()->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() &&
3217 pObj->GetDrawObj()->getSdrPageFromSdrObject() )
3218 {
3219 //#i119945# set pFly's OrdNum to pObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
3221 pObj->GetDrawObj()->GetOrdNumDirect() );
3222 }
3223 }
3224}
3225
3226void RegistFlys( SwPageFrame *pPage, const SwLayoutFrame *pLay )
3227{
3228 if ( pLay->GetDrawObjs() )
3229 ::lcl_Regist( pPage, pLay );
3230 const SwFrame *pFrame = pLay->Lower();
3231 while ( pFrame )
3232 {
3233 if ( pFrame->IsLayoutFrame() )
3234 ::RegistFlys( pPage, static_cast<const SwLayoutFrame*>(pFrame) );
3235 else if ( pFrame->GetDrawObjs() )
3236 ::lcl_Regist( pPage, pFrame );
3237 pFrame = pFrame->GetNext();
3238 }
3239}
3240
3242void Notify( SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld,
3243 const SwRect* pOldPrt )
3244{
3245 const SwRect aFrame( pFly->GetObjRectWithSpaces() );
3246 if ( rOld.Pos() != aFrame.Pos() )
3247 { // changed position, invalidate old and new area
3248 if ( rOld.HasArea() &&
3249 rOld.Left()+pFly->GetFormat()->GetLRSpace().GetLeft() < FAR_AWAY )
3250 {
3251 pFly->NotifyBackground( pOld, rOld, PrepareHint::FlyFrameLeave );
3252 }
3254 }
3255 else if ( rOld.SSize() != aFrame.SSize() )
3256 { // changed size, invalidate the area that was left or is now overlapped
3257 // For simplicity, we purposely invalidate a Twip even if not needed.
3258
3259 SwViewShell *pSh = pFly->getRootFrame()->GetCurrShell();
3260 if( pSh && rOld.HasArea() )
3261 pSh->InvalidateWindows( rOld );
3262
3263 // #i51941# - consider case that fly frame isn't
3264 // registered at the old page <pOld>
3265 SwPageFrame* pPageFrame = pFly->FindPageFrame();
3266 if ( pOld != pPageFrame )
3267 {
3268 pFly->NotifyBackground( pPageFrame, aFrame, PrepareHint::FlyFrameArrive );
3269 }
3270
3271 if ( rOld.Left() != aFrame.Left() )
3272 {
3273 SwRect aTmp( rOld );
3274 aTmp.Union( aFrame );
3275 aTmp.Left( std::min(aFrame.Left(), rOld.Left()) );
3276 aTmp.Right( std::max(aFrame.Left(), rOld.Left()) );
3278 }
3279 SwTwips nOld = rOld.Right();
3280 SwTwips nNew = aFrame.Right();
3281 if ( nOld != nNew )
3282 {
3283 SwRect aTmp( rOld );
3284 aTmp.Union( aFrame );
3285 aTmp.Left( std::min(nNew, nOld) );
3286 aTmp.Right( std::max(nNew, nOld) );
3288 }
3289 if ( rOld.Top() != aFrame.Top() )
3290 {
3291 SwRect aTmp( rOld );
3292 aTmp.Union( aFrame );
3293 aTmp.Top( std::min(aFrame.Top(), rOld.Top()) );
3294 aTmp.Bottom( std::max(aFrame.Top(), rOld.Top()) );
3296 }
3297 nOld = rOld.Bottom();
3298 nNew = aFrame.Bottom();
3299 if ( nOld != nNew )
3300 {
3301 SwRect aTmp( rOld );
3302 aTmp.Union( aFrame );
3303 aTmp.Top( std::min(nNew, nOld) );
3304 aTmp.Bottom( std::max(nNew, nOld) );
3306 }
3307 }
3308 else if(pOldPrt && *pOldPrt != pFly->getFramePrintArea())
3309 {
3310 bool bNotifyBackground(pFly->GetFormat()->GetSurround().IsContour());
3311
3312 if(!bNotifyBackground &&
3313 pFly->IsFlyFreeFrame() &&
3314 static_cast< const SwFlyFreeFrame* >(pFly)->supportsAutoContour())
3315 {
3316 // RotateFlyFrame3: Also notify for FlyFrames which allow AutoContour
3317 bNotifyBackground = true;
3318 }
3319
3320 if(bNotifyBackground)
3321 {
3322 // #i24097#
3324 }
3325 }
3326}
3327
3328static void lcl_CheckFlowBack( SwFrame* pFrame, const SwRect &rRect )
3329{
3330 SwTwips nBottom = rRect.Bottom();
3331 while( pFrame )
3332 {
3333 if( pFrame->IsLayoutFrame() )
3334 {
3335 if( rRect.Overlaps( pFrame->getFrameArea() ) )
3336 lcl_CheckFlowBack( static_cast<SwLayoutFrame*>(pFrame)->Lower(), rRect );
3337 }
3338 else if( !pFrame->GetNext() && nBottom > pFrame->getFrameArea().Bottom() )
3339 {
3340 if( pFrame->IsContentFrame() && static_cast<SwContentFrame*>(pFrame)->HasFollow() )
3341 pFrame->InvalidateSize();
3342 else
3343 pFrame->InvalidateNextPos();
3344 }
3345 pFrame = pFrame->GetNext();
3346 }
3347}
3348
3349static void lcl_NotifyContent( const SdrObject *pThis, SwContentFrame *pCnt,
3350 const SwRect &rRect, const PrepareHint eHint )
3351{
3352 if ( !pCnt->IsTextFrame() )
3353 return;
3354
3355 SwRect aCntPrt( pCnt->getFramePrintArea() );
3356 aCntPrt.Pos() += pCnt->getFrameArea().Pos();
3358 {
3359 // #i35640# - use given rectangle <rRect> instead
3360 // of current bound rectangle
3361 if ( aCntPrt.Overlaps( rRect ) )
3363 }
3364 // #i23129# - only invalidate, if the text frame
3365 // printing area overlaps with the given rectangle.
3366 else if ( aCntPrt.Overlaps( rRect ) )
3367 pCnt->Prepare( eHint, static_cast<void*>(&aCntPrt.Intersection_( rRect )) );
3368 if ( !pCnt->GetDrawObjs() )
3369 return;
3370
3371 const SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
3372 for (SwAnchoredObject* pObj : rObjs)
3373 {
3374 if ( auto pFly = pObj->DynCastFlyFrame() )
3375 {
3376 if ( pFly->IsFlyInContentFrame() )
3377 {
3378 SwContentFrame *pContent = pFly->ContainsContent();
3379 while ( pContent )
3380 {
3381 ::lcl_NotifyContent( pThis, pContent, rRect, eHint );
3382 pContent = pContent->GetNextContentFrame();
3383 }
3384 }
3385 }
3386 }
3387}
3388
3390 SwPageFrame* pPage,
3391 const SwRect& rRect,
3392 const PrepareHint eHint,
3393 const bool bInva )
3394{
3395 // If the frame was positioned correctly for the first time, do not inform the old area
3396 if ( eHint == PrepareHint::FlyFrameLeave && rRect.Top() == FAR_AWAY )
3397 return;
3398
3399 SwLayoutFrame* pArea;
3400 SwFlyFrame *pFlyFrame = nullptr;
3401 SwFrame* pAnchor;
3402 if( auto pVirtFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>( pObj) )
3403 {
3404 pFlyFrame = const_cast<SwVirtFlyDrawObj*>(pVirtFlyDrawObj)->GetFlyFrame();
3405 pAnchor = pFlyFrame->AnchorFrame();
3406 }
3407 else
3408 {
3409 pFlyFrame = nullptr;
3410 pAnchor = const_cast<SwFrame*>(
3411 GetUserCall(pObj)->GetAnchoredObj( pObj )->GetAnchorFrame() );
3412 }
3413 if( PrepareHint::FlyFrameLeave != eHint && pAnchor->IsInFly() )
3414 pArea = pAnchor->FindFlyFrame();
3415 else
3416 pArea = pPage;
3417 SwContentFrame *pCnt = nullptr;
3418 if ( pArea )
3419 {
3420 if( PrepareHint::FlyFrameArrive != eHint )
3421 lcl_CheckFlowBack( pArea, rRect );
3422
3423 // Only the Flys following this anchor are reacting. Thus, those do not
3424 // need to be processed.
3425 // An exception is LEAVE, since the Fly might come "from above".
3426 // If the anchor is positioned on the previous page, the whole page
3427 // needs to be processed (47722).
3428 // OD 2004-05-13 #i28701# - If the wrapping style has to be considered
3429 // on the object positioning, the complete area has to be processed,
3430 // because content frames before the anchor frame also have to consider
3431 // the object for the text wrapping.
3432 // #i3317# - The complete area has always been
3433 // processed.
3434 {
3435 pCnt = pArea->ContainsContent();
3436 }
3437 }
3438 SwFrame *pLastTab = nullptr;
3439
3440 bool isValidTableBeforeAnchor(false);
3441 while ( pCnt && pArea && pArea->IsAnLower( pCnt ) )
3442 {
3443 ::lcl_NotifyContent( pObj, pCnt, rRect, eHint );
3444 if ( pCnt->IsInTab() )
3445 {
3446 SwTabFrame *pTab = pCnt->FindTabFrame();
3447 if ( pTab != pLastTab )
3448 {
3449 pLastTab = pTab;
3450 isValidTableBeforeAnchor = false;
3451 if (PrepareHint::FlyFrameArrive == eHint
3452 && pFlyFrame // TODO: do it for draw objects too?
3453 && pTab->IsFollow() // table starts on previous page?
3454 // "through" means they will actually overlap anyway
3455 && css::text::WrapTextMode_THROUGH != pFlyFrame->GetFormat()->GetSurround().GetSurround()
3456 // if it's anchored in footer it can't move to other page
3457 && !pAnchor->FindFooterOrHeader())
3458 {
3459 SwFrame * pTmp(pAnchor->GetPrev());
3460 while (pTmp)
3461 {
3462 if (pTmp == pTab)
3463 {
3464 // tdf#99460 the table shouldn't be moved by the fly
3465 isValidTableBeforeAnchor = true;
3466 break;
3467 }
3468 pTmp = pTmp->GetPrev();
3469 }
3470 }
3471 // #i40606# - use <GetLastBoundRect()>
3472 // instead of <GetCurrentBoundRect()>, because a recalculation
3473 // of the bounding rectangle isn't intended here.
3474 if (!isValidTableBeforeAnchor
3475 && (pTab->getFrameArea().Overlaps(SwRect(pObj->GetLastBoundRect())) ||
3476 pTab->getFrameArea().Overlaps(rRect)))
3477 {
3478 if ( !pFlyFrame || !pFlyFrame->IsLowerOf( pTab ) )
3479 pTab->InvalidatePrt();
3480 }
3481 }
3482 SwLayoutFrame* pCell = pCnt->GetUpper();
3483 // #i40606# - use <GetLastBoundRect()>
3484 // instead of <GetCurrentBoundRect()>, because a recalculation
3485 // of the bounding rectangle isn't intended here.
3486 if (!isValidTableBeforeAnchor && pCell->IsCellFrame() &&
3487 ( pCell->getFrameArea().Overlaps( SwRect(pObj->GetLastBoundRect()) ) ||
3488 pCell->getFrameArea().Overlaps( rRect ) ) )
3489 {
3490 const SwFormatVertOrient &rOri = pCell->GetFormat()->GetVertOrient();
3492 pCell->InvalidatePrt();
3493 }
3494 }
3495 pCnt = pCnt->GetNextContentFrame();
3496 }
3497 // #128702# - make code robust
3498 if ( pPage && pPage->GetSortedObjs() )
3499 {
3500 pObj->GetOrdNum();
3501 const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
3502 for (SwAnchoredObject* pAnchoredObj : rObjs)
3503 {
3504 if ( pAnchoredObj->DynCastFlyFrame() != nullptr )
3505 {
3506 if( pAnchoredObj->GetDrawObj() == pObj )
3507 continue;
3508 SwFlyFrame *pFly = static_cast<SwFlyFrame*>(pAnchoredObj);
3509 if ( pFly->getFrameArea().Top() == FAR_AWAY )
3510 continue;
3511
3512 if ( !pFlyFrame ||
3513 (!pFly->IsLowerOf( pFlyFrame ) &&
3514 pFly->GetVirtDrawObj()->GetOrdNumDirect() < pObj->GetOrdNumDirect()))
3515 {
3516 pCnt = pFly->ContainsContent();
3517 while ( pCnt )
3518 {
3519 ::lcl_NotifyContent( pObj, pCnt, rRect, eHint );
3520 pCnt = pCnt->GetNextContentFrame();
3521 }
3522 }
3523 if( pFly->IsFlyLayFrame() )
3524 {
3525 if( pFly->Lower() && pFly->Lower()->IsColumnFrame() &&
3526 pFly->getFrameArea().Bottom() >= rRect.Top() &&
3527 pFly->getFrameArea().Top() <= rRect.Bottom() &&
3528 pFly->getFrameArea().Right() >= rRect.Left() &&
3529 pFly->getFrameArea().Left() <= rRect.Right() )
3530 {
3531 pFly->InvalidateSize();
3532 }
3533 }
3534 // Flys above myself might sidestep if they have an automatic
3535 // alignment. This happens independently of my attributes since
3536 // this might have been changed as well.
3537 else if ( pFly->IsFlyAtContentFrame() &&
3538 pObj->GetOrdNumDirect() <
3539 pFly->GetVirtDrawObj()->GetOrdNumDirect() &&
3540 pFlyFrame && !pFly->IsLowerOf( pFlyFrame ) )
3541 {
3542 const SwFormatHoriOrient &rH = pFly->GetFormat()->GetHoriOrient();
3544 text::HoriOrientation::CENTER != rH.GetHoriOrient() &&
3545 ( !pFly->IsAutoPos() || text::RelOrientation::CHAR != rH.GetRelationOrient() ) &&
3546 (pFly->getFrameArea().Bottom() >= rRect.Top() &&
3547 pFly->getFrameArea().Top() <= rRect.Bottom()) )
3548 pFly->InvalidatePos();
3549 }
3550 }
3551 }
3552 }
3553 if ( pFlyFrame && pAnchor->GetUpper() && pAnchor->IsInTab() )//MA_FLY_HEIGHT
3554 pAnchor->GetUpper()->InvalidateSize();
3555
3556 // #i82258# - make code robust
3557 SwViewShell* pSh = nullptr;
3558 if ( bInva && pPage &&
3559 nullptr != (pSh = pPage->getRootFrame()->GetCurrShell()) )
3560 {
3561 pSh->InvalidateWindows( rRect );
3562 }
3563}
3564
3567const SwFrame* GetVirtualUpper( const SwFrame* pFrame, const Point& rPos )
3568{
3569 if( pFrame->IsTextFrame() )
3570 {
3571 pFrame = pFrame->GetUpper();
3572 if( !pFrame->getFrameArea().Contains( rPos ) )
3573 {
3574 if( pFrame->IsFootnoteFrame() )
3575 {
3576 const SwFootnoteFrame* pTmp = static_cast<const SwFootnoteFrame*>(pFrame)->GetFollow();
3577 while( pTmp )
3578 {
3579 if( pTmp->getFrameArea().Contains( rPos ) )
3580 return pTmp;
3581 pTmp = pTmp->GetFollow();
3582 }
3583 }
3584 else
3585 {
3586 SwFlyFrame* pTmp = const_cast<SwFlyFrame*>(pFrame->FindFlyFrame());
3587 while( pTmp )
3588 {
3589 if( pTmp->getFrameArea().Contains( rPos ) )
3590 return pTmp;
3591 pTmp = pTmp->GetNextLink();
3592 }
3593 }
3594 }
3595 }
3596 return pFrame;
3597}
3598
3599bool Is_Lower_Of(const SwFrame *pCurrFrame, const SdrObject* pObj)
3600{
3601 Point aPos;
3602 const SwFrame* pFrame;
3603 if (const SwVirtFlyDrawObj *pFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObj))
3604 {
3605 const SwFlyFrame* pFly = pFlyDrawObj->GetFlyFrame();
3606 pFrame = pFly->GetAnchorFrame();
3607 aPos = pFly->getFrameArea().Pos();
3608 }
3609 else
3610 {
3611 pFrame = static_cast<SwDrawContact*>(GetUserCall(pObj))->GetAnchorFrame(pObj);
3612 aPos = pObj->GetCurrentBoundRect().TopLeft();
3613 }
3614 OSL_ENSURE( pFrame, "8-( Fly is lost in Space." );
3615 pFrame = GetVirtualUpper( pFrame, aPos );
3616 do
3617 { if ( pFrame == pCurrFrame )
3618 return true;
3619 if( pFrame->IsFlyFrame() )
3620 {
3621 aPos = pFrame->getFrameArea().Pos();
3622 pFrame = GetVirtualUpper( static_cast<const SwFlyFrame*>(pFrame)->GetAnchorFrame(), aPos );
3623 }
3624 else
3625 pFrame = pFrame->GetUpper();
3626 } while ( pFrame );
3627 return false;
3628}
3629
3631const SwFrame *FindContext( const SwFrame *pFrame, SwFrameType nAdditionalContextType )
3632{
3636 nAdditionalContextType;
3637 do
3638 { if ( pFrame->GetType() & nTyp )
3639 break;
3640 pFrame = pFrame->GetUpper();
3641 } while( pFrame );
3642 return pFrame;
3643}
3644
3645bool IsFrameInSameContext( const SwFrame *pInnerFrame, const SwFrame *pFrame )
3646{
3647 const SwFrame *pContext = FindContext( pInnerFrame, SwFrameType::None );
3648
3652 do
3653 { if ( pFrame->GetType() & nTyp )
3654 {
3655 if( pFrame == pContext )
3656 return true;
3657 if( pFrame->IsCellFrame() )
3658 return false;
3659 }
3660 if( pFrame->IsFlyFrame() )
3661 {
3662 Point aPos( pFrame->getFrameArea().Pos() );
3663 pFrame = GetVirtualUpper( static_cast<const SwFlyFrame*>(pFrame)->GetAnchorFrame(), aPos );
3664 }
3665 else
3666 pFrame = pFrame->GetUpper();
3667 } while( pFrame );
3668
3669 return false;
3670}
3671
3673{
3674 SwFrame *pLow = pCell->Lower();
3675 if ( pLow && (pLow->IsContentFrame() || pLow->IsSctFrame()) )
3676 {
3677 tools::Long nHeight = 0, nFlyAdd = 0;
3678 do
3679 {
3680 tools::Long nLow = pLow->getFrameArea().Height();
3681 if( pLow->IsTextFrame() && static_cast<SwTextFrame*>(pLow)->IsUndersized() )
3682 nLow += static_cast<SwTextFrame*>(pLow)->GetParHeight()-pLow->getFramePrintArea().Height();
3683 else if( pLow->IsSctFrame() && static_cast<SwSectionFrame*>(pLow)->IsUndersized() )
3684 nLow += static_cast<SwSectionFrame*>(pLow)->Undersize();
3685 nFlyAdd = std::max( tools::Long(0), nFlyAdd - nLow );
3686 nFlyAdd = std::max( nFlyAdd, ::CalcHeightWithFlys( pLow ) );
3687 nHeight += nLow;
3688 pLow = pLow->GetNext();
3689 } while ( pLow );
3690 if ( nFlyAdd )
3691 nHeight += nFlyAdd;
3692
3693 // The border cannot be calculated based on PrtArea and Frame, since both can be invalid.
3694 SwBorderAttrAccess aAccess( SwFrame::GetCache(), pCell );
3695 const SwBorderAttrs &rAttrs = *aAccess.Get();
3696 nHeight += rAttrs.CalcTop() + rAttrs.CalcBottom();
3697
3698 return pCell->getFrameArea().Height() - nHeight;
3699 }
3700 else
3701 {
3702 tools::Long nRstHeight = 0;
3703 while (pLow && pLow->IsLayoutFrame())
3704 {
3705 nRstHeight += ::CalcRowRstHeight(static_cast<SwLayoutFrame*>(pLow));
3706 pLow = pLow->GetNext();
3707 }
3708 return nRstHeight;
3709 }
3710}
3711
3713{
3714 SwFrame *pLow = pRow->Lower();
3715 if (!(pLow && pLow->IsLayoutFrame()))
3716 {
3717 return 0;
3718 }
3719 SwTwips nRstHeight = LONG_MAX;
3720 while (pLow && pLow->IsLayoutFrame())
3721 {
3722 nRstHeight = std::min(nRstHeight, ::lcl_CalcCellRstHeight(static_cast<SwLayoutFrame*>(pLow)));
3723 pLow = pLow->GetNext();
3724 }
3725 return nRstHeight;
3726}
3727
3728const SwFrame* FindPage( const SwRect &rRect, const SwFrame *pPage )
3729{
3730 if ( !rRect.Overlaps( pPage->getFrameArea() ) )
3731 {
3732 const SwRootFrame* pRootFrame = static_cast<const SwRootFrame*>(pPage->GetUpper());
3733 const SwFrame* pTmpPage = pRootFrame ? pRootFrame->GetPageAtPos( rRect.TopLeft(), &rRect.SSize(), true ) : nullptr;
3734 if ( pTmpPage )
3735 pPage = pTmpPage;
3736 }
3737
3738 return pPage;
3739}
3740
3741namespace {
3742
3743class SwFrameHolder : private SfxListener
3744{
3745 SwFrame* m_pFrame;
3746 bool m_bSet;
3747 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
3748public:
3749 SwFrameHolder()
3750 : m_pFrame(nullptr)
3751 , m_bSet(false)
3752 {
3753 }
3754 void SetFrame( SwFrame* pHold );
3755 SwFrame* GetFrame() { return m_pFrame; }
3756 void Reset();
3757 bool IsSet() const { return m_bSet; }
3758};
3759
3760}
3761
3762void SwFrameHolder::SetFrame( SwFrame* pHold )
3763{
3764 m_bSet = true;
3765 if (m_pFrame != pHold)
3766 {
3767 if (m_pFrame)
3768 EndListening(*m_pFrame);
3769 StartListening(*pHold);
3770 m_pFrame = pHold;
3771 }
3772}
3773
3774void SwFrameHolder::Reset()
3775{
3776 if (m_pFrame)
3777 EndListening(*m_pFrame);
3778 m_bSet = false;
3779 m_pFrame = nullptr;
3780}
3781
3782void SwFrameHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
3783{
3784 if (rHint.GetId() == SfxHintId::Dying && &rBC == m_pFrame)
3785 {
3786 m_pFrame = nullptr;
3787 }
3788}
3789
3791 SwFrameType const nFrameType, SwPosition const*const pPos,
3792 std::pair<Point, bool> const*const pViewPosAndCalcFrame)
3793{
3794 SwFrame *pMinFrame = nullptr, *pTmpFrame;
3795 SwFrameHolder aHolder;
3796 SwRect aCalcRect;
3797 bool bClientIterChanged = false;
3798
3800 do {
3801 pMinFrame = nullptr;
3802 aHolder.Reset();
3803 sal_uInt64 nMinDist = 0;
3804 bClientIterChanged = false;
3805
3806 for( pTmpFrame = aIter.First(); pTmpFrame; pTmpFrame = aIter.Next() )
3807 {
3808 if( pTmpFrame->GetType() & nFrameType &&
3809 ( !pLayout || pLayout == pTmpFrame->getRootFrame() ) &&
3810 (!pTmpFrame->IsFlowFrame() ||
3811 !SwFlowFrame::CastFlowFrame( pTmpFrame )->IsFollow() ))
3812 {
3813 if (pViewPosAndCalcFrame)
3814 {
3815 // watch for Frame being deleted
3816 if ( pMinFrame )
3817 aHolder.SetFrame( pMinFrame );
3818 else
3819 aHolder.Reset();
3820
3821 if (pViewPosAndCalcFrame->second)
3822 {
3823 // tdf#108118 prevent recursion
3824 DisableCallbackAction a(*pTmpFrame->getRootFrame());
3825 // - format parent Writer
3826 // fly frame, if it isn't been formatted yet.
3827 // Note: The Writer fly frame could be the frame itself.
3828 SwFlyFrame* pFlyFrame( pTmpFrame->FindFlyFrame() );
3829 if ( pFlyFrame &&
3830 pFlyFrame->getFrameArea().Pos().X() == FAR_AWAY &&
3831 pFlyFrame->getFrameArea().Pos().Y() == FAR_AWAY )
3832 {
3833 SwObjectFormatter::FormatObj( *pFlyFrame );
3834 }
3835 pTmpFrame->Calc(pLayout ? pLayout->GetCurrShell()->GetOut() : nullptr);
3836 }
3837
3838 // aIter.IsChanged checks if the current pTmpFrame has been deleted while
3839 // it is the current iterator
3840 // FrameHolder watches for deletion of the current pMinFrame
3841 if( aIter.IsChanged() || ( aHolder.IsSet() && !aHolder.GetFrame() ) )
3842 {
3843 // restart iteration
3844 bClientIterChanged = true;
3845 break;
3846 }
3847
3848 // for Flys go via the parent if the Fly is not yet "formatted"
3849 if (!pViewPosAndCalcFrame->second &&
3850 pTmpFrame->GetType() & SwFrameType::Fly &&
3851 static_cast<SwFlyFrame*>(pTmpFrame)->GetAnchorFrame() &&
3852 FAR_AWAY == pTmpFrame->getFrameArea().Pos().getX() &&
3853 FAR_AWAY == pTmpFrame->getFrameArea().Pos().getY() )
3854 aCalcRect = static_cast<SwFlyFrame*>(pTmpFrame)->GetAnchorFrame()->getFrameArea();
3855 else
3856 aCalcRect = pTmpFrame->getFrameArea();
3857
3858 if (aCalcRect.Contains(pViewPosAndCalcFrame->first))
3859 {
3860 pMinFrame = pTmpFrame;
3861 break;
3862 }
3863
3864 // Point not in rectangle. Compare distances:
3865 const Point aCalcRectCenter = aCalcRect.Center();
3866 const Point aDiff = aCalcRectCenter - pViewPosAndCalcFrame->first;
3867 const sal_uInt64 nCurrentDist = sal_Int64(aDiff.getX()) * sal_Int64(aDiff.getX()) + sal_Int64(aDiff.getY()) * sal_Int64(aDiff.getY()); // opt: no sqrt
3868 if ( !pMinFrame || nCurrentDist < nMinDist )
3869 {
3870 pMinFrame = pTmpFrame;
3871 nMinDist = nCurrentDist;
3872 }
3873 }
3874 else
3875 {
3876 // if no pViewPosAndCalcFrame is provided, take the first one
3877 pMinFrame = pTmpFrame;
3878 break;
3879 }
3880 }
3881 }
3882 } while( bClientIterChanged );
3883
3884 if( pPos && pMinFrame && pMinFrame->IsTextFrame() )
3885 return static_cast<SwTextFrame*>(pMinFrame)->GetFrameAtPos( *pPos );
3886
3887 return pMinFrame;
3888}
3889
3890bool IsExtraData( const SwDoc *pDoc )
3891{
3892 const SwLineNumberInfo &rInf = pDoc->GetLineNumberInfo();
3893 return rInf.IsPaintLineNumbers() ||
3894 rInf.IsCountInFlys() ||
3895 (static_cast<sal_Int16>(SW_MOD()->GetRedlineMarkPos()) != text::HoriOrientation::NONE &&
3897 (pDoc->GetEditShell() && pDoc->GetEditShell()->GetViewOptions() &&
3899}
3900
3901// OD 22.09.2003 #110978#
3903{
3904 SwRect aPrtWithoutHeaderFooter( getFramePrintArea() );
3905 aPrtWithoutHeaderFooter.Pos() += getFrameArea().Pos();
3906
3907 const SwFrame* pLowerFrame = Lower();
3908 while ( pLowerFrame )
3909 {
3910 // Note: independent on text direction page header and page footer are
3911 // always at top respectively at bottom of the page frame.
3912 if ( pLowerFrame->IsHeaderFrame() )
3913 {
3914 aPrtWithoutHeaderFooter.AddTop( pLowerFrame->getFrameArea().Height() );
3915 }
3916 if ( pLowerFrame->IsFooterFrame() )
3917 {
3918 aPrtWithoutHeaderFooter.AddBottom( - pLowerFrame->getFrameArea().Height() );
3919 }
3920
3921 pLowerFrame = pLowerFrame->GetNext();
3922 }
3923
3924 return aPrtWithoutHeaderFooter;
3925}
3926
3934 SwTwips& onLowerSpacing,
3935 SwTwips& onLineSpacing,
3936 bool& obIsLineSpacingProportional,
3937 bool bIdenticalStyles )
3938{
3939 if ( !rFrame.IsFlowFrame() )
3940 {
3941 onLowerSpacing = 0;
3942 onLineSpacing = 0;
3943 }
3944 else
3945 {
3946 const SvxULSpaceItem& rULSpace = rFrame.GetAttrSet()->GetULSpace();
3947 // check contextual spacing if the style of actual and next paragraphs are identical
3948 if (bIdenticalStyles)
3949 onLowerSpacing = (rULSpace.GetContext() ? 0 : rULSpace.GetLower());
3950 else
3951 onLowerSpacing = rULSpace.GetLower();
3952
3953 onLineSpacing = 0;
3954 obIsLineSpacingProportional = false;
3955 if ( rFrame.IsTextFrame() )
3956 {
3957 onLineSpacing = static_cast<const SwTextFrame&>(rFrame).GetLineSpace();
3958 obIsLineSpacingProportional =
3959 onLineSpacing != 0 &&
3960 static_cast<const SwTextFrame&>(rFrame).GetLineSpace( true ) == 0;
3961 }
3962
3963 OSL_ENSURE( onLowerSpacing >= 0 && onLineSpacing >= 0,
3964 "<GetSpacingValuesOfFrame(..)> - spacing values aren't positive!" );
3965 }
3966}
3967
3970{
3971 const SwContentFrame* pContent = rCell.ContainsContent();
3972 const SwTabFrame* pTab = rCell.FindTabFrame();
3973
3974 while ( pContent && rCell.IsAnLower( pContent ) )
3975 {
3976 const SwTabFrame* pTmpTab = pContent->FindTabFrame();
3977 if ( pTmpTab != pTab )
3978 {
3979 SwFrame const*const pTmp = pTmpTab->FindLastContentOrTable();
3980 if (pTmp)
3981 {
3982 pContent = pTmp->FindNextCnt();
3983 }
3984 else
3985 {
3986 pContent = nullptr;
3987 }
3988 }
3989 else
3990 break;
3991 }
3992 return pContent;
3993}
3994
3996 : mpFrame( pFrame )
3997 , mpRegIn( pFrame
3998 ? pFrame->IsTextFrame()
3999 // sw_redlinehide: GetDep() may be a member of SwTextFrame!
4000 ? static_cast<SwTextFrame const*>(pFrame)->GetTextNodeFirst()
4001 : const_cast<SwFrame*>(pFrame)->GetDep()
4002 : nullptr )
4003{
4004}
4005
4008{
4009 if ( !mpFrame || !mpRegIn )
4010 return false;
4011
4013 SwFrame* pLast = aIter.First();
4014 while ( pLast )
4015 {
4016 if ( pLast == mpFrame )
4017 return false;
4018 pLast = aIter.Next();
4019 }
4020
4021 return true;
4022}
4023
4024/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::chart::ChartAxisLabelPosition ePos
SvxGraphicPosition
GPOS_NONE
GPOS_TILED
helper class to disable creation of an action by a callback event in particular, change event from a ...
Definition: rootfrm.hxx:451
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
virtual void UpdateTableFields(SfxPoolItem *pHt)=0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual const SwRedlineTable & GetRedlineTable() const =0
virtual const SwRangeRedline * GetRedline(const SwPosition &rPos, SwRedlineTable::size_type *pFndPos) const =0
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual bool IsUpdateExpField() const =0
virtual bool IsNewDoc() const =0
virtual void BlockIdling()=0
Increment block count.
virtual void UnblockIdling()=0
Decrement block count.
const SdrPage * GetPage(sal_uInt16 nPgNum) const
virtual SdrObject * SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
sal_uInt32 GetOrdNumDirect() const
void ActionChanged() const
sal_uInt32 GetOrdNum() const
virtual const tools::Rectangle & GetCurrentBoundRect() const
virtual const tools::Rectangle & GetLastBoundRect() const
SdrPage * getSdrPageFromSdrObject() const
bool GetValue() const
SfxHintId GetId() const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint)
static sal_uInt8 s_nCnt
Definition: frmtool.hxx:463
static bool s_bLocked
Definition: frmtool.hxx:464
const editeng::SvxBorderLine * GetTop() const
sal_Int16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false, bool bAllowNegative=false) const
const editeng::SvxBorderLine * GetRight() const
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetBottom() const
SvxGraphicPosition GetGraphicPos() const
tools::Long GetLeft() const
sal_uInt16 GetPropLineSpace() const
SvxInterLineSpaceRule GetInterLineSpaceRule() const
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
bool GetContext() const
SwSectionNode * GetSectionNode()
Definition: layhelp.hxx:97
void SetUpper(SwActualSection *p)
Definition: layhelp.hxx:98
class for the positioning of drawing objects
wrapper class for the positioning of Writer fly frames and drawing objects
const SwFrame * GetAnchorFrame() const
bool ConsiderForTextWrap() const
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint)=0
method to trigger notification of 'background'
SwFrame * AnchorFrame()
bool ConsiderObjWrapInfluenceOnObjPos() const
method to determine, if wrapping style influence of the anchored object has to be considered on the o...
SwPageFrame * GetPageFrame()
void SetConsiderForTextWrap(const bool _bConsiderForTextWrap)
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
const SdrObject * GetDrawObj() const
SdrObject * DrawObj()
void SetRestartLayoutProcess(const bool _bRestartLayoutProcess)
const SwDoc * GetDoc() const
Definition: swatrset.hxx:197
const SwParaConnectBorderItem & GetParaConnectBorder(bool=true) const
Definition: paratr.hxx:222
const SvxBrushItem & GetBackground(bool=true) const
Definition: frmatr.hxx:58
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:46
const SvxFormatKeepItem & GetKeep(bool=true) const
Definition: frmatr.hxx:56
const SvxLineSpacingItem & GetLineSpacing(bool=true) const
Definition: paratr.hxx:192
const SwFrame * m_pConstructor
Definition: frmtool.hxx:432
virtual SwCacheObj * NewObj() override
Can be use in NewObj.
Definition: frmtool.cxx:2675
SwBorderAttrAccess(SwCache &rCache, const SwFrame *pOwner)
Definition: frmtool.cxx:2667
SwBorderAttrs * Get()
Definition: frmtool.cxx:2681
bool m_bLineSpacing
Definition: frmtool.hxx:327
void CalcTopLine_()
Definition: frmtool.cxx:2436
void CalcBottomLine_()
Definition: frmtool.cxx:2443
const SvxShadowItem & m_rShadow
Definition: frmtool.hxx:315
void CalcRightLine_()
Definition: frmtool.cxx:2457
bool JoinedWithNext(const SwFrame &_rFrame) const
Definition: frmtool.cxx:2601
sal_uInt16 CalcRightLine() const
Definition: frmtool.hxx:528
sal_uInt16 m_nGetTopLine
Definition: frmtool.hxx:350
void CalcTop_()
Definition: frmtool.cxx:2285
sal_uInt16 m_nTop
Definition: frmtool.hxx:348
void CalcLineSpacing_()
Definition: frmtool.cxx:2645
sal_uInt16 m_nLeftLine
Definition: frmtool.hxx:346
bool JoinedWithPrev(const SwFrame &_rFrame, const SwFrame *_pPrevFrame=nullptr) const
Definition: frmtool.cxx:2589
SwBorderAttrs(const sw::BorderCacheOwner *pOwner, const SwFrame *pConstructor)
Definition: frmtool.cxx:2221
const SvxBoxItem & GetBox() const
Definition: frmtool.hxx:397
sal_uInt16 m_nGetBottomLine
Definition: frmtool.hxx:351
bool m_bLeftLine
Definition: frmtool.hxx:322
const SvxULSpaceItem & m_rUL
Definition: frmtool.hxx:311
tools::Long CalcLeft(const SwFrame *pCaller) const
Definition: frmtool.cxx:2371
bool m_bJoinedWithNext
Definition: frmtool.hxx:341
bool m_bBottomLine
Definition: frmtool.hxx:321
bool m_bTopLine
Definition: frmtool.hxx:320
bool CmpLeftRight(const SwBorderAttrs &rCmpAttrs, const SwFrame *pCaller, const SwFrame *pCmp) const
Definition: frmtool.cxx:2490
sal_uInt16 CalcTopLine() const
Definition: frmtool.hxx:510
sal_uInt16 m_nBottomLine
Definition: frmtool.hxx:345
bool m_bCachedGetTopLine
Definition: frmtool.hxx:332
sal_uInt16 CalcLeftLine() const
Definition: frmtool.hxx:522
void CalcLeftLine_()
Definition: frmtool.cxx:2450
void GetBottomLine_(const SwFrame &_rFrame)
Definition: frmtool.cxx:2630
sal_uInt16 CalcTop() const
Definition: frmtool.hxx:534
void GetTopLine_(const SwFrame &_rFrame, const SwFrame *_pPrevFrame)
Definition: frmtool.cxx:2613
bool m_bCachedJoinedWithNext
Definition: frmtool.hxx:338
void CalcJoinedWithNext(const SwFrame &_rFrame)
Definition: frmtool.cxx:2558
void CalcBottom_()
Definition: frmtool.cxx:2303
std::shared_ptr< SvxLRSpaceItem > m_rLR
Definition: frmtool.hxx:313
bool m_bCachedJoinedWithPrev
Definition: frmtool.hxx:337
sal_uInt16 m_nBottom
Definition: frmtool.hxx:349
const SvxShadowItem & GetShadow() const
Definition: frmtool.hxx:398
sal_uInt16 m_nLineSpacing
Definition: frmtool.hxx:352
bool m_bCacheGetLine
Definition: frmtool.hxx:331
bool m_bBottom
Definition: frmtool.hxx:325
sal_uInt16 CalcBottomLine() const
Definition: frmtool.hxx:516
bool m_bCachedGetBottomLine
Definition: frmtool.hxx:333
tools::Long CalcRight(const SwFrame *pCaller) const
Definition: frmtool.cxx:2309
sal_uInt16 m_nTopLine
Definition: frmtool.hxx:344
void IsLine_()
Definition: frmtool.cxx:2464
sal_uInt16 m_nRightLine
Definition: frmtool.hxx:347
void CalcJoinedWithPrev(const SwFrame &_rFrame, const SwFrame *_pPrevFrame)
Definition: frmtool.cxx:2523
bool m_bRightLine
Definition: frmtool.hxx:323
bool m_bIsLine
Definition: frmtool.hxx:329
bool m_bJoinedWithPrev
Definition: frmtool.hxx:340
bool JoinWithCmp(const SwFrame &_rCallerFrame, const SwFrame &_rCmpFrame) const
Definition: frmtool.cxx:2501
const SwAttrSet & m_rAttrSet
Definition: frmtool.hxx:310
const SvxBoxItem & m_rBox
Definition: frmtool.hxx:314
sal_uInt16 CalcBottom() const
Definition: frmtool.hxx:540
virtual ~SwBorderAttrs() override
Definition: frmtool.cxx:2275
Access class for the Cache.
Definition: swcache.hxx:196
const void * m_pOwner
Definition: swcache.hxx:203
SwCacheObj * Get(bool isDuplicateOwnerAllowed)
Definition: swcache.hxx:257
The Cache object base class Users of the Cache must derive a class from the SwCacheObj and store thei...
Definition: swcache.hxx:135
const void * m_pOwner
Definition: swcache.hxx:161
Base class for the following contact objects (frame + draw objects).
Definition: dcontact.hxx:67
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const =0
bool ObjAnchoredAtPage() const
Definition: dcontact.hxx:146
bool ObjAnchoredAsChar() const
Definition: dcontact.hxx:150
bool ObjAnchoredAtFly() const
Definition: dcontact.hxx:147
SwFrameFormat * GetFormat()
Definition: dcontact.hxx:112
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
Definition: cntfrm.hxx:58
SwContentFrame * GetNextContentFrame() const
Definition: cntfrm.hxx:119
virtual SwContentFrame * MakeFrame(SwFrame *pSib)=0
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e....
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1204
void ImplDestroy()
Definition: frmtool.cxx:808
bool mbChkHeightOfLastLine
Definition: frmtool.hxx:278
bool mbInvalidatePrevPrtArea
Definition: frmtool.hxx:282
SwTwips mnHeightOfLastLine
Definition: frmtool.hxx:279
SwContentNotify(SwContentFrame *pContentFrame)
Definition: frmtool.cxx:783
bool mbBordersJoinedWithPrev
Definition: frmtool.hxx:283
bool HasBeenDeleted() const
return true if mpFrame != 0 and mpFrame is not client of pRegIn false otherwise
Definition: frmtool.cxx:4007
const sw::BroadcastingModify * mpRegIn
Definition: frmtool.hxx:609
SwDeletionChecker(const SwFrame *pFrame)
Definition: frmtool.cxx:3995
const SwFrame * mpFrame
Definition: frmtool.hxx:608
Definition: doc.hxx:188
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
SwLayoutCache * GetLayoutCache() const
Definition: doc.hxx:1548
const SwLineNumberInfo & GetLineNumberInfo() const
Definition: lineinfo.cxx:49
SwNodes & GetNodes()
Definition: doc.hxx:408
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
IDocumentSettingAccess const & getIDocumentSettingAccess() const
Definition: doc.cxx:176
bool DoesContainAtPageObjWithContentAnchor()
Definition: doc.hxx:572
const SwFrameFormat * GetEmptyPageFormat() const
Definition: doc.hxx:748
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:697
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:743
::sw::DocumentSettingManager & GetDocumentSettingManager()
Definition: doc.cxx:186
IDocumentTimerAccess const & getIDocumentTimerAccess() const
Definition: doc.cxx:249
const SwFrame * GetAnchorFrame(const SdrObject *_pDrawObj=nullptr) const
Definition: dcontact.cxx:804
SwDrawVirtObj * AddVirtObj(SwFrame const &rAnchorFrame)
add a 'virtual' drawing object to drawing page.
Definition: dcontact.cxx:830
virtual const SwAnchoredObject * GetAnchoredObj(const SdrObject *_pSdrObj) const override
Definition: dcontact.cxx:762
SdrObject * GetDrawObjectByAnchorFrame(const SwFrame &_rAnchorFrame)
get drawing object ('master' or 'virtual') by frame.
Definition: dcontact.cxx:856
new class for re-direct methods calls at a 'virtual' drawing object to its referenced object.
Definition: dcontact.hxx:213
virtual void CalcAndSetScale(svt::EmbeddedObjectRef &xObj, const SwRect *pFlyPrtRect=nullptr, const SwRect *pFlyFrameRect=nullptr, const bool bNoTextFramePrtAreaChanged=false)=0
Client for OleObject has to be up-to-date regarding scaling.
Base class that provides the general functionalities for frames that are allowed at page breaks (flow...
Definition: flowfrm.hxx:59
bool IsJoinLocked() const
Definition: flowfrm.hxx:175
bool IsFlyLock() const
Definition: flowfrm.hxx:230
const SwFlowFrame * GetFollow() const
Definition: flowfrm.hxx:168
void CheckKeep()
Definition: flowfrm.cxx:146
bool MoveFwd(bool bMakePage, bool bPageBreak, bool bMoveAlways=false)
Return value guarantees that a new page was not created, although false does not NECESSARILY indicate...
Definition: flowfrm.cxx:1938
bool HasFollow() const
Definition: flowfrm.hxx:165
bool IsFollow() const
Definition: flowfrm.hxx:166
void SetFollow(SwFlowFrame *const pFollow)
Definition: flowfrm.cxx:91
static SwFlowFrame * CastFlowFrame(SwFrame *pFrame)
Definition: flowfrm.cxx:2709
const SwFrame & GetFrame() const
Definition: flowfrm.hxx:151
void UnlockJoin()
Definition: flowfrm.hxx:140
bool IsUndersized() const
Definition: flowfrm.hxx:158
bool IsKeep(SvxFormatKeepItem const &rKeep, SvxFormatBreakItem const &rBreak, bool bBreakCheck=false) const
method to determine if a Keep needs to be considered (Breaks!)
Definition: flowfrm.cxx:234
void LockJoin()
Definition: flowfrm.hxx:139
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2801
void ResetNotifyBack()
Definition: flyfrm.hxx:226
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2895
bool IsFlyAtContentFrame() const
Definition: flyfrm.hxx:218
bool IsLowerOf(const SwLayoutFrame *pUpper) const
Definition: fly.cxx:2173
virtual const SwFlyFrame * DynCastFlyFrame() const override
Definition: fly.cxx:2979
void Invalidate_(SwPageFrame const *pPage=nullptr)
Definition: fly.cxx:1097
void NotifyDrawObj()
Definition: fly.cxx:2496
SwFlyFrame * GetNextLink() const
Definition: flyfrm.hxx:195
void Lock()
Definition: flyfrm.hxx:145
bool IsFlyLayFrame() const
Definition: flyfrm.hxx:217
void Unlock()
Definition: flyfrm.hxx:146
bool IsFlyFreeFrame() const
Definition: flyfrm.hxx:216
bool IsNotifyBack() const
Definition: flyfrm.hxx:224
bool IsAutoPos() const
Definition: flyfrm.hxx:214
bool supportsAutoContour() const
Definition: flylay.cxx:302
bool IsNoMoveOnCheckClip() const
Definition: flyfrms.hxx:88
SwFlyNotify(SwFlyFrame *pFlyFrame)
Definition: frmtool.cxx:663
const SwRect m_aFrameAndSpace
Definition: frmtool.hxx:265
void ImplDestroy()
Definition: frmtool.cxx:672
SwPageFrame * m_pOldPage
Definition: frmtool.hxx:264
const SwFootnoteFrame * GetFollow() const
Definition: ftnfrm.hxx:116
void ColUnlock()
Definition: ftnfrm.hxx:137
void ColLock()
Definition: ftnfrm.hxx:136
FlyAnchors.
Definition: fmtanchr.hxx:35
void SetPageNum(sal_uInt16 nNew)
Definition: fmtanchr.hxx:72
void SetAnchor(const SwPosition *pPos)
Definition: atrfrm.cxx:1586
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
SwFrameSize GetWidthSizeType() const
Definition: fmtfsize.hxx:83
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
bool IsContour() const
Definition: fmtsrnd.hxx:53
css::text::WrapTextMode GetSurround() const
Definition: fmtsrnd.hxx:51
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
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 SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:713
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:712
const SwRect & getFrameArea() const
Definition: frame.hxx:179
const SwRect & getFramePrintArea() const
Definition: frame.hxx:180
bool isFrameAreaSizeValid() const
Definition: frame.hxx:167
Style of a layout element.
Definition: frmfmt.hxx:61
virtual void MakeFrames()
Creates the views.
Definition: atrfrm.cxx:2706
SdrObject * FindSdrObject()
Definition: frmfmt.hxx:140
Specific frame formats (frames, DrawObjects).
bool empty() const
size_t size() const
bool mbHadFollow
Definition: frmtool.hxx:236
bool mbValidSize
Definition: frmtool.hxx:238
const SwRect maPrt
Definition: frmtool.hxx:233
SwFrameNotify(SwFrame *pFrame)
Definition: frmtool.cxx:110
void ImplDestroy()
Definition: frmtool.cxx:136
const SwRect maFrame
Definition: frmtool.hxx:232
bool mbInvaKeep
Definition: frmtool.hxx:237
SwTwips mnFlyAnchorOfstNoWrap
Definition: frmtool.hxx:235
SwTwips mnFlyAnchorOfst
Definition: frmtool.hxx:234
const SwRect & getFrameArea() const
Definition: frmtool.hxx:244
SwFrame * mpFrame
Definition: frmtool.hxx:231
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsRowFrame() const
Definition: frame.hxx:1222
virtual void Cut()=0
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1503
bool IsCellFrame() const
Definition: frame.hxx:1226
void InvalidateInfFlags()
Definition: frame.hxx:608
SwFrame * mpPrev
Definition: frame.hxx:339
void InsertBehind(SwLayoutFrame *pParent, SwFrame *pBefore)
Insert SwFrame into existing structure.
Definition: wsfrm.cxx:866
bool IsTextFrame() const
Definition: frame.hxx:1234
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true)
Definition: wsfrm.cxx:597
SwFrame * GetIndPrev() const
Definition: frame.hxx:724
SwTextFrame * DynCastTextFrame()
Definition: findfrm.cxx:1895
sal_uInt16 GetVirtPageNum() const
Definition: trvlfrm.cxx:1820
void CheckDirChange()
checks the layout direction and invalidates the lower frames recursively, if necessary.
Definition: ssfrm.cxx:194
bool IsInDocBody() const
Definition: frame.hxx:943
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1111
bool IsAccessibleFrame() const
Definition: frame.hxx:1250
SwSectionFrame * FindSctFrame()
Definition: frame.hxx:1115
SwContentFrame * FindPrevCnt()
Definition: findfrm.cxx:199
SwTabFrame * FindTabFrame()
Definition: frame.hxx:1099
SwFrame * FindNext()
Definition: frame.hxx:1141
SwFrame * GetNext()
Definition: frame.hxx:676
bool HasFixSize() const
Definition: frame.hxx:670
bool supportsFullDrawingLayerFillAttributeSet() const
Definition: findfrm.cxx:764
bool IsPageFrame() const
Definition: frame.hxx:1178
bool IsColLocked() const
Definition: frame.hxx:886
bool IsColumnFrame() const
Definition: frame.hxx:1182
void InvalidateNextPos(bool bNoFootnote=false)
Definition: frame.hxx:1072
bool IsTabFrame() const
Definition: frame.hxx:1218
void InvalidatePos_()
Definition: frame.hxx:787
SwFrameType GetType() const
Definition: frame.hxx:519
bool IsInFootnote() const
Definition: frame.hxx:949
bool IsHeaderFrame() const
Definition: frame.hxx:1190
void InvalidateObjs(const bool _bNoInvaOfAsCharAnchoredObjs=true)
Definition: fly.cxx:2363
bool IsRetoucheFrame() const
Definition: frame.hxx:1246
const SwSortedObjs * GetDrawObjs() const
Definition: frame.hxx:564
bool IsInTab() const
Definition: frame.hxx:955
SwFrame * FindPrev()
Definition: frame.hxx:1155
static SwCache & GetCache()
Definition: frame.hxx:521
SwLayoutFrame * mpUpper
Definition: frame.hxx:337
SwFrame * GetLower()
Definition: findfrm.cxx:194
bool IsRightToLeft() const
Definition: frame.hxx:987
bool IsInFly() const
Definition: frame.hxx:961
void AppendFly(SwFlyFrame *pNew)
Definition: fly.cxx:2192
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:1066
SwFlyFrame * ImplFindFlyFrame()
Definition: findfrm.cxx:571
const SwAttrSet * GetAttrSet() const
WARNING: this may not return correct RES_PAGEDESC/RES_BREAK items for SwTextFrame,...
Definition: findfrm.cxx:731
void InvalidateNextPrtArea()
method to invalidate printing area of next frame #i11859#
Definition: findfrm.cxx:1336
void RemoveFromLayout()
Definition: wsfrm.cxx:1007
bool IsFlowFrame() const
Definition: frame.hxx:1242
void InvalidatePrt()
Definition: frame.hxx:1036
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr)=0
bool IsMoveable(const SwLayoutFrame *_pLayoutFrame=nullptr) const
determine, if frame is moveable in given environment
Definition: findfrm.cxx:1416
SwFootnoteFrame * ImplFindFootnoteFrame()
Definition: findfrm.cxx:559
bool IsRootFrame() const
Definition: frame.hxx:1174
bool IsFooterFrame() const
Definition: frame.hxx:1194
void InvalidatePos()
Definition: frame.hxx:1043
bool IsFootnoteFrame() const
Definition: frame.hxx:1202
SwLayoutFrame * GetUpper()
Definition: frame.hxx:678
const SwLayoutFrame * GetNextLayoutLeaf() const
Definition: frame.hxx:1020
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:607
SwRootFrame * getRootFrame()
Definition: frame.hxx:679
bool IsNoTextFrame() const
Definition: frame.hxx:1238
void SetCompletePaint() const
Definition: frame.hxx:994
virtual const SvxFormatBreakItem & GetBreakItem() const
Definition: findfrm.cxx:711
bool IsFlyFrame() const
Definition: frame.hxx:1210
bool IsContentFrame() const
Definition: frame.hxx:1230
void InvalidatePrt_()
Definition: frame.hxx:779
SwFrame * GetPrev()
Definition: frame.hxx:677
SwFrame * FindColFrame()
Definition: findfrm.cxx:584
bool IsSctFrame() const
Definition: frame.hxx:1214
void InvalidateSize()
Definition: frame.hxx:1029
SwContentFrame * FindNextCnt(const bool _bInSameFootnote=false)
Definition: findfrm.cxx:215
SwPageFrame * FindPageFrame()
Definition: frame.hxx:680
drawinglayer::attribute::SdrAllFillAttributesHelperPtr getSdrAllFillAttributesHelper() const
Definition: findfrm.cxx:748
void AppendDrawObj(SwAnchoredObject &_rNewObj)
Definition: fly.cxx:2252
SwFrame * FindFooterOrHeader()
Definition: findfrm.cxx:602
SwFootnoteFrame * FindFootnoteFrame()
Definition: frame.hxx:1107
SwFrame * GetIndNext()
Definition: frame.hxx:727
void InvalidateAll_()
Definition: frame.hxx:803
static void DestroyFrame(SwFrame *const pFrame)
this is the only way to delete a SwFrame instance
Definition: ssfrm.cxx:388
void SetRetouche() const
Definition: frame.hxx:1003
bool IsLayoutFrame() const
Definition: frame.hxx:1170
bool IsInSct() const
Definition: frame.hxx:967
sal_Int32 GetIndex() const
Definition: index.hxx:91
TElementType * Next()
Definition: calbck.hxx:364
TElementType * First()
Definition: calbck.hxx:356
bool IsAgain() const
Definition: layact.hxx:170
Helps during the InsertCnt_ function to create new pages.
Definition: layhelp.hxx:105
SwLayNotify(SwLayoutFrame *pLayFrame)
Definition: frmtool.cxx:446
void ImplDestroy()
Definition: frmtool.cxx:481
bool IsLowersComplete() const
Definition: frmtool.hxx:259
void ClearImpl()
Definition: laycache.cxx:440
bool CompareLayout(const SwDoc &rDoc) const
Definition: laycache.cxx:325
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:3037
bool IsAnLower(const SwFrame *) const
Definition: findfrm.cxx:231
virtual const SwFrameFormat * GetFormat() const
Definition: ssfrm.cxx:399
const SwFrame * ContainsAny(const bool _bInvestigateFootnoteForSections=false) const
Method <ContainsAny()> doesn't investigate content of footnotes by default.
Definition: findfrm.cxx:129
const SwFrame * GetLastLower() const
Definition: findfrm.cxx:1885
void NotifyLowerObjs(const bool _bUnlockPosOfObjs=false)
force an unlockposition call for the lower objects.
Definition: fly.cxx:2430
const SwContentFrame * ContainsContent() const
Checks if the frame contains one or more ContentFrame's anywhere in his subsidiary structure; if so t...
Definition: findfrm.cxx:70
SwFrame * m_pLower
Definition: layfrm.hxx:53
void InvaPercentLowers(SwTwips nDiff=0)
Invalidates the inner Frames, whose width and/or height are calculated using percentages.
Definition: wsfrm.cxx:3586
const SwFrame * Lower() const
Definition: layfrm.hxx:101
< purpose of derivation from SwClient: character style for displaying the numbers.
Definition: lineinfo.hxx:39
bool IsPaintLineNumbers() const
Definition: lineinfo.hxx:80
bool IsCountInFlys() const
Definition: lineinfo.hxx:86
SwFrame * NextFrame()
Definition: node2lay.cxx:494
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:128
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:161
Base class of the Writer document model elements.
Definition: node.hxx:83
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:871
SwNodeOffset GetIndex() const
Definition: node.hxx:292
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:705
bool IsContentNode() const
Definition: node.hxx:640
SwDoc & GetDoc()
Definition: node.hxx:213
bool IsEndNode() const
Definition: node.hxx:644
bool IsStartNode() const
Definition: node.hxx:636
bool IsSectionNode() const
Definition: node.hxx:656
bool IsTableNode() const
Definition: node.hxx:652
bool IsTextNode() const
Definition: node.hxx:648
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:133
Merge GetRedlineMergeFlag() const
Definition: node.hxx:99
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:689
bool IsCreateFrameWhenHidingRedlines() const
Definition: node.hxx:95
std::vector< SwFrameFormat * > const & GetAnchoredFlys() const
Definition: node.hxx:298
SwNode * FindPrvNxtFrameNode(SwNodeIndex &rFrameIdx, const SwNode *pEnd, SwRootFrame const *pLayout=nullptr) const
Search previous / next content node or table node with frames.
Definition: nodes.cxx:2037
bool IsOLESizeInvalid() const
Definition: ndole.hxx:136
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:115
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:137
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:990
bool IsOleRef() const
To avoid unnecessary loading of object.
Definition: ndole.cxx:904
static bool FormatObj(SwAnchoredObject &_rAnchoredObj, SwFrame *_pAnchorFrame=nullptr, const SwPageFrame *_pPageFrame=nullptr)
method to format a given floating screen object
const SdrObject * m_pCurrent
Definition: frmtool.hxx:448
const SdrObject * Bottom()
Definition: frmtool.cxx:2718
const SdrObject * Next()
Definition: frmtool.cxx:2745
void Prev()
Definition: frmtool.cxx:2773
void Top()
Definition: frmtool.cxx:2692
SwOrderIter(const SwPageFrame *pPage)
Definition: frmtool.cxx:2686
const SwPageFrame * m_pPage
Definition: frmtool.hxx:447
const SwPosition * Start() const
Definition: pam.hxx:213
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
bool IsFirstShared() const
Definition: pagedesc.cxx:396
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:241
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:240
SwFrameFormat * GetRightFormat(bool const bFirst=false)
Layout uses the following methods to obtain a format in order to be able to create a page.
Definition: pagedesc.cxx:389
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
Definition: pagedesc.cxx:382
A page of the document layout.
Definition: pagefrm.hxx:58
void InvalidateContent() const
Definition: pagefrm.hxx:380
void AppendFlyToPage(SwFlyFrame *pNew)
Definition: flylay.cxx:788
void PreparePage(bool bFootnote)
Always call after Paste Creates the page-bound frames and formats the generic content.
Definition: pagechg.cxx:475
sal_uInt16 GetPhyPageNum() const
Definition: pagefrm.hxx:204
void RemoveFlyFromPage(SwFlyFrame *pToRemove)
Definition: flylay.cxx:900
const SwSortedObjs * GetSortedObjs() const
Definition: pagefrm.hxx:132
void MoveFly(SwFlyFrame *pToMove, SwPageFrame *pDest)
Definition: flylay.cxx:950
virtual void Paste(SwFrame *pParent, SwFrame *pSibling=nullptr) override
Definition: pagechg.cxx:907
void InvalidateFlyContent() const
Definition: pagefrm.hxx:368
void AppendDrawObjToPage(SwAnchoredObject &_rNewObj)
Definition: flylay.cxx:1049
SwRect PrtWithoutHeaderAndFooter() const
Definition: frmtool.cxx:3902
RedlineType GetType(sal_uInt16 nPos=0) const
Definition: docredln.cxx:1929
bool IsVert() const
Definition: frame.hxx:1366
tools::Long GetHeight(const SwRect &rRect) const
Definition: frame.hxx:1381
void SetPos(SwRect &rRect, const Point &rNew) const
Definition: frame.hxx:1419
tools::Long GetWidth(const SwRect &rRect) const
Definition: frame.hxx:1380
tools::Long TopDist(const SwRect &rRect, tools::Long nPos) const
Definition: frame.hxx:1412
tools::Long GetTop(const SwRect &rRect) const
Definition: frame.hxx:1376
Point GetPos(const SwRect &rRect) const
Definition: frame.hxx:1382
bool PosDiff(const SwRect &rRect1, const SwRect &rRect2) const
Definition: frame.hxx:1370
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
SwRect & Union(const SwRect &rRect)
Definition: swrect.cxx:35
Point TopLeft() const
Definition: swrect.hxx:254
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
SwRect & Intersection_(const SwRect &rRect)
Definition: swrect.cxx:81
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void SSize(const Size &rNew)
Definition: swrect.hxx:180
bool Contains(const Point &rPOINT) const
Definition: swrect.hxx:356
Point Center() const
Definition: swrect.hxx:338
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:130
bool Overlaps(const SwRect &rRect) const
Definition: swrect.hxx:374
void AddTop(const tools::Long nAdd)
Definition: swrect.cxx:128
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:266
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
static void AssertPageFlys(SwPageFrame *)
Makes sure that, starting from the passed Page, all page-bound Frames are on the right Page (pagenumb...
Definition: pagechg.cxx:1699
const SwPageFrame * GetPageAtPos(const Point &rPt, const Size *pSize=nullptr, bool bExtend=false) const
Point rPt: The point that should be used to find the page Size pSize: If given, we return the (first)...
Definition: findfrm.cxx:627
bool HasMergedParas() const
Definition: rootfrm.hxx:425
bool IsAnyShellAccessible() const
Definition: rootfrm.hxx:389
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding).
Definition: rootfrm.hxx:421
bool IsCallbackActionEnabled() const
Definition: rootfrm.hxx:387
void RemoveFromList(SwSectionFrame *pSct)
Definition: rootfrm.hxx:381
void SetCallbackActionEnabled(bool b)
Definition: rootfrm.hxx:386
SwRowFrame is one table row in the document layout.
Definition: rowfrm.hxx:29
void AdjustCells(const SwTwips nHeight, const bool bHeight)
Adapts the Cells to the current height; invalidates the Cells if the Direction does not match the hei...
Definition: tabfrm.cxx:4621
bool ShouldRowKeepWithNext(const bool bCheckParents=true) const
Definition: tabfrm.cxx:4932
SwSectionNode * GetSectionNode()
Definition: section.cxx:922
SwSection * GetSection()
Definition: sectfrm.hxx:97
void DelEmpty(bool bRemove)
Definition: sectfrm.cxx:192
void MergeNext(SwSectionFrame *pNxt)
|* Merges two SectionFrames, in case it's about the same section.
Definition: sectfrm.cxx:476
bool SplitSect(SwFrame *pFrame, bool bApres)
Splits the SectionFrame surrounding the pFrame up in two parts: pFrame and the start of the 2nd part.
Definition: sectfrm.cxx:519
void ColUnlock()
Definition: sectfrm.hxx:100
SwTwips Undersize()
Returns the size delta that the section would like to be greater if it has undersized TextFrames in i...
Definition: sectfrm.cxx:2830
void ColLock()
Definition: sectfrm.hxx:99
const SwSectionFrame * GetFollow() const
Definition: sectfrm.hxx:173
SwFrame * MakeFrame(SwFrame *)
Definition: ndsect.cxx:1042
const SwSection & GetSection() const
Definition: node.hxx:551
SwSectionFormat * GetFormat()
Definition: section.hxx:336
bool CalcHiddenFlag() const
Definition: section.cxx:314
class for collecting anchored objects
Definition: sortedobjs.hxx:49
size_t size() const
Definition: sortedobjs.cxx:43
Starts a section of nodes in the document model.
Definition: node.hxx:314
SwTabFrame is one table in the document layout, containing rows (which contain cells).
Definition: tabfrm.hxx:47
SwTabFrame * FindMaster(bool bFirstMaster=false) const
Definition: flowfrm.cxx:773
SwFrame * FindLastContentOrTable()
Definition: tabfrm.cxx:3534
void SetComplete()
Definition: tabfrm.hxx:162
TableFormulaUpdateFlags m_eFlags
Definition: hints.hxx:270
const SwTable & GetTable() const
Definition: node.hxx:506
SwTabFrame * MakeFrame(SwFrame *)
Definition: ndtbl.cxx:2352
void GCLines()
Definition: gctable.cxx:452
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:163
void Init()
This is public, as it needs to be called by some methods in order to save the Prepare USE WITH CAUTIO...
Definition: txtfrm.cxx:753
SwDoc & GetDoc()
Definition: txtfrm.hxx:464
SwTwips GetBaseOffsetForFly(bool bIgnoreFlysAnchoredAtThisFrame) const
Definition: txtfrm.hxx:762
sw::MergedPara * GetMergedPara()
Definition: txtfrm.hxx:454
bool IsHiddenNow() const
Hidden.
Definition: txtfrm.cxx:1363
SwTextNode * GetTextNodeFirst()
Definition: txtfrm.hxx:461
virtual bool Prepare(const PrepareHint ePrep=PrepareHint::Clear, const void *pVoid=nullptr, bool bNotify=true) override
SwContentFrame: the shortcut for the Frames If the void* casts wrongly, it's its own fault!...
Definition: txtfrm.cxx:2744
SwTwips GetHeightOfLastLine() const
Definition: txtfrm.hxx:771
SwTextNode const * GetTextNodeForParaProps() const
Definition: txtfrm.cxx:1306
bool IsEmpty() const
Definition: txtfrm.hxx:525
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:84
virtual sal_Int32 Len() const override
Definition: ndtxt.cxx:276
void ClearLRSpaceItemDueToListLevelIndents(std::shared_ptr< SvxLRSpaceItem > &o_rLRSpaceItem) const
Definition: ndtxt.cxx:3320
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:99
bool getBrowseMode() const
Definition: viewopt.hxx:472
bool IsAction() const
SS for the Lay-/IdleAction and relatives.
Definition: viewimp.hxx:193
void InvalidateAccessibleFrameContent(const SwFrame *pFrame)
Invalidate accessible frame's content.
Definition: viewimp.cxx:375
SwLayAction & GetLayAction()
Definition: viewimp.hxx:195
void MoveAccessibleFrame(const SwFrame *pFrame, const SwRect &rOldFrame)
Definition: viewimp.hxx:295
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:339
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
SwViewShellImp * Imp()
Definition: viewsh.hxx:182
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2172
void InvalidateAccessibleParaFlowRelation(const SwTextFrame *_pFromTextFrame, const SwTextFrame *_pToTextFrame)
invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs
Definition: viewsh.cxx:2600
void InvalidateWindows(const SwRect &rRect)
Definition: viewsh.cxx:556
SwDoc * GetDoc() const
Definition: viewsh.hxx:282
bool IsInConstructor() const
Definition: viewsh.hxx:556
Bookkeeping helper for SwCache caching writer borders.
bool IsChanged() const
Definition: calbck.hxx:315
virtual bool get(DocumentSettingId id) const override
Return the specified document setting.
const bool m_wasAlreadySuppressed
Definition: frmtool.hxx:164
FlyCreationSuppressor(bool isAlreadySuppressedAllowed=true)
Definition: frmtool.cxx:91