LibreOffice Module oox (master)  1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
oox::StorageBase Class Referenceabstract

Base class for storage access implementations. More...

#include <storagebase.hxx>

Inheritance diagram for oox::StorageBase:
[legend]
Collaboration diagram for oox::StorageBase:
[legend]

Public Member Functions

 StorageBase (const css::uno::Reference< css::io::XInputStream > &rxInStream, bool bBaseStreamAccess)
 
 StorageBase (const css::uno::Reference< css::io::XStream > &rxOutStream, bool bBaseStreamAccess)
 
virtual ~StorageBase ()
 
bool isStorage () const
 Returns true, if the object represents a valid storage. More...
 
bool isRootStorage () const
 Returns true, if the object represents the root storage. More...
 
bool isReadOnly () const
 Returns true, if the storage operates in read-only mode (based on an input stream). More...
 
css::uno::Reference< css::embed::XStorage > getXStorage () const
 Returns the com.sun.star.embed.XStorage interface of the current storage. More...
 
const OUString & getName () const
 Returns the element name of this storage. More...
 
OUString getPath () const
 Returns the full path of this storage. More...
 
void getElementNames (::std::vector< OUString > &orElementNames) const
 Fills the passed vector with the names of all direct elements of this storage. More...
 
StorageRef openSubStorage (const OUString &rStorageName, bool bCreateMissing)
 Opens and returns the specified sub storage from the storage. More...
 
css::uno::Reference< css::io::XInputStream > openInputStream (const OUString &rStreamName)
 Opens and returns the specified input stream from the storage. More...
 
css::uno::Reference< css::io::XOutputStream > openOutputStream (const OUString &rStreamName)
 Opens and returns the specified output stream from the storage. More...
 
void copyToStorage (StorageBase &rDestStrg, const OUString &rElementName)
 Copies the specified element from this storage to the passed destination storage. More...
 
void copyStorageToStorage (StorageBase &rDestStrg)
 Copies all streams of this storage and of all substorages to the passed destination. More...
 
void commit ()
 Commits the changes to the storage and all substorages. More...
 

Protected Member Functions

 StorageBase (const StorageBase &rParentStorage, const OUString &rStorageName, bool bReadOnly)
 Special constructor for sub storage objects. More...
 

Private Member Functions

 StorageBase (const StorageBase &)=delete
 
StorageBaseoperator= (const StorageBase &)=delete
 
virtual bool implIsStorage () const =0
 Returns true, if the object represents a valid storage. More...
 
virtual css::uno::Reference< css::embed::XStorage > implGetXStorage () const =0
 Returns the com.sun.star.embed.XStorage interface of the current storage. More...
 
virtual void implGetElementNames (::std::vector< OUString > &orElementNames) const =0
 Returns the names of all elements of this storage. More...
 
virtual StorageRef implOpenSubStorage (const OUString &rElementName, bool bCreate)=0
 Implementation of opening a storage element. More...
 
virtual css::uno::Reference< css::io::XInputStream > implOpenInputStream (const OUString &rElementName)=0
 Implementation of opening an input stream element. More...
 
virtual css::uno::Reference< css::io::XOutputStream > implOpenOutputStream (const OUString &rElementName)=0
 Implementation of opening an output stream element. More...
 
virtual void implCommit () const =0
 Commits the current storage. More...
 
StorageRef getSubStorage (const OUString &rElementName, bool bCreateMissing)
 Helper that opens and caches the specified direct substorage. More...
 

Private Attributes

RefMap< OUString, StorageBasemaSubStorages
 Map of direct sub storages. More...
 
css::uno::Reference< css::io::XInputStream > mxInStream
 Cached base input stream (to keep it alive). More...
 
css::uno::Reference< css::io::XStream > mxOutStream
 Cached base output stream (to keep it alive). More...
 
OUString maParentPath
 Full path of parent storage. More...
 
OUString maStorageName
 Name of this storage, if it is a substorage. More...
 
bool mbBaseStreamAccess
 True = access base streams with empty stream name. More...
 
bool mbReadOnly
 True = storage opened read-only (based on input stream). More...
 

Detailed Description

Base class for storage access implementations.

Derived classes will be used to encapsulate storage access implementations for ZIP storages containing XML streams, and OLE storages containing binary data streams.

Definition at line 51 of file storagebase.hxx.

Constructor & Destructor Documentation

oox::StorageBase::StorageBase ( const css::uno::Reference< css::io::XInputStream > &  rxInStream,
bool  bBaseStreamAccess 
)
explicit
oox::StorageBase::StorageBase ( const css::uno::Reference< css::io::XStream > &  rxOutStream,
bool  bBaseStreamAccess 
)
explicit
StorageBase::~StorageBase ( )
virtual

