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(sw::FieldmarkMode::ShowBoth),
419  mnBrowseWidth(MIN_BROWSE_WIDTH),
420  mpTurbo( nullptr ),
421  mpLastPage( nullptr ),
422  mpCurrShell( pSh ),
423  mpWaitingCurrShell( nullptr ),
424  mpDrawPage( nullptr ),
425  mnPhyPageNums( 0 ),
426  mnAccessibleShells( 0 )
427 {
429  setRootFrame( this );
430 }
431 
433 {
434  InitCurrShells( this );
435 
436  IDocumentTimerAccess& rTimerAccess = pFormat->getIDocumentTimerAccess();
437  IDocumentLayoutAccess& rLayoutAccess = pFormat->getIDocumentLayoutAccess();
438  IDocumentFieldsAccess& rFieldsAccess = pFormat->getIDocumentFieldsAccess();
439  const IDocumentSettingAccess& rSettingAccess = pFormat->getIDocumentSettingAccess();
440  rTimerAccess.StopIdling();
441  // For creating the Flys by MakeFrames()
442  rLayoutAccess.SetCurrentViewShell( GetCurrShell() );
443  mbCallbackActionEnabled = false; // needs to be set to true before leaving!
444 
446  if ( pMd )
447  {
448  // Disable "multiple layout"
449  mpDrawPage = pMd->GetPage(0);
450 
452  }
453 
454  // Initialize the layout: create pages, link content with Content etc.
455  // First, initialize some stuff, then get hold of the first
456  // node (which will be needed for the PageDesc).
457 
458  SwDoc* pDoc = pFormat->GetDoc();
460  SwContentNode *pNode = pDoc->GetNodes().GoNextSection( &aIndex, true, false );
461  // #123067# pNode = 0 can really happen
462  SwTableNode *pTableNd= pNode ? pNode->FindTableNode() : nullptr;
463 
464  // Get hold of PageDesc (either via FrameFormat of the first node or the initial one).
465  SwPageDesc *pDesc = nullptr;
466  ::std::optional<sal_uInt16> oPgNum;
467 
468  if ( pTableNd )
469  {
470  const SwFormatPageDesc &rDesc = pTableNd->GetTable().GetFrameFormat()->GetPageDesc();
471  pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
472  //#19104# respect the page number offset!!
473  oPgNum = rDesc.GetNumOffset();
474  if (oPgNum)
475  mbIsVirtPageNum = true;
476  }
477  else if ( pNode )
478  {
479  const SwFormatPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
480  pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
481  //#19104# respect the page number offset!!
482  oPgNum = rDesc.GetNumOffset();
483  if (oPgNum)
484  mbIsVirtPageNum = true;
485  }
486  else
487  mbIsVirtPageNum = false;
488  if ( !pDesc )
489  pDesc = &pDoc->GetPageDesc( 0 );
490 
491  // Create a page and put it in the layout
492  // The first page is always a right-page and always a first-page
493  SwPageFrame* pPage = ::InsertNewPage(
494  *pDesc, /*pUpper=*/this, /*isRightPage=*/true, /*bFirst=*/true, /*bInsertEmpty=*/false,
495  /*bFootnote=*/false, /*pSibling=*/nullptr, /*bVeryFirstPage=*/true);
496 
497  // Find the first page in the Bodytext section.
498  SwLayoutFrame *pLay = pPage->FindBodyCont();
499  while( pLay->Lower() )
500  pLay = static_cast<SwLayoutFrame*>(pLay->Lower());
501 
502  SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
503  ::InsertCnt_( pLay, pDoc, aTmp.GetIndex(), true );
504  //Remove masters that haven't been replaced yet from the list.
506  if( rSettingAccess.get(DocumentSettingId::GLOBAL_DOCUMENT) )
507  rFieldsAccess.UpdateRefFields();
508  //b6433357: Update page fields after loading
509  if ( !mpCurrShell || !mpCurrShell->Imp()->IsUpdateExpFields() )
510  {
511  SwDocPosUpdate aMsgHint( pPage->getFrameArea().Top() );
512  rFieldsAccess.UpdatePageFields( &aMsgHint );
513  }
514 
515  rTimerAccess.StartIdling();
517 
518  SwViewShell *pViewSh = GetCurrShell();
519  if (pViewSh)
521 }
522 
524 {
525  mbTurboAllowed = false;
526  mpTurbo = nullptr;
527 
528  SwFrameFormat *pRegisteredInNonConst = static_cast<SwFrameFormat*>(GetDep());
529  if ( pRegisteredInNonConst )
530  {
531  SwDoc *pDoc = pRegisteredInNonConst->GetDoc();
532  pDoc->DelFrameFormat( pRegisteredInNonConst );
533  // do this before calling RemoveFootnotes() because footnotes
534  // can contain anchored objects
536  }
537 
538  mpDestroy.reset();
539 
540  // Remove references
541  for ( auto& rpCurrShell : *mpCurrShells )
542  rpCurrShell->pRoot = nullptr;
543 
544  mpCurrShells.reset();
545 
546  // Some accessible shells are left => problems on second SwFrame::Destroy call
547  assert(0 == mnAccessibleShells);
548 
549  // fdo#39510 crash on document close with footnotes
550  // Object ownership in writer and esp. in layout are a mess: Before the
551  // document/layout split SwDoc and SwRootFrame were essentially one object
552  // and magically/uncleanly worked around their common destruction by call
553  // to SwDoc::IsInDtor() -- even from the layout. As of now destruction of
554  // the layout proceeds forward through the frames. Since SwTextFootnote::DelFrames
555  // also searches backwards to find the master of footnotes, they must be
556  // considered to be owned by the SwRootFrame and also be destroyed here,
557  // before tearing down the (now footnote free) rest of the layout.
558  RemoveFootnotes(nullptr, false, true);
559 
561 }
562 
564 {
565 }
566 
568 {
569  // Remove all master objects from the Page. But don't delete!
570  for( size_t i = pPg ? pPg->GetObjCount() : 0; i; )
571  {
572  SdrObject* pObj = pPg->GetObj( --i );
573  if( dynamic_cast< const SwFlyDrawObj *>( pObj ) != nullptr )
574  pPg->RemoveObject( i );
575  }
576 }
577 
579 {
580  if ( !IsLayoutFreezed() )
581  CheckPageDescs( const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower())) );
582 }
583 
585 {
586  SwPageFrame *pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower()));
587  while ( pPage )
588  {
590  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
591  }
592 }
593 
595 {
597 }
598 
600 {
601  RemoveFootnotes();
602 }
603 
605 {
606  SwPageFrame *pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower()));
607  while ( pPage )
608  {
609  if ( bSmartTags )
610  pPage->InvalidateSmartTags();
611 
612  pPage->InvalidateSpelling();
613  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
614  }
615 }
616 
617 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Size Size_() const
Definition: swrect.cxx:134
void AllRemoveFootnotes()
Definition: newfrm.cxx:599
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: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:140
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:1464
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: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: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:161
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:156
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:204
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:119
bool AddPaintRect(const SwRect &rRect)
Definition: viewsh.cxx:533
Point TopLeft() const
Definition: swrect.hxx:254
bool mbCallbackActionEnabled
Definition: rootfrm.hxx:120
static SwCache * spCache
Definition: frame.hxx:335
static void SetCache(SwCache *pNew)
Definition: frame.hxx:524
const SwRect & getFrameArea() const
Definition: frame.hxx:180
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:456
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:523
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:567
static SwRectFnCollection aVerticalLeftToRight
Definition: newfrm.cxx:171
void Init(SwFrameFormat *)
Definition: newfrm.cxx:432
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:160
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: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: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:477
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:130
Document fields related interfaces.
void AllCheckPageDescs() const
Definition: newfrm.cxx:578
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: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: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:118
bool IsUpdateExpFields()
Definition: viewimp.cxx:172
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: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:171
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:523
tools::Long GetTopDistance(tools::Long) const
Definition: swrect.cxx:139
SwRectFn fnRectHori
Definition: newfrm.cxx:286
void AllInvalidateAutoCompleteWords() const
Definition: newfrm.cxx:584
static sal_uInt32 snLastFrameId
Definition: frame.hxx:153
void SetTopBottomMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:170
void SubTop(const tools::Long nSub)
Definition: swrect.cxx:129
virtual ~SwRootFrame() override
Definition: newfrm.cxx:563
void SetUpperRightCorner(const Point &rNew)
Definition: swrect.cxx:173
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: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:175
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:3089
static SwLayVout * s_pVout
Definition: rootfrm.hxx:105
void Top(const tools::Long nTop)
Definition: swrect.hxx:206
SwFrameType mnFrameType
Definition: frame.hxx:415
tools::Long Bottom_() const
Definition: swrect.cxx:121
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:132
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:604
Size SwappedSize() const
Definition: swrect.cxx:135
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:700
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: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: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:166
tools::Long GetLeftDistance(tools::Long) const
Definition: swrect.cxx:137
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:2067
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:594
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.hxx:262
SwFrame * GetNext()
Definition: frame.hxx:677