LibreOffice Module sw (master)  1
newfrm.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 <sal/config.h>
21 
22 #include <o3tl/safeint.hxx>
23 #include <svx/svdpage.hxx>
24 #include <osl/diagnose.h>
25 #include <drawdoc.hxx>
26 #include <fmtpdsc.hxx>
27 #include <swtable.hxx>
28 #include <rootfrm.hxx>
29 #include <pagefrm.hxx>
30 #include <dflyobj.hxx>
31 #include <frmtool.hxx>
32 #include "virtoutp.hxx"
33 #include <notxtfrm.hxx>
34 #include <pagedesc.hxx>
35 #include <viewimp.hxx>
36 #include <hints.hxx>
37 #include <viewopt.hxx>
38 #include <set>
44 #include <ndindex.hxx>
45 
47 bool SwRootFrame::s_isInPaint = false;
48 bool SwRootFrame::s_isNoVirDev = false;
49 
50 SwCache *SwFrame::spCache = nullptr;
51 
53  { return nFirst - nSecond; }
55  { return nSecond - nFirst; }
57  { return nA + nAdd; }
59  { return nA - nSub; }
60 
62  /*.fnGetTop =*/&SwRect::Top_,
63  /*.fnGetBottom =*/&SwRect::Bottom_,
64  /*.fnGetLeft =*/&SwRect::Left_,
65  /*.fnGetRight =*/&SwRect::Right_,
66  /*.fnGetWidth =*/&SwRect::Width_,
67  /*.fnGetHeight =*/&SwRect::Height_,
68  /*.fnGetPos =*/&SwRect::TopLeft,
69  /*.fnGetSize =*/&SwRect::Size_,
70 
71  /*.fnSetTop =*/&SwRect::Top_,
72  /*.fnSetBottom =*/&SwRect::Bottom_,
73  /*.fnSetLeft =*/&SwRect::Left_,
74  /*.fnSetRight =*/&SwRect::Right_,
75  /*.fnSetWidth =*/&SwRect::Width_,
76  /*.fnSetHeight =*/&SwRect::Height_,
77 
78  /*.fnSubTop =*/&SwRect::SubTop,
79  /*.fnAddBottom =*/&SwRect::AddBottom,
80  /*.fnSubLeft =*/&SwRect::SubLeft,
81  /*.fnAddRight =*/&SwRect::AddRight,
82  /*.fnAddWidth =*/&SwRect::AddWidth,
83  /*.fnAddHeight =*/&SwRect::AddHeight,
84 
85  /*.fnSetPosX =*/&SwRect::SetPosX,
86  /*.fnSetPosY =*/&SwRect::SetPosY,
87 
88  /*.fnGetTopMargin =*/&SwFrame::GetTopMargin,
89  /*.fnGetBottomMargin =*/&SwFrame::GetBottomMargin,
90  /*.fnGetLeftMargin =*/&SwFrame::GetLeftMargin,
91  /*.fnGetRightMargin =*/&SwFrame::GetRightMargin,
92  /*.fnSetXMargins =*/&SwFrame::SetLeftRightMargins,
93  /*.fnSetYMargins =*/&SwFrame::SetTopBottomMargins,
94  /*.fnGetPrtTop =*/&SwFrame::GetPrtTop,
95  /*.fnGetPrtBottom =*/&SwFrame::GetPrtBottom,
96  /*.fnGetPrtLeft =*/&SwFrame::GetPrtLeft,
97  /*.fnGetPrtRight =*/&SwFrame::GetPrtRight,
98  /*.fnTopDist =*/&SwRect::GetTopDistance,
99  /*.fnBottomDist =*/&SwRect::GetBottomDistance,
100  /*.fnLeftDist =*/&SwRect::GetLeftDistance,
101  /*.fnRightDist =*/&SwRect::GetRightDistance,
102  /*.fnSetLimit =*/&SwFrame::SetMaxBottom,
103  /*.fnOverStep =*/&SwRect::OverStepBottom,
104 
105  /*.fnSetPos =*/&SwRect::SetUpperLeftCorner,
106  /*.fnMakePos =*/&SwFrame::MakeBelowPos,
107  /*.fnXDiff =*/&FirstMinusSecond,
108  /*.fnYDiff =*/&FirstMinusSecond,
109  /*.fnXInc =*/&SwIncrement,
110  /*.fnYInc =*/&o3tl::saturating_add<tools::Long>,
111 
112  /*.fnSetLeftAndWidth =*/&SwRect::SetLeftAndWidth,
113  /*.fnSetTopAndHeight =*/&SwRect::SetTopAndHeight
114 };
115 
117  /*.fnGetTop =*/&SwRect::Right_,
118  /*.fnGetBottom =*/&SwRect::Left_,
119  /*.fnGetLeft =*/&SwRect::Top_,
120  /*.fnGetRight =*/&SwRect::Bottom_,
121  /*.fnGetWidth =*/&SwRect::Height_,
122  /*.fnGetHeight =*/&SwRect::Width_,
123  /*.fnGetPos =*/&SwRect::TopRight,
124  /*.fnGetSize =*/&SwRect::SwappedSize,
125 
126  /*.fnSetTop =*/&SwRect::Right_,
127  /*.fnSetBottom =*/&SwRect::Left_,
128  /*.fnSetLeft =*/&SwRect::Top_,
129  /*.fnSetRight =*/&SwRect::Bottom_,
130  /*.fnSetWidth =*/&SwRect::Height_,
131  /*.fnSetHeight =*/&SwRect::Width_,
132 
133  /*.fnSubTop =*/&SwRect::AddRight,
134  /*.fnAddBottom =*/&SwRect::SubLeft,
135  /*.fnSubLeft =*/&SwRect::SubTop,
136  /*.fnAddRight =*/&SwRect::AddBottom,
137  /*.fnAddWidth =*/&SwRect::AddHeight,
138  /*.fnAddHeight =*/&SwRect::AddWidth,
139 
140  /*.fnSetPosX =*/&SwRect::SetPosY,
141  /*.fnSetPosY =*/&SwRect::SetPosX,
142 
143  /*.fnGetTopMargin =*/&SwFrame::GetRightMargin,
144  /*.fnGetBottomMargin =*/&SwFrame::GetLeftMargin,
145  /*.fnGetLeftMargin =*/&SwFrame::GetTopMargin,
146  /*.fnGetRightMargin =*/&SwFrame::GetBottomMargin,
147  /*.fnSetXMargins =*/&SwFrame::SetTopBottomMargins,
148  /*.fnSetYMargins =*/&SwFrame::SetRightLeftMargins,
149  /*.fnGetPrtTop =*/&SwFrame::GetPrtRight,
150  /*.fnGetPrtBottom =*/&SwFrame::GetPrtLeft,
151  /*.fnGetPrtLeft =*/&SwFrame::GetPrtTop,
152  /*.fnGetPrtRight =*/&SwFrame::GetPrtBottom,
153  /*.fnTopDist =*/&SwRect::GetRightDistance,
154  /*.fnBottomDist =*/&SwRect::GetLeftDistance,
155  /*.fnLeftDist =*/&SwRect::GetTopDistance,
156  /*.fnRightDist =*/&SwRect::GetBottomDistance,
157  /*.fnSetLimit =*/&SwFrame::SetMinLeft,
158  /*.fnOverStep =*/&SwRect::OverStepLeft,
159 
160  /*.fnSetPos =*/&SwRect::SetUpperRightCorner,
161  /*.fnMakePos =*/&SwFrame::MakeLeftPos,
162  /*.fnXDiff =*/&FirstMinusSecond,
163  /*.fnYDiff =*/&SecondMinusFirst,
164  /*.fnXInc =*/&SwIncrement,
165  /*.fnYInc =*/&SwDecrement,
166 
167  /*.fnSetLeftAndWidth =*/&SwRect::SetTopAndHeight,
168  /*.fnSetTopAndHeight =*/&SwRect::SetRightAndWidth
169 };
170 
172  /*.fnGetTop =*/&SwRect::Left_,
173  /*.fnGetBottom =*/&SwRect::Right_,
174  /*.fnGetLeft =*/&SwRect::Top_,
175  /*.fnGetRight =*/&SwRect::Bottom_,
176  /*.fnGetWidth =*/&SwRect::Height_,
177  /*.fnGetHeight =*/&SwRect::Width_,
178  /*.fnGetPos =*/&SwRect::TopLeft,
179  /*.fnGetSize =*/&SwRect::SwappedSize,
180 
181  /*.fnSetTop =*/&SwRect::Left_,
182  /*.fnSetBottom =*/&SwRect::Right_,
183  /*.fnSetLeft =*/&SwRect::Top_,
184  /*.fnSetRight =*/&SwRect::Bottom_,
185  /*.fnSetWidth =*/&SwRect::Height_,
186  /*.fnSetHeight =*/&SwRect::Width_,
187 
188  /*.fnSubTop =*/&SwRect::SubLeft,
189  /*.fnAddBottom =*/&SwRect::AddRight,
190  /*.fnSubLeft =*/&SwRect::SubTop,
191  /*.fnAddRight =*/&SwRect::AddBottom,
192  /*.fnAddWidth =*/&SwRect::AddHeight,
193  /*.fnAddHeight =*/&SwRect::AddWidth,
194 
195  /*.fnSetPosX =*/&SwRect::SetPosY,
196  /*.fnSetPosY =*/&SwRect::SetPosX,
197 
198  /*.fnGetTopMargin =*/&SwFrame::GetLeftMargin,
199  /*.fnGetBottomMargin =*/&SwFrame::GetRightMargin,
200  /*.fnGetLeftMargin =*/&SwFrame::GetTopMargin,
201  /*.fnGetRightMargin =*/&SwFrame::GetBottomMargin,
202  /*.fnSetXMargins =*/&SwFrame::SetTopBottomMargins,
203  /*.fnSetYMargins =*/&SwFrame::SetLeftRightMargins,
204  /*.fnGetPrtTop =*/&SwFrame::GetPrtLeft,
205  /*.fnGetPrtBottom =*/&SwFrame::GetPrtRight,
206  /*.fnGetPrtLeft =*/&SwFrame::GetPrtTop,
207  /*.fnGetPrtRight =*/&SwFrame::GetPrtBottom,
208  /*.fnTopDist =*/&SwRect::GetLeftDistance,
209  /*.fnBottomDist =*/&SwRect::GetRightDistance,
210  /*.fnLeftDist =*/&SwRect::GetTopDistance,
211  /*.fnRightDist =*/&SwRect::GetBottomDistance,
212  /*.fnSetLimit =*/&SwFrame::SetMaxRight,
213  /*.fnOverStep =*/&SwRect::OverStepRight,
214 
215  /*.fnSetPos =*/&SwRect::SetUpperLeftCorner,
216  /*.fnMakePos =*/&SwFrame::MakeRightPos,
217  /*.fnXDiff =*/&FirstMinusSecond,
218  /*.fnYDiff =*/&FirstMinusSecond,
219  /*.fnXInc =*/&SwIncrement,
220  /*.fnYInc =*/&SwIncrement,
221 
222  /*.fnSetLeftAndWidth =*/&SwRect::SetTopAndHeight,
223  /*.fnSetTopAndHeight =*/&SwRect::SetLeftAndWidth
224 };
225 
232  /*.fnGetTop =*/&SwRect::Left_,
233  /*.fnGetBottom =*/&SwRect::Right_,
234  /*.fnGetLeft =*/&SwRect::Bottom_,
235  /*.fnGetRight =*/&SwRect::Top_,
236  /*.fnGetWidth =*/&SwRect::Height_,
237  /*.fnGetHeight =*/&SwRect::Width_,
238  /*.fnGetPos =*/&SwRect::BottomLeft,
239  /*.fnGetSize =*/&SwRect::SwappedSize,
240 
241  /*.fnSetTop =*/&SwRect::Left_,
242  /*.fnSetBottom =*/&SwRect::Right_,
243  /*.fnSetLeft =*/&SwRect::Bottom_,
244  /*.fnSetRight =*/&SwRect::Top_,
245  /*.fnSetWidth =*/&SwRect::Height_,
246  /*.fnSetHeight =*/&SwRect::Width_,
247 
248  /*.fnSubTop =*/&SwRect::SubLeft,
249  /*.fnAddBottom =*/&SwRect::AddRight,
250  /*.fnSubLeft =*/&SwRect::AddBottom,
251  /*.fnAddRight =*/&SwRect::SubTop,
252  /*.fnAddWidth =*/&SwRect::AddHeight,
253  /*.fnAddHeight =*/&SwRect::AddWidth,
254 
255  /*.fnSetPosX =*/&SwRect::SetPosY,
256  /*.fnSetPosY =*/&SwRect::SetPosX,
257 
258  /*.fnGetTopMargin =*/&SwFrame::GetLeftMargin,
259  /*.fnGetBottomMargin =*/&SwFrame::GetRightMargin,
260  /*.fnGetLeftMargin =*/&SwFrame::GetBottomMargin,
261  /*.fnGetRightMargin =*/&SwFrame::GetTopMargin,
262  /*.fnSetXMargins =*/&SwFrame::SetTopBottomMargins,
263  /*.fnSetYMargins =*/&SwFrame::SetLeftRightMargins,
264  /*.fnGetPrtTop =*/&SwFrame::GetPrtLeft,
265  /*.fnGetPrtBottom =*/&SwFrame::GetPrtRight,
266  /*.fnGetPrtLeft =*/&SwFrame::GetPrtBottom,
267  /*.fnGetPrtRight =*/&SwFrame::GetPrtTop,
268  /*.fnTopDist =*/&SwRect::GetLeftDistance,
269  /*.fnBottomDist =*/&SwRect::GetRightDistance,
270  /*.fnLeftDist =*/&SwRect::GetBottomDistance,
271  /*.fnRightDist =*/&SwRect::GetTopDistance,
272  /*.fnSetLimit =*/&SwFrame::SetMaxRight,
273  /*.fnOverStep =*/&SwRect::OverStepRight,
274 
275  /*.fnSetPos =*/&SwRect::SetLowerLeftCorner,
276  /*.fnMakePos =*/&SwFrame::MakeRightPos,
277  /*.fnXDiff =*/&SecondMinusFirst,
278  /*.fnYDiff =*/&FirstMinusSecond,
279  /*.fnXInc =*/&SwDecrement,
280  /*.fnYInc =*/&SwIncrement,
281 
282  /*.fnSetLeftAndWidth =*/&SwRect::SetBottomAndHeight,
283  /*.fnSetTopAndHeight =*/&SwRect::SetLeftAndWidth
284 };
285 
290 
291 // #i65250#
293 
294 
295 void FrameInit()
296 {
297  SwRootFrame::s_pVout = new SwLayVout();
298  SwCache *pNew = new SwCache( 100
299 #ifdef DBG_UTIL
300  , "static SwBorderAttrs::pCache"
301 #endif
302  );
303  SwFrame::SetCache( pNew );
304 }
305 
307 {
308 #if OSL_DEBUG_LEVEL > 0
309  // The cache may only contain null pointers at this time.
310  for( size_t n = SwFrame::GetCachePtr()->size(); n; )
311  if( (*SwFrame::GetCachePtr())[ --n ] )
312  {
313  SwCacheObj* pObj = (*SwFrame::GetCachePtr())[ n ];
314  OSL_ENSURE( !pObj, "Who didn't deregister?");
315  }
316 #endif
317  delete SwRootFrame::s_pVout;
318  delete SwFrame::GetCachePtr();
319 }
320 
321 // RootFrame::Everything that belongs to CurrShell
322 
324 {
325  OSL_ENSURE( pNew, "insert 0-Shell?" );
326  pRoot = pNew->GetLayout();
327  if ( pRoot )
328  {
330  pRoot->mpCurrShell = pNew;
331  pRoot->mpCurrShells->insert( this );
332  }
333  else
334  pPrev = nullptr;
335 }
336 
338 {
339  if ( pRoot )
340  {
341  pRoot->mpCurrShells->erase( this );
342  if ( pPrev )
344  if ( pRoot->mpCurrShells->empty() && pRoot->mpWaitingCurrShell )
345  {
347  pRoot->mpWaitingCurrShell = nullptr;
348  }
349  }
350 }
351 
352 void SetShell( SwViewShell *pSh )
353 {
354  SwRootFrame *pRoot = pSh->GetLayout();
355  if ( pRoot->mpCurrShells->empty() )
356  pRoot->mpCurrShell = pSh;
357  else
358  pRoot->mpWaitingCurrShell = pSh;
359 }
360 
362 {
363  // Activate some shell if possible
364  if ( mpCurrShell == pSh )
365  {
366  mpCurrShell = nullptr;
367  for(SwViewShell& rShell : pSh->GetRingContainer())
368  {
369  if(&rShell != pSh)
370  {
371  mpCurrShell = &rShell;
372  break;
373  }
374  }
375  }
376 
377  // Doesn't matter anymore
378  if ( mpWaitingCurrShell == pSh )
379  mpWaitingCurrShell = nullptr;
380 
381  // Remove references
382  for ( CurrShell *pC : *mpCurrShells )
383  {
384  if (pC->pPrev == pSh)
385  pC->pPrev = nullptr;
386  }
387 }
388 
390 {
391  pRoot->mpCurrShells.reset( new SwCurrShells );
392 }
393 
394 /*
395 |* The RootFrame requests an own FrameFormat from the document, which it is
396 |* going to delete again in the dtor. The own FrameFormat is derived from
397 |* the passed FrameFormat.
398 |*/
400  SwLayoutFrame( pFormat->GetDoc()->MakeFrameFormat(
401  "Root", pFormat ), nullptr ),
402  mnViewWidth( -1 ),
403  mnColumns( 0 ),
404  mbBookMode( false ),
405  mbSidebarChanged( false ),
406  mbNeedGrammarCheck( false ),
407  mbCheckSuperfluous( false ),
408  mbIdleFormat( true ),
409  mbBrowseWidthValid( false ),
410  mbTurboAllowed( true ),
411  mbAssertFlyPages( true ),
412  mbTableUpdateInProgress( false ),
413  mbIsVirtPageNum( false ),
414  mbIsNewLayout( true ),
415  mbCallbackActionEnabled ( false ),
416  mbLayoutFreezed ( false ),
417  mbHideRedlines(pFormat->GetDoc()->GetDocumentRedlineManager().IsHideRedlines()),
418  m_FieldmarkMode(pSh->GetViewOptions()->IsFieldName()
419  ? sw::FieldmarkMode::ShowCommand
420  : sw::FieldmarkMode::ShowResult),
421  mnBrowseWidth(MIN_BROWSE_WIDTH),
422  mpTurbo( nullptr ),
423  mpLastPage( nullptr ),
424  mpCurrShell( pSh ),
425  mpWaitingCurrShell( nullptr ),
426  mpDrawPage( nullptr ),
427  mnPhyPageNums( 0 ),
428  mnAccessibleShells( 0 )
429 {
431  setRootFrame( this );
432 }
433 
435 {
436  InitCurrShells( this );
437 
438  IDocumentTimerAccess& rTimerAccess = pFormat->getIDocumentTimerAccess();
439  IDocumentLayoutAccess& rLayoutAccess = pFormat->getIDocumentLayoutAccess();
440  IDocumentFieldsAccess& rFieldsAccess = pFormat->getIDocumentFieldsAccess();
441  const IDocumentSettingAccess& rSettingAccess = pFormat->getIDocumentSettingAccess();
442  rTimerAccess.StopIdling();
443  // For creating the Flys by MakeFrames()
444  rLayoutAccess.SetCurrentViewShell( GetCurrShell() );
445  mbCallbackActionEnabled = false; // needs to be set to true before leaving!
446 
448  if ( pMd )
449  {
450  // Disable "multiple layout"
451  mpDrawPage = pMd->GetPage(0);
452 
454  }
455 
456  // Initialize the layout: create pages, link content with Content etc.
457  // First, initialize some stuff, then get hold of the first
458  // node (which will be needed for the PageDesc).
459 
460  SwDoc* pDoc = pFormat->GetDoc();
462  SwContentNode *pNode = pDoc->GetNodes().GoNextSection( &aIndex, true, false );
463  // #123067# pNode = 0 can really happen
464  SwTableNode *pTableNd= pNode ? pNode->FindTableNode() : nullptr;
465 
466  // Get hold of PageDesc (either via FrameFormat of the first node or the initial one).
467  SwPageDesc *pDesc = nullptr;
468  ::std::optional<sal_uInt16> oPgNum;
469 
470  if ( pTableNd )
471  {
472  const SwFormatPageDesc &rDesc = pTableNd->GetTable().GetFrameFormat()->GetPageDesc();
473  pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
474  //#19104# respect the page number offset!!
475  oPgNum = rDesc.GetNumOffset();
476  if (oPgNum)
477  mbIsVirtPageNum = true;
478  }
479  else if ( pNode )
480  {
481  const SwFormatPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
482  pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
483  //#19104# respect the page number offset!!
484  oPgNum = rDesc.GetNumOffset();
485  if (oPgNum)
486  mbIsVirtPageNum = true;
487  }
488  else
489  mbIsVirtPageNum = false;
490  if ( !pDesc )
491  pDesc = &pDoc->GetPageDesc( 0 );
492 
493  // Create a page and put it in the layout
494  // The first page is always a right-page and always a first-page
495  SwPageFrame* pPage = ::InsertNewPage(
496  *pDesc, /*pUpper=*/this, /*isRightPage=*/true, /*bFirst=*/true, /*bInsertEmpty=*/false,
497  /*bFootnote=*/false, /*pSibling=*/nullptr, /*bVeryFirstPage=*/true);
498 
499  // Find the first page in the Bodytext section.
500  SwLayoutFrame *pLay = pPage->FindBodyCont();
501  while( pLay->Lower() )
502  pLay = static_cast<SwLayoutFrame*>(pLay->Lower());
503 
504  SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
505  ::InsertCnt_( pLay, pDoc, aTmp.GetIndex(), true );
506 
507  if( rSettingAccess.get(DocumentSettingId::GLOBAL_DOCUMENT) )
508  rFieldsAccess.UpdateRefFields();
509  //b6433357: Update page fields after loading
510  if ( !mpCurrShell || !mpCurrShell->Imp()->IsUpdateExpFields() )
511  {
512  SwDocPosUpdate aMsgHint( pPage->getFrameArea().Top() );
513  rFieldsAccess.UpdatePageFields( &aMsgHint );
514  }
515 
516  rTimerAccess.StartIdling();
518 
519  SwViewShell *pViewSh = GetCurrShell();
520  if (pViewSh)
522 }
523 
525 {
526  mbTurboAllowed = false;
527  mpTurbo = nullptr;
528 
529  SwFrameFormat *pRegisteredInNonConst = static_cast<SwFrameFormat*>(GetDep());
530  if ( pRegisteredInNonConst )
531  {
532  SwDoc *pDoc = pRegisteredInNonConst->GetDoc();
533  pDoc->DelFrameFormat( pRegisteredInNonConst );
534  // do this before calling RemoveFootnotes() because footnotes
535  // can contain anchored objects
537  }
538 
539  mpDestroy.reset();
540 
541  // Remove references
542  for ( auto& rpCurrShell : *mpCurrShells )
543  rpCurrShell->pRoot = nullptr;
544 
545  mpCurrShells.reset();
546 
547  // Some accessible shells are left => problems on second SwFrame::Destroy call
548  assert(0 == mnAccessibleShells);
549 
550  // fdo#39510 crash on document close with footnotes
551  // Object ownership in writer and esp. in layout are a mess: Before the
552  // document/layout split SwDoc and SwRootFrame were essentially one object
553  // and magically/uncleanly worked around their common destruction by call
554  // to SwDoc::IsInDtor() -- even from the layout. As of now destruction of
555  // the layout proceeds forward through the frames. Since SwTextFootnote::DelFrames
556  // also searches backwards to find the master of footnotes, they must be
557  // considered to be owned by the SwRootFrame and also be destroyed here,
558  // before tearing down the (now footnote free) rest of the layout.
559  RemoveFootnotes(nullptr, false, true);
560 
562 }
563 
565 {
566 }
567 
569 {
570  // Remove all master objects from the Page. But don't delete!
571  for( size_t i = pPg ? pPg->GetObjCount() : 0; i; )
572  {
573  SdrObject* pObj = pPg->GetObj( --i );
574  if( dynamic_cast< const SwFlyDrawObj *>( pObj ) != nullptr )
575  pPg->RemoveObject( i );
576  }
577 }
578 
580 {
581  if ( !IsLayoutFreezed() )
582  CheckPageDescs( const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower())) );
583 }
584 
586 {
587  SwPageFrame *pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower()));
588  while ( pPage )
589  {
591  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
592  }
593 }
594 
596 {
598 }
599 
601 {
602  RemoveFootnotes();
603 }
604 
606 {
607  SwPageFrame *pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower()));
608  while ( pPage )
609  {
610  if ( bSmartTags )
611  pPage->InvalidateSmartTags();
612 
613  pPage->InvalidateSpelling();
614  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
615  }
616 }
617 
618 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Size Size_() const
Definition: swrect.cxx:134
void AllRemoveFootnotes()
Definition: newfrm.cxx:600
const ::std::optional< sal_uInt16 > & GetNumOffset() const
Definition: fmtpdsc.hxx:64
bool OverStepBottom(tools::Long) const
Definition: swrect.cxx:144
SwRootFrame * pRoot
Definition: viewsh.hxx:584
SdrPage * mpDrawPage
One Page per DrawModel per Document; is always the size of the Root.
Definition: rootfrm.hxx:168
virtual void SetSize(const Size &aSiz)
tools::Long GetRightDistance(tools::Long) const
Definition: swrect.cxx:140
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
void RemoveFootnotes(SwPageFrame *pPage=nullptr, bool bPageOnly=false, bool bEndNotes=false)
Remove all footnotes (but no references)
Definition: ftnfrm.cxx:972
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
void FrameFinit()
Definition: newfrm.cxx:306
SwViewShellImp * Imp()
Definition: viewsh.hxx:182
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:1060
void SubLeft(const tools::Long nSub)
Definition: swrect.cxx:126
virtual void UpdatePageFields(SfxPoolItem *)=0
static SwRectFnCollection aVertical
Definition: newfrm.cxx:116
void FrameInit()
Definition: newfrm.cxx:295
sal_uInt16 char char * pDesc
void MakeLeftPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:129
void SetShell(SwViewShell *pSh)
Definition: newfrm.cxx:352
SwViewShell * mpCurrShell
Definition: rootfrm.hxx:163
long Long
Handle the background jobs of a Writer document.
sal_Int64 n
SdrObject * GetObj(size_t nNum) const
Definition: doc.hxx:187
size_t GetObjCount() const
virtual void StopIdling()=0
Stop idle processing.
::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const
Definition: doc.cxx:415
bool SetMaxBottom(tools::Long)
Definition: ssfrm.cxx:76
Dialog to specify the properties of date form field.
SwRootFrame(SwFrameFormat *, SwViewShell *)
Definition: newfrm.cxx:399
sal_uInt16 mnAccessibleShells
Page count.
Definition: rootfrm.hxx:173
void SetRightAndWidth(tools::Long nRight, tools::Long nNew)
Definition: swrect.cxx:161
IDocumentTimerAccess & getIDocumentTimerAccess()
Provides access to the document idle timer interface.
Definition: format.cxx:717
The root element of a Writer document layout.
Definition: rootfrm.hxx:81
void SetTopAndHeight(tools::Long nTop, tools::Long nNew)
Definition: swrect.cxx:156
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
bool mbIsVirtPageNum
Definition: rootfrm.hxx:117
static SwRectFnCollection aVerticalLeftToRightBottomToTop
This is the same as horizontal, but rotated counter-clockwise by 90 degrees.
Definition: newfrm.cxx:231
FieldmarkMode
Definition: rootfrm.hxx:49
tools::Long GetPrtBottom() const
Definition: ssfrm.cxx:53
tools::Long Right_() const
Definition: swrect.cxx:119
bool AddPaintRect(const SwRect &rRect)
Definition: viewsh.cxx:540
Point TopLeft() const
Definition: swrect.hxx:254
bool mbCallbackActionEnabled
Definition: rootfrm.hxx:119
static SwCache * spCache
Definition: frame.hxx:334
static void SetCache(SwCache *pNew)
Definition: frame.hxx:523
const SwRect & getFrameArea() const
Definition: frame.hxx:179
bool OverStepRight(tools::Long) const
Definition: swrect.cxx:148
static tools::Long SwIncrement(tools::Long nA, tools::Long nAdd)
Definition: newfrm.cxx:56
void setRootFrame(SwRootFrame *pRoot)
Definition: frame.hxx:455
virtual void StartIdling()=0
Start the idle task.
const SwTable & GetTable() const
Definition: node.hxx:506
void InitCurrShells(SwRootFrame *pRoot)
Definition: newfrm.cxx:389
SwRectFn fnRectVertL2R
Definition: newfrm.cxx:288
virtual void DestroyImpl() override
Definition: ssfrm.cxx:485
tools::Long GetPrtLeft() const
Definition: ssfrm.cxx:51
virtual void DestroyImpl() override
Definition: newfrm.cxx:524
bool OverStepLeft(tools::Long) const
Definition: swrect.cxx:142
static void RemoveMasterObjs(SdrPage *pPg)
Remove MasterObjects from the Page (called by the ctors)
Definition: newfrm.cxx:568
static SwRectFnCollection aVerticalLeftToRight
Definition: newfrm.cxx:171
void Init(SwFrameFormat *)
Definition: newfrm.cxx:434
const SwContentFrame * mpTurbo
If we only have to format one ContentFrame, its in mpTurbo.
Definition: rootfrm.hxx:133
IDocumentFieldsAccess & getIDocumentFieldsAccess()
Provides access to the document idle timer interface.
Definition: format.cxx:718
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:162
friend void InitCurrShells(SwRootFrame *pRoot)
Definition: newfrm.cxx:389
void MakeBelowPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:108
void SetLeftAndWidth(tools::Long nLeft, tools::Long nNew)
Definition: swrect.cxx:151
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:393
virtual void UpdateRefFields()=0
Style of a layout element.
Definition: frmfmt.hxx:59
~CurrShell()
Definition: newfrm.cxx:337
SwViewShell * mpWaitingCurrShell
Definition: rootfrm.hxx:164
void InvalidateSpelling() const
Definition: pagefrm.hxx:384
sw::BroadcastingModify * GetDep()
use these so we can grep for SwFrame's GetRegisteredIn accesses beware that SwTextFrame may return sw...
Definition: frame.hxx:476
static SwRectFnCollection aHorizontal
Definition: newfrm.cxx:61
int i
tools::Long GetPrtTop() const
Definition: ssfrm.cxx:57
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:133
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: format.cxx:715
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
tools::Long GetPrtRight() const
Definition: ssfrm.cxx:55
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:130
Document fields related interfaces.
void AllCheckPageDescs() const
Definition: newfrm.cxx:579
SwViewShell * pPrev
Definition: viewsh.hxx:583
const SwFrame * Lower() const
Definition: layfrm.hxx:101
bool mbNeedGrammarCheck
Definition: rootfrm.hxx:102
tools::Long Height_() const
Definition: swrect.cxx:117
const SdrPage * GetPage(sal_uInt16 nPgNum) const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
void AddHeight(const tools::Long nAdd)
Definition: swrect.cxx:124
void InvalidateSmartTags() const
Definition: pagefrm.hxx:389
Provides access to settings of a document.
void DeRegisterShell(SwViewShell *pSh)
Definition: newfrm.cxx:361
size
void AddWidth(const tools::Long nAdd)
Definition: swrect.cxx:123
Marks a node in the document model.
Definition: ndindex.hxx:30
static bool s_isNoVirDev
Definition: rootfrm.hxx:106
ring_container GetRingContainer()
Definition: ring.hxx:240
bool IsOnlineSpell() const
Definition: viewopt.hxx:371
tools::Long Left_() const
Definition: swrect.cxx:118
bool IsUpdateExpFields()
Definition: viewimp.cxx:190
void AddRight(const tools::Long nAdd)
Definition: swrect.cxx:127
void SetPosX(const tools::Long nNew)
Definition: swrect.cxx:131
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
tools::Long GetBottomMargin() const
Definition: ssfrm.cxx:45
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:712
A page of the document layout.
Definition: pagefrm.hxx:57
virtual SdrObject * RemoveObject(size_t nObjNum)
void MakeRightPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:151
bool IsLayoutFreezed() const
Definition: rootfrm.hxx:412
bool SetMinLeft(tools::Long)
Definition: ssfrm.cxx:60
std::set< CurrShell * > SwCurrShells
Definition: rootfrm.hxx:74
static tools::Long SecondMinusFirst(tools::Long nFirst, tools::Long nSecond)
Definition: newfrm.cxx:54
void SetUpperLeftCorner(const Point &rNew)
Definition: swrect.cxx:171
SwRectFn fnRectVert
Definition: newfrm.cxx:287
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:46
static SwCache * GetCachePtr()
Definition: frame.hxx:522
tools::Long GetTopDistance(tools::Long) const
Definition: swrect.cxx:139
SwRectFn fnRectHori
Definition: newfrm.cxx:286
void AllInvalidateAutoCompleteWords() const
Definition: newfrm.cxx:585
static sal_uInt32 snLastFrameId
Definition: frame.hxx:152
void SetTopBottomMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:172
void SubTop(const tools::Long nSub)
Definition: swrect.cxx:129
virtual ~SwRootFrame() override
Definition: newfrm.cxx:564
void SetUpperRightCorner(const Point &rNew)
Definition: swrect.cxx:173
void InsertCnt_(SwLayoutFrame *pLay, SwDoc *pDoc, SwNodeOffset nIndex, bool bPages=false, SwNodeOffset nEndIndex=SwNodeOffset(0), SwFrame *pPrv=nullptr, sw::FrameMode eMode=sw::FrameMode::New)
Definition: frmtool.cxx:1485
tools::Long Width_() const
Definition: swrect.cxx:116
std::deque< AttacherIndex_Impl > aIndex
tools::Long GetBottomDistance(tools::Long) const
Definition: swrect.cxx:138
tools::Long GetRightMargin() const
Definition: ssfrm.cxx:49
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:428
The Cache object base class Users of the Cache must derive a class from the SwCacheObj and store thei...
Definition: swcache.hxx:134
static tools::Long SwDecrement(tools::Long nA, tools::Long nSub)
Definition: newfrm.cxx:58
void SetLowerLeftCorner(const Point &rNew)
Definition: swrect.cxx:175
void SetRightLeftMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:186
SwNodes & GetNodes()
Definition: doc.hxx:408
SwPageFrame * InsertNewPage(SwPageDesc &rDesc, SwFrame *pUpper, bool isRightPage, bool bFirst, bool bInsertEmpty, bool bFootnote, SwFrame *pSibling, bool bVeryFirstPage=false)
Definition: frmtool.cxx:3121
static SwLayVout * s_pVout
Definition: rootfrm.hxx:104
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
SwFrameType mnFrameType
Definition: frame.hxx:414
tools::Long Bottom_() const
Definition: swrect.cxx:121
bool SetMaxRight(tools::Long)
Definition: ssfrm.cxx:92
bool mbTurboAllowed
Definition: rootfrm.hxx:114
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
static bool s_isInPaint
Definition: rootfrm.hxx:105
void SetPosY(const tools::Long nNew)
Definition: swrect.cxx:132
tools::Long GetTopMargin() const
Definition: ssfrm.cxx:43
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:358
void AllInvalidateSmartTagsOrSpelling(bool bSmartTags) const
Definition: newfrm.cxx:605
Size SwappedSize() const
Definition: swrect.cxx:135
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:697
Point TopRight() const
Definition: swrect.hxx:258
tools::Long Top_() const
Definition: swrect.cxx:120
SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position...
Definition: hints.hxx:245
Provides access to the layout of a document.
virtual void SetCurrentViewShell(SwViewShell *pNew)=0
!!!The old layout must be deleted!!!
SwContentNode * GoNextSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true) const
Go to next content-node that is not protected or hidden (Both set FALSE ==> GoNext/GoPrevious!!!).
Definition: nodes.cxx:1919
void SetBottomAndHeight(tools::Long nBottom, tools::Long nNew)
Definition: swrect.cxx:166
A layout frame is a frame that contains other frames (m_pLower), e.g. SwPageFrame or SwTabFrame...
Definition: layfrm.hxx:35
std::unique_ptr< SwCurrShells > mpCurrShells
Definition: rootfrm.hxx:165
tools::Long GetLeftDistance(tools::Long) const
Definition: swrect.cxx:137
tools::Long GetLeftMargin() const
Definition: ssfrm.cxx:47
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:78
CurrShell(SwViewShell *pNew)
Definition: newfrm.cxx:323
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2172
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:206
SwRectFn fnRectVertL2RB2T
Definition: newfrm.cxx:289
void SetLeftRightMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:179
static tools::Long FirstMinusSecond(tools::Long nFirst, tools::Long nSecond)
Definition: newfrm.cxx:52
void AllAddPaintRect() const
Definition: newfrm.cxx:595
std::unique_ptr< SwDestroyList > mpDestroy
Definition: rootfrm.hxx:170
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:713
Point BottomLeft() const
Definition: swrect.hxx:262
bool m_bDetectedRangeSegmentation false
SwFrame * GetNext()
Definition: frame.hxx:676