diff options
Diffstat (limited to 'oox/inc/oox/ole')
-rw-r--r--[-rwxr-xr-x] | oox/inc/oox/ole/vbamodule.hxx | 19 | ||||
-rw-r--r-- | oox/inc/oox/ole/vbaproject.hxx | 21 |
2 files changed, 37 insertions, 3 deletions
diff --git a/oox/inc/oox/ole/vbamodule.hxx b/oox/inc/oox/ole/vbamodule.hxx index 3b529ceee129..377c7abc335a 100755..100644 --- a/oox/inc/oox/ole/vbamodule.hxx +++ b/oox/inc/oox/ole/vbamodule.hxx @@ -68,11 +68,26 @@ public: /** Imports all records for this module until the MODULEEND record. */ void importDirRecords( BinaryInputStream& rDirStrm ); - /** Imports the Basic source code into the passed Basic library. */ - void importSourceCode( + + /** Imports the VBA source code into the passed Basic library. */ + void createAndImportModule( StorageBase& rVbaStrg, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const; + /** Creates an empty Basic module in the passed Basic library. */ + void createEmptyModule( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const; + +private: + /** Reads and returns the VBA source code from the passed storage. */ + ::rtl::OUString readSourceCode( StorageBase& rVbaStrg ) const; + + /** Creates a new Basic module and inserts it into the passed Basic library. */ + void createModule( + const ::rtl::OUString& rVBASourceCode, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const; private: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx index 1d2fca29dbab..e8d9aa7c0f5d 100644 --- a/oox/inc/oox/ole/vbaproject.hxx +++ b/oox/inc/oox/ole/vbaproject.hxx @@ -97,6 +97,18 @@ public: /** Returns true, if the document contains the specified dialog. */ bool hasDialog( const ::rtl::OUString& rDialogName ) const; +protected: + /** Registers a dummy module that will be created when the VBA project is + imported. */ + void addDummyModule( const ::rtl::OUString& rName, sal_Int32 nType ); + /** Creates all dummy modules in the document. */ + void createDummyModules(); + + /** Called when the import process of the VBA project has been started. */ + virtual void prepareImport(); + /** Called when the import process of the VBA project is finished. */ + virtual void finalizeImport(); + private: VbaProject( const VbaProject& ); VbaProject& operator=( const VbaProject& ); @@ -113,12 +125,18 @@ private: /** Creates and returns the dialog library of the document used for import. */ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createDialogLibrary(); + /** Imports the VBA code modules and forms. */ - void importVba( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ); + void importVba( + StorageBase& rVbaPrjStrg, + const GraphicHelper& rGraphicHelper, + bool bDefaultColorBgr ); /** Copies the entire VBA project storage to the passed document model. */ void copyStorage( StorageBase& rVbaPrjStrg ); private: + typedef ::std::map< ::rtl::OUString, sal_Int32 > DummyModuleMap; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxGlobalFactory; /// Global service factory. ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > @@ -127,6 +145,7 @@ private: mxBasicLib; /// The Basic library of the document used for import. ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > mxDialogLib; /// The dialog library of the document used for import. + DummyModuleMap maDummyModules; /// Additional empty modules created on import. const ::rtl::OUString maLibName; /// Name for Basic and dialog library used for import. }; |