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, OUString aStorageName, 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

◆ StorageBase() [1/4]

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

◆ StorageBase() [2/4]

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

◆ ~StorageBase()

StorageBase::~StorageBase ( )
virtual

Definition at line 86 of file storagebase.cxx.

◆ StorageBase() [3/4]

StorageBase::StorageBase ( const StorageBase rParentStorage,
OUString  aStorageName,
bool  bReadOnly 
)
explicitprotected

Special constructor for sub storage objects.

Definition at line 78 of file storagebase.cxx.

References bReadOnly.

◆ StorageBase() [4/4]

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

Member Function Documentation

◆ commit()

void StorageBase::commit ( )

Commits the changes to the storage and all substorages.

Definition at line 232 of file storagebase.cxx.

References commit(), implCommit(), maSubStorages, and mbReadOnly.

Referenced by commit(), oox::ole::VbaProject::copyStorage(), and oox::core::XmlFilterBase::implFinalizeExport().

◆ copyStorageToStorage()

void StorageBase::copyStorageToStorage ( StorageBase rDestStrg)

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

Definition at line 220 of file storagebase.cxx.

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

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

◆ copyToStorage()

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 190 of file storagebase.cxx.

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

Referenced by copyStorageToStorage().

◆ getElementNames()

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 114 of file storagebase.cxx.

References implGetElementNames().

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

◆ getName()

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

Returns the element name of this storage.

Definition at line 79 of file storagebase.hxx.

◆ getPath()

OUString StorageBase::getPath ( ) const

Returns the full path of this storage.

Definition at line 105 of file storagebase.cxx.

References aBuffer, maParentPath, and maStorageName.

◆ getSubStorage()

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

Helper that opens and caches the specified direct substorage.

Definition at line 246 of file storagebase.cxx.

References implOpenSubStorage(), and maSubStorages.

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

◆ getXStorage()

Reference< XStorage > StorageBase::getXStorage ( ) const

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

Definition at line 100 of file storagebase.cxx.

References implGetXStorage().

◆ implCommit()

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

Commits the current storage.

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

Referenced by commit().

◆ implGetElementNames()

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

Returns the names of all elements of this storage.

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

Referenced by getElementNames().

◆ implGetXStorage()

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::ZipStorage, and oox::ole::OleStorage.

Referenced by getXStorage().

◆ implIsStorage()

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

Returns true, if the object represents a valid storage.

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

Referenced by isRootStorage(), and isStorage().

◆ implOpenInputStream()

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::ZipStorage, and oox::ole::OleStorage.

Referenced by openInputStream().

◆ implOpenOutputStream()

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::ZipStorage, and oox::ole::OleStorage.

Referenced by openOutputStream().

◆ implOpenSubStorage()

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

Implementation of opening a storage element.

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

Referenced by getSubStorage().

◆ isReadOnly()

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().

◆ isRootStorage()

bool StorageBase::isRootStorage ( ) const

Returns true, if the object represents the root storage.

Definition at line 95 of file storagebase.cxx.

References implIsStorage(), and maStorageName.

◆ isStorage()

bool StorageBase::isStorage ( ) const

◆ openInputStream()

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 136 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().

◆ openOutputStream()

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 161 of file storagebase.cxx.

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

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

◆ openSubStorage()

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 120 of file storagebase.cxx.

References getSubStorage(), and mbReadOnly.

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

◆ operator=()

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

Member Data Documentation

◆ maParentPath

OUString oox::StorageBase::maParentPath
private

Full path of parent storage.

Definition at line 181 of file storagebase.hxx.

Referenced by getPath().

◆ maStorageName

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().

◆ maSubStorages

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().

◆ mbBaseStreamAccess

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().

◆ mbReadOnly

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().

◆ mxInStream

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().

◆ mxOutStream

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: