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