diff options
Diffstat (limited to 'sfx2/source/doc/sfxbasemodel.cxx')
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 9aa9749ca0..769299366e 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -883,7 +883,15 @@ uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo return m_pData->m_xDocumentInfo; } - +void +SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps ) +{ + // object already disposed? + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( impl_isDisposed() ) + throw lang::DisposedException(); + m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW); +} // document::XDocumentPropertiesSupplier: uno::Reference< document::XDocumentProperties > SAL_CALL SfxBaseModel::getDocumentProperties() @@ -3552,15 +3560,23 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x throw IOEXCEPTION(); // TODO: // the persistence should be switched only if the storage is different - if ( xStorage != m_pData->m_pObjectShell->GetStorage() - && !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) ) - { - sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); - throw task::ErrorCodeIOException( ::rtl::OUString(), - uno::Reference< uno::XInterface >(), - nError ? nError : ERRCODE_IO_GENERAL ); - } - + if ( xStorage != m_pData->m_pObjectShell->GetStorage() ) + { + if ( !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) ) + { + sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); + throw task::ErrorCodeIOException( ::rtl::OUString(), + uno::Reference< uno::XInterface >(), + nError ? nError : ERRCODE_IO_GENERAL ); + } + else + { + // UICfgMgr has a reference to the old storage, update it + uno::Reference< ui::XUIConfigurationStorage > xUICfgMgrStorage( getUIConfigurationManager(), uno::UNO_QUERY ); + if ( xUICfgMgrStorage.is() ) + xUICfgMgrStorage->setStorage( xStorage ); + } + } m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; } |