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