Definition at line 85 of file storagebase.cxx.

StorageBase::StorageBase ( const StorageBase rParentStorage,
const OUString &  rStorageName,
bool  bReadOnly 
)
explicitprotected

Special constructor for sub storage objects.

Definition at line 77 of file storagebase.cxx.

oox::StorageBase::StorageBase ( const StorageBase )
privatedelete

Member Function Documentation

void StorageBase::commit ( )

Commits the changes to the storage and all substorages.

Definition at line 231 of file storagebase.cxx.

References implCommit(), maSubStorages, and mbReadOnly.

Referenced by oox::core::XmlFilterBase::implFinalizeExport().

void StorageBase::copyStorageToStorage ( StorageBase rDestStrg)

Copies all streams of this storage and of all substorages to the passed destination.

Definition at line 219 of file storagebase.cxx.

References copyToStorage(), getElementNames(), isReadOnly(), and isStorage().

Referenced by oox::ole::VbaProject::copyStorage().

void StorageBase::copyToStorage ( StorageBase rDestStrg,
const OUString &  rElementName 
)

Copies the specified element from this storage to the passed destination storage.

Parameters
rElementNameThe name of the embedded storage or stream. The name may contain slashes to specify an element in an embedded substorage. In this case, the element will be copied to the same substorage in the destination storage.

Definition at line 189 of file storagebase.cxx.

References oox::BinaryInputStream::copyToStream(), isReadOnly(), isStorage(), openInputStream(), openOutputStream(), and openSubStorage().

Referenced by copyStorageToStorage().

void StorageBase::getElementNames ( ::std::vector< OUString > &  orElementNames) const

Fills the passed vector with the names of all direct elements of this storage.

Definition at line 113 of file storagebase.cxx.

References implGetElementNames().

Referenced by copyStorageToStorage(), and oox::ole::VbaProject::importModulesAndForms().

const OUString& oox::StorageBase::getName ( ) const
inline

Returns the element name of this storage.

Definition at line 79 of file storagebase.hxx.

OUString StorageBase::getPath ( ) const

Returns the full path of this storage.

Definition at line 104 of file storagebase.cxx.

References aBuffer, maParentPath, and maStorageName.

StorageRef StorageBase::getSubStorage ( const OUString &  rElementName,
bool  bCreateMissing 
)
private

Helper that opens and caches the specified direct substorage.

Definition at line 245 of file storagebase.cxx.

References implOpenSubStorage(), and maSubStorages.

Referenced by openInputStream(), openOutputStream(), and openSubStorage().

Reference< XStorage > StorageBase::getXStorage ( ) const

Returns the com.sun.star.embed.XStorage interface of the current storage.

Definition at line 99 of file storagebase.cxx.

References implGetXStorage().

virtual void oox::StorageBase::implCommit ( ) const
privatepure virtual

Commits the current storage.

Implemented in oox::ole::OleStorage, and oox::ZipStorage.

Referenced by commit().

virtual void oox::StorageBase::implGetElementNames ( ::std::vector< OUString > &  orElementNames) const
privatepure virtual

Returns the names of all elements of this storage.

Implemented in oox::ole::OleStorage, and oox::ZipStorage.

Referenced by getElementNames().

virtual css::uno::Reference< css::embed::XStorage > oox::StorageBase::implGetXStorage ( ) const
privatepure virtual

Returns the com.sun.star.embed.XStorage interface of the current storage.

Implemented in oox::ole::OleStorage, and oox::ZipStorage.

Referenced by getXStorage().

virtual bool oox::StorageBase::implIsStorage ( ) const
privatepure virtual

Returns true, if the object represents a valid storage.

Implemented in oox::ole::OleStorage, and oox::ZipStorage.

Referenced by isRootStorage(), and isStorage().

virtual css::uno::Reference< css::io::XInputStream > oox::StorageBase::implOpenInputStream ( const OUString &  rElementName)
privatepure virtual

Implementation of opening an input stream element.

Implemented in oox::ole::OleStorage, and oox::ZipStorage.

Referenced by openInputStream().

virtual css::uno::Reference< css::io::XOutputStream > oox::StorageBase::implOpenOutputStream ( const OUString &  rElementName)
privatepure virtual

Implementation of opening an output stream element.

Implemented in oox::ole::OleStorage, and oox::ZipStorage.

Referenced by openOutputStream().

