Background: We allow import and running of vba macros in LibreOffice. However, it is not possible to make some changes to the vba code and resave ( e.g. roundrip ) the document. In this scenario all changes to the basic streams are discarded and the original basic streams are restored as part of the save/save as operation. It would be nice to improve this situation by at least allowing the modification of the vba code in imported modules. This would be very useful for those situations where you need to maybe tweak the vba code a little so it runs both in LibreOffice and in MicroSoft Office. This task could be a bit tricky but surely is interesting, there are plenty of open questions like how to determine what to export, just changed modules ? do we handle deleted modules ? or added Modules. Another thing is there is some metadata buried in the Module streams that we strip out ( see VbaModule::readSourceCode in vbamodule.cxx ) Additionally we add some those funny 'Option VBASupport 1' ( and some other comments ) that probably would need to be stripped out on export. Then there is the need to surgically insert the newly modified module streams into the existing project streams ( whilst preserving the existing information ) Note: In addition the module code is compressed there is an experimental compression routine we tried in the past ( I need to find it ;-) ) but it was written prior to release of the Microsoft office file protocols, perhaps it would be better anyway to start from scratch with the algorithm that will be already documented ( see useful links below ) Useful info ( I will add to this ) [edit] export hooks 1) in the oox filter ( note: probably not invoked even in calc export which no doubt still uses the legacy stuff for copying the streams ;-) ) is in source/ole/vbaproject.cxx (VbaProject::importVbaProject method handles both import and export... go figure! 2) in the legacy filter is in filter/source/msfilter/svxmsbas2.cxx SvxImportMSVBasic::SaveOrDelMSVBAStorage [edit] VBA Stream specifications http://download.microsoft.com/download/2/4/8/24862317-78f0-4c4b-b355-c7b2c1d997db/%5BMS-OVBA%5D.pdf [edit] Useful uno apis http://api.openoffice.org/docs/common/ref/com/sun/star/script/XLibraryContainer.html http://api.openoffice.org/docs/common/ref/com/sun/star/script/vba/XVBAModuleInfo.html which can be accessed via the 'BasicLibraries' property of the document Skills: building, debugging, C++
Deleted "Easyhack" from summary.
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility. see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Removing EasyHack due to limited response since 2011-06.
Migrating Whiteboard tags to Keywords: (DifficultyInteresting SkillCpp SkillDebug) [NinjaEdit]
topicDebug is a Topic.
Remove skillDebug, superceded by topicDebug.
Fixed by Rosemary in 5.2 and following.
Actually 5.1 has it already in calc.
(In reply to Markus Mohrhard (retired) from comment #8) > Actually 5.1 has it already in calc. see http://cgit.freedesktop.org/libreoffice/core/commit/?id=c5aeca430288057a721688975173ed764860d8b8 (and others) and https://wiki.documentfoundation.org/ReleaseNotes/5.1#Improvements_in_OpenXML_filter