LibreOffice LibreOffice 5.3 SDK API Reference

Included Services | Exported Interfaces | Public Attributes | List of all members
Storage Service Referencepublished

This is a service that allows to get access to a package using storage hierarchy. More...

`import"Storage.idl";`

Inheritance diagram for Storage:

## Included Services
service | BaseStorage
| This service describes the base functionality of storages. More...

## Exported Interfaces
interface | ::com::sun::star::embed::XTransactedObject
| allows to commit or revert changes that were done for the storage. More...
interface | ::com::sun::star::embed::XTransactionBroadcaster
| allows to track storage's transaction state. More...
interface | ::com::sun::star::embed::XEncryptionProtectedSource
| allows to set password to a root storage. More...
Exported Interfaces inherited from BaseStorage
interface | ::com::sun::star::embed::XStorage
| This is a general interface representing storage functionality. More...
interface | ::com::sun::star::beans::XPropertySet
| allows to get access to storage properties. More...
Exported Interfaces inherited from XStorage
interface | ::com::sun::star::container::XNameAccess
| allows to get list of child elements and to check if an element with a specified name exists in a storage. More...
interface | ::com::sun::star::lang::XComponent
| allows to control and track lifetime of the storage. More...

## Public Attributes
string | MediaType
| allows to get and set the media type of the storage. More...
string | Version
| allows to get and set the version of the format related to the MediaType. More...
boolean | MediaTypeFallbackIsUsed
| allows to detect whether mediatype is detected by using fallback approach. More...
boolean | IsRoot
| allows to detect whether the storage is a root one. More...
boolean | RepairPackage
| allows to detect whether storage is open in "repair package" mode or not. More...
boolean | HasEncryptedEntries
| allows to detect if the storage contains encrypted entries. More...
boolean | HasNonEncryptedEntries
| allows to detect if the storage contains non-encrypted entries. More...
Public Attributes inherited from BaseStorage
long | OpenMode
| allows to get the mode the storage is opened in. More...
string | URL
| allows to retrieve URL the storage is based on. More...

