diff options
-rw-r--r-- | include/oox/ole/vbaproject.hxx | 6 | ||||
-rw-r--r-- | oox/source/ole/vbaproject.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookfragment.cxx | 3 |
3 files changed, 8 insertions, 6 deletions
diff --git a/include/oox/ole/vbaproject.hxx b/include/oox/ole/vbaproject.hxx index 22e1a12f8587..6949834eadf8 100644 --- a/include/oox/ole/vbaproject.hxx +++ b/include/oox/ole/vbaproject.hxx @@ -139,6 +139,9 @@ public: VbaMacroAttacherBase class. */ void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher ); + /** Attaches VBA macros to objects registered via registerMacroAttacher(). */ + void attachMacros(); + /** Returns true, if the document contains at least one code module. */ bool hasModules() const; @@ -177,9 +180,6 @@ private: StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper ); - /** Attaches VBA macros to objects registered via registerMacroAttacher(). */ - void attachMacros(); - /** Copies the entire VBA project storage to the passed document model. */ void copyStorage( StorageBase& rVbaPrjStrg ); diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index 54711172fa98..e71669600647 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -253,6 +253,8 @@ void VbaProject::importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGrap { readVbaModules( rVbaPrjStrg ); importModulesAndForms(rVbaPrjStrg, rGraphicHelper ); + // attach macros to registered objects + attachMacros(); } void VbaProject::readVbaModules( StorageBase& rVbaPrjStrg ) @@ -502,9 +504,6 @@ void VbaProject::importModulesAndForms( StorageBase& rVbaPrjStrg, const GraphicH } } } - - // attach macros to registered objects - attachMacros(); } void VbaProject::attachMacros() diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 77317fe15995..18d207572dd9 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -508,6 +508,9 @@ void WorkbookFragment::finalizeImport() rtl::Reference<oox::core::FragmentHandler> xFragment(new RevisionHeadersFragment(*this, aRevHeadersPath)); importOoxFragment(xFragment, *xParser); } + + // attach macros to registered objects now that all objects have been created. + getBaseFilter().getVbaProject().attachMacros(); } namespace { |