xref: /AOO41X/main/sot/source/unoolestorage/xolesimplestorage.hxx (revision bbfc4cc7abdab5a8f4a1ef75ba4f9b278c9ffcde)
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
10cdf0e10cSrcweir  *
11*bbfc4cc7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
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.
19cdf0e10cSrcweir  *
20*bbfc4cc7SAndrew Rist  *************************************************************/
21*bbfc4cc7SAndrew Rist 
22*bbfc4cc7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef __XOLESIMPLESTORAGE_HXX_
25cdf0e10cSrcweir #define __XOLESIMPLESTORAGE_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/embed/XOLESimpleStorage.hpp>
28cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
32cdf0e10cSrcweir #include <com/sun/star/embed/XTransactedObject.hpp>
33cdf0e10cSrcweir #include <com/sun/star/embed/XClassifiedObject.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp>
37cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
38cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <osl/mutex.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir #include <sot/stg.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 
45cdf0e10cSrcweir class OLESimpleStorage	: public ::cppu::WeakImplHelper3
46cdf0e10cSrcweir 	< ::com::sun::star::embed::XOLESimpleStorage
47cdf0e10cSrcweir 				, ::com::sun::star::lang::XInitialization
48cdf0e10cSrcweir 				, ::com::sun::star::lang::XServiceInfo >
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	::osl::Mutex m_aMutex;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	sal_Bool m_bDisposed;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream;
55cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xTempStream;
56cdf0e10cSrcweir 	SvStream* m_pStream;
57cdf0e10cSrcweir 	BaseStorage* m_pStorage;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners
60cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir 	sal_Bool m_bNoTemporaryCopy;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	void UpdateOriginal_Impl();
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	static void InsertInputStreamToStorage_Impl( BaseStorage* pStorage, ::rtl::OUString aName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream )
67cdf0e10cSrcweir 	throw ( ::com::sun::star::uno::Exception );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	static void InsertNameAccessToStorage_Impl( BaseStorage* pStorage, ::rtl::OUString aName, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xNameAccess )
70cdf0e10cSrcweir 	throw ( ::com::sun::star::uno::Exception );
71cdf0e10cSrcweir 
72cdf0e10cSrcweir public:
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	OLESimpleStorage( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	virtual ~OLESimpleStorage();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
79cdf0e10cSrcweir 	static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
80cdf0e10cSrcweir 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
81cdf0e10cSrcweir 		impl_staticCreateSelfInstance(
82cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	//____________________________________________________________________________________________________
86cdf0e10cSrcweir 	//	XInitialization
87cdf0e10cSrcweir 	//____________________________________________________________________________________________________
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
90cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::Exception,
91cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	//____________________________________________________________________________________________________
94cdf0e10cSrcweir 	//	XNameContainer
95cdf0e10cSrcweir 	//____________________________________________________________________________________________________
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
98cdf0e10cSrcweir 		throw ( ::com::sun::star::lang::IllegalArgumentException,
99cdf0e10cSrcweir 				::com::sun::star::container::ElementExistException,
100cdf0e10cSrcweir 				::com::sun::star::lang::WrappedTargetException,
101cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException);
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
104cdf0e10cSrcweir 		throw ( ::com::sun::star::container::NoSuchElementException,
105cdf0e10cSrcweir 				::com::sun::star::lang::WrappedTargetException,
106cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException);
107cdf0e10cSrcweir 
108cdf0e10cSrcweir     virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
109cdf0e10cSrcweir 		throw ( ::com::sun::star::lang::IllegalArgumentException,
110cdf0e10cSrcweir 				::com::sun::star::container::NoSuchElementException,
111cdf0e10cSrcweir 				::com::sun::star::lang::WrappedTargetException,
112cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException);
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
115cdf0e10cSrcweir 		throw ( ::com::sun::star::container::NoSuchElementException,
116cdf0e10cSrcweir 				::com::sun::star::lang::WrappedTargetException,
117cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException );
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
120cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
123cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
126cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasElements()
129cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	//____________________________________________________________________________________________________
132cdf0e10cSrcweir 	//	XComponent
133cdf0e10cSrcweir 	//____________________________________________________________________________________________________
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     virtual void SAL_CALL dispose()
136cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     virtual void SAL_CALL addEventListener(
139cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
140cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener(
143cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
144cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	//____________________________________________________________________________________________________
147cdf0e10cSrcweir 	//	XTransactedObject
148cdf0e10cSrcweir 	//____________________________________________________________________________________________________
149cdf0e10cSrcweir 
150cdf0e10cSrcweir     virtual void SAL_CALL commit()
151cdf0e10cSrcweir 		throw ( ::com::sun::star::io::IOException,
152cdf0e10cSrcweir 				::com::sun::star::lang::WrappedTargetException,
153cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException );
154cdf0e10cSrcweir 
155cdf0e10cSrcweir     virtual void SAL_CALL revert()
156cdf0e10cSrcweir 		throw ( ::com::sun::star::io::IOException,
157cdf0e10cSrcweir 				::com::sun::star::lang::WrappedTargetException,
158cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException );
159cdf0e10cSrcweir 
160cdf0e10cSrcweir 	//____________________________________________________________________________________________________
161cdf0e10cSrcweir 	//	XClassifiedObject
162cdf0e10cSrcweir 	//____________________________________________________________________________________________________
163cdf0e10cSrcweir 
164cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getClassID()
165cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getClassName()
168cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     virtual void SAL_CALL setClassInfo( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aClassID,
171cdf0e10cSrcweir 										const ::rtl::OUString& sClassName )
172cdf0e10cSrcweir 		throw ( ::com::sun::star::lang::NoSupportException,
173cdf0e10cSrcweir 				::com::sun::star::uno::RuntimeException );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	//____________________________________________________________________________________________________
176cdf0e10cSrcweir 	//	XServiceInfo
177cdf0e10cSrcweir 	//____________________________________________________________________________________________________
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName()
180cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
181cdf0e10cSrcweir 
182cdf0e10cSrcweir     virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
183cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
186cdf0e10cSrcweir 		throw ( ::com::sun::star::uno::RuntimeException );
187cdf0e10cSrcweir 
188cdf0e10cSrcweir };
189cdf0e10cSrcweir 
190cdf0e10cSrcweir #endif
191cdf0e10cSrcweir 
192