virtual StorageRef oox::StorageBase::implOpenSubStorage ( const OUString &  rElementName,
bool  bCreate 
)
privatepure virtual

Implementation of opening a storage element.

Implemented in oox::ole::OleStorage, and oox::ZipStorage.

Referenced by getSubStorage().

bool oox::StorageBase::isReadOnly ( ) const
inline

Returns true, if the storage operates in read-only mode (based on an input stream).

Definition at line 72 of file storagebase.hxx.

Referenced by copyStorageToStorage(), and copyToStorage().

bool StorageBase::isRootStorage ( ) const

Returns true, if the object represents the root storage.

Definition at line 94 of file storagebase.cxx.

References implIsStorage(), and maStorageName.

bool StorageBase::isStorage ( ) const
Reference< XInputStream > StorageBase::openInputStream ( const OUString &  rStreamName)

Opens and returns the specified input stream from the storage.

Parameters
rStreamNameThe name of the embedded storage stream. The name may contain slashes to open streams from embedded substorages. If base stream access has been enabled in the constructor, the base stream can be accessed by passing an empty string as stream name.

Definition at line 135 of file storagebase.cxx.

References getSubStorage(), implOpenInputStream(), mbBaseStreamAccess, and mxInStream.

Referenced by copyToStorage(), oox::crypto::DocumentDecryption::decrypt(), oox::crypto::DocumentDecryption::DocumentDecryption(), oox::dump::StorageObjectBase::extractStream(), oox::ole::VbaUserForm::importForm(), oox::ole::VbaFormControl::importStorage(), oox::ole::AxControlFragment::onCreateContext(), oox::core::FastParser::parseStream(), oox::crypto::DocumentDecryption::readEncryptionInfo(), oox::ole::VbaModule::readSourceCode(), and oox::ole::VbaProject::readVbaModules().

Reference< XOutputStream > StorageBase::openOutputStream ( const OUString &  rStreamName)

Opens and returns the specified output stream from the storage.

Parameters
rStreamNameThe name of the embedded storage stream. The name may contain slashes to create and open streams in embedded substorages. If base stream access has been enabled in the constructor, the base stream can be accessed by passing an empty string as stream name.

Definition at line 160 of file storagebase.cxx.

References getSubStorage(), implOpenOutputStream(), mbBaseStreamAccess, mbReadOnly, and mxOutStream.

Referenced by copyToStorage(), and oox::crypto::DocumentEncryption::encrypt().

StorageRef StorageBase::openSubStorage ( const OUString &  rStorageName,
bool  bCreateMissing 
)

Opens and returns the specified sub storage from the storage.

Parameters
rStorageNameThe name of the embedded storage. The name may contain slashes to open storages from embedded substorages.
bCreateMissingTrue = create missing sub storages (for export filters). Must be false for storages based on input streams.

Definition at line 119 of file storagebase.cxx.

References getSubStorage(), and mbReadOnly.

Referenced by copyToStorage(), oox::ole::VbaFormControl::importModelOrStorage(), oox::ole::VbaProject::importModulesAndForms(), and oox::ole::VbaProject::readVbaModules().

StorageBase& oox::StorageBase::operator= ( const StorageBase )
privatedelete

Member Data Documentation

OUString oox::StorageBase::maParentPath
private

Full path of parent storage.

Definition at line 181 of file storagebase.hxx.

Referenced by getPath().

OUString oox::StorageBase::maStorageName
private

Name of this storage, if it is a substorage.

Definition at line 182 of file storagebase.hxx.

Referenced by getPath(), and isRootStorage().

RefMap< OUString, StorageBase > oox::StorageBase::maSubStorages
private

Map of direct sub storages.

Definition at line 176 of file storagebase.hxx.

Referenced by commit(), and getSubStorage().

bool oox::StorageBase::mbBaseStreamAccess
private

True = access base streams with empty stream name.

Definition at line 183 of file storagebase.hxx.

Referenced by openInputStream(), and openOutputStream().

bool oox::StorageBase::mbReadOnly
private

True = storage opened read-only (based on input stream).

Definition at line 184 of file storagebase.hxx.

Referenced by commit(), openOutputStream(), and openSubStorage().

css::uno::Reference< css::io::XInputStream > oox::StorageBase::mxInStream
private

Cached base input stream (to keep it alive).

Definition at line 178 of file storagebase.hxx.

Referenced by openInputStream().

css::uno::Reference< css::io::XStream > oox::StorageBase::mxOutStream
private

Cached base output stream (to keep it alive).

Definition at line 180 of file storagebase.hxx.

Referenced by openOutputStream().


The documentation for this class was generated from the following files: