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