1*bbfc4cc7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*bbfc4cc7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*bbfc4cc7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*bbfc4cc7SAndrew Rist  * distributed with this work for additional information
6*bbfc4cc7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*bbfc4cc7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*bbfc4cc7SAndrew Rist  * "License"); you may not use this file except in compliance
9*bbfc4cc7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*bbfc4cc7SAndrew Rist  *
11*bbfc4cc7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*bbfc4cc7SAndrew Rist  *
13*bbfc4cc7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*bbfc4cc7SAndrew Rist  * software distributed under the License is distributed on an
15*bbfc4cc7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*bbfc4cc7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*bbfc4cc7SAndrew Rist  * specific language governing permissions and limitations
18*bbfc4cc7SAndrew Rist  * under the License.
19*bbfc4cc7SAndrew Rist  *
20*bbfc4cc7SAndrew Rist  *************************************************************/
21*bbfc4cc7SAndrew Rist 
22*bbfc4cc7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _UNOSTORAGEHOLDER_HXX
25cdf0e10cSrcweir #define _UNOSTORAGEHOLDER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/embed/XTransactionListener.hpp>
28cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <unotools/tempfile.hxx>
31cdf0e10cSrcweir #include <sot/storage.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class SotStorage;
34cdf0e10cSrcweir class UNOStorageHolder : public ::cppu::WeakImplHelper1<
35cdf0e10cSrcweir 					  	::com::sun::star::embed::XTransactionListener >
36cdf0e10cSrcweir 
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	SotStorage* m_pParentStorage;					// parent storage
39cdf0e10cSrcweir 	SotStorageRef m_rSotStorage;					// original substorage
40cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xStorage;	// duplicate storage
41cdf0e10cSrcweir 	::utl::TempFile* m_pTempFile;					// temporary file used by duplicate storage
42cdf0e10cSrcweir 
43cdf0e10cSrcweir public:
44cdf0e10cSrcweir 	UNOStorageHolder( SotStorage& aParentStorage,
45cdf0e10cSrcweir 					  SotStorage& aStorage,
46cdf0e10cSrcweir 					  ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > xStorage,
47cdf0e10cSrcweir 					  ::utl::TempFile* pTempFile );
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 	void InternalDispose();
50cdf0e10cSrcweir 	String GetStorageName();
51cdf0e10cSrcweir 
GetDuplicateStorage()52cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetDuplicateStorage() { return m_xStorage; }
53cdf0e10cSrcweir 
54cdf0e10cSrcweir     virtual void SAL_CALL preCommit( const ::com::sun::star::lang::EventObject& aEvent )
55cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::Exception,
56cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException );
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     virtual void SAL_CALL commited( const ::com::sun::star::lang::EventObject& aEvent )
59cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     virtual void SAL_CALL preRevert( const ::com::sun::star::lang::EventObject& aEvent )
62cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::Exception,
63cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException );
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     virtual void SAL_CALL reverted( const ::com::sun::star::lang::EventObject& aEvent )
66cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
69cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
70cdf0e10cSrcweir };
71cdf0e10cSrcweir 
72cdf0e10cSrcweir #endif
73cdf0e10cSrcweir 
74