1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_PACKAGE_SOURCE_XSTOR_XSTORAGE_HXX
21 #define INCLUDED_PACKAGE_SOURCE_XSTOR_XSTORAGE_HXX
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <com/sun/star/embed/XStorage2.hpp>
25 #include <com/sun/star/embed/XOptimizedStorage.hpp>
26 #include <com/sun/star/embed/XHierarchicalStorageAccess2.hpp>
27 #include <com/sun/star/embed/XStorageRawAccess.hpp>
28 #include <com/sun/star/embed/XTransactedObject.hpp>
29 #include <com/sun/star/embed/XTransactionBroadcaster.hpp>
30 #include <com/sun/star/embed/XClassifiedObject.hpp>
31 #include <com/sun/star/embed/XEncryptionProtectedStorage.hpp>
32 #include <com/sun/star/embed/XRelationshipAccess.hpp>
33 #include <com/sun/star/util/XModifiable.hpp>
34 #include <com/sun/star/container/XNameAccess.hpp>
35 #include <com/sun/star/container/XNameContainer.hpp>
36 #include <com/sun/star/util/XCloseable.hpp>
37 #include <com/sun/star/beans/XPropertySet.hpp>
38 #include <com/sun/star/beans/PropertyValue.hpp>
39 #include <com/sun/star/beans/StringPair.hpp>
40 #include <com/sun/star/io/XStream.hpp>
41 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
42 #include <com/sun/star/lang/XTypeProvider.hpp>
43 #include <com/sun/star/lang/XComponent.hpp>
44 #include <com/sun/star/packages/NoEncryptionException.hpp>
45 #include <com/sun/star/logging/XSimpleLogRing.hpp>
47 #include <cppuhelper/weak.hxx>
48 #include <cppuhelper/interfacecontainer.h>
49 #include <comphelper/sequenceashashmap.hxx>
51 #include "mutexholder.hxx"
56 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{
57 class XComponentContext
;
60 #define RELINFO_NO_INIT 1
61 #define RELINFO_READ 2
62 #define RELINFO_CHANGED 3
63 #define RELINFO_CHANGED_STREAM 4
64 #define RELINFO_CHANGED_STREAM_READ 5
65 #define RELINFO_BROKEN 6
66 #define RELINFO_CHANGED_BROKEN 7
68 #define STOR_MESS_PRECOMMIT 1
69 #define STOR_MESS_COMMITED 2
70 #define STOR_MESS_PREREVERT 3
71 #define STOR_MESS_REVERTED 4
73 // a common implementation for an entry
75 struct StorInternalData_Impl
;
77 struct OWriteStream_Impl
;
79 struct SotElement_Impl
82 OUString m_aOriginalName
;
87 OStorage_Impl
* m_pStorage
;
88 OWriteStream_Impl
* m_pStream
;
91 SotElement_Impl( const OUString
& rName
, bool bStor
, bool bNew
);
95 typedef ::std::list
< SotElement_Impl
* > SotElementList_Impl
;
97 // Main storage implementation
101 struct StorageHolder_Impl
103 OStorage
* m_pPointer
;
104 ::com::sun::star::uno::WeakReference
< ::com::sun::star::embed::XStorage
> m_xWeakRef
;
106 inline StorageHolder_Impl( OStorage
* pStorage
);
108 StorageHolder_Impl( const StorageHolder_Impl
& aSH
)
109 : m_pPointer( aSH
.m_pPointer
)
110 , m_xWeakRef( aSH
.m_xWeakRef
)
115 class SwitchablePersistenceStream
;
118 typedef std::list
<StorageHolder_Impl
> StorageHoldersType
;
120 SotMutexHolderRef m_rMutexRef
;
122 OStorage
* m_pAntiImpl
; // only valid if external references exists
123 StorageHoldersType m_aReadOnlyWrapList
; // only valid if readonly external reference exists
125 sal_Int32 m_nStorageMode
; // open mode ( read/write/trunc/nocreate )
126 bool m_bIsModified
; // only modified elements will be sent to the original content
127 bool m_bBroadcastModified
; // will be set if notification is required
129 bool m_bCommited
; // sending the streams is coordinated by the root storage of the package
131 bool m_bIsRoot
; // marks this storage as root storages that manages all commits and reverts
134 /// Count of registered modification listeners
135 oslInterlockedCount m_nModifiedListenerCount
;
136 bool HasModifiedListener()
138 return m_nModifiedListenerCount
> 0 && m_pAntiImpl
!= NULL
;
141 SotElementList_Impl m_aChildrenList
;
142 SotElementList_Impl m_aDeletedList
;
144 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> m_xPackageFolder
;
145 ::com::sun::star::uno::Reference
< ::com::sun::star::logging::XSimpleLogRing
> m_xLogRing
;
147 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XSingleServiceFactory
> m_xPackage
;
148 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
150 // valid only for root storage
151 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> m_xInputStream
; // ??? may be stored in properties
152 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> m_xStream
; // ??? may be stored in properties
153 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> m_xProperties
;
154 bool m_bHasCommonEncryptionData
;
155 ::comphelper::SequenceAsHashMap m_aCommonEncryptionData
;
157 // must be empty in case of root storage
158 OStorage_Impl
* m_pParent
;
160 bool m_bControlMediaType
;
161 OUString m_aMediaType
;
162 bool m_bMTFallbackUsed
;
164 bool m_bControlVersion
;
167 SwitchablePersistenceStream
* m_pSwitchStream
;
169 sal_Int32 m_nStorageType
; // the mode in which the storage is used
171 // the _rels substorage that is handled in a special way in embed::StorageFormats::OFOPXML
172 SotElement_Impl
* m_pRelStorElement
;
173 ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
> m_xRelStorage
;
174 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
> > m_aRelInfo
;
175 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> m_xNewRelInfoStream
;
176 sal_Int16 m_nRelInfoStatus
;
179 OStorage_Impl( ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> xInputStream
,
181 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& xProperties
,
182 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> xContext
,
183 sal_Int32 nStorageType
);
185 OStorage_Impl( ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> xStream
,
187 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& xProperties
,
188 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> xContext
,
189 sal_Int32 nStorageType
);
191 // constructor for a substorage
192 OStorage_Impl( OStorage_Impl
* pParent
,
194 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> xPackageFolder
,
195 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XSingleServiceFactory
> xPackage
,
196 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> xContext
,
197 sal_Int32 nStorageType
);
201 void AddLog( const OUString
& aMessage
);
203 void SetReadOnlyWrap( OStorage
& aStorage
);
204 void RemoveReadOnlyWrap( OStorage
& aStorage
);
206 void OpenOwnPackage();
208 void ReadRelInfoIfNecessary();
210 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> GetComponentContext();
211 SotElementList_Impl
& GetChildrenList();
212 void GetStorageProperties();
214 ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
> > GetAllRelationshipsIfAny();
215 void CopyLastCommitTo( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xNewStor
);
216 void CopyLastCommitTo( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xNewStor
,
217 const OUString
& aPass
);
219 void InsertIntoPackageFolder(
220 const OUString
& aName
,
221 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
>& xParentPackageFolder
);
226 ::comphelper::SequenceAsHashMap
GetCommonRootEncryptionData() throw ( ::com::sun::star::packages::NoEncryptionException
);
228 void CopyToStorage( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
,
230 void CopyStorageElement( SotElement_Impl
* pElement
,
231 ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
> xDest
,
232 const OUString
& aName
,
235 void SetModified( bool bModified
);
237 SotElement_Impl
* FindElement( const OUString
& rName
);
239 SotElement_Impl
* InsertStream( const OUString
& aName
, bool bEncr
);
240 SotElement_Impl
* InsertRawStream( const OUString
& aName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInStream
);
242 OStorage_Impl
* CreateNewStorageImpl( sal_Int32 nStorageMode
);
243 SotElement_Impl
* InsertStorage( const OUString
& aName
, sal_Int32 nStorageMode
);
244 SotElement_Impl
* InsertElement( const OUString
& aName
, bool bIsStorage
);
246 void OpenSubStorage( SotElement_Impl
* pElement
, sal_Int32 nStorageMode
);
247 void OpenSubStream( SotElement_Impl
* pElement
);
249 ::com::sun::star::uno::Sequence
< OUString
> GetElementNames();
251 void RemoveElement( SotElement_Impl
* pElement
);
252 static void ClearElement( SotElement_Impl
* pElement
);
253 void DisposeChildren();
255 void CloneStreamElement(
256 const OUString
& aStreamName
,
258 const ::comphelper::SequenceAsHashMap
& aEncryptionData
,
259 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xTargetStream
)
260 throw ( ::com::sun::star::embed::InvalidStorageException
,
261 ::com::sun::star::lang::IllegalArgumentException
,
262 ::com::sun::star::packages::WrongPasswordException
,
263 ::com::sun::star::packages::NoEncryptionException
,
264 ::com::sun::star::container::NoSuchElementException
,
265 ::com::sun::star::io::IOException
,
266 ::com::sun::star::embed::StorageWrappedTargetException
,
267 ::com::sun::star::uno::RuntimeException
);
269 void RemoveStreamRelInfo( const OUString
& aOriginalName
);
270 void CreateRelStorage();
271 void CommitStreamRelInfo( SotElement_Impl
* pStreamElement
);
272 ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> GetRelInfoStreamForName( const OUString
& aName
);
273 void CommitRelInfo( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
>& xNewPackageFolder
);
275 static void completeStorageStreamCopy_Impl(
276 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xSource
,
277 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xDest
,
278 sal_Int32 nStorageType
,
279 const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
> >& aRelInfo
);
283 class OStorage
: public ::com::sun::star::lang::XTypeProvider
284 , public ::com::sun::star::embed::XStorage2
285 , public ::com::sun::star::embed::XStorageRawAccess
286 , public ::com::sun::star::embed::XTransactedObject
287 , public ::com::sun::star::embed::XTransactionBroadcaster
288 , public ::com::sun::star::util::XModifiable
289 , public ::com::sun::star::embed::XEncryptionProtectedStorage
290 , public ::com::sun::star::beans::XPropertySet
291 , public ::com::sun::star::embed::XOptimizedStorage
292 , public ::com::sun::star::embed::XRelationshipAccess
293 , public ::com::sun::star::embed::XHierarchicalStorageAccess2
294 , public ::cppu::OWeakObject
296 OStorage_Impl
* m_pImpl
;
297 std::unique_ptr
<StorInternalData_Impl
> m_pData
;
303 SotElement_Impl
* OpenStreamElement_Impl( const OUString
& aStreamName
, sal_Int32 nOpenMode
, bool bEncr
);
305 void BroadcastModifiedIfNecessary();
307 void BroadcastTransaction( sal_Int8 nMessage
);
309 void MakeLinkToSubComponent_Impl(
310 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XComponent
>& xComponent
);
314 OStorage( ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> xInputStream
,
316 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& xProperties
,
317 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> xContext
,
318 sal_Int32 nStorageType
);
320 OStorage( ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> xStream
,
322 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& xProperties
,
323 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> xContext
,
324 sal_Int32 nStorageType
);
326 OStorage( OStorage_Impl
* pImpl
, bool bReadOnlyWrap
);
330 void SAL_CALL
InternalDispose( bool bNotifyImpl
);
332 void ChildIsDisposed( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xChild
);
334 sal_Int32
GetRefCount_Impl() { return m_refCount
; }
338 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface( const ::com::sun::star::uno::Type
& rType
)
339 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
341 virtual void SAL_CALL
acquire() throw() SAL_OVERRIDE
;
343 virtual void SAL_CALL
release() throw() SAL_OVERRIDE
;
347 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
348 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
350 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
351 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
355 virtual void SAL_CALL
copyToStorage( const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
)
356 throw ( ::com::sun::star::embed::InvalidStorageException
,
357 ::com::sun::star::lang::IllegalArgumentException
,
358 ::com::sun::star::io::IOException
,
359 ::com::sun::star::embed::StorageWrappedTargetException
,
360 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
362 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
openStreamElement(
363 const OUString
& aStreamName
, sal_Int32 nOpenMode
)
364 throw ( ::com::sun::star::embed::InvalidStorageException
,
365 ::com::sun::star::lang::IllegalArgumentException
,
366 ::com::sun::star::packages::WrongPasswordException
,
367 ::com::sun::star::io::IOException
,
368 ::com::sun::star::embed::StorageWrappedTargetException
,
369 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
371 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
openEncryptedStreamElement(
372 const OUString
& aStreamName
, sal_Int32 nOpenMode
, const OUString
& aPass
)
373 throw ( ::com::sun::star::embed::InvalidStorageException
,
374 ::com::sun::star::lang::IllegalArgumentException
,
375 ::com::sun::star::packages::NoEncryptionException
,
376 ::com::sun::star::packages::WrongPasswordException
,
377 ::com::sun::star::io::IOException
,
378 ::com::sun::star::embed::StorageWrappedTargetException
,
379 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
381 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
> SAL_CALL
openStorageElement(
382 const OUString
& aStorName
, sal_Int32 nStorageMode
)
383 throw ( ::com::sun::star::embed::InvalidStorageException
,
384 ::com::sun::star::lang::IllegalArgumentException
,
385 ::com::sun::star::io::IOException
,
386 ::com::sun::star::embed::StorageWrappedTargetException
,
387 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
389 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
cloneStreamElement(
390 const OUString
& aStreamName
)
391 throw ( ::com::sun::star::embed::InvalidStorageException
,
392 ::com::sun::star::lang::IllegalArgumentException
,
393 ::com::sun::star::packages::WrongPasswordException
,
394 ::com::sun::star::io::IOException
,
395 ::com::sun::star::embed::StorageWrappedTargetException
,
396 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
398 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
cloneEncryptedStreamElement(
399 const OUString
& aStreamName
, const OUString
& aPass
)
400 throw ( ::com::sun::star::embed::InvalidStorageException
,
401 ::com::sun::star::lang::IllegalArgumentException
,
402 ::com::sun::star::packages::NoEncryptionException
,
403 ::com::sun::star::packages::WrongPasswordException
,
404 ::com::sun::star::io::IOException
,
405 ::com::sun::star::embed::StorageWrappedTargetException
,
406 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
408 virtual void SAL_CALL
copyLastCommitTo(
409 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xTargetStorage
)
410 throw ( ::com::sun::star::embed::InvalidStorageException
,
411 ::com::sun::star::lang::IllegalArgumentException
,
412 ::com::sun::star::io::IOException
,
413 ::com::sun::star::embed::StorageWrappedTargetException
,
414 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
416 virtual void SAL_CALL
copyStorageElementLastCommitTo(
417 const OUString
& aStorName
,
418 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xTargetStorage
)
419 throw ( ::com::sun::star::embed::InvalidStorageException
,
420 ::com::sun::star::lang::IllegalArgumentException
,
421 ::com::sun::star::io::IOException
,
422 ::com::sun::star::embed::StorageWrappedTargetException
,
423 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
425 virtual sal_Bool SAL_CALL
isStreamElement( const OUString
& aElementName
)
426 throw ( ::com::sun::star::container::NoSuchElementException
,
427 ::com::sun::star::lang::IllegalArgumentException
,
428 ::com::sun::star::embed::InvalidStorageException
,
429 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
431 virtual sal_Bool SAL_CALL
isStorageElement( const OUString
& aElementName
)
432 throw ( ::com::sun::star::container::NoSuchElementException
,
433 ::com::sun::star::lang::IllegalArgumentException
,
434 ::com::sun::star::embed::InvalidStorageException
,
435 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
437 virtual void SAL_CALL
removeElement( const OUString
& aElementName
)
438 throw ( ::com::sun::star::embed::InvalidStorageException
,
439 ::com::sun::star::lang::IllegalArgumentException
,
440 ::com::sun::star::container::NoSuchElementException
,
441 ::com::sun::star::io::IOException
,
442 ::com::sun::star::embed::StorageWrappedTargetException
,
443 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
445 virtual void SAL_CALL
renameElement( const OUString
& rEleName
, const OUString
& rNewName
)
446 throw ( ::com::sun::star::embed::InvalidStorageException
,
447 ::com::sun::star::lang::IllegalArgumentException
,
448 ::com::sun::star::container::NoSuchElementException
,
449 ::com::sun::star::container::ElementExistException
,
450 ::com::sun::star::io::IOException
,
451 ::com::sun::star::embed::StorageWrappedTargetException
,
452 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
454 virtual void SAL_CALL
copyElementTo( const OUString
& aElementName
,
455 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
,
456 const OUString
& aNewName
)
457 throw ( ::com::sun::star::embed::InvalidStorageException
,
458 ::com::sun::star::lang::IllegalArgumentException
,
459 ::com::sun::star::container::NoSuchElementException
,
460 ::com::sun::star::container::ElementExistException
,
461 ::com::sun::star::io::IOException
,
462 ::com::sun::star::embed::StorageWrappedTargetException
,
463 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
465 virtual void SAL_CALL
moveElementTo( const OUString
& aElementName
,
466 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>& xDest
,
467 const OUString
& rNewName
)
468 throw ( ::com::sun::star::embed::InvalidStorageException
,
469 ::com::sun::star::lang::IllegalArgumentException
,
470 ::com::sun::star::container::NoSuchElementException
,
471 ::com::sun::star::container::ElementExistException
,
472 ::com::sun::star::io::IOException
,
473 ::com::sun::star::embed::StorageWrappedTargetException
,
474 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
478 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
openEncryptedStream( const OUString
& sStreamName
, ::sal_Int32 nOpenMode
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& aEncryptionData
)
479 throw ( ::com::sun::star::embed::InvalidStorageException
,
480 ::com::sun::star::lang::IllegalArgumentException
,
481 ::com::sun::star::packages::NoEncryptionException
,
482 ::com::sun::star::packages::WrongPasswordException
,
483 ::com::sun::star::io::IOException
,
484 ::com::sun::star::embed::StorageWrappedTargetException
,
485 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
487 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
> SAL_CALL
cloneEncryptedStream( const OUString
& sStreamName
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& aEncryptionData
)
488 throw ( ::com::sun::star::embed::InvalidStorageException
,
489 ::com::sun::star::lang::IllegalArgumentException
,
490 ::com::sun::star::packages::NoEncryptionException
,
491 ::com::sun::star::packages::WrongPasswordException
,
492 ::com::sun::star::io::IOException
,
493 ::com::sun::star::embed::StorageWrappedTargetException
,
494 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
498 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
getPlainRawStreamElement(
499 const OUString
& sStreamName
)
500 throw ( ::com::sun::star::embed::InvalidStorageException
,
501 ::com::sun::star::lang::IllegalArgumentException
,
502 ::com::sun::star::container::NoSuchElementException
,
503 ::com::sun::star::io::IOException
,
504 ::com::sun::star::embed::StorageWrappedTargetException
,
505 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
507 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
> SAL_CALL
getRawEncrStreamElement(
508 const OUString
& sStreamName
)
509 throw ( ::com::sun::star::embed::InvalidStorageException
,
510 ::com::sun::star::lang::IllegalArgumentException
,
511 ::com::sun::star::packages::NoEncryptionException
,
512 ::com::sun::star::container::NoSuchElementException
,
513 ::com::sun::star::io::IOException
,
514 ::com::sun::star::embed::StorageWrappedTargetException
,
515 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
517 virtual void SAL_CALL
insertRawEncrStreamElement( const OUString
& aStreamName
,
518 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInStream
)
519 throw ( ::com::sun::star::embed::InvalidStorageException
,
520 ::com::sun::star::lang::IllegalArgumentException
,
521 ::com::sun::star::packages::NoRawFormatException
,
522 ::com::sun::star::container::ElementExistException
,
523 ::com::sun::star::io::IOException
,
524 ::com::sun::star::embed::StorageWrappedTargetException
,
525 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
528 virtual void SAL_CALL
commit()
529 throw ( ::com::sun::star::io::IOException
,
530 ::com::sun::star::embed::StorageWrappedTargetException
,
531 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
533 virtual void SAL_CALL
revert()
534 throw ( ::com::sun::star::io::IOException
,
535 ::com::sun::star::embed::StorageWrappedTargetException
,
536 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
538 // XTransactionBroadcaster
539 virtual void SAL_CALL
addTransactionListener(
540 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XTransactionListener
>& aListener
)
541 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
543 virtual void SAL_CALL
removeTransactionListener(
544 const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XTransactionListener
>& aListener
)
545 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
549 virtual sal_Bool SAL_CALL
isModified()
550 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
552 virtual void SAL_CALL
setModified( sal_Bool bModified
)
553 throw ( ::com::sun::star::beans::PropertyVetoException
,
554 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
556 virtual void SAL_CALL
addModifyListener(
557 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
558 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
560 virtual void SAL_CALL
removeModifyListener(
561 const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
)
562 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
566 virtual ::com::sun::star::uno::Any SAL_CALL
getByName( const OUString
& aName
)
567 throw ( ::com::sun::star::container::NoSuchElementException
,
568 ::com::sun::star::lang::WrappedTargetException
,
569 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
571 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getElementNames()
572 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
574 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
)
575 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
577 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
578 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
580 virtual sal_Bool SAL_CALL
hasElements()
581 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
585 virtual void SAL_CALL
dispose()
586 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
588 virtual void SAL_CALL
addEventListener(
589 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
590 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
592 virtual void SAL_CALL
removeEventListener(
593 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
)
594 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
596 // XEncryptionProtectedSource
598 virtual void SAL_CALL
setEncryptionPassword( const OUString
& aPass
)
599 throw ( ::com::sun::star::uno::RuntimeException
,
600 ::com::sun::star::io::IOException
, std::exception
) SAL_OVERRIDE
;
602 virtual void SAL_CALL
removeEncryption()
603 throw ( ::com::sun::star::uno::RuntimeException
,
604 ::com::sun::star::io::IOException
, std::exception
) SAL_OVERRIDE
;
606 // XEncryptionProtectedSource2
608 virtual void SAL_CALL
setEncryptionData(
609 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& aEncryptionData
)
610 throw ( ::com::sun::star::io::IOException
,
611 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
613 virtual sal_Bool SAL_CALL
hasEncryptionData()
614 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
616 // XEncryptionProtectedStorage
618 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
, std::exception
) SAL_OVERRIDE
;
620 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
> SAL_CALL
getEncryptionAlgorithms() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
624 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
625 throw ( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
627 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
628 throw ( ::com::sun::star::beans::UnknownPropertyException
,
629 ::com::sun::star::beans::PropertyVetoException
,
630 ::com::sun::star::lang::IllegalArgumentException
,
631 ::com::sun::star::lang::WrappedTargetException
,
632 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
634 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
)
635 throw ( ::com::sun::star::beans::UnknownPropertyException
,
636 ::com::sun::star::lang::WrappedTargetException
,
637 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
639 virtual void SAL_CALL
addPropertyChangeListener(
640 const OUString
& aPropertyName
,
641 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
642 throw ( ::com::sun::star::beans::UnknownPropertyException
,
643 ::com::sun::star::lang::WrappedTargetException
,
644 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
646 virtual void SAL_CALL
removePropertyChangeListener(
647 const OUString
& aPropertyName
,
648 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
649 throw ( ::com::sun::star::beans::UnknownPropertyException
,
650 ::com::sun::star::lang::WrappedTargetException
,
651 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
653 virtual void SAL_CALL
addVetoableChangeListener(
654 const OUString
& PropertyName
,
655 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
656 throw ( ::com::sun::star::beans::UnknownPropertyException
,
657 ::com::sun::star::lang::WrappedTargetException
,
658 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
660 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
661 throw ( ::com::sun::star::beans::UnknownPropertyException
,
662 ::com::sun::star::lang::WrappedTargetException
,
663 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
666 virtual void SAL_CALL
insertRawNonEncrStreamElementDirect( const OUString
& sStreamName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& xInStream
)
667 throw ( ::com::sun::star::embed::InvalidStorageException
,
668 ::com::sun::star::lang::IllegalArgumentException
,
669 ::com::sun::star::packages::NoRawFormatException
,
670 ::com::sun::star::container::ElementExistException
,
671 ::com::sun::star::io::IOException
,
672 ::com::sun::star::embed::StorageWrappedTargetException
,
673 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
675 virtual void SAL_CALL
insertStreamElementDirect( const 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
)
676 throw ( ::com::sun::star::embed::InvalidStorageException
,
677 ::com::sun::star::lang::IllegalArgumentException
,
678 ::com::sun::star::container::ElementExistException
,
679 ::com::sun::star::io::IOException
,
680 ::com::sun::star::embed::StorageWrappedTargetException
,
681 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
683 virtual void SAL_CALL
copyElementDirectlyTo( const OUString
& sSourceName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XOptimizedStorage
>& xTargetStorage
, const OUString
& sTargetName
)
684 throw ( ::com::sun::star::embed::InvalidStorageException
,
685 ::com::sun::star::lang::IllegalArgumentException
,
686 ::com::sun::star::container::NoSuchElementException
,
687 ::com::sun::star::container::ElementExistException
,
688 ::com::sun::star::io::IOException
,
689 ::com::sun::star::embed::StorageWrappedTargetException
,
690 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
692 virtual void SAL_CALL
writeAndAttachToStream( const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xStream
)
693 throw ( ::com::sun::star::embed::InvalidStorageException
,
694 ::com::sun::star::lang::IllegalArgumentException
,
695 ::com::sun::star::io::IOException
,
696 ::com::sun::star::embed::StorageWrappedTargetException
,
697 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
699 virtual void SAL_CALL
attachToURL( const OUString
& sURL
, sal_Bool bReadOnly
)
700 throw ( ::com::sun::star::embed::InvalidStorageException
,
701 ::com::sun::star::lang::IllegalArgumentException
,
702 ::com::sun::star::io::IOException
,
703 ::com::sun::star::embed::StorageWrappedTargetException
,
704 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
706 virtual ::com::sun::star::uno::Any SAL_CALL
getElementPropertyValue( const OUString
& sElementName
, const OUString
& sPropertyName
)
707 throw ( ::com::sun::star::embed::InvalidStorageException
,
708 ::com::sun::star::lang::IllegalArgumentException
,
709 ::com::sun::star::container::NoSuchElementException
,
710 ::com::sun::star::io::IOException
,
711 ::com::sun::star::beans::UnknownPropertyException
,
712 ::com::sun::star::beans::PropertyVetoException
,
713 ::com::sun::star::embed::StorageWrappedTargetException
,
714 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
716 virtual void SAL_CALL
copyStreamElementData( const OUString
& sStreamName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XStream
>& xTargetStream
)
717 throw ( ::com::sun::star::embed::InvalidStorageException
,
718 ::com::sun::star::lang::IllegalArgumentException
,
719 ::com::sun::star::packages::WrongPasswordException
,
720 ::com::sun::star::io::IOException
,
721 ::com::sun::star::embed::StorageWrappedTargetException
,
722 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
724 // XRelationshipAccess
725 virtual sal_Bool SAL_CALL
hasByID( const OUString
& sID
)
726 throw ( ::com::sun::star::io::IOException
,
727 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
729 virtual OUString SAL_CALL
getTargetByID( const OUString
& sID
)
730 throw ( ::com::sun::star::container::NoSuchElementException
,
731 ::com::sun::star::io::IOException
,
732 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
734 virtual OUString SAL_CALL
getTypeByID( const OUString
& sID
)
735 throw ( ::com::sun::star::container::NoSuchElementException
,
736 ::com::sun::star::io::IOException
,
737 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
739 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
> SAL_CALL
getRelationshipByID( const OUString
& sID
)
740 throw ( ::com::sun::star::container::NoSuchElementException
,
741 ::com::sun::star::io::IOException
,
742 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
744 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
> > SAL_CALL
getRelationshipsByType( const OUString
& sType
)
745 throw ( ::com::sun::star::io::IOException
,
746 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
748 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
> > SAL_CALL
getAllRelationships( )
749 throw ( ::com::sun::star::io::IOException
,
750 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
752 virtual void SAL_CALL
insertRelationshipByID( const OUString
& sID
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::StringPair
>& aEntry
, sal_Bool bReplace
)
753 throw ( ::com::sun::star::container::ElementExistException
,
754 ::com::sun::star::io::IOException
,
755 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
757 virtual void SAL_CALL
removeRelationshipByID( const OUString
& sID
)
758 throw ( ::com::sun::star::container::NoSuchElementException
,
759 ::com::sun::star::io::IOException
,
760 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
762 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
)
763 throw ( ::com::sun::star::container::ElementExistException
,
764 ::com::sun::star::io::IOException
,
765 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
767 virtual void SAL_CALL
clearRelationships( )
768 throw ( ::com::sun::star::io::IOException
,
769 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
771 // XHierarchicalStorageAccess
772 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XExtendedStorageStream
> SAL_CALL
openStreamElementByHierarchicalName( const OUString
& sStreamPath
, ::sal_Int32 nOpenMode
)
773 throw ( ::com::sun::star::embed::InvalidStorageException
,
774 ::com::sun::star::lang::IllegalArgumentException
,
775 ::com::sun::star::packages::WrongPasswordException
,
776 ::com::sun::star::io::IOException
,
777 ::com::sun::star::embed::StorageWrappedTargetException
,
778 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
780 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XExtendedStorageStream
> SAL_CALL
openEncryptedStreamElementByHierarchicalName( const OUString
& sStreamName
, ::sal_Int32 nOpenMode
, const OUString
& sPassword
)
781 throw ( ::com::sun::star::embed::InvalidStorageException
,
782 ::com::sun::star::lang::IllegalArgumentException
,
783 ::com::sun::star::packages::NoEncryptionException
,
784 ::com::sun::star::packages::WrongPasswordException
,
785 ::com::sun::star::io::IOException
,
786 ::com::sun::star::embed::StorageWrappedTargetException
,
787 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
789 virtual void SAL_CALL
removeStreamElementByHierarchicalName( const OUString
& sElementPath
)
790 throw ( ::com::sun::star::embed::InvalidStorageException
,
791 ::com::sun::star::lang::IllegalArgumentException
,
792 ::com::sun::star::container::NoSuchElementException
,
793 ::com::sun::star::io::IOException
,
794 ::com::sun::star::embed::StorageWrappedTargetException
,
795 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
797 // XHierarchicalStorageAccess2
798 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XExtendedStorageStream
> SAL_CALL
openEncryptedStreamByHierarchicalName( const OUString
& sStreamName
, ::sal_Int32 nOpenMode
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& aEncryptionData
)
799 throw ( ::com::sun::star::embed::InvalidStorageException
,
800 ::com::sun::star::lang::IllegalArgumentException
,
801 ::com::sun::star::packages::NoEncryptionException
,
802 ::com::sun::star::packages::WrongPasswordException
,
803 ::com::sun::star::container::NoSuchElementException
,
804 ::com::sun::star::io::IOException
,
805 ::com::sun::star::embed::StorageWrappedTargetException
,
806 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
809 StorageHolder_Impl::StorageHolder_Impl( OStorage
* pStorage
)
810 : m_pPointer( pStorage
)
811 , m_xWeakRef( ::com::sun::star::uno::Reference
< ::com::sun::star::embed::XStorage
>( pStorage
) )
817 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */