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