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

◆ DummyModuleMap

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

Definition at line 186 of file vbaproject.hxx.

◆ MacroAttacherVector

Definition at line 185 of file vbaproject.hxx.

◆ VbaModuleMap

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

Definition at line 201 of file vbaproject.hxx.

Constructor & Destructor Documentation

◆ VbaProject() [1/2]

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

◆ ~VbaProject()

oox::ole::VbaProject::~VbaProject ( )
virtual

Definition at line 152 of file vbaproject.cxx.

◆ VbaProject() [2/2]

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

Member Function Documentation

◆ addDummyModule()

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 209 of file vbaproject.cxx.

References maDummyModules, and nType.

◆ attachMacros()

void oox::ole::VbaProject::attachMacros ( )

◆ copyStorage()

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

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

Definition at line 547 of file vbaproject.cxx.

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

Referenced by importVbaProject().

◆ createBasicLibrary()

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

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

Definition at line 246 of file vbaproject.cxx.

References mxBasicLib, and openLibrary().

Referenced by importModulesAndForms().

◆ createDialogLibrary()

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

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

Definition at line 253 of file vbaproject.cxx.

References mxDialogLib, and openLibrary().

Referenced by importModulesAndForms().

◆ getLibraryContainer()

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

Returns the Basic or dialog library container.

Definition at line 221 of file vbaproject.cxx.

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

Referenced by openLibrary(), and readVbaModules().

◆ importModulesAndForms()

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

◆ importVba()

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

Imports the VBA code modules and forms.

Definition at line 260 of file vbaproject.cxx.

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

Referenced by importVbaProject().

◆ importVbaData()

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 189 of file vbaproject.cxx.

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

◆ importVbaProject() [1/2]

bool oox::ole::VbaProject::importVbaProject ( StorageBase rVbaPrjStrg)

◆ importVbaProject() [2/2]

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 176 of file vbaproject.cxx.

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

Referenced by importVbaProject().

◆ openLibrary()

Reference< XNameContainer > oox::ole::VbaProject::openLibrary ( sal_Int32  nPropId)
private

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

Definition at line 228 of file vbaproject.cxx.

References Exception, getLibraryContainer(), maPrjName, and TOOLS_WARN_EXCEPTION.

Referenced by createBasicLibrary(), and createDialogLibrary().

◆ operator=()

VbaProject & oox::ole::VbaProject::operator= ( const VbaProject )
privatedelete

◆ prepareImport()

void oox::ole::VbaProject::prepareImport ( )
protectedvirtual

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

Definition at line 215 of file vbaproject.cxx.

Referenced by readVbaModules().

◆ readVbaModules()

void oox::ole::VbaProject::readVbaModules ( StorageBase rVbaPrjStrg)

◆ registerMacroAttacher()

void oox::ole::VbaProject::registerMacroAttacher ( const VbaMacroAttacherRef rxAttacher)

Registers a macro attacher object.

For details, see description of the VbaMacroAttacherBase class.

Definition at line 201 of file vbaproject.cxx.

References maMacroAttachers.

◆ setOleOverridesSink()

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

◆ maDummyModules

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

◆ maMacroAttachers

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

◆ maModules

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

Definition at line 202 of file vbaproject.hxx.

Referenced by importModulesAndForms(), and readVbaModules().

◆ maModulesByStrm

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

Definition at line 203 of file vbaproject.hxx.

Referenced by importModulesAndForms(), and readVbaModules().

◆ maPrjName

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

◆ mxBasicLib

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

◆ mxContext

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

◆ mxDialogLib

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

◆ mxDocModel

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

◆ mxOleOverridesSink

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: