diff options
author | Noel Power <noel.power@novell.com> | 2011-09-05 10:45:21 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2011-09-05 10:46:10 +0100 |
commit | 8be4261608251630017f88faae0fbf696016a96a (patch) | |
tree | 095936e00ccc5da66a0fd366dc510f1f45e8b88c /oox | |
parent | 9ced6d79edc66f7b2d5376ee9507e69126a0dcb7 (diff) |
access oox vbaproject import directly
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/ole/vbaproject.hxx | 3 | ||||
-rw-r--r-- | oox/source/ole/vbaproject.cxx | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/oox/inc/oox/ole/vbaproject.hxx b/oox/inc/oox/ole/vbaproject.hxx index 001188f8ffff..91f399daa835 100644 --- a/oox/inc/oox/ole/vbaproject.hxx +++ b/oox/inc/oox/ole/vbaproject.hxx @@ -131,6 +131,9 @@ public: const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr = true ); + void importVbaProject( + StorageBase& rVbaPrjStrg ); + /** Registers a macro atatcher object. For details, see description of the VbaMacroAttacherBase class. */ void registerMacroAttacher( const VbaMacroAttacherRef& rxAttacher ); diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx index 8e5d2eb42427..1173783a36a0 100644 --- a/oox/source/ole/vbaproject.cxx +++ b/oox/source/ole/vbaproject.cxx @@ -168,6 +168,24 @@ VbaProject::~VbaProject() { } + +void VbaProject::importVbaProject( StorageBase& rVbaPrjStrg ) +{ + // create GraphicHelper + Reference< ::com::sun::star::frame::XFrame > xFrame; + if ( mxDocModel.is() ) + { + Reference< ::com::sun::star::frame::XController > xController = mxDocModel->getCurrentController(); + xFrame = xController.is() ? xController->getFrame() : NULL; + } + StorageRef noStorage; + // if the GraphicHelper tries to use noStorage it will of course crash + // but.. this shouldn't happen as there is no reason for GraphicHelper + // to do that when importing VBA projects + GraphicHelper grfHlp( mxContext, xFrame, noStorage ); + importVbaProject( rVbaPrjStrg, grfHlp ); +} + void VbaProject::importVbaProject( StorageBase& rVbaPrjStrg, const GraphicHelper& rGraphicHelper, bool bDefaultColorBgr ) { if( rVbaPrjStrg.isStorage() ) |