--- a/sw/inc/doc.hxx +++ a/sw/inc/doc.hxx @@ -87,6 +87,7 @@ #include #include +#include class SwList; class SvxForbiddenCharactersTable; @@ -327,6 +328,7 @@ SwDefTOXBase_Impl * pDefTOXBases; // defaults of SwTOXBase's ViewShell *pCurrentView; // SwDoc should get a new member pCurrentView//swmod 071225 + boost::shared_ptr pLayoutPtr; SdrModel *pDrawModel; // StarView Drawing SwDocUpdtFld *pUpdtFlds; // Struktur zum Field-Update @@ -1784,6 +1786,8 @@ const IDocShell* GetDocShell() const { return pDocShell; } void SetDocShell( IDocShell* pDSh ); + void ShareLayout( boost::shared_ptr& rPtr); + // in case during copying of embedded object a new shell is created, // it should be set here and cleaned later void SetTmpDocShell( SfxObjectShellLock rLock ) { xTmpDocShell = rLock; } --- a/sw/source/core/doc/doclay.cxx +++ a/sw/source/core/doc/doclay.cxx @@ -2429,3 +2429,9 @@ return aAllLayouts; }//swmod 070825 + +void SwDoc::ShareLayout(boost::shared_ptr& rPtr) +{ + pLayoutPtr = rPtr; +} --- a/sw/source/core/doc/docnew.cxx +++ a/sw/source/core/doc/docnew.cxx @@ -518,6 +518,7 @@ delete pPgPViewPrtData; mbDtor = sal_True; + pLayoutPtr.reset(); delete pRedlineTbl; delete pUnoCrsrTbl; --- a/sw/source/core/view/vnew.cxx +++ a/sw/source/core/view/vnew.cxx @@ -145,6 +145,17 @@ // switched to two step construction because creating the layout in SwRootFrm needs a valid pLayout set pLayout = SwRootFrmPtr(new SwRootFrm( pDoc->GetDfltFrmFmt(), this ));//swmod081016 pLayout->Init( pDoc->GetDfltFrmFmt() ); + + // mba: the layout refactoring overlooked an important detail + // prior to that change, the layout always was destroyed in the dtor of swdoc + // it is necessary to suppress notifications in the layout when the layout is discarded in its dtor + // unfortunately this was done by asking whether the doc is in dtor - though the correct question should + // have been if the rootfrm is in dtor (or even better: discard the layout before the SwRootFrm is destroyed!) + // SwDoc::IsInDtor() is used at several places all over the code that need to be checked whether + // "pDoc->IsInDtor()" means what is says or in fact should check for "pRootFrm->IsInDtor()". As this will take some time, I decided + // to postpone that investigations and the changes it will bring to the 3.5 release and for 3.4 make sure + // that the layout still gets destroyed in the doc dtor. This is done by sharing "the" layout (that we still have) with the doc. + GetDoc()->ShareLayout( pLayout ); } } SizeChgNotify(); //swmod 071108 --- a/sw/source/ui/uno/unomod.cxx +++ a/sw/source/ui/uno/unomod.cxx @@ -782,6 +782,12 @@ aOpt.setBrowseMode( bVal ); pView->GetWrtShell().ApplyViewOptions( aOpt ); pView->RecheckBrowseMode(); + + // must be set in mpViewOption as this will overwrite settings in _post! + mpViewOption->setBrowseMode( bVal ); + + // disable multiple layout + pView->GetDocShell()->ToggleBrowserMode(bVal, pView ); } } break;