Kaydet (Commit) 7e2677c0 authored tarafından Michael Meeks's avatar Michael Meeks Kaydeden (comit) Kohei Yoshida

Accelerate checking for VBA macros that are not there.

üst 01ea75c0
...@@ -44,10 +44,7 @@ interface XVBAEventProcessor ...@@ -44,10 +44,7 @@ interface XVBAEventProcessor
@return @return
`TRUE`, if the VBA event handler exists. `TRUE`, if the VBA event handler exists.
`FALSE`, for all other cases.
@throws ::com::sun::star::lang::IllegalArgumentException
if the passed event identifier is not supported, or if the passed
specifier is required but invalid.
**/ **/
boolean hasVbaEventHandler( [in] long nEventId, [in] sequence< any > aArgs ) boolean hasVbaEventHandler( [in] long nEventId, [in] sequence< any > aArgs )
raises (::com::sun::star::lang::IllegalArgumentException); raises (::com::sun::star::lang::IllegalArgumentException);
......
...@@ -51,15 +51,6 @@ VbaEventsHelperBase::~VbaEventsHelperBase() ...@@ -51,15 +51,6 @@ VbaEventsHelperBase::~VbaEventsHelperBase()
SAL_WARN_IF( !mbDisposed, "vbahelper", "VbaEventsHelperBase::~VbaEventsHelperBase - missing disposing notification" ); 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 ) sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
throw (lang::IllegalArgumentException, util::VetoException, uno::RuntimeException) throw (lang::IllegalArgumentException, util::VetoException, uno::RuntimeException)
{ {
...@@ -241,6 +232,16 @@ void VbaEventsHelperBase::stopListening() ...@@ -241,6 +232,16 @@ void VbaEventsHelperBase::stopListening()
mbDisposed = true; 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( const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandlerInfo(
sal_Int32 nEventId ) const throw (lang::IllegalArgumentException) sal_Int32 nEventId ) const throw (lang::IllegalArgumentException)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment