LibreOffice Module oox (master)  1
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
oox::ole::VbaProject Class Reference

#include <vbaproject.hxx>

Inheritance diagram for oox::ole::VbaProject:
[legend]
Collaboration diagram for oox::ole::VbaProject:
[legend]

Public Member Functions

 VbaProject (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XModel > &rxDocModel, std::u16string_view rConfigCompName)
 
virtual ~VbaProject ()
 
void importVbaProject (StorageBase &rVbaPrjStrg, const GraphicHelper &rGraphicHelper)
 Imports the entire VBA project from the passed storage. More...
 
bool importVbaProject (StorageBase &rVbaPrjStrg)
 
void importVbaData (const css::uno::Reference< css::io::XInputStream > &xInputStream)
 Imports VBA data for a VBA project, e.g. word/vbaData.xml. More...
 
void readVbaModules (StorageBase &rVbaPrjStrg)
 Reads vba module related information from the project streams. More...
 
void importModulesAndForms (StorageBase &rVbaPrjStrg, const GraphicHelper &rGraphicHelper)
 Imports (and creates) vba modules and user forms from the vba project records previously read. More...
 
void registerMacroAttacher (const VbaMacroAttacherRef &rxAttacher)
 Registers a macro attacher object. More...
 
void attachMacros ()
 Attaches VBA macros to objects registered via registerMacroAttacher(). More...
 
void setOleOverridesSink (css::uno::Reference< css::container::XNameContainer > const &rxOleOverridesSink)
 
- Public Member Functions inherited from oox::ole::VbaFilterConfig
 VbaFilterConfig (const css::uno::Reference< css::uno::XComponentContext > &rxContext, std::u16string_view rConfigCompName)
 
 ~VbaFilterConfig ()
 
bool isImportVba () const
 Returns true, if the VBA source code and forms should be imported. More...
 
bool isImportVbaExecutable () const
 Returns true, if the VBA source code should be imported executable. More...
 
bool isExportVba () const
 Returns true, if the VBA source code and forms should be exported. More...
 

Protected Member Functions

void addDummyModule (const OUString &rName, sal_Int32 nType)
 Registers a dummy module that will be created when the VBA project is imported. More...
 
virtual void prepareImport ()
 Called when the import process of the VBA project has been started. More...
 

Private Types

typedef RefVector< VbaMacroAttacherBaseMacroAttacherVector
 
typedef ::std::map< OUString, sal_Int32 > DummyModuleMap
 
typedef RefMap< OUString, VbaModuleVbaModuleMap
 

Private Member Functions

 VbaProject (const VbaProject &)=delete
 
VbaProjectoperator= (const VbaProject &)=delete
 
css::uno::Reference< css::script::XLibraryContainer > getLibraryContainer (sal_Int32 nPropId)
 Returns the Basic or dialog library container. More...
 
css::uno::Reference< css::container::XNameContainer > openLibrary (sal_Int32 nPropId)
 Opens a Basic or dialog library, creates missing if not found. More...
 
css::uno::Reference< css::container::XNameContainer > const & createBasicLibrary ()
 Creates and returns the Basic library of the document used for import. More...
 
css::uno::Reference< css::container::XNameContainer > const & createDialogLibrary ()
 Creates and returns the dialog library of the document used for import. More...
 
void importVba (StorageBase &rVbaPrjStrg, const GraphicHelper &rGraphicHelper)
 Imports the VBA code modules and forms. More...
 
void copyStorage (StorageBase &rVbaPrjStrg)
 Copies the entire VBA project storage to the passed document model. More...
 

Private Attributes

css::uno::Reference< css::uno::XComponentContext > mxContext
 Component context with service manager. More...
 
css::uno::Reference< css::frame::XModel > mxDocModel
 Document model used to import/export the VBA project. More...
 
css::uno::Reference< css::container::XNameContainer > mxBasicLib
 The Basic library of the document used for import. More...
 
css::uno::Reference< css::container::XNameContainer > mxDialogLib
 The dialog library of the document used for import. More...
 
