Line data Source code
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 <svx/svdmodel.hxx>
21 : #include <svx/svdpage.hxx>
22 : #include <drawdoc.hxx>
23 : #include <fmtpdsc.hxx>
24 : #include <swtable.hxx>
25 : #include <rootfrm.hxx>
26 : #include <pagefrm.hxx>
27 : #include <dflyobj.hxx>
28 : #include <frmtool.hxx>
29 : #include <virtoutp.hxx>
30 : #include <blink.hxx>
31 : #include <sectfrm.hxx>
32 : #include <notxtfrm.hxx>
33 : #include <pagedesc.hxx>
34 : #include "viewimp.hxx"
35 : #include <hints.hxx>
36 : #include <viewopt.hxx>
37 : #include <set>
38 : #include <IDocumentSettingAccess.hxx>
39 : #include <IDocumentFieldsAccess.hxx>
40 : #include <DocumentLayoutManager.hxx>
41 :
42 : SwLayVout *SwRootFrm::pVout = 0;
43 : bool SwRootFrm::bInPaint = false;
44 : bool SwRootFrm::bNoVirDev = false;
45 :
46 : SwCache *SwFrm::mpCache = 0;
47 :
48 1466901 : long FirstMinusSecond( long nFirst, long nSecond )
49 1466901 : { return nFirst - nSecond; }
50 4 : long SecondMinusFirst( long nFirst, long nSecond )
51 4 : { return nSecond - nFirst; }
52 134308 : long SwIncrement( long nA, long nAdd )
53 134308 : { return nA + nAdd; }
54 2 : long SwDecrement( long nA, long nSub )
55 2 : { return nA - nSub; }
56 :
57 : static SwRectFnCollection aHorizontal = {
58 : /* fnRectGet */
59 : &SwRect::_Top,
60 : &SwRect::_Bottom,
61 : &SwRect::_Left,
62 : &SwRect::_Right,
63 : &SwRect::_Width,
64 : &SwRect::_Height,
65 : &SwRect::TopLeft,
66 : &SwRect::_Size,
67 : /* fnRectSet */
68 : &SwRect::_Top,
69 : &SwRect::_Bottom,
70 : &SwRect::_Left,
71 : &SwRect::_Right,
72 : &SwRect::_Width,
73 : &SwRect::_Height,
74 :
75 : &SwRect::SubTop,
76 : &SwRect::AddBottom,
77 : &SwRect::SubLeft,
78 : &SwRect::AddRight,
79 : &SwRect::AddWidth,
80 : &SwRect::AddHeight,
81 :
82 : &SwRect::SetPosX,
83 : &SwRect::SetPosY,
84 :
85 : &SwFrm::GetTopMargin,
86 : &SwFrm::GetBottomMargin,
87 : &SwFrm::GetLeftMargin,
88 : &SwFrm::GetRightMargin,
89 : &SwFrm::SetLeftRightMargins,
90 : &SwFrm::SetTopBottomMargins,
91 : &SwFrm::GetPrtTop,
92 : &SwFrm::GetPrtBottom,
93 : &SwFrm::GetPrtLeft,
94 : &SwFrm::GetPrtRight,
95 : &SwRect::GetTopDistance,
96 : &SwRect::GetBottomDistance,
97 : &SwRect::GetLeftDistance,
98 : &SwRect::GetRightDistance,
99 : &SwFrm::SetMaxBottom,
100 : &SwRect::OverStepBottom,
101 :
102 : &SwRect::SetUpperLeftCorner,
103 : &SwFrm::MakeBelowPos,
104 : &FirstMinusSecond,
105 : &FirstMinusSecond,
106 : &SwIncrement,
107 : &SwIncrement,
108 : &SwRect::SetLeftAndWidth,
109 : &SwRect::SetTopAndHeight
110 : };
111 :
112 : static SwRectFnCollection aVertical = {
113 : /* fnRectGet */
114 : &SwRect::_Right,
115 : &SwRect::_Left,
116 : &SwRect::_Top,
117 : &SwRect::_Bottom,
118 : &SwRect::_Height,
119 : &SwRect::_Width,
120 : &SwRect::TopRight,
121 : &SwRect::SwappedSize,
122 : /* fnRectSet */
123 : &SwRect::_Right,
124 : &SwRect::_Left,
125 : &SwRect::_Top,
126 : &SwRect::_Bottom,
127 : &SwRect::_Height,
128 : &SwRect::_Width,
129 :
130 : &SwRect::AddRight,
131 : &SwRect::SubLeft,
132 : &SwRect::SubTop,
133 : &SwRect::AddBottom,
134 : &SwRect::AddHeight,
135 : &SwRect::AddWidth,
136 :
137 : &SwRect::SetPosY,
138 : &SwRect::SetPosX,
139 :
140 : &SwFrm::GetRightMargin,
141 : &SwFrm::GetLeftMargin,
142 : &SwFrm::GetTopMargin,
143 : &SwFrm::GetBottomMargin,
144 : &SwFrm::SetTopBottomMargins,
145 : &SwFrm::SetRightLeftMargins,
146 : &SwFrm::GetPrtRight,
147 : &SwFrm::GetPrtLeft,
148 : &SwFrm::GetPrtTop,
149 : &SwFrm::GetPrtBottom,
150 : &SwRect::GetRightDistance,
151 : &SwRect::GetLeftDistance,
152 : &SwRect::GetTopDistance,
153 : &SwRect::GetBottomDistance,
154 : &SwFrm::SetMinLeft,
155 : &SwRect::OverStepLeft,
156 :
157 : &SwRect::SetUpperRightCorner,
158 : &SwFrm::MakeLeftPos,
159 : &FirstMinusSecond,
160 : &SecondMinusFirst,
161 : &SwIncrement,
162 : &SwDecrement,
163 : &SwRect::SetTopAndHeight,
164 : &SwRect::SetRightAndWidth
165 : };
166 :
167 : static SwRectFnCollection aBottomToTop = {
168 : /* fnRectGet */
169 : &SwRect::_Bottom,
170 : &SwRect::_Top,
171 : &SwRect::_Left,
172 : &SwRect::_Right,
173 : &SwRect::_Width,
174 : &SwRect::_Height,
175 : &SwRect::BottomLeft,
176 : &SwRect::_Size,
177 : /* fnRectSet */
178 : &SwRect::_Bottom,
179 : &SwRect::_Top,
180 : &SwRect::_Left,
181 : &SwRect::_Right,
182 : &SwRect::_Width,
183 : &SwRect::_Height,
184 :
185 : &SwRect::AddBottom,
186 : &SwRect::SubTop,
187 : &SwRect::SubLeft,
188 : &SwRect::AddRight,
189 : &SwRect::AddWidth,
190 : &SwRect::AddHeight,
191 :
192 : &SwRect::SetPosX,
193 : &SwRect::SetPosY,
194 :
195 : &SwFrm::GetBottomMargin,
196 : &SwFrm::GetTopMargin,
197 : &SwFrm::GetLeftMargin,
198 : &SwFrm::GetRightMargin,
199 : &SwFrm::SetLeftRightMargins,
200 : &SwFrm::SetBottomTopMargins,
201 : &SwFrm::GetPrtBottom,
202 : &SwFrm::GetPrtTop,
203 : &SwFrm::GetPrtLeft,
204 : &SwFrm::GetPrtRight,
205 : &SwRect::GetBottomDistance,
206 : &SwRect::GetTopDistance,
207 : &SwRect::GetLeftDistance,
208 : &SwRect::GetRightDistance,
209 : &SwFrm::SetMinTop,
210 : &SwRect::OverStepTop,
211 :
212 : &SwRect::SetLowerLeftCorner,
213 : &SwFrm::MakeUpperPos,
214 : &FirstMinusSecond,
215 : &SecondMinusFirst,
216 : &SwIncrement,
217 : &SwDecrement,
218 : &SwRect::SetLeftAndWidth,
219 : &SwRect::SetBottomAndHeight
220 : };
221 :
222 : static SwRectFnCollection aVerticalRightToLeft = {
223 : /* fnRectGet */
224 : &SwRect::_Left,
225 : &SwRect::_Right,
226 : &SwRect::_Top,
227 : &SwRect::_Bottom,
228 : &SwRect::_Height,
229 : &SwRect::_Width,
230 : &SwRect::BottomRight,
231 : &SwRect::SwappedSize,
232 : /* fnRectSet */
233 : &SwRect::_Left,
234 : &SwRect::_Right,
235 : &SwRect::_Top,
236 : &SwRect::_Bottom,
237 : &SwRect::_Height,
238 : &SwRect::_Width,
239 :
240 : &SwRect::SubLeft,
241 : &SwRect::AddRight,
242 : &SwRect::SubTop,
243 : &SwRect::AddBottom,
244 : &SwRect::AddHeight,
245 : &SwRect::AddWidth,
246 :
247 : &SwRect::SetPosY,
248 : &SwRect::SetPosX,
249 :
250 : &SwFrm::GetLeftMargin,
251 : &SwFrm::GetRightMargin,
252 : &SwFrm::GetTopMargin,
253 : &SwFrm::GetBottomMargin,
254 : &SwFrm::SetTopBottomMargins,
255 : &SwFrm::SetLeftRightMargins,
256 : &SwFrm::GetPrtLeft,
257 : &SwFrm::GetPrtRight,
258 : &SwFrm::GetPrtBottom,
259 : &SwFrm::GetPrtTop,
260 : &SwRect::GetLeftDistance,
261 : &SwRect::GetRightDistance,
262 : &SwRect::GetBottomDistance,
263 : &SwRect::GetTopDistance,
264 : &SwFrm::SetMaxRight,
265 : &SwRect::OverStepRight,
266 :
267 : &SwRect::SetLowerLeftCorner,
268 : &SwFrm::MakeRightPos,
269 : &FirstMinusSecond,
270 : &FirstMinusSecond,
271 : &SwDecrement,
272 : &SwIncrement,
273 : &SwRect::SetBottomAndHeight,
274 : &SwRect::SetLeftAndWidth
275 : };
276 :
277 : static SwRectFnCollection aVerticalLeftToRight = {
278 : /* fnRectGet */
279 : &SwRect::_Left,
280 : &SwRect::_Right,
281 : &SwRect::_Top,
282 : &SwRect::_Bottom,
283 : &SwRect::_Height,
284 : &SwRect::_Width,
285 : &SwRect::TopLeft,
286 : &SwRect::SwappedSize,
287 : /* fnRectSet */
288 : &SwRect::_Left,
289 : &SwRect::_Right,
290 : &SwRect::_Top,
291 : &SwRect::_Bottom,
292 : &SwRect::_Height,
293 : &SwRect::_Width,
294 :
295 : &SwRect::SubLeft,
296 : &SwRect::AddRight,
297 : &SwRect::SubTop,
298 : &SwRect::AddBottom,
299 : &SwRect::AddHeight,
300 : &SwRect::AddWidth,
301 :
302 : &SwRect::SetPosY,
303 : &SwRect::SetPosX,
304 :
305 : &SwFrm::GetLeftMargin,
306 : &SwFrm::GetRightMargin,
307 : &SwFrm::GetTopMargin,
308 : &SwFrm::GetBottomMargin,
309 : &SwFrm::SetTopBottomMargins,
310 : &SwFrm::SetLeftRightMargins,
311 : &SwFrm::GetPrtLeft,
312 : &SwFrm::GetPrtRight,
313 : &SwFrm::GetPrtTop,
314 : &SwFrm::GetPrtBottom,
315 : &SwRect::GetLeftDistance,
316 : &SwRect::GetRightDistance,
317 : &SwRect::GetTopDistance,
318 : &SwRect::GetBottomDistance,
319 : &SwFrm::SetMaxRight,
320 : &SwRect::OverStepRight,
321 :
322 : &SwRect::SetUpperLeftCorner,
323 : &SwFrm::MakeRightPos,
324 : &FirstMinusSecond,
325 : &FirstMinusSecond,
326 : &SwIncrement,
327 : &SwIncrement,
328 : &SwRect::SetTopAndHeight,
329 : &SwRect::SetLeftAndWidth
330 : };
331 :
332 : SwRectFn fnRectHori = &aHorizontal;
333 : SwRectFn fnRectVert = &aVertical;
334 :
335 : SwRectFn fnRectVertL2R = &aVerticalLeftToRight;
336 :
337 : SwRectFn fnRectB2T = &aBottomToTop;
338 : SwRectFn fnRectVL2R = &aVerticalRightToLeft;
339 :
340 : // #i65250#
341 : sal_uInt32 SwFrm::mnLastFrmId=0;
342 :
343 7406406 : TYPEINIT1(SwFrm,SwClient); //rtti for SwFrm
344 4714946 : TYPEINIT1(SwCntntFrm,SwFrm); //rtti for SwCntntFrm
345 :
346 90 : void _FrmInit()
347 : {
348 90 : SwRootFrm::pVout = new SwLayVout();
349 : SwCache *pNew = new SwCache( 100
350 : #ifdef DBG_UTIL
351 : , "static SwBorderAttrs::pCache"
352 : #endif
353 90 : );
354 90 : SwFrm::SetCache( pNew );
355 90 : }
356 :
357 90 : void _FrmFinit()
358 : {
359 : #if OSL_DEBUG_LEVEL > 0
360 : // The cache may only contain null pointers at this time.
361 : for( sal_uInt16 n = SwFrm::GetCachePtr()->size(); n; )
362 : if( (*SwFrm::GetCachePtr())[ --n ] )
363 : {
364 : SwCacheObj* pObj = (*SwFrm::GetCachePtr())[ n ];
365 : OSL_ENSURE( !pObj, "Who didn't deregister?");
366 : }
367 : #endif
368 90 : delete SwRootFrm::pVout;
369 90 : delete SwFrm::GetCachePtr();
370 90 : }
371 :
372 : // RootFrm::Everything that belongs to CurrShell
373 :
374 10530 : class SwCurrShells : public std::set<CurrShell*> {};
375 :
376 712339 : CurrShell::CurrShell( SwViewShell *pNew )
377 : {
378 : OSL_ENSURE( pNew, "insert 0-Shell?" );
379 712339 : pRoot = pNew->GetLayout();
380 712339 : if ( pRoot )
381 : {
382 712339 : pPrev = pRoot->pCurrShell;
383 712339 : pRoot->pCurrShell = pNew;
384 712339 : pRoot->pCurrShells->insert( this );
385 : }
386 : else
387 0 : pPrev = 0;
388 712339 : }
389 :
390 712339 : CurrShell::~CurrShell()
391 : {
392 712339 : if ( pRoot )
393 : {
394 712339 : pRoot->pCurrShells->erase( this );
395 712339 : if ( pPrev )
396 712339 : pRoot->pCurrShell = pPrev;
397 712339 : if ( pRoot->pCurrShells->empty() && pRoot->pWaitingCurrShell )
398 : {
399 0 : pRoot->pCurrShell = pRoot->pWaitingCurrShell;
400 0 : pRoot->pWaitingCurrShell = 0;
401 : }
402 : }
403 712339 : }
404 :
405 4650 : void SetShell( SwViewShell *pSh )
406 : {
407 4650 : SwRootFrm *pRoot = pSh->GetLayout();
408 4650 : if ( pRoot->pCurrShells->empty() )
409 4650 : pRoot->pCurrShell = pSh;
410 : else
411 0 : pRoot->pWaitingCurrShell = pSh;
412 4650 : }
413 :
414 5316 : void SwRootFrm::DeRegisterShell( SwViewShell *pSh )
415 : {
416 : // Activate some shell if possible
417 5316 : if ( pCurrShell == pSh )
418 5264 : pCurrShell = pSh->GetNext() != pSh ? (SwViewShell*)pSh->GetNext() : 0;
419 :
420 : // Doesn't matter anymore
421 5316 : if ( pWaitingCurrShell == pSh )
422 0 : pWaitingCurrShell = 0;
423 :
424 : // Remove references
425 5316 : for ( SwCurrShells::iterator it = pCurrShells->begin(); it != pCurrShells->end(); ++it )
426 : {
427 0 : CurrShell *pC = *it;
428 0 : if (pC->pPrev == pSh)
429 0 : pC->pPrev = 0;
430 : }
431 5316 : }
432 :
433 5266 : void InitCurrShells( SwRootFrm *pRoot )
434 : {
435 5266 : pRoot->pCurrShells = new SwCurrShells;
436 5266 : }
437 :
438 : /*
439 : |* The RootFrm requests an own FrmFmt from the document, which it is
440 : |* going to delete again in the dtor. The own FrmFmt is derived from
441 : |* the passed FrmFmt.
442 : |*/
443 5266 : SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, SwViewShell * pSh ) :
444 : SwLayoutFrm( pFmt->GetDoc()->MakeFrmFmt(
445 : OUString("Root"), pFmt ), 0 ),
446 : maPagesArea(),
447 : mnViewWidth( -1 ),
448 : mnColumns( 0 ),
449 : mbBookMode( false ),
450 : mbSidebarChanged( false ),
451 : mbNeedGrammarCheck( false ),
452 : bCheckSuperfluous( false ),
453 : bIdleFormat( true ),
454 : bBrowseWidthValid( false ),
455 : bTurboAllowed( true ),
456 : bAssertFlyPages( true ),
457 : bIsVirtPageNum( false ),
458 : bIsNewLayout( true ),
459 : bCallbackActionEnabled ( false ),
460 : bLayoutFreezed ( false ),
461 : nBrowseWidth( MM50*4 ), //2cm minimum
462 : pTurbo( 0 ),
463 : pLastPage( 0 ),
464 : pCurrShell( pSh ),
465 : pWaitingCurrShell( 0 ),
466 : pCurrShells(NULL),
467 : pDrawPage( 0 ),
468 : pDestroy( 0 ),
469 : nPhyPageNums( 0 ),
470 5266 : nAccessibleShells( 0 )
471 : {
472 5266 : mnType = FRMC_ROOT;
473 5266 : setRootFrm( this );
474 5266 : }
475 :
476 5266 : void SwRootFrm::Init( SwFrmFmt* pFmt )
477 : {
478 5266 : InitCurrShells( this );
479 :
480 5266 : IDocumentTimerAccess *pTimerAccess = pFmt->getIDocumentTimerAccess();
481 5266 : IDocumentLayoutAccess *pLayoutAccess = pFmt->getIDocumentLayoutAccess();
482 5266 : IDocumentFieldsAccess *pFieldsAccess = pFmt->getIDocumentFieldsAccess();
483 5266 : const IDocumentSettingAccess *pSettingAccess = pFmt->getIDocumentSettingAccess();
484 5266 : pTimerAccess->StopIdling();
485 : // For creating the Flys by MakeFrms()
486 5266 : pLayoutAccess->SetCurrentViewShell( this->GetCurrShell() );
487 5266 : bCallbackActionEnabled = false; // needs to be set to sal_True before leaving!
488 :
489 5266 : SwDrawModel* pMd = pFmt->getIDocumentDrawModelAccess()->GetDrawModel();
490 5266 : if ( pMd )
491 : {
492 : // Disable "multiple layout"
493 5266 : pDrawPage = pMd->GetPage(0);
494 :
495 5266 : pDrawPage->SetSize( Frm().SSize() );
496 : }
497 :
498 : // Initialize the layout: create pages, link content with Cntnt etc.
499 : // First, initialize some stuff, then get hold of the first
500 : // node (which will be needed for the PageDesc).
501 :
502 5266 : SwDoc* pDoc = pFmt->GetDoc();
503 5266 : SwNodeIndex aIndex( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode() );
504 5266 : SwCntntNode *pNode = pDoc->GetNodes().GoNextSection( &aIndex, true, false );
505 : // #123067# pNode = 0 can really happen
506 5266 : SwTableNode *pTblNd= pNode ? pNode->FindTableNode() : 0;
507 :
508 : // Get hold of PageDesc (either via FrmFmt of the first node or the initial one).
509 5266 : SwPageDesc *pDesc = 0;
510 10532 : ::boost::optional<sal_uInt16> oPgNum;
511 :
512 5266 : if ( pTblNd )
513 : {
514 364 : const SwFmtPageDesc &rDesc = pTblNd->GetTable().GetFrmFmt()->GetPageDesc();
515 364 : pDesc = (SwPageDesc*)rDesc.GetPageDesc();
516 : //#19104# respect the page number offset!!
517 364 : oPgNum = rDesc.GetNumOffset();
518 364 : if (oPgNum)
519 6 : bIsVirtPageNum = true;
520 : }
521 4902 : else if ( pNode )
522 : {
523 4900 : const SwFmtPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
524 4900 : pDesc = (SwPageDesc*)rDesc.GetPageDesc();
525 : //#19104# respect the page number offset!!
526 4900 : oPgNum = rDesc.GetNumOffset();
527 4900 : if (oPgNum)
528 176 : bIsVirtPageNum = true;
529 : }
530 : else
531 2 : bIsVirtPageNum = false;
532 5266 : if ( !pDesc )
533 1680 : pDesc = &pDoc->GetPageDesc( 0 );
534 5266 : const bool bOdd = !oPgNum || 0 != ( oPgNum.get() % 2 );
535 5266 : bool bFirst = !oPgNum || 1 == oPgNum.get();
536 :
537 : // Create a page and put it in the layout
538 5266 : SwPageFrm *pPage = ::InsertNewPage( *pDesc, this, bOdd, bFirst, false, false, 0 );
539 :
540 : // Find the first page in the Bodytext section.
541 5266 : SwLayoutFrm *pLay = pPage->FindBodyCont();
542 10568 : while( pLay->Lower() )
543 36 : pLay = (SwLayoutFrm*)pLay->Lower();
544 :
545 10532 : SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
546 5266 : ::_InsertCnt( pLay, pDoc, aTmp.GetIndex(), true );
547 : //Remove masters that haven't been replaced yet from the list.
548 5266 : RemoveMasterObjs( pDrawPage );
549 5266 : if( pSettingAccess->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
550 0 : pFieldsAccess->UpdateRefFlds( NULL );
551 : //b6433357: Update page fields after loading
552 5266 : if ( !pCurrShell || !pCurrShell->Imp()->IsUpdateExpFlds() )
553 : {
554 5266 : SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
555 5266 : pFieldsAccess->UpdatePageFlds( &aMsgHnt );
556 : }
557 :
558 5266 : pTimerAccess->StartIdling();
559 5266 : bCallbackActionEnabled = true;
560 :
561 5266 : SwViewShell *pViewSh = GetCurrShell();
562 5266 : if (pViewSh)
563 10532 : mbNeedGrammarCheck = pViewSh->GetViewOptions()->IsOnlineSpell();
564 5266 : }
565 :
566 15792 : SwRootFrm::~SwRootFrm()
567 : {
568 5264 : bTurboAllowed = false;
569 5264 : pTurbo = 0;
570 : // fdo#39510 crash on document close with footnotes
571 : // Object ownership in writer and esp. in layout are a mess: Before the
572 : // document/layout split SwDoc and SwRootFrm were essentially one object
573 : // and magically/uncleanly worked around their common destruction by call
574 : // to SwDoc::IsInDtor() -- even from the layout. As of now destuction of
575 : // the layout proceeds forward through the frames. Since SwTxtFtn::DelFrms
576 : // also searches backwards to find the master of footnotes, they must be
577 : // considered to be owned by the SwRootFrm and also be destroyed here,
578 : // before tearing down the (now footnote free) rest of the layout.
579 5264 : RemoveFtns(0, false, true);
580 :
581 5264 : if(pBlink)
582 73 : pBlink->FrmDelete( this );
583 5264 : SwFrmFmt *pRegisteredInNonConst = static_cast<SwFrmFmt*>(GetRegisteredInNonConst());
584 5264 : if ( pRegisteredInNonConst )
585 : {
586 5264 : SwDoc *pDoc = pRegisteredInNonConst->GetDoc();
587 5264 : pDoc->DelFrmFmt( pRegisteredInNonConst );
588 5264 : pDoc->GetDocumentLayoutManager().ClearSwLayouterEntries();
589 : }
590 5264 : delete pDestroy;
591 5264 : pDestroy = 0;
592 :
593 : // Remove references
594 5264 : for ( SwCurrShells::iterator it = pCurrShells->begin(); it != pCurrShells->end(); ++it )
595 0 : (*it)->pRoot = 0;
596 :
597 5264 : delete pCurrShells;
598 5264 : pCurrShells = 0;
599 :
600 : // Some accessible shells are left => problems on second SwFrm::Destroy call
601 : assert(0 == nAccessibleShells);
602 :
603 : // manually call base classes Destroy because it could call stuff
604 : // that accesses members of this
605 5264 : SwLayoutFrm::Destroy();
606 5264 : SwFrm::Destroy();
607 10528 : }
608 :
609 5266 : void SwRootFrm::RemoveMasterObjs( SdrPage *pPg )
610 : {
611 : // Remove all master objects from the Page. But don't delete!
612 15676 : for( size_t i = pPg ? pPg->GetObjCount() : 0; i; )
613 : {
614 5144 : SdrObject* pObj = pPg->GetObj( --i );
615 5144 : if( pObj->ISA(SwFlyDrawObj ) )
616 298 : pPg->RemoveObject( i );
617 : }
618 5266 : }
619 :
620 54 : void SwRootFrm::AllCheckPageDescs() const
621 : {
622 54 : if ( !IsLayoutFreezed() )
623 54 : CheckPageDescs( (SwPageFrm*)this->Lower() );
624 54 : }
625 :
626 0 : void SwRootFrm::AllInvalidateAutoCompleteWords() const
627 : {
628 0 : SwPageFrm *pPage = (SwPageFrm*)this->Lower();
629 0 : while ( pPage )
630 : {
631 0 : pPage->InvalidateAutoCompleteWords();
632 0 : pPage = (SwPageFrm*)pPage->GetNext();
633 : }
634 0 : }
635 :
636 0 : void SwRootFrm::AllAddPaintRect() const
637 : {
638 0 : GetCurrShell()->AddPaintRect( this->Frm() );
639 0 : }
640 :
641 2 : void SwRootFrm::AllRemoveFtns()
642 : {
643 2 : RemoveFtns();
644 2 : }
645 :
646 9 : void SwRootFrm::AllInvalidateSmartTagsOrSpelling(bool bSmartTags) const
647 : {
648 9 : SwPageFrm *pPage = (SwPageFrm*)this->Lower();
649 27 : while ( pPage )
650 : {
651 9 : if ( bSmartTags )
652 8 : pPage->InvalidateSmartTags();
653 :
654 9 : pPage->InvalidateSpelling();
655 9 : pPage = (SwPageFrm*)pPage->GetNext();
656 : }
657 279 : }
658 :
659 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|