## Additional Inherited Members
Public Member Functions inherited from XStorage
void | copyToStorage ([in] XStorage xDest) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to copy current storage to another one More...
::com::sun::star::io::XStream | openStreamElement ([in] string sStreamName, [in] long nOpenMode) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::packages::WrongPasswordException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to get access to a child stream of the storage. More...
::com::sun::star::io::XStream | openEncryptedStreamElement ([in] string sStreamName, [in] long nOpenMode, [in] string sPassword) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::packages::NoEncryptionException, ::com::sun::star::packages::WrongPasswordException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to get access to a child encrypted stream with password. More...
XStorage | openStorageElement ([in] string sStorName, [in] long nOpenMode) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to get access to a child storage. More...
::com::sun::star::io::XStream | cloneStreamElement ([in] string sStreamName) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::packages::WrongPasswordException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to get readonly copy of a child stream of the storage. More...
::com::sun::star::io::XStream | cloneEncryptedStreamElement ([in] string sStreamName, [in] string sPassword) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::packages::NoEncryptionException, ::com::sun::star::packages::WrongPasswordException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to get readonly copy of a child encrypted stream with password. More...
void | copyLastCommitTo ([in] XStorage xTargetStorage) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to get copy of this storage at the state of its last commit. More...
void | copyStorageElementLastCommitTo ([in] string sStorName, [in] XStorage xTargetStorage) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to get copy of a child storage at the state of its last commit. More...
boolean | isStreamElement ([in] string sElementName) raises ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::InvalidStorageException )
| allows to check if an element is a child stream with specified name. More...
boolean | isStorageElement ([in] string sElementName) raises ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::InvalidStorageException )
| allows to check if an element is a child storage with specified name. More...
void | removeElement ([in] string sElementName) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| removes an element from a storage. More...
void | renameElement ([in] string sElementName, [in] string sNewName) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::container::ElementExistException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| renames an element in a storage. More...
void | copyElementTo ([in] string sElementName, [in] XStorage xDest, [in] string sNewName) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::container::ElementExistException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to copy an entry from one storage to another. More...
void | moveElementTo ([in] string sElementName, [in] XStorage xDest, [in] string sNewName) raises ( ::com::sun::star::embed::InvalidStorageException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::container::ElementExistException, ::com::sun::star::io::IOException, ::com::sun::star::embed::StorageWrappedTargetException )
| allows to move an entry from one storage to another. More...
Public Member Functions inherited from XNameAccess
any | getByName ([in] string aName) raises ( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException )
sequence< string > | getElementNames ()
boolean | hasByName ([in] string aName)
Public Member Functions inherited from XElementAccess
type | getElementType ()
boolean | hasElements ()
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...
Public Member Functions inherited from XComponent
void | dispose ()
| The owner of an object calls this method to explicitly free all resources kept by this object and thus break cyclic references. More...
void | addEventListener ([in] XEventListener xListener)
| adds an event listener to the object. More...
void | removeEventListener ([in] XEventListener aListener)
| removes an event listener from the listener list. More...
Public Member Functions inherited from XPropertySet
com::sun::star::beans::XPropertySetInfo | getPropertySetInfo ()
void | setPropertyValue ([in] string aPropertyName, [in] any aValue) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException )
| sets the value of the property with the specified name. More...
any | getPropertyValue ([in] string PropertyName) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
void | addPropertyChangeListener ([in] string aPropertyName, [in] com::sun::star::beans::XPropertyChangeListener xListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
| adds an XPropertyChangeListener to the specified property. More...
void | removePropertyChangeListener ([in] string aPropertyName, [in] com::sun::star::beans::XPropertyChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
| removes an XPropertyChangeListener from the listener list. More...
void | addVetoableChangeListener ([in] string PropertyName, [in] com::sun::star::beans::XVetoableChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
| adds an XVetoableChangeListener to the specified property with the name PropertyName. More...
void | removeVetoableChangeListener ([in] string PropertyName, [in] com::sun::star::beans::XVetoableChangeListener aListener) raises ( com::sun::star::beans::UnknownPropertyException, com::sun::star::lang::WrappedTargetException )
| removes an XVetoableChangeListener from the listener list. More...
Public Member Functions inherited from XTransactedObject
void | commit () raises ( ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException )
| commits the changes made for object. More...
void | revert () raises ( ::com::sun::star::io::IOException, ::com::sun::star::lang::WrappedTargetException )
| removes all the changes made for the object after last commit or loading. More...
Public Member Functions inherited from XTransactionBroadcaster
void | addTransactionListener ([in] com::sun::star::embed::XTransactionListener aListener)
| adds the specified listener to receive events about commits and reverts. More...
void | removeTransactionListener ([in] com::sun::star::embed::XTransactionListener aListener)
| removes the specified listener. More...
Protected Member Functions inherited from XEncryptionProtectedSource
void | setEncryptionPassword ([in] string sPassword) raises ( ::com::sun::star::io::IOException )
| sets a password for the object. More...
void | removeEncryption () raises ( ::com::sun::star::io::IOException )
| removes encryption from the object. More...

## Detailed Description

This is a service that allows to get access to a package using storage hierarchy.

A root storage should be retrieved by using StorageFactory service. Substorages are created through XStorage interface of a parent storage.

## Exported Interfaces

## ◆ BaseStorage

service BaseStorage

This service describes the base functionality of storages.

Please see below the description of additional requirements for the package storage implementation.

interface com::sun::star::lang::XComponent

  A root storage is created by StorageFactory and is controlled by refcounting. In case refcounting is decreased to zero the storage will be disposed automatically. It is still strongly recommended that a root storage is disposed explicitly since in garbage collector based languages the refcounting can be decreased too late and resources locked by the storage will not be freed until then.

  A substorage is created by XStorage interface of storage. Each time a substorage is opened it is locked ( in case it is opened in readonly mode it is locked for writing, in case it is opened in read-write mode it is locked for reading and writing ) until it is disposed. The lifetime of substorage is also controlled by refcounting but because of mentioned garbage collection specific it is strongly recommended to dispose substorages explicitly.

  In case a storage object is disposed all the elements ( substorages and substreams ) retrieved from the object are disposed. If the storage was opened in read-write mode all non-committed changes will be lost.

interface XStorage
  XStorage::openStreamElement()

    This method returns StorageStream service implementation.

    If the child stream is an encrypted one a correct common storage password should be set through XEncryptionProtectedSource interface to this storage or to a one of storages in parent hierarchy. In case the password is not set or is a wrong one an exception will be thrown.

  XStorage::openEncryptedStreamElement()

    This method allows to specify reading password for the stream explicitly. The password will be used to read the stream. It is possible to specify a new password for stream storing through XEncryptionProtectedSource interface. In case a new password is not specified an old one will be used for storing.

  XStorage::openStorageElement()

    This method returns Storage service implementation.

  XStorage::cloneStreamElement()

    This method returns StorageStream service implementation.

    The latest flashed version of the stream will be used. The stream can be flashed explicitly by com::sun::star::io::XOutputStream::flush() call.

    A storage flashes on commit all the child streams it owns. So in case after the stream is changed neither the storage was committed nor the stream was flushed explicitly, the changes will not appear in the new created stream. This method allows to retrieve copy of a child stream even in case it is already opened for writing.

    If the child stream is an encrypted one a correct common storage password should be set through XEncryptionProtectedSource interface to this storage or to a one of storages in parent hierarchy. In case the password is not set or is a wrong one an exception will be thrown.

  XStorage::cloneEncryptedStreamElement()

    This method returns StorageStream service implementation.

    The latest flashed version of the stream will be used. The stream can be flashed explicitly by com::sun::star::io::XOutputStream::flush() call.

    A storage flashes on commit all the child streams it owns. So in case after the stream is changed neither the storage was committed nor the stream was flushed explicitly, the changes will not appear in the new created stream. This method allows to retrieve copy of a child stream even in case it is already opened for writing.

  XStorage::copyLastCommitTo()

    This method gets Storage service implementation and fills it in with the latest committed version of this storage. So in case the storage was not committed after it was changed, the changes will not appear in the new created storage.

  XStorage::copyStorageElementLastCommitTo()

    This method gets Storage service implementation and fills it in with the contents of the requested substorage. The latest committed version of child storage will be used. So in case the child storage was not committed after it was changed, the changes will not appear in the new created storage.

    This method allows to retrieve copy of a child storage even in case it is already opened for writing.

  XStorage::removeStorageElement()
    If the element is opened the removing will fail.
property URL
  If the storage is created based on url this property allows to retrieve it.

## Exported Interfaces

## ◆ ::com::sun::star::embed::XEncryptionProtectedSource

interface ::com::sun::star::embed::XEncryptionProtectedSource
| optional

allows to set password to a root storage.

This interface can be supported by a storage to allow to set a common storage password. This password is used as default password to decrypt all encrypted streams and to encrypt streams that are marked to use common storage password on storing. Specifying of the password for a storage allows to use it for the whole subtree. Of course substorage can allow to overwrite the common storage password for own subtree.

## ◆ ::com::sun::star::embed::XTransactedObject

interface ::com::sun::star::embed::XTransactedObject

allows to commit or revert changes that were done for the storage.

If a storage is committed all changes made to it will be integrated to its parent storage. This is recursive process, so the last committed storage should be the root one. For the package based storages commit of a root storage also means flashing to the related medium. If a storage is not committed, no changes for it or its child elements will be stored.

## ◆ ::com::sun::star::embed::XTransactionBroadcaster

interface ::com::sun::star::embed::XTransactionBroadcaster

allows to track storage's transaction state.

## Member Data Documentation

## ◆ HasEncryptedEntries

boolean HasEncryptedEntries
| optional property readonly

allows to detect if the storage contains encrypted entries.

In case it is set to `TRUE` the storage itself and/or a tree of substorages contain encrypted streams. Usually in case this property is supported the implementation supports XEncryptionProtectedSource interface.

## ◆ HasNonEncryptedEntries

boolean HasNonEncryptedEntries
| optional property readonly

allows to detect if the storage contains non-encrypted entries.

In case it is set to `TRUE` the storage itself and/or a tree of substorages contains non-encrypted streams. Usually in case this property is supported the implementation supports XEncryptionProtectedSource interface.

## ◆ IsRoot

boolean IsRoot
| property readonly

allows to detect whether the storage is a root one.

## ◆ MediaType

string MediaType
| property

allows to get and set the media type of the storage.

## ◆ MediaTypeFallbackIsUsed

boolean MediaTypeFallbackIsUsed
| property readonly

allows to detect whether mediatype is detected by using fallback approach.

Can be set to true if the mediatype can not be detected in standard way, but there is a fallback solution allows to do it.

Usually means that the document validity is questionable, although the package itself is not corrupted. The decision about document validity in this case is in application hands. It is up to user of the storage to decide whether he accepts the fallback approach for an implementation of this service, outputs a warning or an error.

## ◆ RepairPackage

boolean RepairPackage
| optional property readonly

allows to detect whether storage is open in "repair package" mode or not.

## ◆ Version

string Version
| optional property

allows to get and set the version of the format related to the MediaType.

The documentation for this service was generated from the following file:

- com/sun/star/embed/Storage.idl