summaryrefslogtreecommitdiff
path: root/package/source/xstor/xstorage.cxx
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2004-10-04 20:08:31 +0000
committerKurt Zenker <kz@openoffice.org>2004-10-04 20:08:31 +0000
commit205ad3957342ec96995118d04bb1d70bcbd56d7a (patch)
tree41f426d15ea9e7edb48899ae24a9edf0c080b043 /package/source/xstor/xstorage.cxx
parent413df9c430d73db0e13c292a43f8bb94570d1a74 (diff)
INTEGRATION: CWS mav09 (1.6.28); FILE MERGED
2004/09/17 00:04:41 mav 1.6.28.14: RESYNC: (1.9-1.12); FILE MERGED 2004/09/02 12:01:52 mav 1.6.28.13: #i27773# allow to copy element to the same storage 2004/08/25 11:48:40 mav 1.6.28.12: #i27773# substorage must also implement XTransactionBroadcaster 2004/08/25 11:41:04 mav 1.6.28.11: #i27773# substorage must also implement XTransactionBroadcaster 2004/08/09 19:17:23 mav 1.6.28.10: RESYNC: (1.8-1.9); FILE MERGED 2004/08/06 09:55:46 mav 1.6.28.9: #i26216# handle empty storages in a special way 2004/08/05 11:18:46 mav 1.6.28.8: #i26216# allow to commit empty folders 2004/07/15 10:55:44 mav 1.6.28.7: #i27773# notification about corruption 2004/07/08 15:57:09 mav 1.6.28.6: RESYNC: (1.7-1.8); FILE MERGED 2004/07/05 09:45:57 mav 1.6.28.5: #i27773# wrap the original exception 2004/06/21 08:46:23 mav 1.6.28.4: #i30400# do not ignore target name 2004/05/17 17:47:24 mav 1.6.28.3: RESYNC: (1.6-1.7); FILE MERGED 2004/05/16 17:33:59 mba 1.6.28.2: #i27773#: problems when opening storage several times in different modes 2004/05/10 08:04:27 mba 1.6.28.1: #i27773#: typo in property name
Diffstat (limited to 'package/source/xstor/xstorage.cxx')
-rw-r--r--package/source/xstor/xstorage.cxx46
1 files changed, 38 insertions, 8 deletions
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 9bb8092a2..3931bdbf8 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xstorage.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: kz $ $Date: 2004-08-31 12:45:26 $
+ * last change: $Author: kz $ $Date: 2004-10-04 21:08:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,6 +66,9 @@
#ifndef _COM_SUN_STAR_EMBED_ELEMENTMODES_HPP_
#include <com/sun/star/embed/ElementModes.hpp>
#endif
+#ifndef _COM_SUN_STAR_EMBED_USEBACKUPEXCEPTION_HPP_
+#include <com/sun/star/embed/UseBackupException.hpp>
+#endif
#ifndef _COM_SUN_STAR_UCB_XPROGRESSHANDLER_HPP_
#include <com/sun/star/ucb/XProgressHandler.hpp>
@@ -286,6 +289,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream,
, m_xFactory( xFactory )
, m_xStream( xStream )
, m_xProperties( xProperties )
+, m_bHasCommonPassword( sal_False )
, m_pParent( NULL )
, m_bControlMediaType( sal_False )
{
@@ -320,6 +324,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent,
, m_xPackageFolder( xPackageFolder )
, m_xPackage( xPackage )
, m_xFactory( xFactory )
+, m_bHasCommonPassword( sal_False )
, m_pParent( pParent ) // can be empty in case of temporary readonly substorages
, m_bControlMediaType( sal_False )
{
@@ -762,6 +767,16 @@ void OStorage_Impl::Commit()
{
::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
+ if ( !m_bListCreated )
+ {
+ // nothing was changed, but a new empty storage must be marked as commited one
+ ReadContents();
+ if ( !m_bIsRoot && !m_aChildrenList.size() )
+ m_bCommited = sal_True;
+
+ return;
+ }
+
// if storage is commited it should have a valid Package representation
OSL_ENSURE( m_xPackageFolder.is(), "The package representation should exist!\n" );
if ( !m_xPackageFolder.is() )
@@ -936,7 +951,23 @@ void OStorage_Impl::Commit()
if ( !xChangesBatch.is() )
throw uno::RuntimeException(); // TODO
- xChangesBatch->commitChanges();
+ try
+ {
+ xChangesBatch->commitChanges();
+ }
+ catch( lang::WrappedTargetException& r )
+ {
+ // the wrapped UseBackupException means that the target medium can be corrupted
+ embed::UseBackupException aException;
+ if ( r.TargetException >>= aException )
+ {
+ m_xStream = uno::Reference< io::XStream >();
+ m_xInputStream = uno::Reference< io::XInputStream >();
+ throw aException;
+ }
+
+ throw;
+ }
}
else if ( !m_bCommited )
{
@@ -1624,6 +1655,7 @@ uno::Any SAL_CALL OStorage::queryInterface( const uno::Type& rType )
, static_cast<lang::XTypeProvider*> ( this )
, static_cast<embed::XStorage*> ( this )
, static_cast<embed::XTransactedObject*> ( this )
+ , static_cast<embed::XTransactionBroadcaster*> ( this )
, static_cast<util::XModifiable*> ( this )
, static_cast<container::XNameAccess*> ( this )
, static_cast<container::XElementAccess*> ( this )
@@ -1682,6 +1714,7 @@ uno::Sequence< uno::Type > SAL_CALL OStorage::getTypes()
( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL )
, ::getCppuType( ( const uno::Reference< embed::XStorage >* )NULL )
, ::getCppuType( ( const uno::Reference< embed::XTransactedObject >* )NULL )
+ , ::getCppuType( ( const uno::Reference< embed::XTransactionBroadcaster >* )NULL )
, ::getCppuType( ( const uno::Reference< util::XModifiable >* )NULL )
// , ::getCppuType( ( const uno::Reference< container::XNameAccess >* )NULL )
// , ::getCppuType( ( const uno::Reference< lang::XComponent >* )NULL )
@@ -2185,8 +2218,8 @@ void SAL_CALL OStorage::copyElementTo( const ::rtl::OUString& aElementName,
if ( !m_pImpl )
throw lang::DisposedException();
- if ( !aElementName.getLength() || !aNewName.getLength()
- || !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) )
+ if ( !aElementName.getLength() || !aNewName.getLength() || !xDest.is() )
+ // || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ), uno::UNO_QUERY ) )
throw lang::IllegalArgumentException();
SotElement_Impl* pElement = m_pImpl->FindElement( aElementName );
@@ -2290,9 +2323,6 @@ void SAL_CALL OStorage::commit()
if ( m_pData->m_bReadOnlyWrap )
throw io::IOException(); // TODO: access_denied
- if ( !m_pImpl->m_bListCreated )
- return; // nothing was changed
-
try {
BroadcastTransaction( STOR_MESS_PRECOMMIT );
m_pImpl->Commit(); // the root storage initiates the storing to source