diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2010-08-24 15:50:24 +0200 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2010-08-24 15:50:24 +0200 |
commit | d2ab8942a1b6ab8507dbf4c8b3042991558eb44c (patch) | |
tree | 3b6eb16a5b13f87d38aec614b4921f016d57f8b8 /vbahelper | |
parent | 17b2a94d5109b82392538c943696aab254c00879 (diff) |
mib19: #163216# handle the case when the model is already disposed
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbadocumentbase.cxx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 6023be1fd9d2..ad7ea62cd613 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -28,6 +28,8 @@ #include "vbahelper/vbadocumentbase.hxx" #include "vbahelper/helperdecl.hxx" +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XProtectable.hpp> #include <com/sun/star/util/XCloseable.hpp> @@ -36,6 +38,7 @@ #include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn #include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/exc_hlp.hxx> #include <comphelper/unwrapargs.hxx> #include <tools/urlobj.hxx> #include <osl/file.hxx> @@ -182,7 +185,22 @@ void VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException) { uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - xModifiable->setModified( !bSave ); + try + { + xModifiable->setModified( !bSave ); + } + catch ( lang::DisposedException& ) + { + // impossibility to set the modified state on disposed document should not trigger an error + } + catch ( beans::PropertyVetoException& ) + { + uno::Any aCaught( ::cppu::getCaughtException() ); + throw lang::WrappedTargetRuntimeException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't change modified state of model!" ) ), + uno::Reference< uno::XInterface >(), + aCaught ); + } } sal_Bool |