vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 9 +++++++++ 1 file changed, 9 insertions(+)
New commits: commit 5ee6862ee420f13133ade382d7ef2be319414d40 Author: Tamas Bunth <tamas.bu...@collabora.co.uk> Date: Thu Jul 6 10:46:48 2017 +0200 Create vba library if it did not exist before Add basicLibraries to the library container in the ensure function. It is needed in case of an xlsm file, because the VBAProject library was not added by the filter. Change-Id: I13f78384b9b1bbff1d9d5b1cd36d5a3b878f63e6 Reviewed-on: https://gerrit.libreoffice.org/39622 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Bunth <btom...@gmail.com> diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index 87b6fac6df38..800fa7231f8e 100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/vba/XVBAModuleInfo.hpp> +#include <com/sun/star/script/XLibraryContainer.hpp> #include <com/sun/star/util/XChangesNotifier.hpp> #include <cppuhelper/supportsservice.hxx> #include <filter/msfilter/msvbahelper.hxx> @@ -295,6 +296,14 @@ void VbaEventsHelperBase::ensureVBALibrary() uno::Reference< beans::XPropertySet > xModelProps( mxModel, uno::UNO_QUERY_THROW ); uno::Reference< container::XNameAccess > xBasicLibs( xModelProps->getPropertyValue( "BasicLibraries" ), uno::UNO_QUERY_THROW ); + + if(!xBasicLibs->hasByName(maLibraryName) ) + { + uno::Reference< script::XLibraryContainer > xLibContainer( + xModelProps->getPropertyValue("BasicLibraries"), uno::UNO_QUERY_THROW); + xLibContainer->createLibrary(maLibraryName); + } + mxModuleInfos.set( xBasicLibs->getByName( maLibraryName ), uno::UNO_QUERY_THROW ); // listen to changes in the VBA source code uno::Reference< util::XChangesNotifier > xChangesNotifier( mxModuleInfos, uno::UNO_QUERY_THROW );
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits