diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2013-11-11 17:07:35 +0000 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-11-11 16:17:30 -0500 |
commit | 7e2677c02997ad7bf38641b46fd1e7ac2c643cd2 (patch) | |
tree | 35b1c07ed12f72bfcc5150dc199399ed72ab9d06 /vbahelper | |
parent | 01ea75c0f08e07c8243aafc8628612a9210add26 (diff) |
Accelerate checking for VBA macros that are not there.
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index b6a7e7a2923c..69b558425e48 100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -51,15 +51,6 @@ VbaEventsHelperBase::~VbaEventsHelperBase() SAL_WARN_IF( !mbDisposed, "vbahelper", "VbaEventsHelperBase::~VbaEventsHelperBase - missing disposing notification" ); } -sal_Bool SAL_CALL VbaEventsHelperBase::hasVbaEventHandler( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs ) - throw (lang::IllegalArgumentException, uno::RuntimeException) -{ - // getEventHandlerInfo() throws, if unknown event dentifier has been passed - const EventHandlerInfo& rInfo = getEventHandlerInfo( nEventId ); - // getEventHandlerPath() searches for the macro in the document - return !getEventHandlerPath( rInfo, rArgs ).isEmpty(); -} - sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs ) throw (lang::IllegalArgumentException, util::VetoException, uno::RuntimeException) { @@ -241,6 +232,16 @@ void VbaEventsHelperBase::stopListening() mbDisposed = true; } +sal_Bool SAL_CALL VbaEventsHelperBase::hasVbaEventHandler( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + EventHandlerInfoMap::const_iterator aIt = maEventInfos.find( nEventId ); + if( aIt == maEventInfos.end() ) + return sal_False; // throwing a lot of exceptions is slow. + else // getEventHandlerPath() searches for the macro in the document + return !getEventHandlerPath( aIt->second, rArgs ).isEmpty(); +} + const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandlerInfo( sal_Int32 nEventId ) const throw (lang::IllegalArgumentException) { |