summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-01-05 22:32:38 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-01-05 22:32:38 +0100
commiteafba820349005ea5426cab58911f9ff99969966 (patch)
tree6939f6d685d166f21c6cfc745b51f544d0c4398d /sfx2
parent94bf18438d4ea4f47c440d0d758ac6fa3d04f84e (diff)
autorecovery: define a new css.document.XDocumentRecovery interface, implement it in both SFX and DBACCESS, and use it in the autorecovery
In this course, the auto recovery learned to restore multiple views of a document. Also, in the course of the change, the LoadDispatchListener became superfluous, and was removed. Also, the loader code in dbaccess was slightly adjusted, since now the connectController call is in the responsibility of the loader, and must not happen inside the XController::attachModel call anymore. This change made the ModelControllerConnector class superfluous, so it has been removed, too.
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx58
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx584
2 files changed, 237 insertions, 405 deletions
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 6e7f9be72b11..fd2c73bfd323 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -47,6 +47,7 @@
#include <com/sun/star/document/XDocumentInfo.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentRecovery.hpp>
#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
@@ -59,6 +60,8 @@
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/document/XScriptInvocationContext.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/NotInitializedException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/frame/XModel2.hpp>
#include <com/sun/star/frame/DoubleInitializationException.hpp>
#include <com/sun/star/util/XModifiable2.hpp>
@@ -86,6 +89,8 @@
#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/script/XStarBasicAccess.hpp>
#include <osl/mutex.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
#include <tools/link.hxx>
@@ -95,9 +100,9 @@
#include <com/sun/star/task/XInteractionHandler.hpp>
//________________________________________________________________________________________________________
-#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_29)
-#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_29
-#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 29
+#if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_30)
+#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_30
+#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 30
#include <comphelper/implbase_var.hxx>
#endif
@@ -236,10 +241,11 @@ namespace sfx { namespace intern {
SfxListener
*/
-typedef ::comphelper::WeakImplHelper29 < XCHILD
+typedef ::comphelper::WeakImplHelper30 < XCHILD
, XDOCUMENTINFOSUPPLIER
, ::com::sun::star::document::XDocumentPropertiesSupplier
, ::com::sun::star::rdf::XDocumentMetadataAccess
+ , ::com::sun::star::document::XDocumentRecovery
, XEVENTBROADCASTER
, XEVENTLISTENER
, XEVENTSSUPPLIER
@@ -1292,6 +1298,16 @@ public:
virtual ::rtl::OUString SAL_CALL getUntitledPrefix()
throw (css::uno::RuntimeException);
+ // css.document.XDocumentRecovery
+ virtual void SAL_CALL doEmergencySave( const ::rtl::OUString& i_TargetLocation, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor )
+ throw ( ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::lang::WrappedTargetException );
+ virtual void SAL_CALL recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& i_MediaDescriptor )
+ throw ( ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::lang::WrappedTargetException );
+
//____________________________________________________________________________________________________
// ::com::sun::star::rdf::XNode:
@@ -1471,6 +1487,7 @@ public:
SAL_DLLPRIVATE sal_Bool impl_isDisposed() const ;
sal_Bool IsDisposed() const ;
+ sal_Bool IsInitialized() const;
::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess > SAL_CALL getViewData() throw (::com::sun::star::uno::RuntimeException);
void SAL_CALL setViewData( const ::com::sun::star::uno::Reference < ::com::sun::star::container::XIndexAccess >& aData ) throw (::com::sun::star::uno::RuntimeException);
@@ -1481,7 +1498,6 @@ public:
/** returns true if someone added a XEventListener to this XEventBroadcaster */
sal_Bool hasEventListeners() const;
-
protected:
/* returns a unique id for the model that is valid as long as the document
@@ -1542,6 +1558,38 @@ private:
} ; // class SfxBaseModel
+class SFX2_DLLPUBLIC SfxModelGuard
+{
+public:
+ enum AllowedModelState
+ {
+ // not yet initialized
+ E_INITIALIZING,
+ // fully alive, i.e. initialized, and not yet disposed
+ E_FULLY_ALIVE
+ };
+
+ SfxModelGuard( SfxBaseModel& i_rModel, const AllowedModelState i_eState = E_FULLY_ALIVE )
+ :m_aGuard( Application::GetSolarMutex() )
+ {
+ if ( i_rModel.IsDisposed() )
+ throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *&i_rModel );
+ if ( ( i_eState != E_INITIALIZING ) && !i_rModel.IsInitialized() )
+ throw ::com::sun::star::lang::NotInitializedException( ::rtl::OUString(), *&i_rModel );
+ }
+ ~SfxModelGuard()
+ {
+ }
+
+ void clear()
+ {
+ m_aGuard.clear();
+ }
+
+private:
+ ::vos::OClearableGuard m_aGuard;
+};
+
#undef css
#endif // _SFX_SFXBASEMODEL_HXX_
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 868ccb138a02..7c420779409c 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -149,6 +149,8 @@ using ::com::sun::star::frame::XFrame;
using ::com::sun::star::frame::XController;
using ::com::sun::star::frame::XController2;
using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::io::IOException;
+using ::com::sun::star::lang::WrappedTargetException;
/** This Listener is used to get notified when the XDocumentProperties of the
XModel change.
@@ -224,6 +226,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
sal_Bool m_bClosing ;
sal_Bool m_bSaving ;
sal_Bool m_bSuicide ;
+ sal_Bool m_bInitialized ;
uno::Reference< com::sun::star::view::XPrintable> m_xPrintable ;
uno::Reference< script::provider::XScriptProvider > m_xScriptProvider;
uno::Reference< ui::XUIConfigurationManager > m_xUIConfigurationManager;
@@ -242,6 +245,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
, m_bClosing ( sal_False )
, m_bSaving ( sal_False )
, m_bSuicide ( sal_False )
+ , m_bInitialized ( sal_False )
, m_pStorageModifyListen ( NULL )
, m_xTitleHelper ()
, m_xNumberedControllers ()
@@ -659,9 +663,7 @@ uno::Reference< script::XStarBasicAccess > implGetStarBasicAccess( SfxObjectShel
uno::Reference< XNAMECONTAINER > SAL_CALL SfxBaseModel::getLibraryContainer() throw( uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess;
if( !rxAccess.is() && m_pData->m_pObjectShell.Is() )
@@ -680,9 +682,7 @@ void SAL_CALL SfxBaseModel::createLibrary( const ::rtl::OUString& LibName, const
const ::rtl::OUString& ExternalSourceURL, const ::rtl::OUString& LinkTargetURL )
throw(ELEMENTEXISTEXCEPTION, uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess;
if( !rxAccess.is() && m_pData->m_pObjectShell.Is() )
@@ -699,9 +699,7 @@ void SAL_CALL SfxBaseModel::addModule( const ::rtl::OUString& LibraryName, const
const ::rtl::OUString& Language, const ::rtl::OUString& Source )
throw( NOSUCHELEMENTEXCEPTION, uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess;
if( !rxAccess.is() && m_pData->m_pObjectShell.Is() )
@@ -718,9 +716,7 @@ void SAL_CALL SfxBaseModel::addDialog( const ::rtl::OUString& LibraryName, const
const ::com::sun::star::uno::Sequence< sal_Int8 >& Data )
throw(NOSUCHELEMENTEXCEPTION, uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess;
if( !rxAccess.is() && m_pData->m_pObjectShell.Is() )
@@ -737,9 +733,7 @@ void SAL_CALL SfxBaseModel::addDialog( const ::rtl::OUString& LibraryName, const
uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getParent() throw( uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
return m_pData->m_xParent;
}
@@ -750,7 +744,7 @@ uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getParent() throw( uno:
void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& Parent) throw(NOSUPPORTEXCEPTION, uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
m_pData->m_xParent = Parent;
}
@@ -760,11 +754,7 @@ void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& P
void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- // object already disposed?
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( !m_pData->m_bClosed )
{
@@ -823,10 +813,7 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept
void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTENER >& aListener )
throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener );
}
@@ -838,11 +825,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTEN
void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLISTENER >& aListener )
throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
-
+ SfxModelGuard aGuard( *this );
m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener );
}
@@ -852,11 +835,7 @@ void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLIS
uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
-
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
if ( !m_pData->m_xDocumentInfo.is() )
{
// WARNING: this will only work if (when loading a document) the
@@ -902,11 +881,7 @@ uno::Reference< document::XDocumentProperties > SAL_CALL
SfxBaseModel::getDocumentProperties()
throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
-
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
if ( !m_pData->m_xDocumentProperties.is() )
{
uno::Reference< lang::XInitialization > xDocProps(
@@ -954,10 +929,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString&
const uno::Sequence< beans::PropertyValue >& rArgs )
throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
-
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
if ( rURL.getLength() == 0 && rArgs.getLength() == 1 && rArgs[0].Name.equalsAscii( "SetEmbedded" ) )
{
// allows to set a windowless document to EMBEDDED state
@@ -1034,10 +1006,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString&
::rtl::OUString SAL_CALL SfxBaseModel::getURL() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
-
+ SfxModelGuard aGuard( *this );
return m_pData->m_sURL ;
}
@@ -1047,10 +1016,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString&
uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
-
+ SfxModelGuard aGuard( *this );
if ( m_pData->m_pObjectShell.Is() )
{
uno::Sequence< beans::PropertyValue > seqArgsNew;
@@ -1150,10 +1116,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::c
void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XController >& xController )
throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
-
+ SfxModelGuard aGuard( *this );
OSL_PRECOND( xController.is(), "SfxBaseModel::connectController: invalid controller!" );
if ( !xController.is() )
return;
@@ -1182,9 +1145,7 @@ void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XCon
void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength();
if ( !nOldCount )
@@ -1212,9 +1173,8 @@ void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::X
void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
+
++m_pData->m_nControllerLockCount ;
}
@@ -1224,9 +1184,8 @@ void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::Runti
void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
+
--m_pData->m_nControllerLockCount ;
}
@@ -1236,9 +1195,7 @@ void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::Run
sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
return ( m_pData->m_nControllerLockCount != 0 ) ;
}
@@ -1248,10 +1205,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::u
uno::Reference< frame::XController > SAL_CALL SfxBaseModel::getCurrentController() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
// get the last active controller of this model
if ( m_pData->m_xCurrent.is() )
@@ -1268,10 +1222,7 @@ uno::Reference< frame::XController > SAL_CALL SfxBaseModel::getCurrentController
void SAL_CALL SfxBaseModel::setCurrentController( const uno::Reference< frame::XController >& xCurrentController )
throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
m_pData->m_xCurrent = xCurrentController;
}
@@ -1282,10 +1233,7 @@ void SAL_CALL SfxBaseModel::setCurrentController( const uno::Reference< frame::X
uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getCurrentSelection() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< uno::XInterface > xReturn;
uno::Reference< frame::XController > xController = getCurrentController() ;
@@ -1309,9 +1257,7 @@ uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getCurrentSelection() t
sal_Bool SAL_CALL SfxBaseModel::disableSetModified() throw (::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw DISPOSEDEXCEPTION();
+ SfxModelGuard aGuard( *this );
if ( !m_pData->m_pObjectShell.Is() )
throw uno::RuntimeException();
@@ -1324,9 +1270,7 @@ sal_Bool SAL_CALL SfxBaseModel::disableSetModified() throw (::com::sun::star::un
sal_Bool SAL_CALL SfxBaseModel::enableSetModified() throw (::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw DISPOSEDEXCEPTION();
+ SfxModelGuard aGuard( *this );
if ( !m_pData->m_pObjectShell.Is() )
throw uno::RuntimeException();
@@ -1339,9 +1283,7 @@ sal_Bool SAL_CALL SfxBaseModel::enableSetModified() throw (::com::sun::star::uno
sal_Bool SAL_CALL SfxBaseModel::isSetModifiedEnabled() throw (::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw DISPOSEDEXCEPTION();
+ SfxModelGuard aGuard( *this );
if ( !m_pData->m_pObjectShell.Is() )
throw uno::RuntimeException();
@@ -1355,10 +1297,7 @@ sal_Bool SAL_CALL SfxBaseModel::isSetModifiedEnabled() throw (::com::sun::star::
sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsModified() : sal_False;
}
@@ -1370,10 +1309,7 @@ sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::Runtim
void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified )
throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( m_pData->m_pObjectShell.Is() )
m_pData->m_pObjectShell->SetModified(bModified);
@@ -1385,10 +1321,7 @@ void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified )
void SAL_CALL SfxBaseModel::addModifyListener(const uno::Reference< XMODIFYLISTENER >& xListener) throw( uno::RuntimeException )
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0),xListener );
}
@@ -1399,10 +1332,7 @@ void SAL_CALL SfxBaseModel::addModifyListener(const uno::Reference< XMODIFYLISTE
void SAL_CALL SfxBaseModel::removeModifyListener(const uno::Reference< XMODIFYLISTENER >& xListener) throw( uno::RuntimeException )
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0), xListener );
}
@@ -1415,8 +1345,9 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo
{
static ::rtl::OUString MSG_1 = ::rtl::OUString::createFromAscii("Cant close while saving.");
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( !m_pData || m_pData->m_bClosed || m_pData->m_bClosing )
+ SfxModelGuard aGuard( *this );
+
+ if ( m_pData->m_bClosed || m_pData->m_bClosing )
return;
uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) );
@@ -1478,10 +1409,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo
void SAL_CALL SfxBaseModel::addCloseListener( const uno::Reference< XCLOSELISTENER >& xListener ) throw (uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XCLOSELISTENER >*)0), xListener );
}
@@ -1492,10 +1420,7 @@ void SAL_CALL SfxBaseModel::addCloseListener( const uno::Reference< XCLOSELISTEN
void SAL_CALL SfxBaseModel::removeCloseListener( const uno::Reference< XCLOSELISTENER >& xListener ) throw (uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XCLOSELISTENER >*)0), xListener );
}
@@ -1506,10 +1431,7 @@ void SAL_CALL SfxBaseModel::removeCloseListener( const uno::Reference< XCLOSELIS
uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( impl_getPrintHelper() )
return m_pData->m_xPrintable->getPrinter();
@@ -1520,10 +1442,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() throw(
void SAL_CALL SfxBaseModel::setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter)
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( impl_getPrintHelper() )
m_pData->m_xPrintable->setPrinter( rPrinter );
@@ -1532,10 +1451,7 @@ void SAL_CALL SfxBaseModel::setPrinter(const uno::Sequence< beans::PropertyValue
void SAL_CALL SfxBaseModel::print(const uno::Sequence< beans::PropertyValue >& rOptions)
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( impl_getPrintHelper() )
m_pData->m_xPrintable->print( rOptions );
@@ -1547,10 +1463,7 @@ void SAL_CALL SfxBaseModel::print(const uno::Sequence< beans::PropertyValue >& r
sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->HasName() : sal_False;
}
@@ -1561,10 +1474,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::Runti
::rtl::OUString SAL_CALL SfxBaseModel::getLocation() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( m_pData->m_pObjectShell.Is() )
{
@@ -1584,10 +1494,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::Runti
sal_Bool SAL_CALL SfxBaseModel::isReadonly() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsReadOnly() : sal_True;
}
@@ -1603,10 +1510,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa
{
RTL_LOGFILE_PRODUCT_CONTEXT( aPerfLog, "PERFORMANCE - SfxBaseModel::storeSelf" );
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( m_pData->m_pObjectShell.Is() )
{
@@ -1704,10 +1608,7 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString&
{
RTL_LOGFILE_PRODUCT_CONTEXT( aPerfLog, "PERFORMANCE - SfxBaseModel::storeAsURL" );
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( m_pData->m_pObjectShell.Is() )
{
@@ -1730,10 +1631,7 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString&
const uno::Sequence< beans::PropertyValue >& rArgs )
throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( m_pData->m_pObjectShell.Is() )
{
@@ -1743,6 +1641,30 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString&
}
}
+void SAL_CALL SfxBaseModel::doEmergencySave( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException )
+{
+ // just delegate this to storeToURL
+ storeToURL( i_TargetLocation, i_MediaDescriptor );
+}
+
+void SAL_CALL SfxBaseModel::recoverDocument( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException )
+{
+ // delegate to our "load" method
+ ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor );
+
+ // our load implementation expects the SalvagedFile to be in the media descriptor
+ OSL_ENSURE( !aMediaDescriptor.has( "SalvagedFile" ) || ( aMediaDescriptor.getOrDefault( "SalvagedFile", ::rtl::OUString() ) == i_SalvagedFile ),
+ "SfxBaseModel::recoverDocument: inconsistent information!" );
+ aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile );
+
+ // similar for the to-be-loaded file
+ OSL_ENSURE( !aMediaDescriptor.has( "URL" ) || ( aMediaDescriptor.getOrDefault( "URL", ::rtl::OUString() ) == i_SourceLocation ),
+ "SfxBaseModel::recoverDocument: inconsistent information!" );
+ aMediaDescriptor.put( "URL", i_SourceLocation );
+
+ load( aMediaDescriptor.getPropertyValues() );
+}
+
//________________________________________________________________________________________________________
// XLoadable
//________________________________________________________________________________________________________
@@ -1753,10 +1675,12 @@ void SAL_CALL SfxBaseModel::initNew()
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception)
{
- // object already disposed?
::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ // do not use the SfxModelGuard, it would throw, since we're not yet initialized
+ if ( IsDisposed() )
+ throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this );
+ if ( IsInitialized() )
+ throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this );
// the object shell should exist always
DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" );
@@ -1785,10 +1709,12 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >&
::com::sun::star::uno::RuntimeException,
::com::sun::star::uno::Exception)
{
- // object already disposed?
::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ // do not use the SfxModelGuard, it would throw, since we're not yet initialized
+ if ( IsDisposed() )
+ throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this );
+ if ( IsInitialized() )
+ throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this );
// the object shell should exist always
DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" );
@@ -1951,10 +1877,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor )
::com::sun::star::io::IOException,
::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Any aAny;
@@ -2193,10 +2116,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor )
uno::Sequence< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors()
throw (::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
sal_Int32 nSuppFlavors = GraphicHelper::supportsMetaFileHandle_Impl() ? 10 : 8;
uno::Sequence< DATAFLAVOR > aFlavorSeq( nSuppFlavors );
@@ -2265,10 +2185,7 @@ uno::Sequence< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors()
sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor )
throw (::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) )
{
@@ -2327,10 +2244,7 @@ sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor
uno::Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() throw( uno::RuntimeException )
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( ! m_pData->m_xEvents.is() )
{
@@ -2346,9 +2260,7 @@ uno::Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() thr
uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getBasicLibraries() throw (RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries;
if ( m_pData->m_pObjectShell )
@@ -2358,9 +2270,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g
uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getDialogLibraries() throw (RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries;
if ( m_pData->m_pObjectShell )
@@ -2370,9 +2280,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g
::sal_Bool SAL_CALL SfxBaseModel::getAllowMacroExecution() throw (RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( m_pData->m_pObjectShell )
return m_pData->m_pObjectShell->AdjustMacroMode( String(), false );
@@ -2385,9 +2293,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g
Reference< document::XEmbeddedScripts > SAL_CALL SfxBaseModel::getScriptContainer() throw (RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
Reference< document::XEmbeddedScripts > xDocumentScripts;
@@ -2423,10 +2329,7 @@ Reference< document::XEmbeddedScripts > SAL_CALL SfxBaseModel::getScriptContaine
void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XDOCEVENTLISTENER >& aListener ) throw( uno::RuntimeException )
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0), aListener );
}
@@ -2437,10 +2340,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XDOCEVENTLIS
void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XDOCEVENTLISTENER >& aListener ) throw( uno::RuntimeException )
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0), aListener );
}
@@ -2603,11 +2503,7 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC ,
void SfxBaseModel::changing()
{
- // object already disposed?
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
// the notification should not be sent if the document can not be modified
if ( !m_pData->m_pObjectShell.Is() || !m_pData->m_pObjectShell->IsEnableSetModified() )
@@ -2682,6 +2578,17 @@ sal_Bool SfxBaseModel::IsDisposed() const
return ( m_pData == NULL ) ;
}
+sal_Bool SfxBaseModel::IsInitialized() const
+{
+ if ( !m_pData || !m_pData->m_pObjectShell )
+ {
+ OSL_ENSURE( false, "SfxBaseModel::IsInitialized: this should have been caught earlier!" );
+ return sal_False;
+ }
+
+ return m_pData->m_pObjectShell->GetMedium() != NULL;
+}
+
sal_Bool SfxBaseModel::impl_isDisposed() const
{
return ( m_pData == NULL ) ;
@@ -2949,10 +2856,7 @@ void SfxBaseModel::postEvent_Impl( ::rtl::OUString aName )
uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( m_pData->m_pObjectShell.Is() && !m_pData->m_contViewData.is() )
{
@@ -2995,10 +2899,7 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData()
void SAL_CALL SfxBaseModel::setViewData( const uno::Reference < container::XIndexAccess >& aData ) throw(::com::sun::star::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
m_pData->m_contViewData = aData;
}
@@ -3038,10 +2939,7 @@ sal_Bool SfxBaseModel::hasEventListeners() const
void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
if ( impl_getPrintHelper() )
{
@@ -3055,10 +2953,7 @@ void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPr
void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
if ( impl_getPrintHelper() )
{
@@ -3076,8 +2971,8 @@ void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view::
class SvObject;
sal_Int64 SAL_CALL SfxBaseModel::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( !impl_isDisposed() && GetObjectShell() )
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
+ if ( GetObjectShell() )
{
SvGlobalName aName( aIdentifier );
if ( aName == SvGlobalName( SO3_GLOBAL_CLASSID ) )
@@ -3111,9 +3006,7 @@ void SfxBaseModel::ListenForStorage_Impl( const uno::Reference< embed::XStorage
uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentSubStorage( const ::rtl::OUString& aStorageName, sal_Int32 nMode )
throw ( uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< XSTORAGE > xResult;
if ( m_pData->m_pObjectShell.Is() )
@@ -3138,9 +3031,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames()
throw ( io::IOException,
RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
Sequence< ::rtl::OUString > aResult;
sal_Int32 nResultSize = 0;
@@ -3179,9 +3070,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames()
uno::Reference< script::provider::XScriptProvider > SAL_CALL SfxBaseModel::getScriptProvider()
throw ( uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< script::provider::XScriptProvider > xScriptProvider;
@@ -3287,9 +3176,7 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, uno::Reference< contai
uno::Reference< ui::XUIConfigurationManager > SAL_CALL SfxBaseModel::getUIConfigurationManager()
throw ( uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( !m_pData->m_xUIConfigurationManager.is() )
{
@@ -3405,9 +3292,7 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz
uno::Exception,
uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( !m_pData->m_pObjectShell.Is() )
throw uno::Exception(); // TODO: error handling
@@ -3439,9 +3324,7 @@ awt::Size SAL_CALL SfxBaseModel::getVisualAreaSize( sal_Int64 /*nAspect*/ )
uno::Exception,
uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( !m_pData->m_pObjectShell.Is() )
throw uno::Exception(); // TODO: error handling
@@ -3470,9 +3353,7 @@ sal_Int32 SAL_CALL SfxBaseModel::getMapUnit( sal_Int64 /*nAspect*/ )
throw ( uno::Exception,
uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( !m_pData->m_pObjectShell.Is() )
throw uno::Exception(); // TODO: error handling
@@ -3486,9 +3367,7 @@ embed::VisualRepresentation SAL_CALL SfxBaseModel::getPreferredVisualRepresentat
uno::Exception,
uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
datatransfer::DataFlavor aDataFlavor(
::rtl::OUString::createFromAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ),
@@ -3515,43 +3394,36 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const uno::Reference< XSTORAGE >& x
uno::RuntimeException )
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
-
- if ( !m_pData->m_pObjectShell.Is() )
- throw IOEXCEPTION(); // TODO:
+ // do not use the SfxModelGuard, it would throw, since we're not yet initialized
+ if ( IsDisposed() )
+ throw ::com::sun::star::lang::DisposedException( ::rtl::OUString(), *this );
+ if ( IsInitialized() )
+ throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this );
+
+ // after i36090 is fixed the pool from object shell can be used
+ // SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() );
+ SfxAllItemSet aSet( SFX_APP()->GetPool() );
+
+ // the BaseURL is part of the ItemSet
+ SfxMedium* pMedium = new SfxMedium( xStorage, String() );
+ TransformParameters( SID_OPENDOC, aMediaDescriptor, aSet );
+ pMedium->GetItemSet()->Put( aSet );
+
+ // allow to use an interactionhandler (if there is one)
+ pMedium->UseInteractionHandler( TRUE );
+
+ SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False);
+ BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue();
+ m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC );
+ m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE;
- if ( m_pData->m_pObjectShell.Is() )
+ // load document
+ if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
{
- if( m_pData->m_pObjectShell->GetMedium() )
- // if a Medium is present, the document is already initialized
- throw DOUBLEINITIALIZATIONEXCEPTION();
-
- // after i36090 is fixed the pool from object shell can be used
- // SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() );
- SfxAllItemSet aSet( SFX_APP()->GetPool() );
-
- // the BaseURL is part of the ItemSet
- SfxMedium* pMedium = new SfxMedium( xStorage, String() );
- TransformParameters( SID_OPENDOC, aMediaDescriptor, aSet );
- pMedium->GetItemSet()->Put( aSet );
-
- // allow to use an interactionhandler (if there is one)
- pMedium->UseInteractionHandler( TRUE );
-
- SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False);
- BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue();
- m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC );
- m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE;
-
- // load document
- if ( !m_pData->m_pObjectShell->DoLoad(pMedium) )
- {
- sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
- throw task::ErrorCodeIOException( ::rtl::OUString(),
- uno::Reference< uno::XInterface >(),
- nError ? nError : ERRCODE_IO_CANTREAD );
- }
+ sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
+ throw task::ErrorCodeIOException( ::rtl::OUString(),
+ uno::Reference< uno::XInterface >(),
+ nError ? nError : ERRCODE_IO_CANTREAD );
}
}
@@ -3562,9 +3434,7 @@ void SAL_CALL SfxBaseModel::storeToStorage( const uno::Reference< XSTORAGE >& xS
EXCEPTION,
uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< XSTORAGE > xResult;
if ( !m_pData->m_pObjectShell.Is() )
@@ -3625,9 +3495,7 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x
EXCEPTION,
uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< XSTORAGE > xResult;
if ( !m_pData->m_pObjectShell.Is() )
@@ -3651,9 +3519,7 @@ uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentStorage()
EXCEPTION,
uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
uno::Reference< XSTORAGE > xResult;
if ( !m_pData->m_pObjectShell.Is() )
@@ -3666,9 +3532,7 @@ void SAL_CALL SfxBaseModel::addStorageChangeListener(
const uno::Reference< document::XStorageChangeListener >& xListener )
throw ( uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
m_pData->m_aInterfaceContainer.addInterface(
::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener );
@@ -3678,9 +3542,7 @@ void SAL_CALL SfxBaseModel::removeStorageChangeListener(
const uno::Reference< document::XStorageChangeListener >& xListener )
throw ( uno::RuntimeException )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
m_pData->m_aInterfaceContainer.removeInterface(
::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener );
@@ -3706,9 +3568,7 @@ bool SfxBaseModel::impl_getPrintHelper()
void SAL_CALL SfxBaseModel::setIdentifier(const ::rtl::OUString& Identifier)
throw (css::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
m_pData->m_sModuleIdentifier = Identifier;
}
@@ -3717,9 +3577,7 @@ bool SfxBaseModel::impl_getPrintHelper()
::rtl::OUString SAL_CALL SfxBaseModel::getIdentifier()
throw (css::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return ::rtl::OUString();
+ SfxModelGuard aGuard( *this );
if (m_pData->m_sModuleIdentifier.getLength() > 0)
return m_pData->m_sModuleIdentifier;
if (m_pData->m_pObjectShell)
@@ -3730,10 +3588,7 @@ bool SfxBaseModel::impl_getPrintHelper()
//=============================================================================
css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper ()
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- if ( impl_isDisposed() )
- return css::uno::Reference< css::frame::XTitle >();
+ SfxModelGuard aGuard( *this );
if ( ! m_pData->m_xTitleHelper.is ())
{
@@ -3753,10 +3608,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper ()
//=============================================================================
css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitledHelper ()
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- if ( impl_isDisposed() )
- return css::uno::Reference< css::frame::XUntitledNumbers >();
+ SfxModelGuard aGuard( *this );
if ( ! m_pData->m_xNumberedControllers.is ())
{
@@ -3778,10 +3630,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl
throw (css::uno::RuntimeException)
{
// SYNCHRONIZED ->
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- if ( impl_isDisposed() )
- return ::rtl::OUString();
+ SfxModelGuard aGuard( *this );
::rtl::OUString aResult = impl_getTitleHelper()->getTitle ();
if ( m_pData->m_pObjectShell )
@@ -3812,10 +3661,7 @@ void SAL_CALL SfxBaseModel::setTitle( const ::rtl::OUString& sTitle )
throw (css::uno::RuntimeException)
{
// SYNCHRONIZED ->
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
impl_getTitleHelper()->setTitle (sTitle);
}
@@ -3826,10 +3672,7 @@ void SAL_CALL SfxBaseModel::addTitleChangeListener( const css::uno::Reference< c
throw (css::uno::RuntimeException)
{
// SYNCHRONIZED ->
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING );
css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY);
if (xBroadcaster.is ())
@@ -3842,10 +3685,7 @@ void SAL_CALL SfxBaseModel::removeTitleChangeListener( const css::uno::Reference
throw (css::uno::RuntimeException)
{
// SYNCHRONIZED ->
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
- if ( impl_isDisposed() )
- return;
+ SfxModelGuard aGuard( *this );
css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY);
if (xBroadcaster.is ())
@@ -3858,10 +3698,7 @@ void SAL_CALL SfxBaseModel::removeTitleChangeListener( const css::uno::Reference
throw (css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return css::frame::UntitledNumbersConst::INVALID_NUMBER;
+ SfxModelGuard aGuard( *this );
return impl_getUntitledHelper ()->leaseNumber (xComponent);
}
@@ -3872,11 +3709,7 @@ void SAL_CALL SfxBaseModel::releaseNumber( ::sal_Int32 nNumber )
throw (css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
-
+ SfxModelGuard aGuard( *this );
impl_getUntitledHelper ()->releaseNumber (nNumber);
}
@@ -3886,11 +3719,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference
throw (css::lang::IllegalArgumentException,
css::uno::RuntimeException )
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return;
-
+ SfxModelGuard aGuard( *this );
impl_getUntitledHelper ()->releaseNumberForComponent (xComponent);
}
@@ -3899,11 +3728,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference
::rtl::OUString SAL_CALL SfxBaseModel::getUntitledPrefix()
throw (css::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return ::rtl::OUString ();
-
+ SfxModelGuard aGuard( *this );
return impl_getUntitledHelper ()->getUntitledPrefix ();
}
@@ -3912,10 +3737,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference
css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getControllers()
throw (css::uno::RuntimeException)
{
- // object already disposed?
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- return css::uno::Reference< css::container::XEnumeration >();
+ SfxModelGuard aGuard( *this );
sal_Int32 c = m_pData->m_seqControllers.getLength();
sal_Int32 i = 0;
@@ -3933,9 +3755,7 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getCo
css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewControllerNames()
throw (css::uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory();
const sal_Int32 nViewFactoryCount = rDocumentFactory.GetViewFactoryCount();
@@ -3953,9 +3773,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDef
css::lang::IllegalArgumentException,
css::uno::Exception )
{
- ::vos::OClearableGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory();
const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetViewName();
@@ -4071,9 +3889,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie
css::lang::IllegalArgumentException,
css::uno::Exception )
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
if ( !i_rFrame.is() )
throw css::lang::IllegalArgumentException( ::rtl::OUString(), *this, 3 );
@@ -4159,9 +3975,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie
uno::Reference< rdf::XRepository > SAL_CALL
SfxBaseModel::getRDFRepository() throw (uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4176,9 +3990,7 @@ SfxBaseModel::getRDFRepository() throw (uno::RuntimeException)
::rtl::OUString SAL_CALL
SfxBaseModel::getStringValue() throw (uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4193,9 +4005,7 @@ SfxBaseModel::getStringValue() throw (uno::RuntimeException)
::rtl::OUString SAL_CALL
SfxBaseModel::getNamespace() throw (uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4209,9 +4019,7 @@ SfxBaseModel::getNamespace() throw (uno::RuntimeException)
::rtl::OUString SAL_CALL
SfxBaseModel::getLocalName() throw (uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4228,9 +4036,7 @@ SfxBaseModel::getElementByMetadataReference(
const ::com::sun::star::beans::StringPair & i_rReference)
throw (uno::RuntimeException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4245,9 +4051,7 @@ uno::Reference< rdf::XMetadatable > SAL_CALL
SfxBaseModel::getElementByURI(const uno::Reference< rdf::XURI > & i_xURI)
throw (uno::RuntimeException, lang::IllegalArgumentException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4263,9 +4067,7 @@ SfxBaseModel::getMetadataGraphsWithType(
const uno::Reference<rdf::XURI> & i_xType)
throw (uno::RuntimeException, lang::IllegalArgumentException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4282,9 +4084,7 @@ SfxBaseModel::addMetadataFile(const ::rtl::OUString & i_rFileName,
throw (uno::RuntimeException, lang::IllegalArgumentException,
container::ElementExistException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4305,9 +4105,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
datatransfer::UnsupportedFlavorException,
container::ElementExistException, rdf::ParseException, io::IOException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4325,9 +4123,7 @@ SfxBaseModel::removeMetadataFile(
throw (uno::RuntimeException, lang::IllegalArgumentException,
container::NoSuchElementException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4343,9 +4139,7 @@ SfxBaseModel::addContentOrStylesFile(const ::rtl::OUString & i_rFileName)
throw (uno::RuntimeException, lang::IllegalArgumentException,
container::ElementExistException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4361,9 +4155,7 @@ SfxBaseModel::removeContentOrStylesFile(const ::rtl::OUString & i_rFileName)
throw (uno::RuntimeException, lang::IllegalArgumentException,
container::NoSuchElementException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4382,9 +4174,7 @@ SfxBaseModel::loadMetadataFromStorage(
throw (uno::RuntimeException, lang::IllegalArgumentException,
lang::WrappedTargetException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(
m_pData->CreateDMAUninitialized());
@@ -4412,9 +4202,7 @@ SfxBaseModel::storeMetadataToStorage(
throw (uno::RuntimeException, lang::IllegalArgumentException,
lang::WrappedTargetException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {
@@ -4431,9 +4219,7 @@ SfxBaseModel::loadMetadataFromMedium(
throw (uno::RuntimeException, lang::IllegalArgumentException,
lang::WrappedTargetException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(
m_pData->CreateDMAUninitialized());
@@ -4460,9 +4246,7 @@ SfxBaseModel::storeMetadataToMedium(
throw (uno::RuntimeException, lang::IllegalArgumentException,
lang::WrappedTargetException)
{
- ::vos::OGuard aGuard( Application::GetSolarMutex() );
- if ( impl_isDisposed() )
- throw lang::DisposedException();
+ SfxModelGuard aGuard( *this );
const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA());
if (!xDMA.is()) {