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  maPagesArea(),
403  mnViewWidth( -1 ),
404  mnColumns( 0 ),
405  mbBookMode( false ),
406  mbSidebarChanged( false ),
407  mbNeedGrammarCheck( false ),
408  mbCheckSuperfluous( false ),
409  mbIdleFormat( true ),
410  mbBrowseWidthValid( false ),
411  mbTurboAllowed( true ),
412  mbAssertFlyPages( true ),
413  mbTableUpdateInProgress( false ),
414  mbIsVirtPageNum( false ),
415  mbIsNewLayout( true ),
416  mbCallbackActionEnabled ( false ),
417  mbLayoutFreezed ( false ),
418  mbHideRedlines(pFormat->GetDoc()->GetDocumentRedlineManager().IsHideRedlines()),
419  m_FieldmarkMode(sw::FieldmarkMode::ShowBoth),
420  mnBrowseWidth(MIN_BROWSE_WIDTH),
421  mpTurbo( nullptr ),
422  mpLastPage( nullptr ),
423  mpCurrShell( pSh ),
424  mpWaitingCurrShell( nullptr ),
425  mpDrawPage( nullptr ),
426  mnPhyPageNums( 0 ),
427  mnAccessibleShells( 0 )
428 {
430  setRootFrame( this );
431 }
432 
434 {
435  InitCurrShells( this );
436 
437  IDocumentTimerAccess& rTimerAccess = pFormat->getIDocumentTimerAccess();
438  IDocumentLayoutAccess& rLayoutAccess = pFormat->getIDocumentLayoutAccess();
439  IDocumentFieldsAccess& rFieldsAccess = pFormat->getIDocumentFieldsAccess();
440  const IDocumentSettingAccess& rSettingAccess = pFormat->getIDocumentSettingAccess();
441  rTimerAccess.StopIdling();
442  // For creating the Flys by MakeFrames()
443  rLayoutAccess.SetCurrentViewShell( GetCurrShell() );
444  mbCallbackActionEnabled = false; // needs to be set to true before leaving!
445 
447  if ( pMd )
448  {
449  // Disable "multiple layout"
450  mpDrawPage = pMd->GetPage(0);
451 
453  }
454 
455  // Initialize the layout: create pages, link content with Content etc.
456  // First, initialize some stuff, then get hold of the first
457  // node (which will be needed for the PageDesc).
458 
459  SwDoc* pDoc = pFormat->GetDoc();
461  SwContentNode *pNode = pDoc->GetNodes().GoNextSection( &aIndex, true, false );
462  // #123067# pNode = 0 can really happen
463  SwTableNode *pTableNd= pNode ? pNode->FindTableNode() : nullptr;
464 
465  // Get hold of PageDesc (either via FrameFormat of the first node or the initial one).
466  SwPageDesc *pDesc = nullptr;
467  ::std::optional<sal_uInt16> oPgNum;
468 
469  if ( pTableNd )
470  {
471  const SwFormatPageDesc &rDesc = pTableNd->GetTable().GetFrameFormat()->GetPageDesc();
472  pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
473  //#19104# respect the page number offset!!
474  oPgNum = rDesc.GetNumOffset();
475  if (oPgNum)
476  mbIsVirtPageNum = true;
477  }
478  else if ( pNode )
479  {
480  const SwFormatPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
481  pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
482  //#19104# respect the page number offset!!
483  oPgNum = rDesc.GetNumOffset();
484  if (oPgNum)
485  mbIsVirtPageNum = true;
486  }
487  else
488  mbIsVirtPageNum = false;
489  if ( !pDesc )
490  pDesc = &pDoc->GetPageDesc( 0 );
491 
492  // Create a page and put it in the layout
493  // The first page is always a right-page and always a first-page
494  SwPageFrame* pPage = ::InsertNewPage(
495  *pDesc, /*pUpper=*/this, /*isRightPage=*/true, /*bFirst=*/true, /*bInsertEmpty=*/false,
496  /*bFootnote=*/false, /*pSibling=*/nullptr, /*bVeryFirstPage=*/true);
497 
498  // Find the first page in the Bodytext section.
499  SwLayoutFrame *pLay = pPage->FindBodyCont();
500  while( pLay->Lower() )
501  pLay = static_cast<SwLayoutFrame*>(pLay->Lower());
502 
503  SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
504  ::InsertCnt_( pLay, pDoc, aTmp.GetIndex(), true );
505  //Remove masters that haven't been replaced yet from the list.
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:171
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:187
SwRootFrame * pRoot
Definition: viewsh.hxx:579
SdrPage * mpDrawPage
One Page per DrawModel per Document; is always the size of the Root.
Definition: rootfrm.hxx:169
virtual void SetSize(const Size &aSiz)
tools::Long GetRightDistance(tools::Long) const
Definition: swrect.cxx:183
void InsertCnt_(SwLayoutFrame *pLay, SwDoc *pDoc, sal_uLong nIndex, bool bPages=false, sal_uLong nEndIndex=0, SwFrame *pPrv=nullptr, sw::FrameMode eMode=sw::FrameMode::New)
Definition: frmtool.cxx:1458
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:962
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:1056
void SubLeft(const tools::Long nSub)
Definition: swrect.cxx:163
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:127
void SetShell(SwViewShell *pSh)
Definition: newfrm.cxx:352
SwViewShell * mpCurrShell
Definition: rootfrm.hxx:164
long Long
Handle the background jobs of a Writer document.
sal_Int64 n
SdrObject * GetObj(size_t nNum) const
Definition: doc.hxx:188
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:74
Dialog to specify the properties of date form field.
SwRootFrame(SwFrameFormat *, SwViewShell *)
Definition: newfrm.cxx:399
sal_uInt16 mnAccessibleShells
Page count.
Definition: rootfrm.hxx:174
void SetRightAndWidth(tools::Long nRight, tools::Long nNew)
Definition: swrect.cxx:204
IDocumentTimerAccess & getIDocumentTimerAccess()
Provides access to the document idle timer interface.
Definition: format.cxx:722
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
void SetTopAndHeight(tools::Long nTop, tools::Long nNew)
Definition: swrect.cxx:199
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:203
bool mbIsVirtPageNum
Definition: rootfrm.hxx:118
static SwRectFnCollection aVerticalLeftToRightBottomToTop
This is the same as horizontal, but rotated counter-clockwise by 90 degrees.
Definition: newfrm.cxx:231
FieldmarkMode
Definition: rootfrm.hxx:50
tools::Long GetPrtBottom() const
Definition: ssfrm.cxx:51
tools::Long Right_() const
Definition: swrect.cxx:156
bool AddPaintRect(const SwRect &rRect)
Definition: viewsh.cxx:529
Point TopLeft() const
Definition: swrect.cxx:174
bool mbCallbackActionEnabled
Definition: rootfrm.hxx:120
static SwCache * spCache
Definition: frame.hxx:333
static void SetCache(SwCache *pNew)
Definition: frame.hxx:522
const SwRect & getFrameArea() const
Definition: frame.hxx:178
bool OverStepRight(tools::Long) const
Definition: swrect.cxx:191
static tools::Long SwIncrement(tools::Long nA, tools::Long nAdd)
Definition: newfrm.cxx:56
void setRootFrame(SwRootFrame *pRoot)
Definition: frame.hxx:454
virtual void StartIdling()=0
Start the idle task.
const SwTable & GetTable() const
Definition: node.hxx:499
void InitCurrShells(SwRootFrame *pRoot)
Definition: newfrm.cxx:389
SwRectFn fnRectVertL2R
Definition: newfrm.cxx:288
virtual void DestroyImpl() override
Definition: ssfrm.cxx:481
tools::Long GetPrtLeft() const
Definition: ssfrm.cxx:49
virtual void DestroyImpl() override
Definition: newfrm.cxx:524
bool OverStepLeft(tools::Long) const
Definition: swrect.cxx:185
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:433
const SwContentFrame * mpTurbo
If we only have to format one ContentFrame, its in mpTurbo.
Definition: rootfrm.hxx:134
IDocumentFieldsAccess & getIDocumentFieldsAccess()
Provides access to the document idle timer interface.
Definition: format.cxx:723
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
friend void InitCurrShells(SwRootFrame *pRoot)
Definition: newfrm.cxx:389
void MakeBelowPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:106
void SetLeftAndWidth(tools::Long nLeft, tools::Long nNew)
Definition: swrect.cxx:194
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:393
virtual void UpdateRefFields()=0
Style of a layout element.
Definition: frmfmt.hxx:58
~CurrShell()
Definition: newfrm.cxx:337
SwViewShell * mpWaitingCurrShell
Definition: rootfrm.hxx:165
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:475
static SwRectFnCollection aHorizontal
Definition: newfrm.cxx:61
int i
tools::Long GetPrtTop() const
Definition: ssfrm.cxx:55
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:132
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: format.cxx:720
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:881
tools::Long GetPrtRight() const
Definition: ssfrm.cxx:53
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:167
Document fields related interfaces.
void AllCheckPageDescs() const
Definition: newfrm.cxx:579
SwViewShell * pPrev
Definition: viewsh.hxx:578
const SwFrame * Lower() const
Definition: layfrm.hxx:101
bool mbNeedGrammarCheck
Definition: rootfrm.hxx:103
tools::Long Height_() const
Definition: swrect.cxx:154
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:161
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:160
Marks a node in the document model.
Definition: ndindex.hxx:31
static bool s_isNoVirDev
Definition: rootfrm.hxx:107
ring_container GetRingContainer()
Definition: ring.hxx:240
bool IsOnlineSpell() const
Definition: viewopt.hxx:371
tools::Long Left_() const
Definition: swrect.cxx:155
bool IsUpdateExpFields()
Definition: viewimp.cxx:151
void AddRight(const tools::Long nAdd)
Definition: swrect.cxx:164
void SetPosX(const tools::Long nNew)
Definition: swrect.cxx:168
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
tools::Long GetBottomMargin() const
Definition: ssfrm.cxx:43
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:717
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:149
bool IsLayoutFreezed() const
Definition: rootfrm.hxx:413
bool SetMinLeft(tools::Long)
Definition: ssfrm.cxx:58
std::set< CurrShell * > SwCurrShells
Definition: rootfrm.hxx:75
static tools::Long SecondMinusFirst(tools::Long nFirst, tools::Long nSecond)
Definition: newfrm.cxx:54
void SetUpperLeftCorner(const Point &rNew)
Definition: swrect.cxx:214
SwRectFn fnRectVert
Definition: newfrm.cxx:287
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:43
static SwCache * GetCachePtr()
Definition: frame.hxx:521
tools::Long GetTopDistance(tools::Long) const
Definition: swrect.cxx:182
SwRectFn fnRectHori
Definition: newfrm.cxx:286
void AllInvalidateAutoCompleteWords() const
Definition: newfrm.cxx:585
static sal_uInt32 snLastFrameId
Definition: frame.hxx:151
void SetTopBottomMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:170
void SubTop(const tools::Long nSub)
Definition: swrect.cxx:166
virtual ~SwRootFrame() override
Definition: newfrm.cxx:564
void SetUpperRightCorner(const Point &rNew)
Definition: swrect.cxx:216
tools::Long Width_() const
Definition: swrect.cxx:153
std::deque< AttacherIndex_Impl > aIndex
tools::Long GetBottomDistance(tools::Long) const
Definition: swrect.cxx:181
tools::Long GetRightMargin() const
Definition: ssfrm.cxx:47
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:423
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:218
void SetRightLeftMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:184
SwNodes & GetNodes()
Definition: doc.hxx:409
SwPageFrame * InsertNewPage(SwPageDesc &rDesc, SwFrame *pUpper, bool isRightPage, bool bFirst, bool bInsertEmpty, bool bFootnote, SwFrame *pSibling, bool bVeryFirstPage=false)
Definition: frmtool.cxx:3070
static SwLayVout * s_pVout
Definition: rootfrm.hxx:105
void Top(const tools::Long nTop)
Definition: swrect.hxx:203
SwFrameType mnFrameType
Definition: frame.hxx:413
tools::Long Bottom_() const
Definition: swrect.cxx:158
bool SetMaxRight(tools::Long)
Definition: ssfrm.cxx:90
bool mbTurboAllowed
Definition: rootfrm.hxx:115
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
static bool s_isInPaint
Definition: rootfrm.hxx:106
void SetPosY(const tools::Long nNew)
Definition: swrect.cxx:169
tools::Long GetTopMargin() const
Definition: ssfrm.cxx:41
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:357
void AllInvalidateSmartTagsOrSpelling(bool bSmartTags) const
Definition: newfrm.cxx:605
Size SwappedSize() const
Definition: swrect.cxx:172
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:686
Point TopRight() const
Definition: swrect.cxx:175
tools::Long Top_() const
Definition: swrect.cxx:157
SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position...
Definition: hints.hxx:243
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:1916
void SetBottomAndHeight(tools::Long nBottom, tools::Long nNew)
Definition: swrect.cxx:209
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:166
tools::Long GetLeftDistance(tools::Long) const
Definition: swrect.cxx:180
tools::Long GetLeftMargin() const
Definition: ssfrm.cxx:45
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:78
CurrShell(SwViewShell *pNew)
Definition: newfrm.cxx:323
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2068
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:207
SwRectFn fnRectVertL2RB2T
Definition: newfrm.cxx:289
void SetLeftRightMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:177
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:171
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:718
Point BottomLeft() const
Definition: swrect.cxx:176
SwFrame * GetNext()
Definition: frame.hxx:675