LibreOffice Module oox (master) 1
|
#include <vbaproject.hxx>
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< VbaMacroAttacherBase > | MacroAttacherVector |
typedef ::std::map< OUString, sal_Int32 > | DummyModuleMap |
typedef RefMap< OUString, VbaModule > | VbaModuleMap |
Private Member Functions | |
VbaProject (const VbaProject &)=delete | |
VbaProject & | operator= (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 |
Definition at line 114 of file vbaproject.hxx.
|
private |
Definition at line 186 of file vbaproject.hxx.
|
private |
Definition at line 185 of file vbaproject.hxx.
|
private |
Definition at line 201 of file vbaproject.hxx.
|
explicit |
|
virtual |
Definition at line 152 of file vbaproject.cxx.
|
privatedelete |
|
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.
void oox::ole::VbaProject::attachMacros | ( | ) |
Attaches VBA macros to objects registered via registerMacroAttacher().
Definition at line 525 of file vbaproject.cxx.
References Any, Exception, oox::RefVector< ObjType >::forEachMem(), maMacroAttachers, maPrjName, mxContext, mxDocModel, comphelper::DocumentInfo::notifyMacroEventRead(), oox::ole::VbaMacroAttacherBase::resolveAndAttachMacro(), TOOLS_WARN_EXCEPTION, and xFactory.
Referenced by importVba().
|
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().
|
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().
|
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().
|
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().
void oox::ole::VbaProject::importModulesAndForms | ( | StorageBase & | rVbaPrjStrg, |
const GraphicHelper & | rGraphicHelper | ||
) |
Imports (and creates) vba modules and user forms from the vba project records previously read.
Note: ( expects that readVbaModules was already called )
Definition at line 433 of file vbaproject.cxx.
References oox::ole::VbaModule::createAndImportModule(), createBasicLibrary(), createDialogLibrary(), oox::ole::VbaModule::createEmptyModule(), Exception, oox::RefMap< KeyType, ObjType, CompType >::forEachMem(), oox::RefMap< KeyType, ObjType, CompType >::get(), oox::StorageBase::getElementNames(), oox::ole::VbaModule::getName(), oox::ole::VbaModule::getType(), oox::RefMap< KeyType, ObjType, CompType >::has(), oox::ole::VbaUserForm::importForm(), oox::ole::VbaFilterConfig::isImportVbaExecutable(), maDummyModules, maModules, maModulesByStrm, mxContext, mxDocModel, oox::StorageBase::openSubStorage(), and TOOLS_WARN_EXCEPTION.
Referenced by importVba().
|
private |
Imports the VBA code modules and forms.
Definition at line 260 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 189 of file vbaproject.cxx.
References comphelper::OStorageHelper::CopyInputToOutput(), and mxDocModel.
bool oox::ole::VbaProject::importVbaProject | ( | StorageBase & | rVbaPrjStrg | ) |
Definition at line 156 of file vbaproject.cxx.
References importVbaProject(), mxBasicLib, mxContext, mxDialogLib, mxDocModel, xController, and xFrame.
void oox::ole::VbaProject::importVbaProject | ( | StorageBase & | rVbaPrjStrg, |
const GraphicHelper & | rGraphicHelper | ||
) |
Imports the entire VBA project from the passed storage.
rVbaPrjStrg | The 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().
|
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().
|
privatedelete |
|
protectedvirtual |
Called when the import process of the VBA project has been started.
Definition at line 215 of file vbaproject.cxx.
Referenced by readVbaModules().
void oox::ole::VbaProject::readVbaModules | ( | StorageBase & | rVbaPrjStrg | ) |
Reads vba module related information from the project streams.
Definition at line 268 of file vbaproject.cxx.
References aName, Exception, oox::ole::VbaHelper::extractKeyValue(), oox::RefMap< KeyType, ObjType, CompType >::get(), getLibraryContainer(), oox::RefMap< KeyType, ObjType, CompType >::has(), oox::BinaryStreamBase::isEof(), oox::TextInputStream::isEof(), oox::ole::VbaFilterConfig::isImportVbaExecutable(), maModules, maModulesByStrm, maPrjName, mxContext, mxDocModel, nType, oox::StorageBase::openInputStream(), oox::StorageBase::openSubStorage(), prepareImport(), oox::BinaryInputStream::readCharArrayUC(), oox::ole::VbaHelper::readDirRecord(), oox::TextInputStream::readLine(), oox::BinaryInputStream::readuInt16(), SAL_WARN_IF, TOOLS_WARN_EXCEPTION, oox::ole::VBA_ID_MODULENAME, oox::ole::VBA_ID_PROJECTCODEPAGE, oox::ole::VBA_ID_PROJECTEND, oox::ole::VBA_ID_PROJECTMODULES, and oox::ole::VBA_ID_PROJECTNAME.
Referenced by importVba().
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.
|
inline |
Definition at line 149 of file vbaproject.hxx.
|
private |
Additional empty modules created on import.
Definition at line 197 of file vbaproject.hxx.
Referenced by addDummyModule(), and importModulesAndForms().
|
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().
|
private |
Definition at line 202 of file vbaproject.hxx.
Referenced by importModulesAndForms(), and readVbaModules().
|
private |
Definition at line 203 of file vbaproject.hxx.
Referenced by importModulesAndForms(), and readVbaModules().
|
private |
Name of the VBA project.
Definition at line 198 of file vbaproject.hxx.
Referenced by attachMacros(), openLibrary(), and readVbaModules().
|
private |
The Basic library of the document used for import.
Definition at line 193 of file vbaproject.hxx.
Referenced by createBasicLibrary(), and importVbaProject().
|
private |
Component context with service manager.
Definition at line 189 of file vbaproject.hxx.
Referenced by attachMacros(), copyStorage(), importModulesAndForms(), importVbaProject(), and readVbaModules().
|
private |
The dialog library of the document used for import.
Definition at line 195 of file vbaproject.hxx.
Referenced by createDialogLibrary(), and importVbaProject().
|
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().
|
private |
Definition at line 200 of file vbaproject.hxx.