summaryrefslogtreecommitdiff
path: root/sot/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-08-24 22:57:23 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-08-25 09:42:06 +0100
commit2d1c4141bafea812c9db2db5cb8bf0b248b05242 (patch)
treea37f3e2b04809c6afbc046dca5116da4a388949c /sot/source
parentac1530a37e4544378c22c9358e57ca8a596c1aa8 (diff)
UnoStorageHolder is never ctored, follow logical consequences of that
Diffstat (limited to 'sot/source')
-rw-r--r--sot/source/sdstor/storage.cxx21
-rw-r--r--sot/source/sdstor/ucbstorage.cxx30
-rw-r--r--sot/source/sdstor/unostorageholder.cxx199
-rw-r--r--sot/source/sdstor/unostorageholder.hxx79
4 files changed, 0 insertions, 329 deletions
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index d2e3cd701ab5..593de587e5d0 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -50,8 +50,6 @@
#include <unotools/ucbhelper.hxx>
#include <comphelper/processfactory.hxx>
-#include "unostorageholder.hxx"
-
using namespace ::com::sun::star;
/************** class SotStorageStream ***********************************/
@@ -711,25 +709,6 @@ SotStorage::~SotStorage()
}
/*************************************************************************
-|* SotStorage::RemoveUNOStorageHolder()
-|*
-|* Beschreibung
-*************************************************************************/
-void SotStorage::RemoveUNOStorageHolder( UNOStorageHolder* pHolder )
-{
- UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg );
- if ( pStg )
- {
- pStg->GetUNOStorageHolderList()->remove( pHolder );
- pHolder->release();
- }
- else
- {
- OSL_FAIL("Not implemented!");
- }
-}
-
-/*************************************************************************
|* SotStorage::CreateMemoryStream()
|*
|* Beschreibung
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index dfc5024889a3..6f95d2aa74a5 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -73,8 +73,6 @@
#include <sot/formats.hxx>
#include "sot/clsids.hxx"
-#include "unostorageholder.hxx"
-
#include <vector>
using namespace ::com::sun::star::lang;
@@ -513,7 +511,6 @@ public:
sal_Bool m_bRepairPackage;
Reference< XProgressHandler > m_xProgressHandler;
- UNOStorageHolderList* m_pUNOStorageHolderList;
UCBStorage_Impl( const ::ucbhelper::Content&, const String&, StreamMode, UCBStorage*, sal_Bool, sal_Bool, sal_Bool = sal_False, Reference< XProgressHandler > = Reference< XProgressHandler >() );
UCBStorage_Impl( const String&, StreamMode, UCBStorage*, sal_Bool, sal_Bool, sal_Bool = sal_False, Reference< XProgressHandler > = Reference< XProgressHandler >() );
UCBStorage_Impl( SvStream&, UCBStorage*, sal_Bool );
@@ -1662,8 +1659,6 @@ UCBStorage_Impl::UCBStorage_Impl( const ::ucbhelper::Content& rContent, const St
, m_aClassId( SvGlobalName() )
, m_bRepairPackage( bIsRepair )
, m_xProgressHandler( xProgressHandler )
- , m_pUNOStorageHolderList( NULL )
-
{
String aName( rName );
if( !aName.Len() )
@@ -1697,7 +1692,6 @@ UCBStorage_Impl::UCBStorage_Impl( const String& rName, StreamMode nMode, UCBStor
, m_aClassId( SvGlobalName() )
, m_bRepairPackage( bIsRepair )
, m_xProgressHandler( xProgressHandler )
- , m_pUNOStorageHolderList( NULL )
{
String aName( rName );
if( !aName.Len() )
@@ -1748,7 +1742,6 @@ UCBStorage_Impl::UCBStorage_Impl( SvStream& rStream, UCBStorage* pStorage, sal_B
, m_nFormat( 0 )
, m_aClassId( SvGlobalName() )
, m_bRepairPackage( sal_False )
- , m_pUNOStorageHolderList( NULL )
{
// opening in direct mode is too fuzzy because the data is transferred to the stream in the Commit() call,
// which will be called in the storages' dtor
@@ -2176,21 +2169,6 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < Propert
UCBStorage_Impl::~UCBStorage_Impl()
{
- if ( m_pUNOStorageHolderList )
- {
- for ( UNOStorageHolderList::iterator aIter = m_pUNOStorageHolderList->begin();
- aIter != m_pUNOStorageHolderList->end(); ++aIter )
- if ( *aIter )
- {
- (*aIter)->InternalDispose();
- (*aIter)->release();
- (*aIter) = NULL;
- }
-
- m_pUNOStorageHolderList->clear();
- DELETEZ( m_pUNOStorageHolderList );
- }
-
// first delete elements!
for ( size_t i = 0, n = m_aChildrenList.size(); i < n; ++i )
delete m_aChildrenList[ i ];
@@ -3512,12 +3490,4 @@ sal_Bool UCBStorage::GetProperty( const String& rEleName, const String& rName, :
return sal_False;
}
-UNOStorageHolderList* UCBStorage::GetUNOStorageHolderList()
-{
- if ( !pImp->m_pUNOStorageHolderList )
- pImp->m_pUNOStorageHolderList = new UNOStorageHolderList;
-
- return pImp->m_pUNOStorageHolderList;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/sdstor/unostorageholder.cxx b/sot/source/sdstor/unostorageholder.cxx
deleted file mode 100644
index dbb54e08cd4d..000000000000
--- a/sot/source/sdstor/unostorageholder.cxx
+++ /dev/null
@@ -1,199 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sot.hxx"
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include <comphelper/processfactory.hxx>
-
-#include "unostorageholder.hxx"
-#include "sot/storinfo.hxx"
-
-
-using namespace ::com::sun::star;
-
-UNOStorageHolder::UNOStorageHolder( SotStorage& aParentStorage,
- SotStorage& aStorage,
- uno::Reference< embed::XStorage > xStorage,
- ::utl::TempFile* pTempFile )
-: m_pParentStorage( &aParentStorage )
-, m_rSotStorage( &aStorage )
-, m_xStorage( xStorage )
-, m_pTempFile( pTempFile )
-{
- OSL_ENSURE( m_xStorage.is() && m_pTempFile, "Wrong initialization!\n" );
- if ( !m_xStorage.is() || !m_pTempFile )
- throw uno::RuntimeException();
-
- uno::Reference< embed::XTransactionBroadcaster > xTrBroadcast( m_xStorage, uno::UNO_QUERY );
- if ( !xTrBroadcast.is() )
- throw uno::RuntimeException();
-
- xTrBroadcast->addTransactionListener( (embed::XTransactionListener*)this );
-}
-
-void UNOStorageHolder::InternalDispose()
-{
- uno::Reference< embed::XTransactionBroadcaster > xTrBroadcast( m_xStorage, uno::UNO_QUERY );
- if ( xTrBroadcast.is() )
- xTrBroadcast->removeTransactionListener( (embed::XTransactionListener*)this );
-
- uno::Reference< lang::XComponent > xComponent( m_xStorage, uno::UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
- m_xStorage = uno::Reference< embed::XStorage >();
-
- if ( m_pParentStorage )
- m_pParentStorage = NULL;
-
- if ( m_pTempFile )
- {
- delete m_pTempFile;
- m_pTempFile = NULL;
- }
-
- if ( m_rSotStorage.Is() )
- m_rSotStorage = NULL;
-}
-
-String UNOStorageHolder::GetStorageName()
-{
- if ( m_rSotStorage.Is() )
- return m_rSotStorage->GetName();
-
- return String();
-}
-
-void SAL_CALL UNOStorageHolder::preCommit( const lang::EventObject& /*aEvent*/ )
- throw ( uno::Exception,
- uno::RuntimeException )
-{
- // do nothing
-}
-
-void SAL_CALL UNOStorageHolder::commited( const lang::EventObject& /*aEvent*/ )
- throw ( uno::RuntimeException )
-{
- ::utl::TempFile aTmpStorFile;
- if ( !aTmpStorFile.GetURL().Len() )
- throw uno::RuntimeException();
-
- uno::Reference< lang::XSingleServiceFactory > xStorageFactory(
- ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory")) ),
- uno::UNO_QUERY );
-
- OSL_ENSURE( xStorageFactory.is(), "Can't create storage factory!\n" );
- if ( !xStorageFactory.is() )
- throw uno::RuntimeException();
-
- uno::Sequence< uno::Any > aArg( 2 );
- aArg[0] <<= ::rtl::OUString( aTmpStorFile.GetURL() );
- aArg[1] <<= embed::ElementModes::READWRITE;
- uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArg ), uno::UNO_QUERY );
-
- OSL_ENSURE( xTempStorage.is(), "Can't open storage!\n" );
- if ( !xTempStorage.is() )
- throw uno::RuntimeException();
-
- m_xStorage->copyToStorage( xTempStorage );
-
- uno::Reference< lang::XComponent > xComp( xTempStorage, uno::UNO_QUERY );
- if ( !xComp.is() )
- throw uno::RuntimeException();
-
- xComp->dispose();
-
- SotStorageRef rTempStorage = new SotStorage( sal_True, aTmpStorFile.GetURL(), STREAM_WRITE, STORAGE_TRANSACTED );
- if ( !rTempStorage.Is() || rTempStorage->GetError() != ERRCODE_NONE )
- throw uno::RuntimeException();
-
- SvStorageInfoList aSubStorInfoList;
- m_rSotStorage->FillInfoList( &aSubStorInfoList );
- for ( sal_uInt32 nInd = 0; nInd < aSubStorInfoList.size(); nInd++ )
- {
- m_rSotStorage->Remove( aSubStorInfoList[nInd].GetName() );
- if ( m_rSotStorage->GetError() )
- {
- m_rSotStorage->ResetError();
- throw uno::RuntimeException();
- }
- }
-
- rTempStorage->CopyTo( m_rSotStorage );
-
- // CopyTo does not transport unknown media type
- // just workaround it
- uno::Any aMediaType;
- if ( rTempStorage->GetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aMediaType ) )
- m_rSotStorage->SetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aMediaType );
-
- m_rSotStorage->Commit();
-}
-
-void SAL_CALL UNOStorageHolder::preRevert( const lang::EventObject& /*aEvent*/ )
- throw ( uno::Exception,
- uno::RuntimeException )
-{
- // do nothing
-}
-
-void SAL_CALL UNOStorageHolder::reverted( const lang::EventObject& /*aEvent*/ )
- throw ( uno::RuntimeException )
-{
- // do nothing, since reverting of the duplicate storage just means
- // not to copy changes done for it to the original storage
-}
-
-void SAL_CALL UNOStorageHolder::disposing( const lang::EventObject& /*Source*/ )
- throw ( uno::RuntimeException )
-{
- if ( m_pTempFile )
- {
- delete m_pTempFile;
- m_pTempFile = NULL;
- }
-
- if ( m_rSotStorage.Is() )
- m_rSotStorage = NULL;
-
- if ( m_pParentStorage )
- {
- SotStorage* pTmp = m_pParentStorage;
- m_pParentStorage = NULL;
- pTmp->RemoveUNOStorageHolder( this ); // this statement can lead to destruction of the holder
- }
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sot/source/sdstor/unostorageholder.hxx b/sot/source/sdstor/unostorageholder.hxx
deleted file mode 100644
index 13743c64447e..000000000000
--- a/sot/source/sdstor/unostorageholder.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _UNOSTORAGEHOLDER_HXX
-#define _UNOSTORAGEHOLDER_HXX
-
-#include <com/sun/star/embed/XTransactionListener.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-#include <unotools/tempfile.hxx>
-#include <sot/storage.hxx>
-
-class SotStorage;
-class UNOStorageHolder : public ::cppu::WeakImplHelper1<
- ::com::sun::star::embed::XTransactionListener >
-
-{
- SotStorage* m_pParentStorage; // parent storage
- SotStorageRef m_rSotStorage; // original substorage
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xStorage; // duplicate storage
- ::utl::TempFile* m_pTempFile; // temporary file used by duplicate storage
-
-public:
- UNOStorageHolder( SotStorage& aParentStorage,
- SotStorage& aStorage,
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > xStorage,
- ::utl::TempFile* pTempFile );
-
- void InternalDispose();
- String GetStorageName();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetDuplicateStorage() { return m_xStorage; }
-
- virtual void SAL_CALL preCommit( const ::com::sun::star::lang::EventObject& aEvent )
- throw ( ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL commited( const ::com::sun::star::lang::EventObject& aEvent )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL preRevert( const ::com::sun::star::lang::EventObject& aEvent )
- throw ( ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
- throw ( ::com::sun::star::uno::RuntimeException );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */