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 <drawdoc.hxx>
25 #include <fmtpdsc.hxx>
26 #include <swtable.hxx>
27 #include <rootfrm.hxx>
28 #include <pagefrm.hxx>
29 #include <dflyobj.hxx>
30 #include <frmtool.hxx>
31 #include "virtoutp.hxx"
32 #include <notxtfrm.hxx>
33 #include <pagedesc.hxx>
34 #include <viewimp.hxx>
35 #include <hints.hxx>
36 #include <viewopt.hxx>
37 #include <set>
43 #include <ndindex.hxx>
44 
46 bool SwRootFrame::s_isInPaint = false;
47 bool SwRootFrame::s_isNoVirDev = false;
48 
49 SwCache *SwFrame::spCache = nullptr;
50 
52  { return nFirst - nSecond; }
54  { return nSecond - nFirst; }
56  { return nA + nAdd; }
58  { return nA - nSub; }
59 
61  /*.fnGetTop =*/&SwRect::Top_,
62  /*.fnGetBottom =*/&SwRect::Bottom_,
63  /*.fnGetLeft =*/&SwRect::Left_,
64  /*.fnGetRight =*/&SwRect::Right_,
65  /*.fnGetWidth =*/&SwRect::Width_,
66  /*.fnGetHeight =*/&SwRect::Height_,
67  /*.fnGetPos =*/&SwRect::TopLeft,
68  /*.fnGetSize =*/&SwRect::Size_,
69 
70  /*.fnSetTop =*/&SwRect::Top_,
71  /*.fnSetBottom =*/&SwRect::Bottom_,
72  /*.fnSetLeft =*/&SwRect::Left_,
73  /*.fnSetRight =*/&SwRect::Right_,
74  /*.fnSetWidth =*/&SwRect::Width_,
75  /*.fnSetHeight =*/&SwRect::Height_,
76 
77  /*.fnSubTop =*/&SwRect::SubTop,
78  /*.fnAddBottom =*/&SwRect::AddBottom,
79  /*.fnSubLeft =*/&SwRect::SubLeft,
80  /*.fnAddRight =*/&SwRect::AddRight,
81  /*.fnAddWidth =*/&SwRect::AddWidth,
82  /*.fnAddHeight =*/&SwRect::AddHeight,
83 
84  /*.fnSetPosX =*/&SwRect::SetPosX,
85  /*.fnSetPosY =*/&SwRect::SetPosY,
86 
87  /*.fnGetTopMargin =*/&SwFrame::GetTopMargin,
88  /*.fnGetBottomMargin =*/&SwFrame::GetBottomMargin,
89  /*.fnGetLeftMargin =*/&SwFrame::GetLeftMargin,
90  /*.fnGetRightMargin =*/&SwFrame::GetRightMargin,
91  /*.fnSetXMargins =*/&SwFrame::SetLeftRightMargins,
92  /*.fnSetYMargins =*/&SwFrame::SetTopBottomMargins,
93  /*.fnGetPrtTop =*/&SwFrame::GetPrtTop,
94  /*.fnGetPrtBottom =*/&SwFrame::GetPrtBottom,
95  /*.fnGetPrtLeft =*/&SwFrame::GetPrtLeft,
96  /*.fnGetPrtRight =*/&SwFrame::GetPrtRight,
97  /*.fnTopDist =*/&SwRect::GetTopDistance,
98  /*.fnBottomDist =*/&SwRect::GetBottomDistance,
99  /*.fnLeftDist =*/&SwRect::GetLeftDistance,
100  /*.fnRightDist =*/&SwRect::GetRightDistance,
101  /*.fnSetLimit =*/&SwFrame::SetMaxBottom,
102  /*.fnOverStep =*/&SwRect::OverStepBottom,
103 
104  /*.fnSetPos =*/&SwRect::SetUpperLeftCorner,
105  /*.fnMakePos =*/&SwFrame::MakeBelowPos,
106  /*.fnXDiff =*/&FirstMinusSecond,
107  /*.fnYDiff =*/&FirstMinusSecond,
108  /*.fnXInc =*/&SwIncrement,
109  /*.fnYInc =*/&o3tl::saturating_add<tools::Long>,
110 
111  /*.fnSetLeftAndWidth =*/&SwRect::SetLeftAndWidth,
112  /*.fnSetTopAndHeight =*/&SwRect::SetTopAndHeight
113 };
114 
116  /*.fnGetTop =*/&SwRect::Right_,
117  /*.fnGetBottom =*/&SwRect::Left_,
118  /*.fnGetLeft =*/&SwRect::Top_,
119  /*.fnGetRight =*/&SwRect::Bottom_,
120  /*.fnGetWidth =*/&SwRect::Height_,
121  /*.fnGetHeight =*/&SwRect::Width_,
122  /*.fnGetPos =*/&SwRect::TopRight,
123  /*.fnGetSize =*/&SwRect::SwappedSize,
124 
125  /*.fnSetTop =*/&SwRect::Right_,
126  /*.fnSetBottom =*/&SwRect::Left_,
127  /*.fnSetLeft =*/&SwRect::Top_,
128  /*.fnSetRight =*/&SwRect::Bottom_,
129  /*.fnSetWidth =*/&SwRect::Height_,
130  /*.fnSetHeight =*/&SwRect::Width_,
131 
132  /*.fnSubTop =*/&SwRect::AddRight,
133  /*.fnAddBottom =*/&SwRect::SubLeft,
134  /*.fnSubLeft =*/&SwRect::SubTop,
135  /*.fnAddRight =*/&SwRect::AddBottom,
136  /*.fnAddWidth =*/&SwRect::AddHeight,
137  /*.fnAddHeight =*/&SwRect::AddWidth,
138 
139  /*.fnSetPosX =*/&SwRect::SetPosY,
140  /*.fnSetPosY =*/&SwRect::SetPosX,
141 
142  /*.fnGetTopMargin =*/&SwFrame::GetRightMargin,
143  /*.fnGetBottomMargin =*/&SwFrame::GetLeftMargin,
144  /*.fnGetLeftMargin =*/&SwFrame::GetTopMargin,
145  /*.fnGetRightMargin =*/&SwFrame::GetBottomMargin,
146  /*.fnSetXMargins =*/&SwFrame::SetTopBottomMargins,
147  /*.fnSetYMargins =*/&SwFrame::SetRightLeftMargins,
148  /*.fnGetPrtTop =*/&SwFrame::GetPrtRight,
149  /*.fnGetPrtBottom =*/&SwFrame::GetPrtLeft,
150  /*.fnGetPrtLeft =*/&SwFrame::GetPrtTop,
151  /*.fnGetPrtRight =*/&SwFrame::GetPrtBottom,
152  /*.fnTopDist =*/&SwRect::GetRightDistance,
153  /*.fnBottomDist =*/&SwRect::GetLeftDistance,
154  /*.fnLeftDist =*/&SwRect::GetTopDistance,
155  /*.fnRightDist =*/&SwRect::GetBottomDistance,
156  /*.fnSetLimit =*/&SwFrame::SetMinLeft,
157  /*.fnOverStep =*/&SwRect::OverStepLeft,
158 
159  /*.fnSetPos =*/&SwRect::SetUpperRightCorner,
160  /*.fnMakePos =*/&SwFrame::MakeLeftPos,
161  /*.fnXDiff =*/&FirstMinusSecond,
162  /*.fnYDiff =*/&SecondMinusFirst,
163  /*.fnXInc =*/&SwIncrement,
164  /*.fnYInc =*/&SwDecrement,
165 
166  /*.fnSetLeftAndWidth =*/&SwRect::SetTopAndHeight,
167  /*.fnSetTopAndHeight =*/&SwRect::SetRightAndWidth
168 };
169 
171  /*.fnGetTop =*/&SwRect::Left_,
172  /*.fnGetBottom =*/&SwRect::Right_,
173  /*.fnGetLeft =*/&SwRect::Top_,
174  /*.fnGetRight =*/&SwRect::Bottom_,
175  /*.fnGetWidth =*/&SwRect::Height_,
176  /*.fnGetHeight =*/&SwRect::Width_,
177  /*.fnGetPos =*/&SwRect::TopLeft,
178  /*.fnGetSize =*/&SwRect::SwappedSize,
179 
180  /*.fnSetTop =*/&SwRect::Left_,
181  /*.fnSetBottom =*/&SwRect::Right_,
182  /*.fnSetLeft =*/&SwRect::Top_,
183  /*.fnSetRight =*/&SwRect::Bottom_,
184  /*.fnSetWidth =*/&SwRect::Height_,
185  /*.fnSetHeight =*/&SwRect::Width_,
186 
187  /*.fnSubTop =*/&SwRect::SubLeft,
188  /*.fnAddBottom =*/&SwRect::AddRight,
189  /*.fnSubLeft =*/&SwRect::SubTop,
190  /*.fnAddRight =*/&SwRect::AddBottom,
191  /*.fnAddWidth =*/&SwRect::AddHeight,
192  /*.fnAddHeight =*/&SwRect::AddWidth,
193 
194  /*.fnSetPosX =*/&SwRect::SetPosY,
195  /*.fnSetPosY =*/&SwRect::SetPosX,
196 
197  /*.fnGetTopMargin =*/&SwFrame::GetLeftMargin,
198  /*.fnGetBottomMargin =*/&SwFrame::GetRightMargin,
199  /*.fnGetLeftMargin =*/&SwFrame::GetTopMargin,
200  /*.fnGetRightMargin =*/&SwFrame::GetBottomMargin,
201  /*.fnSetXMargins =*/&SwFrame::SetTopBottomMargins,
202  /*.fnSetYMargins =*/&SwFrame::SetLeftRightMargins,
203  /*.fnGetPrtTop =*/&SwFrame::GetPrtLeft,
204  /*.fnGetPrtBottom =*/&SwFrame::GetPrtRight,
205  /*.fnGetPrtLeft =*/&SwFrame::GetPrtTop,
206  /*.fnGetPrtRight =*/&SwFrame::GetPrtBottom,
207  /*.fnTopDist =*/&SwRect::GetLeftDistance,
208  /*.fnBottomDist =*/&SwRect::GetRightDistance,
209  /*.fnLeftDist =*/&SwRect::GetTopDistance,
210  /*.fnRightDist =*/&SwRect::GetBottomDistance,
211  /*.fnSetLimit =*/&SwFrame::SetMaxRight,
212  /*.fnOverStep =*/&SwRect::OverStepRight,
213 
214  /*.fnSetPos =*/&SwRect::SetUpperLeftCorner,
215  /*.fnMakePos =*/&SwFrame::MakeRightPos,
216  /*.fnXDiff =*/&FirstMinusSecond,
217  /*.fnYDiff =*/&FirstMinusSecond,
218  /*.fnXInc =*/&SwIncrement,
219  /*.fnYInc =*/&SwIncrement,
220 
221  /*.fnSetLeftAndWidth =*/&SwRect::SetTopAndHeight,
222  /*.fnSetTopAndHeight =*/&SwRect::SetLeftAndWidth
223 };
224 
231  /*.fnGetTop =*/&SwRect::Left_,
232  /*.fnGetBottom =*/&SwRect::Right_,
233  /*.fnGetLeft =*/&SwRect::Bottom_,
234  /*.fnGetRight =*/&SwRect::Top_,
235  /*.fnGetWidth =*/&SwRect::Height_,
236  /*.fnGetHeight =*/&SwRect::Width_,
237  /*.fnGetPos =*/&SwRect::BottomLeft,
238  /*.fnGetSize =*/&SwRect::SwappedSize,
239 
240  /*.fnSetTop =*/&SwRect::Left_,
241  /*.fnSetBottom =*/&SwRect::Right_,
242  /*.fnSetLeft =*/&SwRect::Bottom_,
243  /*.fnSetRight =*/&SwRect::Top_,
244  /*.fnSetWidth =*/&SwRect::Height_,
245  /*.fnSetHeight =*/&SwRect::Width_,
246 
247  /*.fnSubTop =*/&SwRect::SubLeft,
248  /*.fnAddBottom =*/&SwRect::AddRight,
249  /*.fnSubLeft =*/&SwRect::AddBottom,
250  /*.fnAddRight =*/&SwRect::SubTop,
251  /*.fnAddWidth =*/&SwRect::AddHeight,
252  /*.fnAddHeight =*/&SwRect::AddWidth,
253 
254  /*.fnSetPosX =*/&SwRect::SetPosY,
255  /*.fnSetPosY =*/&SwRect::SetPosX,
256 
257  /*.fnGetTopMargin =*/&SwFrame::GetLeftMargin,
258  /*.fnGetBottomMargin =*/&SwFrame::GetRightMargin,
259  /*.fnGetLeftMargin =*/&SwFrame::GetBottomMargin,
260  /*.fnGetRightMargin =*/&SwFrame::GetTopMargin,
261  /*.fnSetXMargins =*/&SwFrame::SetTopBottomMargins,
262  /*.fnSetYMargins =*/&SwFrame::SetLeftRightMargins,
263  /*.fnGetPrtTop =*/&SwFrame::GetPrtLeft,
264  /*.fnGetPrtBottom =*/&SwFrame::GetPrtRight,
265  /*.fnGetPrtLeft =*/&SwFrame::GetPrtBottom,
266  /*.fnGetPrtRight =*/&SwFrame::GetPrtTop,
267  /*.fnTopDist =*/&SwRect::GetLeftDistance,
268  /*.fnBottomDist =*/&SwRect::GetRightDistance,
269  /*.fnLeftDist =*/&SwRect::GetBottomDistance,
270  /*.fnRightDist =*/&SwRect::GetTopDistance,
271  /*.fnSetLimit =*/&SwFrame::SetMaxRight,
272  /*.fnOverStep =*/&SwRect::OverStepRight,
273 
274  /*.fnSetPos =*/&SwRect::SetLowerLeftCorner,
275  /*.fnMakePos =*/&SwFrame::MakeRightPos,
276  /*.fnXDiff =*/&SecondMinusFirst,
277  /*.fnYDiff =*/&FirstMinusSecond,
278  /*.fnXInc =*/&SwDecrement,
279  /*.fnYInc =*/&SwIncrement,
280 
281  /*.fnSetLeftAndWidth =*/&SwRect::SetBottomAndHeight,
282  /*.fnSetTopAndHeight =*/&SwRect::SetLeftAndWidth
283 };
284 
289 
290 // #i65250#
292 
293 
294 void FrameInit()
295 {
296  SwRootFrame::s_pVout = new SwLayVout();
297  SwCache *pNew = new SwCache( 100
298 #ifdef DBG_UTIL
299  , "static SwBorderAttrs::pCache"
300 #endif
301  );
302  SwFrame::SetCache( pNew );
303 }
304 
306 {
307 #if OSL_DEBUG_LEVEL > 0
308  // The cache may only contain null pointers at this time.
309  for( size_t n = SwFrame::GetCachePtr()->size(); n; )
310  if( (*SwFrame::GetCachePtr())[ --n ] )
311  {
312  SwCacheObj* pObj = (*SwFrame::GetCachePtr())[ n ];
313  OSL_ENSURE( !pObj, "Who didn't deregister?");
314  }
315 #endif
316  delete SwRootFrame::s_pVout;
317  delete SwFrame::GetCachePtr();
318 }
319 
320 // RootFrame::Everything that belongs to CurrShell
321 
323 {
324  OSL_ENSURE( pNew, "insert 0-Shell?" );
325  pRoot = pNew->GetLayout();
326  if ( pRoot )
327  {
329  pRoot->mpCurrShell = pNew;
330  pRoot->mpCurrShells->insert( this );
331  }
332  else
333  pPrev = nullptr;
334 }
335 
337 {
338  if ( pRoot )
339  {
340  pRoot->mpCurrShells->erase( this );
341  if ( pPrev )
343  if ( pRoot->mpCurrShells->empty() && pRoot->mpWaitingCurrShell )
344  {
346  pRoot->mpWaitingCurrShell = nullptr;
347  }
348  }
349 }
350 
351 void SetShell( SwViewShell *pSh )
352 {
353  SwRootFrame *pRoot = pSh->GetLayout();
354  if ( pRoot->mpCurrShells->empty() )
355  pRoot->mpCurrShell = pSh;
356  else
357  pRoot->mpWaitingCurrShell = pSh;
358 }
359 
361 {
362  // Activate some shell if possible
363  if ( mpCurrShell == pSh )
364  {
365  mpCurrShell = nullptr;
366  for(SwViewShell& rShell : pSh->GetRingContainer())
367  {
368  if(&rShell != pSh)
369  {
370  mpCurrShell = &rShell;
371  break;
372  }
373  }
374  }
375 
376  // Doesn't matter anymore
377  if ( mpWaitingCurrShell == pSh )
378  mpWaitingCurrShell = nullptr;
379 
380  // Remove references
381  for ( CurrShell *pC : *mpCurrShells )
382  {
383  if (pC->pPrev == pSh)
384  pC->pPrev = nullptr;
385  }
386 }
387 
389 {
390  pRoot->mpCurrShells.reset( new SwCurrShells );
391 }
392 
393 /*
394 |* The RootFrame requests an own FrameFormat from the document, which it is
395 |* going to delete again in the dtor. The own FrameFormat is derived from
396 |* the passed FrameFormat.
397 |*/
399  SwLayoutFrame( pFormat->GetDoc()->MakeFrameFormat(
400  "Root", pFormat ), nullptr ),
401  maPagesArea(),
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  mbIsVirtPageNum( false ),
413  mbIsNewLayout( true ),
414  mbCallbackActionEnabled ( false ),
415  mbLayoutFreezed ( false ),
416  mbHideRedlines(pFormat->GetDoc()->GetDocumentRedlineManager().IsHideRedlines()),
417  m_FieldmarkMode(pSh->GetViewOptions()->IsFieldName()
418  ? sw::FieldmarkMode::ShowCommand
419  : sw::FieldmarkMode::ShowResult),
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(*pDesc, this, true, true, false, false, nullptr, true);
495 
496  // Find the first page in the Bodytext section.
497  SwLayoutFrame *pLay = pPage->FindBodyCont();
498  while( pLay->Lower() )
499  pLay = static_cast<SwLayoutFrame*>(pLay->Lower());
500 
501  SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
502  ::InsertCnt_( pLay, pDoc, aTmp.GetIndex(), true );
503  //Remove masters that haven't been replaced yet from the list.
505  if( rSettingAccess.get(DocumentSettingId::GLOBAL_DOCUMENT) )
506  rFieldsAccess.UpdateRefFields();
507  //b6433357: Update page fields after loading
508  if ( !mpCurrShell || !mpCurrShell->Imp()->IsUpdateExpFields() )
509  {
510  SwDocPosUpdate aMsgHint( pPage->getFrameArea().Top() );
511  rFieldsAccess.UpdatePageFields( &aMsgHint );
512  }
513 
514  rTimerAccess.StartIdling();
516 
517  SwViewShell *pViewSh = GetCurrShell();
518  if (pViewSh)
520 }
521 
523 {
524  mbTurboAllowed = false;
525  mpTurbo = nullptr;
526 
527  SwFrameFormat *pRegisteredInNonConst = static_cast<SwFrameFormat*>(GetDep());
528  if ( pRegisteredInNonConst )
529  {
530  SwDoc *pDoc = pRegisteredInNonConst->GetDoc();
531  pDoc->DelFrameFormat( pRegisteredInNonConst );
532  // do this before calling RemoveFootnotes() because footnotes
533  // can contain anchored objects
535  }
536 
537  mpDestroy.reset();
538 
539  // Remove references
540  for ( auto& rpCurrShell : *mpCurrShells )
541  rpCurrShell->pRoot = nullptr;
542 
543  mpCurrShells.reset();
544 
545  // Some accessible shells are left => problems on second SwFrame::Destroy call
547 
548  // fdo#39510 crash on document close with footnotes
549  // Object ownership in writer and esp. in layout are a mess: Before the
550  // document/layout split SwDoc and SwRootFrame were essentially one object
551  // and magically/uncleanly worked around their common destruction by call
552  // to SwDoc::IsInDtor() -- even from the layout. As of now destruction of
553  // the layout proceeds forward through the frames. Since SwTextFootnote::DelFrames
554  // also searches backwards to find the master of footnotes, they must be
555  // considered to be owned by the SwRootFrame and also be destroyed here,
556  // before tearing down the (now footnote free) rest of the layout.
557  RemoveFootnotes(nullptr, false, true);
558 
560 }
561 
563 {
564 }
565 
567 {
568  // Remove all master objects from the Page. But don't delete!
569  for( size_t i = pPg ? pPg->GetObjCount() : 0; i; )
570  {
571  SdrObject* pObj = pPg->GetObj( --i );
572  if( dynamic_cast< const SwFlyDrawObj *>( pObj ) != nullptr )
573  pPg->RemoveObject( i );
574  }
575 }
576 
578 {
579  if ( !IsLayoutFreezed() )
580  CheckPageDescs( const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower())) );
581 }
582 
584 {
585  SwPageFrame *pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower()));
586  while ( pPage )
587  {
589  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
590  }
591 }
592 
594 {
596 }
597 
599 {
600  RemoveFootnotes();
601 }
602 
604 {
605  SwPageFrame *pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower()));
606  while ( pPage )
607  {
608  if ( bSmartTags )
609  pPage->InvalidateSmartTags();
610 
611  pPage->InvalidateSpelling();
612  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
613  }
614 }
615 
616 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Size Size_() const
Definition: swrect.cxx:171
void AllRemoveFootnotes()
Definition: newfrm.cxx:598
const ::std::optional< sal_uInt16 > & GetNumOffset() const
Definition: fmtpdsc.hxx:65
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:168
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:1434
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:959
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:62
void FrameFinit()
Definition: newfrm.cxx:305
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:1054
void SubLeft(const tools::Long nSub)
Definition: swrect.cxx:163
virtual void UpdatePageFields(SfxPoolItem *)=0
static SwRectFnCollection aVertical
Definition: newfrm.cxx:115
void FrameInit()
Definition: newfrm.cxx:294
sal_uInt16 char char * pDesc
void MakeLeftPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:126
void SetShell(SwViewShell *pSh)
Definition: newfrm.cxx:351
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:186
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:73
Dialog to specify the properties of date form field.
SwRootFrame(SwFrameFormat *, SwViewShell *)
Definition: newfrm.cxx:398
sal_uInt16 mnAccessibleShells
Page count.
Definition: rootfrm.hxx:173
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:741
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:117
static SwRectFnCollection aVerticalLeftToRightBottomToTop
This is the same as horizontal, but rotated counter-clockwise by 90 degrees.
Definition: newfrm.cxx:230
FieldmarkMode
Definition: rootfrm.hxx:50
tools::Long GetPrtBottom() const
Definition: ssfrm.cxx:50
tools::Long Right_() const
Definition: swrect.cxx:156
bool AddPaintRect(const SwRect &rRect)
Definition: viewsh.cxx:526
Point TopLeft() const
Definition: swrect.cxx:174
bool mbCallbackActionEnabled
Definition: rootfrm.hxx:119
static SwCache * spCache
Definition: frame.hxx:318
static void SetCache(SwCache *pNew)
Definition: frame.hxx:507
const SwRect & getFrameArea() const
Definition: frame.hxx:178
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
bool OverStepRight(tools::Long) const
Definition: swrect.cxx:191
static tools::Long SwIncrement(tools::Long nA, tools::Long nAdd)
Definition: newfrm.cxx:55
void setRootFrame(SwRootFrame *pRoot)
Definition: frame.hxx:439
virtual void StartIdling()=0
Start the idle task.
const SwTable & GetTable() const
Definition: node.hxx:500
void InitCurrShells(SwRootFrame *pRoot)
Definition: newfrm.cxx:388
SwRectFn fnRectVertL2R
Definition: newfrm.cxx:287
virtual void DestroyImpl() override
Definition: ssfrm.cxx:480
tools::Long GetPrtLeft() const
Definition: ssfrm.cxx:48
virtual void DestroyImpl() override
Definition: newfrm.cxx:522
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:566
static SwRectFnCollection aVerticalLeftToRight
Definition: newfrm.cxx:170
void Init(SwFrameFormat *)
Definition: newfrm.cxx:433
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:742
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
friend void InitCurrShells(SwRootFrame *pRoot)
Definition: newfrm.cxx:388
void MakeBelowPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:105
void SetLeftAndWidth(tools::Long nLeft, tools::Long nNew)
Definition: swrect.cxx:194
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:380
virtual void UpdateRefFields()=0
Style of a layout element.
Definition: frmfmt.hxx:58
~CurrShell()
Definition: newfrm.cxx:336
SwViewShell * mpWaitingCurrShell
Definition: rootfrm.hxx:164
void InvalidateSpelling() const
Definition: pagefrm.hxx:371
sw::BroadcastingModify * GetDep()
use these so we can grep for SwFrame's GetRegisteredIn accesses beware that SwTextFrame may return sw...
Definition: frame.hxx:460
static SwRectFnCollection aHorizontal
Definition: newfrm.cxx:60
int i
tools::Long GetPrtTop() const
Definition: ssfrm.cxx:54
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: format.cxx:739
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:880
tools::Long GetPrtRight() const
Definition: ssfrm.cxx:52
void AddBottom(const tools::Long nAdd)
Definition: swrect.cxx:167
Document fields related interfaces.
void AllCheckPageDescs() const
Definition: newfrm.cxx:577
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:376
Provides access to settings of a document.
void DeRegisterShell(SwViewShell *pSh)
Definition: newfrm.cxx:360
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:357
tools::Long Left_() const
Definition: swrect.cxx:155
bool IsUpdateExpFields()
Definition: viewimp.cxx:150
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:119
tools::Long GetBottomMargin() const
Definition: ssfrm.cxx:42
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:736
A page of the document layout.
Definition: pagefrm.hxx:41
virtual SdrObject * RemoveObject(size_t nObjNum)
void MakeRightPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:148
bool IsLayoutFreezed() const
Definition: rootfrm.hxx:411
bool SetMinLeft(tools::Long)
Definition: ssfrm.cxx:57
std::set< CurrShell * > SwCurrShells
Definition: rootfrm.hxx:75
static tools::Long SecondMinusFirst(tools::Long nFirst, tools::Long nSecond)
Definition: newfrm.cxx:53
void SetUpperLeftCorner(const Point &rNew)
Definition: swrect.cxx:214
SwRectFn fnRectVert
Definition: newfrm.cxx:286
SwLayoutFrame * FindBodyCont()
Searches the first ContentFrame in BodyText below the page.
Definition: findfrm.cxx:42
static SwCache * GetCachePtr()
Definition: frame.hxx:506
tools::Long GetTopDistance(tools::Long) const
Definition: swrect.cxx:182
SwRectFn fnRectHori
Definition: newfrm.cxx:285
void AllInvalidateAutoCompleteWords() const
Definition: newfrm.cxx:583
static sal_uInt32 snLastFrameId
Definition: frame.hxx:151
void SetTopBottomMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:169
void SubTop(const tools::Long nSub)
Definition: swrect.cxx:166
virtual ~SwRootFrame() override
Definition: newfrm.cxx:562
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:46
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:57
void SetLowerLeftCorner(const Point &rNew)
Definition: swrect.cxx:218
void SetRightLeftMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:183
SwNodes & GetNodes()
Definition: doc.hxx:405
SwPageFrame * InsertNewPage(SwPageDesc &rDesc, SwFrame *pUpper, bool isRightPage, bool bFirst, bool bInsertEmpty, bool bFootnote, SwFrame *pSibling, bool bVeryFirstPage=false)
Definition: frmtool.cxx:3000
static SwLayVout * s_pVout
Definition: rootfrm.hxx:105
void Top(const tools::Long nTop)
Definition: swrect.hxx:204
SwFrameType mnFrameType
Definition: frame.hxx:398
tools::Long Bottom_() const
Definition: swrect.cxx:158
bool SetMaxRight(tools::Long)
Definition: ssfrm.cxx:89
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:40
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:355
void AllInvalidateSmartTagsOrSpelling(bool bSmartTags) const
Definition: newfrm.cxx:603
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:221
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:1907
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:165
tools::Long GetLeftDistance(tools::Long) const
Definition: swrect.cxx:180
tools::Long GetLeftMargin() const
Definition: ssfrm.cxx:44
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:79
CurrShell(SwViewShell *pNew)
Definition: newfrm.cxx:322
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2072
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:208
SwRectFn fnRectVertL2RB2T
Definition: newfrm.cxx:288
void SetLeftRightMargins(tools::Long, tools::Long)
Definition: ssfrm.cxx:176
static tools::Long FirstMinusSecond(tools::Long nFirst, tools::Long nSecond)
Definition: newfrm.cxx:51
void AllAddPaintRect() const
Definition: newfrm.cxx:593
std::unique_ptr< SwDestroyList > mpDestroy
Definition: rootfrm.hxx:170
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:737
Point BottomLeft() const
Definition: swrect.cxx:176
SwFrame * GetNext()
Definition: frame.hxx:659