MacroAttacherVector maMacroAttachers
 Objects that want to attach a VBA macro to an action. More...
 
DummyModuleMap maDummyModules
 Additional empty modules created on import. More...
 
OUString maPrjName
 Name of the VBA project. More...
 
css::uno::Reference< css::container::XNameContainer > mxOleOverridesSink
 
VbaModuleMap maModules
 
VbaModuleMap maModulesByStrm
 

Detailed Description

Definition at line 114 of file vbaproject.hxx.

Member Typedef Documentation

typedef ::std::map< OUString, sal_Int32 > oox::ole::VbaProject::DummyModuleMap
private

Definition at line 186 of file vbaproject.hxx.

Definition at line 185 of file vbaproject.hxx.

typedef RefMap< OUString, VbaModule > oox::ole::VbaProject::VbaModuleMap
private

Definition at line 201 of file vbaproject.hxx.

Constructor & Destructor Documentation

oox::ole::VbaProject::VbaProject ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext,
const css::uno::Reference< css::frame::XModel > &  rxDocModel,
std::u16string_view  rConfigCompName 
)
explicit
oox::ole::VbaProject::~VbaProject ( )
virtual

Definition at line 148 of file vbaproject.cxx.

oox::ole::VbaProject::VbaProject ( const VbaProject )
privatedelete

Member Function Documentation

void oox::ole::VbaProject::addDummyModule ( const OUString &  rName,
sal_Int32  nType 
)
protected

Registers a dummy module that will be created when the VBA project is imported.

Definition at line 205 of file vbaproject.cxx.

References maDummyModules.

void oox::ole::VbaProject::attachMacros ( )
void oox::ole::VbaProject::copyStorage ( StorageBase rVbaPrjStrg)
private

Copies the entire VBA project storage to the passed document model.

Definition at line 539 of file vbaproject.cxx.

References oox::StorageBase::copyStorageToStorage(), Exception, mxContext, and mxDocModel.

Referenced by importVbaProject().

Reference< XNameContainer > const & oox::ole::VbaProject::createBasicLibrary ( )
private

Creates and returns the Basic library of the document used for import.

Definition at line 241 of file vbaproject.cxx.

References mxBasicLib, and openLibrary().

Referenced by importModulesAndForms().

Reference< XNameContainer > const & oox::ole::VbaProject::createDialogLibrary ( )
private

Creates and returns the dialog library of the document used for import.

Definition at line 248 of file vbaproject.cxx.

References mxDialogLib, and openLibrary().

Referenced by importModulesAndForms().

Reference< XLibraryContainer > oox::ole::VbaProject::getLibraryContainer ( sal_Int32  nPropId)
private

Returns the Basic or dialog library container.

Definition at line 217 of file vbaproject.cxx.

References oox::PropertySet::getAnyProperty(), and mxDocModel.

Referenced by openLibrary(), and readVbaModules().

void oox::ole::VbaProject::importModulesAndForms ( StorageBase rVbaPrjStrg,
const GraphicHelper rGraphicHelper 
)
void oox::ole::VbaProject::importVba ( StorageBase rVbaPrjStrg,
const GraphicHelper rGraphicHelper 
)
private

Imports the VBA code modules and forms.

Definition at line 255 of file vbaproject.cxx.

References attachMacros(), importModulesAndForms(), and readVbaModules().

Referenced by importVbaProject().

void oox::ole::VbaProject::importVbaData ( const css::uno::Reference< css::io::XInputStream > &  xInputStream)

Imports VBA data for a VBA project, e.g. word/vbaData.xml.

Definition at line 185 of file vbaproject.cxx.

References comphelper::OStorageHelper::CopyInputToOutput(), and mxDocModel.

void oox::ole::VbaProject::importVbaProject ( StorageBase rVbaPrjStrg,
const GraphicHelper rGraphicHelper 
)

Imports the entire VBA project from the passed storage.

Parameters
rVbaPrjStrgThe root storage of the entire VBA project.

