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::mpCache = nullptr;
50 
51 static long FirstMinusSecond( long nFirst, long nSecond )
52  { return nFirst - nSecond; }
53 static long SecondMinusFirst( long nFirst, long nSecond )
54  { return nSecond - nFirst; }
55 static long SwIncrement( long nA, long nAdd )
56  { return nA + nAdd; }
57 static long SwDecrement( long nA, long nSub )
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<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  mnBrowseWidth(MIN_BROWSE_WIDTH),
418  mpTurbo( nullptr ),
419  mpLastPage( nullptr ),
420  mpCurrShell( pSh ),
421  mpWaitingCurrShell( nullptr ),
422  mpDrawPage( nullptr ),
423  mnPhyPageNums( 0 ),
424  mnAccessibleShells( 0 )
425 {
427  setRootFrame( this );
428 }
429 
431 {
432  InitCurrShells( this );
433 
434  IDocumentTimerAccess& rTimerAccess = pFormat->getIDocumentTimerAccess();
435  IDocumentLayoutAccess& rLayoutAccess = pFormat->getIDocumentLayoutAccess();
436  IDocumentFieldsAccess& rFieldsAccess = pFormat->getIDocumentFieldsAccess();
437  const IDocumentSettingAccess& rSettingAccess = pFormat->getIDocumentSettingAccess();
438  rTimerAccess.StopIdling();
439  // For creating the Flys by MakeFrames()
440  rLayoutAccess.SetCurrentViewShell( GetCurrShell() );
441  mbCallbackActionEnabled = false; // needs to be set to true before leaving!
442 
444  if ( pMd )
445  {
446  // Disable "multiple layout"
447  mpDrawPage = pMd->GetPage(0);
448 
450  }
451 
452  // Initialize the layout: create pages, link content with Content etc.
453  // First, initialize some stuff, then get hold of the first
454  // node (which will be needed for the PageDesc).
455 
456  SwDoc* pDoc = pFormat->GetDoc();
458  SwContentNode *pNode = pDoc->GetNodes().GoNextSection( &aIndex, true, false );
459  // #123067# pNode = 0 can really happen
460  SwTableNode *pTableNd= pNode ? pNode->FindTableNode() : nullptr;
461 
462  // Get hold of PageDesc (either via FrameFormat of the first node or the initial one).
463  SwPageDesc *pDesc = nullptr;
464  ::std::optional<sal_uInt16> oPgNum;
465 
466  if ( pTableNd )
467  {
468  const SwFormatPageDesc &rDesc = pTableNd->GetTable().GetFrameFormat()->GetPageDesc();
469  pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
470  //#19104# respect the page number offset!!
471  oPgNum = rDesc.GetNumOffset();
472  if (oPgNum)
473  mbIsVirtPageNum = true;
474  }
475  else if ( pNode )
476  {
477  const SwFormatPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
478  pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
479  //#19104# respect the page number offset!!
480  oPgNum = rDesc.GetNumOffset();
481  if (oPgNum)
482  mbIsVirtPageNum = true;
483  }
484  else
485  mbIsVirtPageNum = false;
486  if ( !pDesc )
487  pDesc = &pDoc->GetPageDesc( 0 );
488 
489  // Create a page and put it in the layout
490  // The first page is always a right-page and always a first-page
491  SwPageFrame *pPage = ::InsertNewPage(*pDesc, this, true, true, false, false, nullptr);
492 
493  // Find the first page in the Bodytext section.
494  SwLayoutFrame *pLay = pPage->FindBodyCont();
495  while( pLay->Lower() )
496  pLay = static_cast<SwLayoutFrame*>(pLay->Lower());
497 
498  SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
499  ::InsertCnt_( pLay, pDoc, aTmp.GetIndex(), true );
500  //Remove masters that haven't been replaced yet from the list.
502  if( rSettingAccess.get(DocumentSettingId::GLOBAL_DOCUMENT) )
503  rFieldsAccess.UpdateRefFields();
504  //b6433357: Update page fields after loading
505  if ( !mpCurrShell || !mpCurrShell->Imp()->IsUpdateExpFields() )
506  {
507  SwDocPosUpdate aMsgHint( pPage->getFrameArea().Top() );
508  rFieldsAccess.UpdatePageFields( &aMsgHint );
509  }
510 
511  rTimerAccess.StartIdling();
513 
514  SwViewShell *pViewSh = GetCurrShell();
515  if (pViewSh)
517 }
518 
520 {
521  mbTurboAllowed = false;
522  mpTurbo = nullptr;
523 
524  SwFrameFormat *pRegisteredInNonConst = static_cast<SwFrameFormat*>(GetDep());
525  if ( pRegisteredInNonConst )
526  {
527  SwDoc *pDoc = pRegisteredInNonConst->GetDoc();
528  pDoc->DelFrameFormat( pRegisteredInNonConst );
529  // do this before calling RemoveFootnotes() because footnotes
530  // can contain anchored objects
532  }
533 
534  mpDestroy.reset();
535 
536  // Remove references
537  for ( auto& rpCurrShell : *mpCurrShells )
538  rpCurrShell->pRoot = nullptr;
539 
540  mpCurrShells.reset();
541 
542  // Some accessible shells are left => problems on second SwFrame::Destroy call
544 
545  // fdo#39510 crash on document close with footnotes
546  // Object ownership in writer and esp. in layout are a mess: Before the
547  // document/layout split SwDoc and SwRootFrame were essentially one object
548  // and magically/uncleanly worked around their common destruction by call
549  // to SwDoc::IsInDtor() -- even from the layout. As of now destruction of
550  // the layout proceeds forward through the frames. Since SwTextFootnote::DelFrames
551  // also searches backwards to find the master of footnotes, they must be
552  // considered to be owned by the SwRootFrame and also be destroyed here,
553  // before tearing down the (now footnote free) rest of the layout.
554  RemoveFootnotes(nullptr, false, true);
555 
557 }
558 
560 {
561 }
562 
564 {
565  // Remove all master objects from the Page. But don't delete!
566  for( size_t i = pPg ? pPg->GetObjCount() : 0; i; )
567  {
568  SdrObject* pObj = pPg->GetObj( --i );
569  if( dynamic_cast< const SwFlyDrawObj *>( pObj ) != nullptr )
570  pPg->RemoveObject( i );
571  }
572 }
573 
575 {
576  if ( !IsLayoutFreezed() )
577  CheckPageDescs( const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower())) );
578 }
579 
581 {
582  SwPageFrame *pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower()));
583  while ( pPage )
584  {
586  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
587  }
588 }
589 
591 {
593 }
594 
596 {
597  RemoveFootnotes();
598 }
599 
601 {
602  SwPageFrame *pPage = const_cast<SwPageFrame*>(static_cast<const SwPageFrame*>(Lower()));
603  while ( pPage )
604  {
605  if ( bSmartTags )
606  pPage->InvalidateSmartTags();
607 
608  pPage->InvalidateSpelling();
609  pPage = static_cast<SwPageFrame*>(pPage->GetNext());
610  }
611 }
612 
613 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
long GetPrtLeft() const
Definition: ssfrm.cxx:47
Size Size_() const
Definition: swrect.cxx:171
void AllRemoveFootnotes()
Definition: newfrm.cxx:595
const ::std::optional< sal_uInt16 > & GetNumOffset() const
Definition: fmtpdsc.hxx:65
SwRootFrame * pRoot
Definition: viewsh.hxx:579
bool OverStepLeft(long) const
Definition: swrect.cxx:185
SdrPage * mpDrawPage
One Page per DrawModel per Document; is always the size of the Root.
Definition: rootfrm.hxx:165
virtual void SetSize(const Size &aSiz)
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:1416
long Bottom_() const
Definition: swrect.cxx:158
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:183
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:1003
virtual void UpdatePageFields(SfxPoolItem *)=0
static SwRectFnCollection aVertical
Definition: newfrm.cxx:115
void FrameInit()
Definition: newfrm.cxx:294
long GetBottomDistance(long) const
Definition: swrect.cxx:181
sal_uInt16 char char * pDesc
void MakeLeftPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:125
SwModify * GetDep()
use these so we can grep for SwFrame's GetRegisteredIn accesses beware that SwTextFrame may return sw...
Definition: frame.hxx:459
void SetShell(SwViewShell *pSh)
Definition: newfrm.cxx:351
SwViewShell * mpCurrShell
Definition: rootfrm.hxx:160
Handle the background jobs of a Writer document.
sal_Int64 n
SdrObject * GetObj(size_t nNum) const
Definition: doc.hxx:184
size_t GetObjCount() const
virtual void StopIdling()=0
Stop idle processing.
::sw::DocumentLayoutManager const & GetDocumentLayoutManager() const
Definition: doc.cxx:414
void SetRightLeftMargins(long, long)
Definition: ssfrm.cxx:182
void SetPosX(const long nNew)
Definition: swrect.cxx:168
SwRootFrame(SwFrameFormat *, SwViewShell *)
Definition: newfrm.cxx:398
sal_uInt16 mnAccessibleShells
Page count.
Definition: rootfrm.hxx:170
long GetLeftDistance(long) const
Definition: swrect.cxx:180
IDocumentTimerAccess & getIDocumentTimerAccess()
Provides access to the document idle timer interface.
Definition: format.cxx:762
The root element of a Writer document layout.
Definition: rootfrm.hxx:80
SwTableFormat * GetFrameFormat()
Definition: swtable.hxx:201
bool mbIsVirtPageNum
Definition: rootfrm.hxx:115
static SwRectFnCollection aVerticalLeftToRightBottomToTop
This is the same as horizontal, but rotated counter-clockwise by 90 degrees.
Definition: newfrm.cxx:230
bool AddPaintRect(const SwRect &rRect)
Definition: viewsh.cxx:525
Point TopLeft() const
Definition: swrect.cxx:174
bool mbCallbackActionEnabled
Definition: rootfrm.hxx:117
long Left_() const
Definition: swrect.cxx:155
void SetTopBottomMargins(long, long)
Definition: ssfrm.cxx:168
void Top(const long nTop)
Definition: swrect.hxx:204
static void SetCache(SwCache *pNew)
Definition: frame.hxx:504
const SwRect & getFrameArea() const
Definition: frame.hxx:177
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
static sal_uInt32 mnLastFrameId
Definition: frame.hxx:150
void setRootFrame(SwRootFrame *pRoot)
Definition: frame.hxx:438
virtual void StartIdling()=0
Start the idle task.
SwPageFrame * InsertNewPage(SwPageDesc &rDesc, SwFrame *pUpper, bool isRightPage, bool bFirst, bool bInsertEmpty, bool bFootnote, SwFrame *pSibling)
Definition: frmtool.cxx:2987
const SwTable & GetTable() const
Definition: node.hxx:497
void InitCurrShells(SwRootFrame *pRoot)
Definition: newfrm.cxx:388
SwRectFn fnRectVertL2R
Definition: newfrm.cxx:287
virtual void DestroyImpl() override
Definition: ssfrm.cxx:473
long GetRightDistance(long) const
Definition: swrect.cxx:183
virtual void DestroyImpl() override
Definition: newfrm.cxx:519
static void RemoveMasterObjs(SdrPage *pPg)
Remove MasterObjects from the Page (called by the ctors)
Definition: newfrm.cxx:563
void SubLeft(const long nSub)
Definition: swrect.cxx:163
static SwRectFnCollection aVerticalLeftToRight
Definition: newfrm.cxx:170
void Init(SwFrameFormat *)
Definition: newfrm.cxx:430
const SwContentFrame * mpTurbo
If we only have to format one ContentFrame, its in mpTurbo.
Definition: rootfrm.hxx:130
IDocumentFieldsAccess & getIDocumentFieldsAccess()
Provides access to the document idle timer interface.
Definition: format.cxx:763
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
bool SetMaxRight(long)
Definition: ssfrm.cxx:88
void SetLeftAndWidth(long nLeft, long nNew)
Definition: swrect.cxx:194
friend void InitCurrShells(SwRootFrame *pRoot)
Definition: newfrm.cxx:388
void MakeBelowPos(const SwFrame *, const SwFrame *, bool)
Definition: ssfrm.cxx:104
void InvalidateAutoCompleteWords() const
Definition: pagefrm.hxx:380
virtual void UpdateRefFields()=0
Style of a layout element.
Definition: frmfmt.hxx:57
long Height_() const
Definition: swrect.cxx:154
~CurrShell()
Definition: newfrm.cxx:336
SwViewShell * mpWaitingCurrShell
Definition: rootfrm.hxx:161
void InvalidateSpelling() const
Definition: pagefrm.hxx:371
static SwRectFnCollection aHorizontal
Definition: newfrm.cxx:60
int i
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:131
long Width_() const
Definition: swrect.cxx:153
const IDocumentLayoutAccess & getIDocumentLayoutAccess() const
Provides access to the document layout interface.
Definition: format.cxx:760
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:878
void SubTop(const long nSub)
Definition: swrect.cxx:166
Document fields related interfaces.
void AddWidth(const long nAdd)
Definition: swrect.cxx:160
void AllCheckPageDescs() const
Definition: newfrm.cxx:574
SwViewShell * pPrev
Definition: viewsh.hxx:578
void SetPosY(const long nNew)
Definition: swrect.cxx:169
const SwFrame * Lower() const
Definition: layfrm.hxx:101
bool mbNeedGrammarCheck
Definition: rootfrm.hxx:101
void AddRight(const long nAdd)
Definition: swrect.cxx:164
const SdrPage * GetPage(sal_uInt16 nPgNum) const
virtual const SwDrawModel * GetDrawModel() const =0
Draw Model and id accessors.
void InvalidateSmartTags() const
Definition: pagefrm.hxx:376
long GetPrtTop() const
Definition: ssfrm.cxx:53
void AddHeight(const long nAdd)
Definition: swrect.cxx:161
static long FirstMinusSecond(long nFirst, long nSecond)
Definition: newfrm.cxx:51
Provides access to settings of a document.
void DeRegisterShell(SwViewShell *pSh)
Definition: newfrm.cxx:360
size
Marks a node in the document model.
Definition: ndindex.hxx:31
static bool s_isNoVirDev
Definition: rootfrm.hxx:105
ring_container GetRingContainer()
Definition: ring.hxx:240
bool IsOnlineSpell() const
Definition: viewopt.hxx:353
long GetTopMargin() const
Definition: ssfrm.cxx:39
bool IsUpdateExpFields()
Definition: viewimp.cxx:150
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document settings interface.
Definition: format.cxx:757
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:147
bool IsLayoutFreezed() const
Definition: rootfrm.hxx:408
std::set< CurrShell * > SwCurrShells
Definition: rootfrm.hxx:73
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:503
long GetBottomMargin() const
Definition: ssfrm.cxx:41
void SetRightAndWidth(long nRight, long nNew)
Definition: swrect.cxx:204
bool OverStepBottom(long) const
Definition: swrect.cxx:187
long GetPrtRight() const
Definition: ssfrm.cxx:51
SwRectFn fnRectHori
Definition: newfrm.cxx:285
void AllInvalidateAutoCompleteWords() const
Definition: newfrm.cxx:580
virtual ~SwRootFrame() override
Definition: newfrm.cxx:559
void SetUpperRightCorner(const Point &rNew)
Definition: swrect.cxx:216
void SetTopAndHeight(long nTop, long nNew)
Definition: swrect.cxx:199
std::deque< AttacherIndex_Impl > aIndex
long GetRightMargin() const
Definition: ssfrm.cxx:45
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:424
The Cache object base class Users of the Cache must derive a class from the SwCacheObj and store thei...
Definition: swcache.hxx:133
long GetTopDistance(long) const
Definition: swrect.cxx:182
static long SwDecrement(long nA, long nSub)
Definition: newfrm.cxx:57
void SetLowerLeftCorner(const Point &rNew)
Definition: swrect.cxx:218
SwNodes & GetNodes()
Definition: doc.hxx:403
static SwLayVout * s_pVout
Definition: rootfrm.hxx:103
static long SwIncrement(long nA, long nAdd)
Definition: newfrm.cxx:55
SwFrameType mnFrameType
Definition: frame.hxx:397
void SetLeftRightMargins(long, long)
Definition: ssfrm.cxx:175
bool SetMaxBottom(long)
Definition: ssfrm.cxx:72
bool mbTurboAllowed
Definition: rootfrm.hxx:113
static SwCache * mpCache
Definition: frame.hxx:317
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
static bool s_isInPaint
Definition: rootfrm.hxx:104
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:352
void AllInvalidateSmartTagsOrSpelling(bool bSmartTags) const
Definition: newfrm.cxx:600
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
void AddBottom(const long nAdd)
Definition: swrect.cxx:167
SwDocPosUpdate is sent to signal that only the frames from or to a specified document-global position...
Definition: hints.hxx:183
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:1906
void SetBottomAndHeight(long nBottom, 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:162
bool OverStepRight(long) const
Definition: swrect.cxx:191
const SwFormatPageDesc & GetPageDesc(bool=true) const
Definition: fmtpdsc.hxx:79
long Top_() const
Definition: swrect.cxx:157
CurrShell(SwViewShell *pNew)
Definition: newfrm.cxx:322
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2069
long GetLeftMargin() const
Definition: ssfrm.cxx:43
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:205
SwRectFn fnRectVertL2RB2T
Definition: newfrm.cxx:288
long GetPrtBottom() const
Definition: ssfrm.cxx:49
void AllAddPaintRect() const
Definition: newfrm.cxx:590
bool SetMinLeft(long)
Definition: ssfrm.cxx:56
std::unique_ptr< SwDestroyList > mpDestroy
Definition: rootfrm.hxx:167
long Right_() const
Definition: swrect.cxx:156
const IDocumentDrawModelAccess & getIDocumentDrawModelAccess() const
Provides access to the document draw model interface.
Definition: format.cxx:758
static long SecondMinusFirst(long nFirst, long nSecond)
Definition: newfrm.cxx:53
Point BottomLeft() const
Definition: swrect.cxx:176
SwFrame * GetNext()
Definition: frame.hxx:656