diff options
author | Carsten Driesner <cd@openoffice.org> | 2011-01-21 17:18:37 +0100 |
---|---|---|
committer | Carsten Driesner <cd@openoffice.org> | 2011-01-21 17:18:37 +0100 |
commit | 605209eda74b0b31a8da020a2dfd2bbadbb1c7d4 (patch) | |
tree | df8a931de7a4c4b1ee5ab1f7ed5506388943ecbc /sfx2/source/view/frmload.cxx | |
parent | c931cca51fec6a327e94b22e93f0e2fb3fa1e43f (diff) | |
parent | d646413d464dc5d6518f87daa8538cd0c600797f (diff) |
removetooltypes01: Rebase to DEV300m98
Diffstat (limited to 'sfx2/source/view/frmload.cxx')
-rw-r--r-- | sfx2/source/view/frmload.cxx | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 1a578643e443..958f37f12916 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -263,25 +263,6 @@ sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const sal_uInt16 _ } // -------------------------------------------------------------------------------------------------------------------- -void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) const -{ - const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); - if ( !bHidden ) - return; - - const SfxViewFrame* pExistingViewFrame = SfxViewFrame::GetFirst( &i_rDocument ); - if ( pExistingViewFrame ) - return; - - // the document is to be loaded hidden, and it is not yet displayed in any other frame - // To prevent it from being closed when the loader returns, increase its OwnerLock - // (the OwnerLock is normally increased by every frame in which the document is displayed, and by this loader) - i_rDocument.RestoreNoDelete(); - i_rDocument.OwnerLock( sal_True ); - i_rDocument.Get_Impl()->bHiddenLockedByAPI = sal_True; -} - -// -------------------------------------------------------------------------------------------------------------------- void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) const { const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); @@ -331,7 +312,7 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti } // -------------------------------------------------------------------------------------------------------------------- -SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const +SfxObjectShellRef SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const { for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, sal_False ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, sal_False ) ) { @@ -635,15 +616,12 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA // tell the doc its (current) load args. impl_removeLoaderArguments( aDescriptor ); xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() ); - // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could - // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs) - // with the ones passed to the loader here. For instance, what about the MacroExecutionMode? The document - // might have a mode other than the one passed to the loader, and we always overwrite the former with - // the latter. } // get the SfxObjectShell (still needed at the moment) - const SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); + // SfxObjectShellRef is used here ( instead of ...Lock ) since the model is closed below if necessary + // SfxObjectShellLock would be even dangerous here, since the lifetime control should be done outside in case of success + const SfxObjectShellRef xDoc = impl_findObjectShell( xModel ); ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); // ensure the ID of the to-be-created view is in the descriptor, if possible @@ -651,16 +629,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() ); - // if the document is created hidden, prevent it from being deleted until it is shown or disposed - impl_lockHiddenDocument( *xDoc, aDescriptor ); - // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef, - // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter - // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the - // object is closed (DoClose). The impl_lockHiddenDocument is to prevent exactly that premature - // closing. However, a *Ref object wouldn't close, anyway. And in case of unsuccessfull loading, the - // code at the very end of this method cares for closing the XModel, which should also close the - // ObjectShell. - // plug the document into the frame impl_createDocumentView( xModel, _rTargetFrame, aViewCreationArgs, sViewName ); bLoadSuccess = sal_True; |