Definition at line 172 of file vbaproject.cxx.

References copyStorage(), importVba(), oox::ole::VbaFilterConfig::isExportVba(), oox::ole::VbaFilterConfig::isImportVba(), and oox::StorageBase::isStorage().

Referenced by importVbaProject().

bool oox::ole::VbaProject::importVbaProject ( StorageBase rVbaPrjStrg)
Reference< XNameContainer > oox::ole::VbaProject::openLibrary ( sal_Int32  nPropId)
private

Opens a Basic or dialog library, creates missing if not found.

Definition at line 224 of file vbaproject.cxx.

References Exception, getLibraryContainer(), and maPrjName.

Referenced by createBasicLibrary(), and createDialogLibrary().

VbaProject& oox::ole::VbaProject::operator= ( const VbaProject )
privatedelete
void oox::ole::VbaProject::prepareImport ( )
protectedvirtual

Called when the import process of the VBA project has been started.

Definition at line 211 of file vbaproject.cxx.

Referenced by readVbaModules().

void oox::ole::VbaProject::readVbaModules ( StorageBase rVbaPrjStrg)
void oox::ole::VbaProject::registerMacroAttacher ( const VbaMacroAttacherRef rxAttacher)

Registers a macro attacher object.

For details, see description of the VbaMacroAttacherBase class.

Definition at line 197 of file vbaproject.cxx.

References maMacroAttachers.

void oox::ole::VbaProject::setOleOverridesSink ( css::uno::Reference< css::container::XNameContainer > const &  rxOleOverridesSink)
inline

Definition at line 149 of file vbaproject.hxx.

Member Data Documentation

DummyModuleMap oox::ole::VbaProject::maDummyModules
private

Additional empty modules created on import.

Definition at line 197 of file vbaproject.hxx.

Referenced by addDummyModule(), and importModulesAndForms().

MacroAttacherVector oox::ole::VbaProject::maMacroAttachers
private

Objects that want to attach a VBA macro to an action.

Definition at line 196 of file vbaproject.hxx.

Referenced by attachMacros(), and registerMacroAttacher().

VbaModuleMap oox::ole::VbaProject::maModules
private

Definition at line 202 of file vbaproject.hxx.

Referenced by importModulesAndForms(), and readVbaModules().

VbaModuleMap oox::ole::VbaProject::maModulesByStrm
private

Definition at line 203 of file vbaproject.hxx.

Referenced by importModulesAndForms(), and readVbaModules().

OUString oox::ole::VbaProject::maPrjName
private

Name of the VBA project.

Definition at line 198 of file vbaproject.hxx.

Referenced by attachMacros(), openLibrary(), and readVbaModules().

css::uno::Reference< css::container::XNameContainer > oox::ole::VbaProject::mxBasicLib
private

The Basic library of the document used for import.

Definition at line 193 of file vbaproject.hxx.

Referenced by createBasicLibrary(), and importVbaProject().

css::uno::Reference< css::uno::XComponentContext > oox::ole::VbaProject::mxContext
private

Component context with service manager.

Definition at line 189 of file vbaproject.hxx.

Referenced by attachMacros(), copyStorage(), importModulesAndForms(), importVbaProject(), and readVbaModules().

css::uno::Reference< css::container::XNameContainer > oox::ole::VbaProject::mxDialogLib
private

The dialog library of the document used for import.

Definition at line 195 of file vbaproject.hxx.

Referenced by createDialogLibrary(), and importVbaProject().

css::uno::Reference< css::frame::XModel > oox::ole::VbaProject::mxDocModel
private

Document model used to import/export the VBA project.

Definition at line 191 of file vbaproject.hxx.

Referenced by attachMacros(), copyStorage(), getLibraryContainer(), importModulesAndForms(), importVbaData(), importVbaProject(), and readVbaModules().

css::uno::Reference< css::container::XNameContainer > oox::ole::VbaProject::mxOleOverridesSink
private

Definition at line 200 of file vbaproject.hxx.


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