LibreOffice Module oox (master) 1
|
Base class for storage access implementations. More...
#include <storagebase.hxx>
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 | |
StorageBase & | operator= (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, StorageBase > | maSubStorages |
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... | |
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.
|
explicit |
|
explicit |
|
virtual |
Definition at line 86 of file storagebase.cxx.
|
explicitprotected |
Special constructor for sub storage objects.
Definition at line 78 of file storagebase.cxx.
References bReadOnly.
|
privatedelete |
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().
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().
void StorageBase::copyToStorage | ( | StorageBase & | rDestStrg, |
const OUString & | rElementName | ||
) |
Copies the specified element from this storage to the passed destination storage.
rElementName | The 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().
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().
|
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 105 of file storagebase.cxx.
References aBuffer, maParentPath, and maStorageName.
|
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().
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().
|
privatepure virtual |
Commits the current storage.
Implemented in oox::ZipStorage, and oox::ole::OleStorage.
Referenced by commit().
|
privatepure virtual |
Returns the names of all elements of this storage.
Implemented in oox::ZipStorage, and oox::ole::OleStorage.
Referenced by getElementNames().
|
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().
|
privatepure virtual |
Returns true, if the object represents a valid storage.
Implemented in oox::ZipStorage, and oox::ole::OleStorage.
Referenced by isRootStorage(), and isStorage().
|
privatepure virtual |
Implementation of opening an input stream element.
Implemented in oox::ZipStorage, and oox::ole::OleStorage.
Referenced by openInputStream().
|
privatepure virtual |
Implementation of opening an output stream element.
Implemented in oox::ZipStorage, and oox::ole::OleStorage.
Referenced by openOutputStream().
|
privatepure virtual |
Implementation of opening a storage element.
Implemented in oox::ZipStorage, and oox::ole::OleStorage.
Referenced by getSubStorage().
|
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 95 of file storagebase.cxx.
References implIsStorage(), and maStorageName.
bool StorageBase::isStorage | ( | ) | const |
Returns true, if the object represents a valid storage.
Definition at line 90 of file storagebase.cxx.
References implIsStorage().
Referenced by copyStorageToStorage(), copyToStorage(), oox::crypto::DocumentDecryption::decrypt(), oox::crypto::DocumentEncryption::encrypt(), oox::core::FilterDetect::extractUnencryptedPackage(), oox::ole::VbaProject::importVbaProject(), and oox::crypto::DocumentDecryption::readEncryptionInfo().
Reference< XInputStream > StorageBase::openInputStream | ( | const OUString & | rStreamName | ) |
Opens and returns the specified input stream from the storage.
rStreamName | The 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().
Reference< XOutputStream > StorageBase::openOutputStream | ( | const OUString & | rStreamName | ) |
Opens and returns the specified output stream from the storage.
rStreamName | The 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().
StorageRef StorageBase::openSubStorage | ( | const OUString & | rStorageName, |
bool | bCreateMissing | ||
) |
Opens and returns the specified sub storage from the storage.
rStorageName | The name of the embedded storage. The name may contain slashes to open storages from embedded substorages. |
bCreateMissing | True = 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().
|
privatedelete |
|
private |
Full path of parent storage.
Definition at line 181 of file storagebase.hxx.
Referenced by getPath().
|
private |
Name of this storage, if it is a substorage.
Definition at line 182 of file storagebase.hxx.
Referenced by getPath(), and isRootStorage().
|
private |
Map of direct sub storages.
Definition at line 176 of file storagebase.hxx.
Referenced by commit(), and getSubStorage().
|
private |
True = access base streams with empty stream name.
Definition at line 183 of file storagebase.hxx.
Referenced by openInputStream(), and openOutputStream().
|
private |
True = storage opened read-only (based on input stream).
Definition at line 184 of file storagebase.hxx.
Referenced by commit(), openOutputStream(), and openSubStorage().
|
private |
Cached base input stream (to keep it alive).
Definition at line 178 of file storagebase.hxx.
Referenced by openInputStream().
|
private |
Cached base output stream (to keep it alive).
Definition at line 180 of file storagebase.hxx.
Referenced by openOutputStream().