xref: /aoo41x/main/package/source/xstor/xstorage.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef __XSTORAGE_HXX_
29 #define __XSTORAGE_HXX_
30 
31 #include <com/sun/star/uno/Sequence.hxx>
32 #include <com/sun/star/embed/XStorage2.hpp>
33 #include <com/sun/star/embed/XOptimizedStorage.hpp>
34 #include <com/sun/star/embed/XHierarchicalStorageAccess2.hpp>
35 #include <com/sun/star/embed/XStorageRawAccess.hpp>
36 #include <com/sun/star/embed/XTransactedObject.hpp>
37 #include <com/sun/star/embed/XTransactionBroadcaster.hpp>
38 #include <com/sun/star/embed/XClassifiedObject.hpp>
39 #include <com/sun/star/embed/XEncryptionProtectedStorage.hpp>
40 #include <com/sun/star/embed/XRelationshipAccess.hpp>
41 #include <com/sun/star/util/XModifiable.hpp>
42 #include <com/sun/star/container/XNameAccess.hpp>
43 #include <com/sun/star/container/XNameContainer.hpp>
44 #include <com/sun/star/util/XCloseable.hpp>
45 #include <com/sun/star/beans/XPropertySet.hpp>
46 #include <com/sun/star/beans/PropertyValue.hpp>
47 #include <com/sun/star/beans/StringPair.hpp>
48 #include <com/sun/star/io/XStream.hpp>
49 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
51 #include <com/sun/star/lang/XTypeProvider.hpp>
52 #include <com/sun/star/lang/XComponent.hpp>
53 #include <com/sun/star/packages/NoEncryptionException.hpp>
54 #include <com/sun/star/logging/XSimpleLogRing.hpp>
55 
56 #include <cppuhelper/weak.hxx>
57 #include <cppuhelper/interfacecontainer.h>
58 #include <comphelper/sequenceashashmap.hxx>
59 
60 #include "mutexholder.hxx"
61 
62 #define RELINFO_NO_INIT				1
63 #define RELINFO_READ				2
64 #define RELINFO_CHANGED				3
65 #define RELINFO_CHANGED_STREAM		4
66 #define RELINFO_CHANGED_STREAM_READ	5
67 #define RELINFO_BROKEN				6
68 #define RELINFO_CHANGED_BROKEN		7
69 
70 #define STOR_MESS_PRECOMMIT 1
71 #define STOR_MESS_COMMITED  2
72 #define STOR_MESS_PREREVERT 3
73 #define STOR_MESS_REVERTED  4
74 
75 namespace cppu
76 {
77 	class OTypeCollection;
78 }
79 
80 //================================================
81 // a common implementation for an entry
82 
83 struct StorInternalData_Impl;
84 struct OStorage_Impl;
85 struct OWriteStream_Impl;
86 
87 struct SotElement_Impl
88 {
89     ::rtl::OUString             m_aName;
90     ::rtl::OUString             m_aOriginalName;
91     sal_Bool                    m_bIsRemoved;
92     sal_Bool                    m_bIsInserted;
93 	sal_Bool					m_bIsStorage;
94 
95 	OStorage_Impl*				m_pStorage;
96 	OWriteStream_Impl*			m_pStream;
97 
98 public:
99                                 SotElement_Impl( const ::rtl::OUString& rName, sal_Bool bStor, sal_Bool bNew );
100 								~SotElement_Impl();
101 };
102 
103 #include <list>
104 typedef ::std::list< SotElement_Impl* > SotElementList_Impl;
105 
106 //=========================================================================
107 // Main storage implementation
108 
109 class OStorage;
110 
111 struct StorageHolder_Impl
112 {
113 	OStorage* m_pPointer;
114 	::com::sun::star::uno::WeakReference< ::com::sun::star::embed::XStorage > m_xWeakRef;
115 
116 	StorageHolder_Impl( OStorage* pStorage )
117 	: m_pPointer( pStorage )
118 	, m_xWeakRef( ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >(
119 												(::com::sun::star::embed::XStorage*)pStorage ) )
120 	{
121 	}
122 
123 	StorageHolder_Impl( const StorageHolder_Impl& aSH )
124 	: m_pPointer( aSH.m_pPointer )
125 	, m_xWeakRef( aSH.m_xWeakRef )
126 	{
127 	}
128 };
129 
130 typedef ::std::list< StorageHolder_Impl > OStorageList_Impl;
131 
132 class SwitchablePersistenceStream;
133 struct OStorage_Impl
134 {
135 	SotMutexHolderRef			m_rMutexRef;
136 
137     OStorage*					m_pAntiImpl;    	 // only valid if external references exists
138 	OStorageList_Impl			m_aReadOnlyWrapList; // only valid if readonly external reference exists
139 
140     sal_Int32					m_nStorageMode; // open mode ( read/write/trunc/nocreate )
141     sal_Bool                    m_bIsModified;  // only modified elements will be sent to the original content
142     sal_Bool                    m_bBroadcastModified;  // will be set if notification is required
143     sal_Bool                    m_bCommited;    // sending the streams is coordinated by the root storage of the package
144 
145     sal_Bool                    m_bIsRoot;      // marks this storage as root storages that manages all commits and reverts
146     sal_Bool                    m_bListCreated;
147 
148 
149 	SotElementList_Impl							m_aChildrenList;
150 	SotElementList_Impl							m_aDeletedList;
151 
152 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > m_xPackageFolder;
153 	::com::sun::star::uno::Reference< ::com::sun::star::logging::XSimpleLogRing >  m_xLogRing;
154 
155 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > m_xPackage;
156 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >  m_xFactory;
157 
158 	// valid only for root storage
159 	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream; // ??? may be stored in properties
160 	::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream; // ??? may be stored in properties
161 	::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_xProperties;
162 	sal_Bool m_bHasCommonEncryptionData;
163 	::comphelper::SequenceAsHashMap m_aCommonEncryptionData;
164 
165 	// must be empty in case of root storage
166 	OStorage_Impl* m_pParent;
167 
168 	sal_Bool		m_bControlMediaType;
169 	::rtl::OUString m_aMediaType;
170 	sal_Bool		m_bMTFallbackUsed;
171 
172 	sal_Bool		m_bControlVersion;
173     ::rtl::OUString m_aVersion;
174 
175 	SwitchablePersistenceStream* m_pSwitchStream;
176 
177 	sal_Int32 m_nStorageType; // the mode in wich the storage is used
178 
179 	// the _rels substorage that is handled in a special way in embed::StorageFormats::OFOPXML
180 	SotElement_Impl* m_pRelStorElement;
181 	::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xRelStorage;
182 	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > m_aRelInfo;
183 	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xNewRelInfoStream;
184 	sal_Int16 m_nRelInfoStatus;
185 
186 	//////////////////////////////////////////
187 	// Constructors
188 
189 	OStorage_Impl(	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
190 					sal_Int32 nMode,
191 					::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
192 					::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
193 					sal_Int32 nStorageType );
194 
195 	OStorage_Impl(	::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream,
196 					sal_Int32 nMode,
197 					::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
198 					::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
199 					sal_Int32 nStorageType );
200 
201 	// constructor for a substorage
202 	OStorage_Impl(	OStorage_Impl* pParent,
203 					sal_Int32 nMode,
204 					::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > xPackageFolder,
205 					::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > xPackage,
206 					::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
207 					sal_Int32 nStorageType );
208 
209 	~OStorage_Impl();
210 
211     void AddLog( const ::rtl::OUString& aMessage );
212 
213 	void SetReadOnlyWrap( OStorage& aStorage );
214 	void RemoveReadOnlyWrap( OStorage& aStorage );
215 
216 	void OpenOwnPackage();
217 	void ReadContents();
218 	void ReadRelInfoIfNecessary();
219 
220 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > GetServiceFactory();
221 	SotElementList_Impl& GetChildrenList();
222 	void GetStorageProperties();
223 
224 	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > GetAllRelationshipsIfAny();
225 	void CopyLastCommitTo( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewStor );
226 	void CopyLastCommitTo( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewStor,
227 							const ::rtl::OUString& aPass );
228 
229 	void InsertIntoPackageFolder(
230 			const ::rtl::OUString& aName,
231 			const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xParentPackageFolder );
232 
233 	void Commit();
234 	void Revert();
235 
236 	::comphelper::SequenceAsHashMap GetCommonRootEncryptionData() throw ( ::com::sun::star::packages::NoEncryptionException );
237 
238 	void CopyToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
239 						sal_Bool bDirect );
240 	void CopyStorageElement( SotElement_Impl* pElement,
241 							::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > xDest,
242 							::rtl::OUString aName,
243 							sal_Bool bDirect );
244 
245 	void SetModified( sal_Bool bModified );
246 
247 	SotElement_Impl* FindElement( const ::rtl::OUString& rName );
248 
249 
250 	SotElement_Impl* InsertStream( ::rtl::OUString aName, sal_Bool bEncr );
251 	SotElement_Impl* InsertRawStream( ::rtl::OUString aName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream );
252 
253 	OStorage_Impl* CreateNewStorageImpl( sal_Int32 nStorageMode );
254 	SotElement_Impl* InsertStorage( ::rtl::OUString aName, sal_Int32 nStorageMode );
255 	SotElement_Impl* InsertElement( ::rtl::OUString aName, sal_Bool bIsStorage );
256 
257 	void OpenSubStorage( SotElement_Impl* pElement, sal_Int32 nStorageMode );
258 	void OpenSubStream( SotElement_Impl* pElement );
259 
260 	::com::sun::star::uno::Sequence< ::rtl::OUString > GetElementNames();
261 
262 	void RemoveElement( SotElement_Impl* pElement );
263 	void ClearElement( SotElement_Impl* pElement );
264 	void DisposeChildren();
265 
266 	void CloneStreamElement(
267 					const ::rtl::OUString& aStreamName,
268 					sal_Bool bPassProvided,
269 					const ::comphelper::SequenceAsHashMap& aEncryptionData,
270 					::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream )
271 		throw ( ::com::sun::star::embed::InvalidStorageException,
272 				::com::sun::star::lang::IllegalArgumentException,
273 				::com::sun::star::packages::WrongPasswordException,
274 				::com::sun::star::io::IOException,
275 				::com::sun::star::embed::StorageWrappedTargetException,
276 				::com::sun::star::uno::RuntimeException );
277 
278 	void RemoveStreamRelInfo( const ::rtl::OUString& aOriginalName );
279 	void CreateRelStorage();
280 	void CommitStreamRelInfo( SotElement_Impl* pStreamElement );
281 	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > GetRelInfoStreamForName( const ::rtl::OUString& aName );
282 	void CommitRelInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& xNewPackageFolder );
283 
284 	static void completeStorageStreamCopy_Impl(
285 		const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xSource,
286 		const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xDest,
287 		sal_Int32 nStorageType,
288 		const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >& aRelInfo );
289 
290 };
291 
292 
293 class OStorage	: public ::com::sun::star::lang::XTypeProvider
294 				, public ::com::sun::star::embed::XStorage2
295 				, public ::com::sun::star::embed::XStorageRawAccess
296 				, public ::com::sun::star::embed::XTransactedObject
297 				, public ::com::sun::star::embed::XTransactionBroadcaster
298 				, public ::com::sun::star::util::XModifiable
299 				// , public ::com::sun::star::container::XNameAccess
300 				// , public ::com::sun::star::lang::XComponent
301 				, public ::com::sun::star::embed::XEncryptionProtectedStorage
302 				, public ::com::sun::star::beans::XPropertySet
303 				, public ::com::sun::star::embed::XOptimizedStorage
304 				, public ::com::sun::star::embed::XRelationshipAccess
305 				, public ::com::sun::star::embed::XHierarchicalStorageAccess2
306 				, public ::cppu::OWeakObject
307 {
308 	OStorage_Impl*	m_pImpl;
309 	StorInternalData_Impl* m_pData;
310 
311 protected:
312 
313 	void Commit_Impl();
314 
315 	SotElement_Impl* OpenStreamElement_Impl( const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode, sal_Bool bEncr );
316 
317 	void BroadcastModifiedIfNecessary();
318 
319 	void BroadcastTransaction( sal_Int8 nMessage );
320 
321 	void MakeLinkToSubComponent_Impl(
322 					const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComponent );
323 
324 public:
325 
326 	OStorage(	::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
327 				sal_Int32 nMode,
328 				::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
329 				::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
330 				sal_Int32 nStorageType );
331 
332 	OStorage(	::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xStream,
333 				sal_Int32 nMode,
334 				::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
335 				::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
336 				sal_Int32 nStorageType );
337 
338 	OStorage(	OStorage_Impl* pImpl, sal_Bool bReadOnlyWrap );
339 
340 	virtual ~OStorage();
341 
342 	void SAL_CALL InternalDispose( sal_Bool bNotifyImpl );
343 
344 	void ChildIsDisposed( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xChild );
345 
346 	sal_Int32 GetRefCount_Impl() { return m_refCount; }
347 
348 	//____________________________________________________________________________________________________
349 	//	XInterface
350 	//____________________________________________________________________________________________________
351 
352 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
353 		throw( ::com::sun::star::uno::RuntimeException );
354 
355     virtual void SAL_CALL acquire() throw();
356 
357     virtual void SAL_CALL release() throw();
358 
359 	//____________________________________________________________________________________________________
360 	//	XTypeProvider
361 	//____________________________________________________________________________________________________
362 
363 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
364 		throw( ::com::sun::star::uno::RuntimeException );
365 
366 	virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
367 		throw( ::com::sun::star::uno::RuntimeException );
368 
369 	//____________________________________________________________________________________________________
370 	//	XStorage
371 	//____________________________________________________________________________________________________
372 
373     virtual void SAL_CALL copyToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest )
374 		throw ( ::com::sun::star::embed::InvalidStorageException,
375 				::com::sun::star::lang::IllegalArgumentException,
376 				::com::sun::star::io::IOException,
377 				::com::sun::star::embed::StorageWrappedTargetException,
378 				::com::sun::star::uno::RuntimeException );
379 
380     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openStreamElement(
381 			const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode )
382 		throw ( ::com::sun::star::embed::InvalidStorageException,
383 				::com::sun::star::lang::IllegalArgumentException,
384 				::com::sun::star::packages::WrongPasswordException,
385 				::com::sun::star::io::IOException,
386 				::com::sun::star::embed::StorageWrappedTargetException,
387 				::com::sun::star::uno::RuntimeException );
388 
389     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openEncryptedStreamElement(
390 			const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode, const ::rtl::OUString& aPass )
391 		throw ( ::com::sun::star::embed::InvalidStorageException,
392 				::com::sun::star::lang::IllegalArgumentException,
393 				::com::sun::star::packages::NoEncryptionException,
394 				::com::sun::star::packages::WrongPasswordException,
395 				::com::sun::star::io::IOException,
396 				::com::sun::star::embed::StorageWrappedTargetException,
397 				::com::sun::star::uno::RuntimeException );
398 
399     virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL openStorageElement(
400 			const ::rtl::OUString& aStorName, sal_Int32 nStorageMode )
401 		throw ( ::com::sun::star::embed::InvalidStorageException,
402 				::com::sun::star::lang::IllegalArgumentException,
403 				::com::sun::star::io::IOException,
404 				::com::sun::star::embed::StorageWrappedTargetException,
405 				::com::sun::star::uno::RuntimeException );
406 
407     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneStreamElement(
408 			const ::rtl::OUString& aStreamName )
409 		throw ( ::com::sun::star::embed::InvalidStorageException,
410 				::com::sun::star::lang::IllegalArgumentException,
411 				::com::sun::star::packages::WrongPasswordException,
412 				::com::sun::star::io::IOException,
413 				::com::sun::star::embed::StorageWrappedTargetException,
414 				::com::sun::star::uno::RuntimeException );
415 
416     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneEncryptedStreamElement(
417 			const ::rtl::OUString& aStreamName, const ::rtl::OUString& aPass )
418 		throw ( ::com::sun::star::embed::InvalidStorageException,
419 				::com::sun::star::lang::IllegalArgumentException,
420 				::com::sun::star::packages::NoEncryptionException,
421 				::com::sun::star::packages::WrongPasswordException,
422 				::com::sun::star::io::IOException,
423 				::com::sun::star::embed::StorageWrappedTargetException,
424 				::com::sun::star::uno::RuntimeException );
425 
426     virtual void SAL_CALL copyLastCommitTo(
427 			const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage )
428 		throw ( ::com::sun::star::embed::InvalidStorageException,
429 				::com::sun::star::lang::IllegalArgumentException,
430 				::com::sun::star::io::IOException,
431 				::com::sun::star::embed::StorageWrappedTargetException,
432 				::com::sun::star::uno::RuntimeException );
433 
434     virtual void SAL_CALL copyStorageElementLastCommitTo(
435 			const ::rtl::OUString& aStorName,
436 			const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage )
437 		throw ( ::com::sun::star::embed::InvalidStorageException,
438 				::com::sun::star::lang::IllegalArgumentException,
439 				::com::sun::star::io::IOException,
440 				::com::sun::star::embed::StorageWrappedTargetException,
441 				::com::sun::star::uno::RuntimeException );
442 
443     virtual sal_Bool SAL_CALL isStreamElement( const ::rtl::OUString& aElementName )
444 		throw ( ::com::sun::star::container::NoSuchElementException,
445 				::com::sun::star::lang::IllegalArgumentException,
446 				::com::sun::star::embed::InvalidStorageException,
447 				::com::sun::star::uno::RuntimeException );
448 
449     virtual sal_Bool SAL_CALL isStorageElement( const ::rtl::OUString& aElementName )
450 		throw ( ::com::sun::star::container::NoSuchElementException,
451 				::com::sun::star::lang::IllegalArgumentException,
452 				::com::sun::star::embed::InvalidStorageException,
453 				::com::sun::star::uno::RuntimeException );
454 
455     virtual void SAL_CALL removeElement( const ::rtl::OUString& aElementName )
456 		throw ( ::com::sun::star::embed::InvalidStorageException,
457 				::com::sun::star::lang::IllegalArgumentException,
458 				::com::sun::star::container::NoSuchElementException,
459 				::com::sun::star::io::IOException,
460 				::com::sun::star::embed::StorageWrappedTargetException,
461 				::com::sun::star::uno::RuntimeException );
462 
463     virtual void SAL_CALL renameElement( const ::rtl::OUString& rEleName, const ::rtl::OUString& rNewName )
464 		throw ( ::com::sun::star::embed::InvalidStorageException,
465 				::com::sun::star::lang::IllegalArgumentException,
466 				::com::sun::star::container::NoSuchElementException,
467 				::com::sun::star::container::ElementExistException,
468 				::com::sun::star::io::IOException,
469 				::com::sun::star::embed::StorageWrappedTargetException,
470 				::com::sun::star::uno::RuntimeException );
471 
472     virtual void SAL_CALL copyElementTo(	const ::rtl::OUString& aElementName,
473 										const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
474 										const ::rtl::OUString& aNewName )
475 		throw ( ::com::sun::star::embed::InvalidStorageException,
476 				::com::sun::star::lang::IllegalArgumentException,
477 				::com::sun::star::container::NoSuchElementException,
478 				::com::sun::star::container::ElementExistException,
479 				::com::sun::star::io::IOException,
480 				::com::sun::star::embed::StorageWrappedTargetException,
481 				::com::sun::star::uno::RuntimeException );
482 
483     virtual void SAL_CALL moveElementTo(	const ::rtl::OUString& aElementName,
484 										const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
485 										const ::rtl::OUString& rNewName )
486 		throw ( ::com::sun::star::embed::InvalidStorageException,
487 				::com::sun::star::lang::IllegalArgumentException,
488 				::com::sun::star::container::NoSuchElementException,
489 				::com::sun::star::container::ElementExistException,
490 				::com::sun::star::io::IOException,
491 				::com::sun::star::embed::StorageWrappedTargetException,
492 				::com::sun::star::uno::RuntimeException );
493 
494 	//____________________________________________________________________________________________________
495 	//	XStorage2
496 	//____________________________________________________________________________________________________
497 
498     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openEncryptedStream( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData )
499         throw ( ::com::sun::star::embed::InvalidStorageException,
500                 ::com::sun::star::lang::IllegalArgumentException,
501                 ::com::sun::star::packages::NoEncryptionException,
502                 ::com::sun::star::packages::WrongPasswordException,
503                 ::com::sun::star::io::IOException,
504                 ::com::sun::star::embed::StorageWrappedTargetException,
505                 ::com::sun::star::uno::RuntimeException);
506 
507     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneEncryptedStream( const ::rtl::OUString& sStreamName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData )
508         throw ( ::com::sun::star::embed::InvalidStorageException,
509                 ::com::sun::star::lang::IllegalArgumentException,
510                 ::com::sun::star::packages::NoEncryptionException,
511                 ::com::sun::star::packages::WrongPasswordException,
512                 ::com::sun::star::io::IOException,
513                 ::com::sun::star::embed::StorageWrappedTargetException,
514                 ::com::sun::star::uno::RuntimeException);
515 
516 	//____________________________________________________________________________________________________
517 	//	XStorageRawAccess
518 	//____________________________________________________________________________________________________
519 
520     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getPlainRawStreamElement(
521 			const ::rtl::OUString& sStreamName )
522 		throw ( ::com::sun::star::embed::InvalidStorageException,
523 				::com::sun::star::lang::IllegalArgumentException,
524 				::com::sun::star::container::NoSuchElementException,
525 				::com::sun::star::io::IOException,
526 				::com::sun::star::embed::StorageWrappedTargetException,
527 				::com::sun::star::uno::RuntimeException );
528 
529     virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getRawEncrStreamElement(
530 			const ::rtl::OUString& sStreamName )
531 		throw ( ::com::sun::star::embed::InvalidStorageException,
532 				::com::sun::star::lang::IllegalArgumentException,
533 				::com::sun::star::packages::NoEncryptionException,
534 				::com::sun::star::container::NoSuchElementException,
535 				::com::sun::star::io::IOException,
536 				::com::sun::star::embed::StorageWrappedTargetException,
537 				::com::sun::star::uno::RuntimeException );
538 
539 	virtual void SAL_CALL insertRawEncrStreamElement( const ::rtl::OUString& aStreamName,
540 								const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream )
541 		throw ( ::com::sun::star::embed::InvalidStorageException,
542 				::com::sun::star::lang::IllegalArgumentException,
543 				::com::sun::star::packages::NoRawFormatException,
544 				::com::sun::star::container::ElementExistException,
545 				::com::sun::star::io::IOException,
546 				::com::sun::star::embed::StorageWrappedTargetException,
547 				::com::sun::star::uno::RuntimeException);
548 
549 	//____________________________________________________________________________________________________
550 	// XTransactedObject
551 	//____________________________________________________________________________________________________
552 
553     virtual void SAL_CALL commit()
554 		throw ( ::com::sun::star::io::IOException,
555 				::com::sun::star::embed::StorageWrappedTargetException,
556 				::com::sun::star::uno::RuntimeException );
557 
558     virtual void SAL_CALL revert()
559 		throw ( ::com::sun::star::io::IOException,
560 				::com::sun::star::embed::StorageWrappedTargetException,
561 				::com::sun::star::uno::RuntimeException );
562 
563 	//____________________________________________________________________________________________________
564 	// XTransactionBroadcaster
565 	//____________________________________________________________________________________________________
566 
567     virtual void SAL_CALL addTransactionListener(
568 			const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XTransactionListener >& aListener )
569 		throw ( ::com::sun::star::uno::RuntimeException );
570 
571     virtual void SAL_CALL removeTransactionListener(
572 			const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XTransactionListener >& aListener )
573 		throw ( ::com::sun::star::uno::RuntimeException );
574 
575 	//____________________________________________________________________________________________________
576 	//	XModifiable
577 	//____________________________________________________________________________________________________
578 
579     virtual sal_Bool SAL_CALL isModified()
580 		throw ( ::com::sun::star::uno::RuntimeException );
581 
582     virtual void SAL_CALL setModified( sal_Bool bModified )
583 		throw ( ::com::sun::star::beans::PropertyVetoException,
584 				::com::sun::star::uno::RuntimeException );
585 
586     virtual void SAL_CALL addModifyListener(
587 			const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
588 		throw ( ::com::sun::star::uno::RuntimeException );
589 
590     virtual void SAL_CALL removeModifyListener(
591 			const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener )
592 		throw ( ::com::sun::star::uno::RuntimeException );
593 
594 	//____________________________________________________________________________________________________
595 	//	XNameAccess
596 	//____________________________________________________________________________________________________
597 
598     virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
599 		throw ( ::com::sun::star::container::NoSuchElementException,
600 				::com::sun::star::lang::WrappedTargetException,
601 				::com::sun::star::uno::RuntimeException );
602 
603     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
604 		throw ( ::com::sun::star::uno::RuntimeException );
605 
606     virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
607 		throw ( ::com::sun::star::uno::RuntimeException );
608 
609     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
610 		throw ( ::com::sun::star::uno::RuntimeException );
611 
612     virtual sal_Bool SAL_CALL hasElements()
613 		throw ( ::com::sun::star::uno::RuntimeException );
614 
615 	//____________________________________________________________________________________________________
616 	//	XComponent
617 	//____________________________________________________________________________________________________
618 
619     virtual void SAL_CALL dispose()
620 		throw ( ::com::sun::star::uno::RuntimeException );
621 
622     virtual void SAL_CALL addEventListener(
623 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
624 		throw ( ::com::sun::star::uno::RuntimeException );
625 
626     virtual void SAL_CALL removeEventListener(
627 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
628 		throw ( ::com::sun::star::uno::RuntimeException );
629 
630 	//____________________________________________________________________________________________________
631 	//	XEncryptionProtectedSource
632 	//____________________________________________________________________________________________________
633 
634 	virtual void SAL_CALL setEncryptionPassword( const ::rtl::OUString& aPass )
635 		throw ( ::com::sun::star::uno::RuntimeException,
636 				::com::sun::star::io::IOException );
637 
638     virtual void SAL_CALL removeEncryption()
639 		throw ( ::com::sun::star::uno::RuntimeException,
640 				::com::sun::star::io::IOException );
641 
642 	//____________________________________________________________________________________________________
643 	//  XEncryptionProtectedSource2
644 	//____________________________________________________________________________________________________
645 
646     virtual void SAL_CALL setEncryptionData(
647             const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData )
648         throw ( ::com::sun::star::io::IOException,
649                 ::com::sun::star::uno::RuntimeException );
650 
651 	//____________________________________________________________________________________________________
652 	//  XEncryptionProtectedStorage
653 	//____________________________________________________________________________________________________
654 
655     virtual void SAL_CALL setEncryptionAlgorithms( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aAlgorithms ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
656 
657     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getEncryptionAlgorithms() throw (::com::sun::star::uno::RuntimeException);
658 
659 	//____________________________________________________________________________________________________
660 	//	XPropertySet
661 	//____________________________________________________________________________________________________
662 
663     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
664 		throw ( ::com::sun::star::uno::RuntimeException );
665 
666     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
667 		throw ( ::com::sun::star::beans::UnknownPropertyException,
668 				::com::sun::star::beans::PropertyVetoException,
669 				::com::sun::star::lang::IllegalArgumentException,
670 				::com::sun::star::lang::WrappedTargetException,
671 				::com::sun::star::uno::RuntimeException );
672 
673     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
674 		throw ( ::com::sun::star::beans::UnknownPropertyException,
675 				::com::sun::star::lang::WrappedTargetException,
676 				::com::sun::star::uno::RuntimeException );
677 
678     virtual void SAL_CALL addPropertyChangeListener(
679 			const ::rtl::OUString& aPropertyName,
680 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
681 		throw ( ::com::sun::star::beans::UnknownPropertyException,
682 				::com::sun::star::lang::WrappedTargetException,
683 				::com::sun::star::uno::RuntimeException );
684 
685     virtual void SAL_CALL removePropertyChangeListener(
686 			const ::rtl::OUString& aPropertyName,
687 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
688 		throw ( ::com::sun::star::beans::UnknownPropertyException,
689 				::com::sun::star::lang::WrappedTargetException,
690 				::com::sun::star::uno::RuntimeException );
691 
692     virtual void SAL_CALL addVetoableChangeListener(
693 			const ::rtl::OUString& PropertyName,
694 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
695 		throw ( ::com::sun::star::beans::UnknownPropertyException,
696 				::com::sun::star::lang::WrappedTargetException,
697 				::com::sun::star::uno::RuntimeException );
698 
699     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
700 		throw ( ::com::sun::star::beans::UnknownPropertyException,
701 				::com::sun::star::lang::WrappedTargetException,
702 				::com::sun::star::uno::RuntimeException );
703 
704 	//____________________________________________________________________________________________________
705 	//	XOptimizedStorage
706 	//____________________________________________________________________________________________________
707     virtual void SAL_CALL insertRawNonEncrStreamElementDirect( const ::rtl::OUString& sStreamName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream )
708 		throw ( ::com::sun::star::embed::InvalidStorageException,
709 				::com::sun::star::lang::IllegalArgumentException,
710 				::com::sun::star::packages::NoRawFormatException,
711 				::com::sun::star::container::ElementExistException,
712 				::com::sun::star::io::IOException,
713 				::com::sun::star::embed::StorageWrappedTargetException,
714 				::com::sun::star::uno::RuntimeException );
715 
716     virtual void SAL_CALL insertStreamElementDirect( const ::rtl::OUString& sStreamName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProps )
717 		throw ( ::com::sun::star::embed::InvalidStorageException,
718 				::com::sun::star::lang::IllegalArgumentException,
719 				::com::sun::star::container::ElementExistException,
720 				::com::sun::star::io::IOException,
721 				::com::sun::star::embed::StorageWrappedTargetException,
722 				::com::sun::star::uno::RuntimeException );
723 
724     virtual void SAL_CALL copyElementDirectlyTo( const ::rtl::OUString& sSourceName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XOptimizedStorage >& xTargetStorage, const ::rtl::OUString& sTargetName )
725 		throw ( ::com::sun::star::embed::InvalidStorageException,
726 				::com::sun::star::lang::IllegalArgumentException,
727 				::com::sun::star::container::NoSuchElementException,
728 				::com::sun::star::container::ElementExistException,
729 				::com::sun::star::io::IOException,
730 				::com::sun::star::embed::StorageWrappedTargetException,
731 				::com::sun::star::uno::RuntimeException );
732 
733     virtual void SAL_CALL writeAndAttachToStream( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream )
734 		throw ( ::com::sun::star::embed::InvalidStorageException,
735 				::com::sun::star::lang::IllegalArgumentException,
736 				::com::sun::star::io::IOException,
737 				::com::sun::star::embed::StorageWrappedTargetException,
738 				::com::sun::star::uno::RuntimeException );
739 
740     virtual void SAL_CALL attachToURL( const ::rtl::OUString& sURL, sal_Bool bReadOnly )
741 		throw ( ::com::sun::star::embed::InvalidStorageException,
742 				::com::sun::star::lang::IllegalArgumentException,
743 				::com::sun::star::io::IOException,
744 				::com::sun::star::embed::StorageWrappedTargetException,
745 				::com::sun::star::uno::RuntimeException );
746 
747     virtual ::com::sun::star::uno::Any SAL_CALL getElementPropertyValue( const ::rtl::OUString& sElementName, const ::rtl::OUString& sPropertyName )
748 		throw ( ::com::sun::star::embed::InvalidStorageException,
749 				::com::sun::star::lang::IllegalArgumentException,
750 				::com::sun::star::container::NoSuchElementException,
751 				::com::sun::star::io::IOException,
752 				::com::sun::star::beans::UnknownPropertyException,
753 				::com::sun::star::beans::PropertyVetoException,
754 				::com::sun::star::embed::StorageWrappedTargetException,
755 				::com::sun::star::uno::RuntimeException);
756 
757     virtual void SAL_CALL copyStreamElementData( const ::rtl::OUString& sStreamName, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream )
758 		throw ( ::com::sun::star::embed::InvalidStorageException,
759 				::com::sun::star::lang::IllegalArgumentException,
760 				::com::sun::star::packages::WrongPasswordException,
761 				::com::sun::star::io::IOException,
762 				::com::sun::star::embed::StorageWrappedTargetException,
763 				::com::sun::star::uno::RuntimeException );
764 
765 	//____________________________________________________________________________________________________
766 	// XRelationshipAccess
767 	//____________________________________________________________________________________________________
768 
769     virtual ::sal_Bool SAL_CALL hasByID( const ::rtl::OUString& sID )
770 		throw ( ::com::sun::star::io::IOException,
771 				::com::sun::star::uno::RuntimeException);
772 
773     virtual ::rtl::OUString SAL_CALL getTargetByID( const ::rtl::OUString& sID )
774 		throw ( ::com::sun::star::container::NoSuchElementException,
775 				::com::sun::star::io::IOException,
776 				::com::sun::star::uno::RuntimeException);
777 
778     virtual ::rtl::OUString SAL_CALL getTypeByID( const ::rtl::OUString& sID )
779 		throw ( ::com::sun::star::container::NoSuchElementException,
780 				::com::sun::star::io::IOException,
781 				::com::sun::star::uno::RuntimeException);
782 
783     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > SAL_CALL getRelationshipByID( const ::rtl::OUString& sID )
784 		throw ( ::com::sun::star::container::NoSuchElementException,
785 				::com::sun::star::io::IOException,
786 				::com::sun::star::uno::RuntimeException);
787 
788     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > SAL_CALL getRelationshipsByType( const ::rtl::OUString& sType )
789 		throw ( ::com::sun::star::io::IOException,
790 				::com::sun::star::uno::RuntimeException);
791 
792     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > SAL_CALL getAllRelationships(  )
793 		throw ( ::com::sun::star::io::IOException,
794 				::com::sun::star::uno::RuntimeException);
795 
796     virtual void SAL_CALL insertRelationshipByID( const ::rtl::OUString& sID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aEntry, ::sal_Bool bReplace )
797 		throw ( ::com::sun::star::container::ElementExistException,
798 				::com::sun::star::io::IOException,
799 				::com::sun::star::uno::RuntimeException);
800 
801     virtual void SAL_CALL removeRelationshipByID( const ::rtl::OUString& sID )
802 		throw ( ::com::sun::star::container::NoSuchElementException,
803 				::com::sun::star::io::IOException,
804 				::com::sun::star::uno::RuntimeException);
805 
806     virtual void SAL_CALL insertRelationships( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >& aEntries, ::sal_Bool bReplace )
807 		throw ( ::com::sun::star::container::ElementExistException,
808 				::com::sun::star::io::IOException,
809 				::com::sun::star::uno::RuntimeException);
810 
811     virtual void SAL_CALL clearRelationships(  )
812 		throw ( ::com::sun::star::io::IOException,
813 				::com::sun::star::uno::RuntimeException);
814 
815 	//____________________________________________________________________________________________________
816 	// XHierarchicalStorageAccess
817 	//____________________________________________________________________________________________________
818 
819     virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath, ::sal_Int32 nOpenMode )
820 		throw ( ::com::sun::star::embed::InvalidStorageException,
821 				::com::sun::star::lang::IllegalArgumentException,
822 				::com::sun::star::packages::WrongPasswordException,
823 				::com::sun::star::io::IOException,
824 				::com::sun::star::embed::StorageWrappedTargetException,
825 				::com::sun::star::uno::RuntimeException);
826 
827     virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamElementByHierarchicalName( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::rtl::OUString& sPassword )
828 		throw ( ::com::sun::star::embed::InvalidStorageException,
829 				::com::sun::star::lang::IllegalArgumentException,
830 				::com::sun::star::packages::NoEncryptionException,
831 				::com::sun::star::packages::WrongPasswordException,
832 				::com::sun::star::io::IOException,
833 				::com::sun::star::embed::StorageWrappedTargetException,
834 				::com::sun::star::uno::RuntimeException);
835 
836     virtual void SAL_CALL removeStreamElementByHierarchicalName( const ::rtl::OUString& sElementPath )
837 		throw ( ::com::sun::star::embed::InvalidStorageException,
838 				::com::sun::star::lang::IllegalArgumentException,
839 				::com::sun::star::container::NoSuchElementException,
840 				::com::sun::star::io::IOException,
841 				::com::sun::star::embed::StorageWrappedTargetException,
842 				::com::sun::star::uno::RuntimeException);
843 
844 	//____________________________________________________________________________________________________
845 	// XHierarchicalStorageAccess2
846 	//____________________________________________________________________________________________________
847 
848     virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamByHierarchicalName( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData )
849         throw ( ::com::sun::star::embed::InvalidStorageException,
850                 ::com::sun::star::lang::IllegalArgumentException,
851                 ::com::sun::star::packages::NoEncryptionException,
852                 ::com::sun::star::packages::WrongPasswordException,
853                 ::com::sun::star::io::IOException,
854                 ::com::sun::star::embed::StorageWrappedTargetException,
855                 ::com::sun::star::uno::RuntimeException );
856 };
857 
858 
859 #endif
860 
861