From 6bb742b9cbbdabbbd53dd9cdf6cb165e4b30bf86 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 28 Apr 2015 15:01:43 +0200 Subject: convert STR_EVENT constants to scoped enum - also add needed infrastructure to o3tl::enumarray so we can use std::find on it - move the Impl inside the .cxx file, no need to expose it in the header Change-Id: I7758a6175849f46723d97b1e657f846524c3b7cd --- basic/source/classes/sbxmod.cxx | 2 +- include/o3tl/enumarray.hxx | 7 ++ include/sfx2/event.hxx | 2 +- include/unotools/eventcfg.hxx | 90 ++++++++-------------- sc/source/ui/vba/vbaeventshelper.cxx | 24 +++--- sfx2/source/appl/app.cxx | 4 +- sfx2/source/doc/objembed.cxx | 2 +- sfx2/source/doc/objmisc.cxx | 6 +- sfx2/source/doc/objstor.cxx | 4 +- sfx2/source/doc/objxtor.cxx | 6 +- sfx2/source/doc/sfxbasemodel.cxx | 18 ++--- sfx2/source/view/frame.cxx | 2 +- sfx2/source/view/sfxbasecontroller.cxx | 6 +- sfx2/source/view/viewfrm.cxx | 2 +- sfx2/source/view/viewprn.cxx | 2 +- starmath/source/document.cxx | 2 +- sw/source/filter/html/htmlgrin.cxx | 8 +- sw/source/uibase/app/docsh2.cxx | 8 +- unotools/source/config/eventcfg.cxx | 80 ++++++++++--------- vbahelper/source/vbahelper/vbaeventshelperbase.cxx | 2 +- 20 files changed, 132 insertions(+), 145 deletions(-) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 9990a04d5f46..0d4395c866ba 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2426,7 +2426,7 @@ public: virtual void SAL_CALL documentEventOccured( const document::DocumentEvent& rEvent ) throw (uno::RuntimeException, std::exception) SAL_OVERRIDE { // early dosposing on document event "OnUnload", to be sure Basic still exists when calling VBA "UserForm_Terminate" - if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) ) + if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ) ) { removeListener(); mbDisposed = true; diff --git a/include/o3tl/enumarray.hxx b/include/o3tl/enumarray.hxx index 777e205b8cf5..355e674a5e77 100644 --- a/include/o3tl/enumarray.hxx +++ b/include/o3tl/enumarray.hxx @@ -70,6 +70,8 @@ public: iterator begin() { return iterator(*this, 0); } iterator end() { return iterator(*this, size()); } + V* data() { return detail_values; } + //private: V detail_values[max_index + 1]; }; @@ -83,6 +85,10 @@ public: typedef enumarray_iterator self_type; typedef typename EA::value_type value_type; typedef typename EA::key_type key_type; + typedef std::bidirectional_iterator_tag iterator_category; //should be random access, but that would require define subtraction operators on the enums + typedef typename EA::key_type difference_type; + typedef typename EA::value_type* pointer; + typedef typename EA::value_type& reference; enumarray_iterator(EA& b, size_t start_pos) : m_buf(b), m_pos(start_pos) {} @@ -90,6 +96,7 @@ public: value_type *operator->() { return &(operator*()); } self_type &operator++() { ++m_pos; return *this; } bool operator!=(const self_type& other) { return &m_buf != &other.m_buf || m_pos != other.m_pos; } + bool operator==(const self_type& other) { return &m_buf == &other.m_buf && m_pos == other.m_pos; } }; }; // namespace o3tl diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx index 5b4970d571e4..dbb0fa77c24d 100644 --- a/include/sfx2/event.hxx +++ b/include/sfx2/event.hxx @@ -121,7 +121,7 @@ public: const css::uno::Reference< css::frame::XController2 >& xController ) : SfxViewEventHint( SFX_EVENT_PRINTDOC, - GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), + GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ), pObj, xController ) , mnPrintableState( nEvent ) diff --git a/include/unotools/eventcfg.hxx b/include/unotools/eventcfg.hxx index d1cc6fe95e30..ff11795e20f3 100644 --- a/include/unotools/eventcfg.hxx +++ b/include/unotools/eventcfg.hxx @@ -29,65 +29,41 @@ #include #include -#define STR_EVENT_STARTAPP 0 -#define STR_EVENT_CLOSEAPP 1 -#define STR_EVENT_DOCCREATED 2 -#define STR_EVENT_CREATEDOC 3 -#define STR_EVENT_LOADFINISHED 4 -#define STR_EVENT_OPENDOC 5 -#define STR_EVENT_PREPARECLOSEDOC 6 -#define STR_EVENT_CLOSEDOC 7 -#define STR_EVENT_SAVEDOC 8 -#define STR_EVENT_SAVEDOCDONE 9 -#define STR_EVENT_SAVEDOCFAILED 10 -#define STR_EVENT_SAVEASDOC 11 -#define STR_EVENT_SAVEASDOCDONE 12 -#define STR_EVENT_SAVEASDOCFAILED 13 -#define STR_EVENT_SAVETODOC 14 -#define STR_EVENT_SAVETODOCDONE 15 -#define STR_EVENT_SAVETODOCFAILED 16 -#define STR_EVENT_ACTIVATEDOC 17 -#define STR_EVENT_DEACTIVATEDOC 18 -#define STR_EVENT_PRINTDOC 19 -#define STR_EVENT_VIEWCREATED 20 -#define STR_EVENT_PREPARECLOSEVIEW 21 -#define STR_EVENT_CLOSEVIEW 22 -#define STR_EVENT_MODIFYCHANGED 23 -#define STR_EVENT_TITLECHANGED 24 -#define STR_EVENT_VISAREACHANGED 25 -#define STR_EVENT_MODECHANGED 26 -#define STR_EVENT_STORAGECHANGED 27 - -typedef std::unordered_map< OUString, OUString, OUStringHash, std::equal_to< OUString > > EventBindingHash; -typedef std::vector< css::uno::WeakReference< css::frame::XFrame > > FrameVector; -typedef std::vector< OUString > SupportedEventsVector; - -class GlobalEventConfig_Impl : public utl::ConfigItem +enum class GlobalEventId { -private: - EventBindingHash m_eventBindingHash; - FrameVector m_lFrames; - SupportedEventsVector m_supportedEvents; - - void initBindingInfo(); - - virtual void ImplCommit() SAL_OVERRIDE; - -public: - GlobalEventConfig_Impl( ); - virtual ~GlobalEventConfig_Impl( ); - - void Notify( const com::sun::star::uno::Sequence& aPropertyNames) SAL_OVERRIDE; - - void SAL_CALL replaceByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); - bool SAL_CALL hasByName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); - bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); - OUString GetEventName( sal_Int32 nID ); + STARTAPP, + CLOSEAPP, + DOCCREATED, + CREATEDOC, + LOADFINISHED, + OPENDOC, + PREPARECLOSEDOC, + CLOSEDOC, + SAVEDOC, + SAVEDOCDONE, + SAVEDOCFAILED, + SAVEASDOC, + SAVEASDOCDONE, + SAVEASDOCFAILED, + SAVETODOC, + SAVETODOCDONE, + SAVETODOCFAILED, + ACTIVATEDOC, + DEACTIVATEDOC, + PRINTDOC, + VIEWCREATED, + PREPARECLOSEVIEW, + CLOSEVIEW, + MODIFYCHANGED, + TITLECHANGED, + VISAREACHANGED, + MODECHANGED, + STORAGECHANGED, + LAST = STORAGECHANGED }; +class GlobalEventConfig_Impl; + class UNOTOOLS_DLLPUBLIC GlobalEventConfig: public ::cppu::WeakImplHelper2 < ::com::sun::star::document::XEventsSupplier, ::com::sun::star::container::XNameReplace > { @@ -103,7 +79,7 @@ class UNOTOOLS_DLLPUBLIC GlobalEventConfig: sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - static OUString GetEventName( sal_Int32 nID ); + static OUString GetEventName( GlobalEventId nID ); private: static GlobalEventConfig_Impl* m_pImpl; diff --git a/sc/source/ui/vba/vbaeventshelper.cxx b/sc/source/ui/vba/vbaeventshelper.cxx index 078060d87e25..d0415abab096 100644 --- a/sc/source/ui/vba/vbaeventshelper.cxx +++ b/sc/source/ui/vba/vbaeventshelper.cxx @@ -564,36 +564,36 @@ ScVbaEventsHelper::~ScVbaEventsHelper() void SAL_CALL ScVbaEventsHelper::notifyEvent( const css::document::EventObject& rEvent ) throw (css::uno::RuntimeException, std::exception) { static const uno::Sequence< uno::Any > saEmptyArgs; - if( (rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC )) || - (rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CREATEDOC )) ) // CREATEDOC triggered e.g. during VBA Workbooks.Add + if( (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::OPENDOC )) || + (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::CREATEDOC )) ) // CREATEDOC triggered e.g. during VBA Workbooks.Add { processVbaEventNoThrow( WORKBOOK_OPEN, saEmptyArgs ); } - else if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ) ) + else if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::ACTIVATEDOC ) ) { processVbaEventNoThrow( WORKBOOK_ACTIVATE, saEmptyArgs ); } - else if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ) ) + else if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::DEACTIVATEDOC ) ) { processVbaEventNoThrow( WORKBOOK_DEACTIVATE, saEmptyArgs ); } - else if( (rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_SAVEDOCDONE )) || - (rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_SAVEASDOCDONE )) || - (rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_SAVETODOCDONE )) ) + else if( (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVEDOCDONE )) || + (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVEASDOCDONE )) || + (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVETODOCDONE )) ) { uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= true; processVbaEventNoThrow( WORKBOOK_AFTERSAVE, aArgs ); } - else if( (rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_SAVEDOCFAILED )) || - (rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_SAVEASDOCFAILED )) || - (rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_SAVETODOCFAILED )) ) + else if( (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVEDOCFAILED )) || + (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVEASDOCFAILED )) || + (rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::SAVETODOCFAILED )) ) { uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= false; processVbaEventNoThrow( WORKBOOK_AFTERSAVE, aArgs ); } - else if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) ) + else if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ) ) { /* Trigger the WORKBOOK_WINDOWDEACTIVATE and WORKBOOK_DEACTIVATE events and stop listening to the model (done in base class). */ @@ -606,7 +606,7 @@ void SAL_CALL ScVbaEventsHelper::notifyEvent( const css::document::EventObject& } processVbaEventNoThrow( WORKBOOK_DEACTIVATE, saEmptyArgs ); } - else if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ) ) + else if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::VIEWCREATED ) ) { uno::Reference< frame::XController > xController( mxModel->getCurrentController() ); if( mxListener.get() && xController.is() ) diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index ad88d7700901..290ded19f137 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -333,7 +333,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) if ( pOldContainerFrame ) { if ( bTaskActivate ) - NotifyEvent( SfxViewEventHint( SFX_EVENT_DEACTIVATEDOC, GlobalEventConfig::GetEventName(STR_EVENT_DEACTIVATEDOC), pOldContainerFrame->GetObjectShell(), pOldContainerFrame->GetFrame().GetController() ) ); + NotifyEvent( SfxViewEventHint( SFX_EVENT_DEACTIVATEDOC, GlobalEventConfig::GetEventName(GlobalEventId::DEACTIVATEDOC), pOldContainerFrame->GetObjectShell(), pOldContainerFrame->GetFrame().GetController() ) ); pOldContainerFrame->DoDeactivate( bTaskActivate, pFrame ); if( pOldContainerFrame->GetProgress() ) @@ -348,7 +348,7 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) if ( bTaskActivate && pNewContainerFrame->GetObjectShell() ) { pNewContainerFrame->GetObjectShell()->PostActivateEvent_Impl( pNewContainerFrame ); - NotifyEvent(SfxViewEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName(STR_EVENT_ACTIVATEDOC), pNewContainerFrame->GetObjectShell(), pNewContainerFrame->GetFrame().GetController() ) ); + NotifyEvent(SfxViewEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName(GlobalEventId::ACTIVATEDOC), pNewContainerFrame->GetObjectShell(), pNewContainerFrame->GetFrame().GetController() ) ); } SfxProgress *pProgress = pNewContainerFrame->GetProgress(); diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index a5f90700340e..1a04f9711ebe 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -124,7 +124,7 @@ void SfxObjectShell::SetVisArea( const Rectangle & rVisArea ) if ( IsEnableSetModified() ) SetModified( true ); - SfxGetpApp()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(STR_EVENT_VISAREACHANGED), this)); + SfxGetpApp()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(GlobalEventId::VISAREACHANGED), this)); } } } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 98dbc7fee6c9..3aa652121d62 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -369,7 +369,7 @@ void SfxObjectShell::ModifyChanged() Invalidate( SID_MACRO_SIGNATURE ); Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); // xmlsec05, signed state might change in title... - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, GlobalEventConfig::GetEventName(STR_EVENT_MODIFYCHANGED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_MODIFYCHANGED, GlobalEventConfig::GetEventName(GlobalEventId::MODIFYCHANGED), this ) ); } @@ -1030,9 +1030,9 @@ void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame* pFrame ) sal_uInt16 nId = pImp->nEventId; pImp->nEventId = 0; if ( nId == SFX_EVENT_OPENDOC ) - pSfxApp->NotifyEvent(SfxViewEventHint( nId, GlobalEventConfig::GetEventName(STR_EVENT_OPENDOC), this, pFrame->GetFrame().GetController() ), false); + pSfxApp->NotifyEvent(SfxViewEventHint( nId, GlobalEventConfig::GetEventName(GlobalEventId::OPENDOC), this, pFrame->GetFrame().GetController() ), false); else if (nId == SFX_EVENT_CREATEDOC ) - pSfxApp->NotifyEvent(SfxViewEventHint( nId, GlobalEventConfig::GetEventName(STR_EVENT_CREATEDOC), this, pFrame->GetFrame().GetController() ), false); + pSfxApp->NotifyEvent(SfxViewEventHint( nId, GlobalEventConfig::GetEventName(GlobalEventId::CREATEDOC), this, pFrame->GetFrame().GetController() ), false); } } } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index d181c628cf5d..afd3de2eb42d 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -3115,7 +3115,7 @@ uno::Reference< embed::XStorage > SfxObjectShell::GetStorage() SetupStorage( pImp->m_xDocStorage, SOFFICE_FILEFORMAT_CURRENT, false, false ); pImp->m_bCreateTempStor = false; - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(STR_EVENT_STORAGECHANGED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(GlobalEventId::STORAGECHANGED), this ) ); } catch( uno::Exception& ) { @@ -3266,7 +3266,7 @@ bool SfxObjectShell::SaveCompleted( const uno::Reference< embed::XStorage >& xSt if ( bSendNotification ) { - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(STR_EVENT_STORAGECHANGED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_STORAGECHANGED, GlobalEventConfig::GetEventName(GlobalEventId::STORAGECHANGED), this ) ); } return bResult; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 4e562e54f56d..bfbe5d3e9e95 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -607,7 +607,7 @@ bool SfxObjectShell::PrepareClose } SfxApplication *pSfxApp = SfxGetpApp(); - pSfxApp->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEDOC, GlobalEventConfig::GetEventName(STR_EVENT_PREPARECLOSEDOC), this) ); + pSfxApp->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEDOC, GlobalEventConfig::GetEventName(GlobalEventId::PREPARECLOSEDOC), this) ); if( GetCreateMode() == SfxObjectCreateMode::EMBEDDED ) { @@ -1155,11 +1155,11 @@ void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) if ( i_fromInitNew ) { SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(GlobalEventId::DOCCREATED), this ) ); } else { - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(GlobalEventId::LOADFINISHED), this ) ); } } diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index bc1f5e43f585..20f15ee6aec2 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -1576,7 +1576,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > SfxAllItemSet *pParams = new SfxAllItemSet( SfxGetpApp()->GetPool() ); TransformParameters( nSlotId, aArgs, *pParams ); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOC), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOC, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOC), m_pData->m_pObjectShell ) ); bool bRet = false; @@ -1617,7 +1617,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > m_pData->m_pObjectShell->AddLog( OUString( OSL_LOG_PREFIX "successful saving." ) ); m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOCDONE), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCDONE), m_pData->m_pObjectShell ) ); } else { @@ -1625,7 +1625,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const Sequence< beans::PropertyValue > m_pData->m_pObjectShell->StoreLog(); // write the contents of the logger to the file - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(STR_EVENT_SAVEDOCFAILED), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEDOCFAILED, GlobalEventConfig::GetEventName(GlobalEventId::SAVEDOCFAILED), m_pData->m_pObjectShell ) ); throw task::ErrorCodeIOException( "SfxBaseModel::storeSelf: 0x" + OUString::number(nErrCode, 16), @@ -2831,11 +2831,11 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , { OUString aTitle = m_pData->m_pObjectShell->GetTitle(); addTitle_Impl( m_pData->m_seqArguments, aTitle ); - postEvent_Impl( GlobalEventConfig::GetEventName( STR_EVENT_TITLECHANGED ) ); + postEvent_Impl( GlobalEventConfig::GetEventName( GlobalEventId::TITLECHANGED ) ); } if ( pSimpleHint->GetId() == SFX_HINT_MODECHANGED ) { - postEvent_Impl( GlobalEventConfig::GetEventName( STR_EVENT_MODECHANGED ) ); + postEvent_Impl( GlobalEventConfig::GetEventName( GlobalEventId::MODECHANGED ) ); } } } @@ -3008,7 +3008,7 @@ void SfxBaseModel::impl_store( const OUString& sURL if ( !bSaved && m_pData->m_pObjectShell ) { - SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOC : STR_EVENT_SAVEASDOC ), + SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOC : SFX_EVENT_SAVEASDOC, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOC : GlobalEventId::SAVEASDOC ), m_pData->m_pObjectShell ) ); SfxAllItemSet *aParams = new SfxAllItemSet( SfxGetpApp()->GetPool() ); @@ -3108,14 +3108,14 @@ void SfxBaseModel::impl_store( const OUString& sURL m_pData->m_aPreusedFilterName = GetMediumFilterName_Impl(); m_pData->m_pObjectShell->SetModifyPasswordEntered(); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVEASDOCDONE), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVEASDOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVEASDOCDONE), m_pData->m_pObjectShell ) ); } else { m_pData->m_pObjectShell->SetModifyPasswordHash( nOldModifyPasswordHash ); m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(STR_EVENT_SAVETODOCDONE), m_pData->m_pObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_SAVETODOCDONE, GlobalEventConfig::GetEventName(GlobalEventId::SAVETODOCDONE), m_pData->m_pObjectShell ) ); } } else @@ -3128,7 +3128,7 @@ void SfxBaseModel::impl_store( const OUString& sURL m_pData->m_pObjectShell->SetModifyPasswordInfo( aOldModifyPasswordInfo ); - SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? STR_EVENT_SAVETODOCFAILED : STR_EVENT_SAVEASDOCFAILED), + SfxGetpApp()->NotifyEvent( SfxEventHint( bSaveTo ? SFX_EVENT_SAVETODOCFAILED : SFX_EVENT_SAVEASDOCFAILED, GlobalEventConfig::GetEventName( bSaveTo ? GlobalEventId::SAVETODOCFAILED : GlobalEventId::SAVEASDOCFAILED), m_pData->m_pObjectShell ) ); throw task::ErrorCodeIOException( diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index c830ff577a17..29fbf423c6f6 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -207,7 +207,7 @@ bool SfxFrame::PrepareClose_Impl( bool bUI ) bOther = ( &pFrame->GetFrame() != this ); } - SfxGetpApp()->NotifyEvent( SfxViewEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur, GetController() ) ); + SfxGetpApp()->NotifyEvent( SfxViewEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( GlobalEventId::PREPARECLOSEVIEW ), pCur, GetController() ) ); if ( bOther ) // if there are other views only the current view of this frame must be asked diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 22d283b9553c..2bcac22259bb 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -571,7 +571,7 @@ void SAL_CALL SfxBaseController::attachFrame( const Reference< frame::XFrame >& ShowInfoBars( ); // attaching the frame to the controller is the last step in the creation of a new view, so notify this - SfxViewEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell(), Reference< frame::XController2 >( this ) ); + SfxViewEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( GlobalEventId::VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell(), Reference< frame::XController2 >( this ) ); SfxGetpApp()->NotifyEvent( aHint ); } } @@ -1000,9 +1000,9 @@ void SAL_CALL SfxBaseController::dispose() throw( RuntimeException, std::excepti pView = SfxViewFrame::GetNext( *pView, pDoc ); } - SfxGetpApp()->NotifyEvent( SfxViewEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc, Reference< frame::XController2 >( this ) ) ); + SfxGetpApp()->NotifyEvent( SfxViewEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEVIEW ), pDoc, Reference< frame::XController2 >( this ) ) ); if ( !pView ) - SfxGetpApp()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) ); + SfxGetpApp()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ), pDoc) ); Reference< frame::XModel > xModel = pDoc->GetModel(); Reference < util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index cfae5c1232e2..124a1f676897 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -822,7 +822,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } // Propagate document closure. - SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ), xOldObj ) ); } // Record as done diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index d478a4a847d2..1ffc411ffd89 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -316,7 +316,7 @@ void SfxPrinterController::jobStarted() xDocProps->setPrintDate( now.GetUNODateTime() ); - SfxGetpApp()->NotifyEvent( SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), mpObjectShell ) ); + SfxGetpApp()->NotifyEvent( SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( GlobalEventId::PRINTDOC ), mpObjectShell ) ); uno::Sequence < beans::PropertyValue > aOpts; aOpts = getJobProperties( aOpts ); diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index c96cd46c8173..1e41db81ea96 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -171,7 +171,7 @@ void SmDocShell::SetText(const OUString& rBuffer) // have SwOleClient::FormatChanged() to align the modified formula properly // even if the vis area does not change (e.g. when formula text changes from // "{a over b + c} over d" to "d over {a over b + c}" - SfxGetpApp()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(STR_EVENT_VISAREACHANGED), this)); + SfxGetpApp()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(GlobalEventId::VISAREACHANGED), this)); Repaint(); } diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 9eebbfa0af62..84e90e5ea894 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -882,7 +882,7 @@ void SwHTMLParser::InsertBodyOptions() eScriptType2 = STARBASIC; //fallthrough case HTML_O_ONLOAD: - aEvent = GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ); + aEvent = GlobalEventConfig::GetEventName( GlobalEventId::OPENDOC ); bSetEvent = true; break; @@ -890,7 +890,7 @@ void SwHTMLParser::InsertBodyOptions() eScriptType2 = STARBASIC; //fallthrough case HTML_O_ONUNLOAD: - aEvent = GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ); + aEvent = GlobalEventConfig::GetEventName( GlobalEventId::PREPARECLOSEDOC ); bSetEvent = true; break; @@ -898,7 +898,7 @@ void SwHTMLParser::InsertBodyOptions() eScriptType2 = STARBASIC; //fallthrough case HTML_O_ONFOCUS: - aEvent = GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ); + aEvent = GlobalEventConfig::GetEventName( GlobalEventId::ACTIVATEDOC ); bSetEvent = true; break; @@ -906,7 +906,7 @@ void SwHTMLParser::InsertBodyOptions() eScriptType2 = STARBASIC; //fallthrough case HTML_O_ONBLUR: - aEvent = GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ); + aEvent = GlobalEventConfig::GetEventName( GlobalEventId::DEACTIVATEDOC ); bSetEvent = true; break; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 706015d73dbd..880ed86cf4c4 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -657,10 +657,10 @@ void SwDocShell::Execute(SfxRequest& rReq) pSrcView->SaveContent(aTempFile.GetURL()); bDone = true; SvxMacro aMac(aEmptyOUStr, aEmptyOUStr, STARBASIC); - SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this); - SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this); - SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this); - SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this); + SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( GlobalEventId::OPENDOC ), aMac, this); + SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( GlobalEventId::PREPARECLOSEDOC ), aMac, this); + SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( GlobalEventId::ACTIVATEDOC ), aMac, this); + SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( GlobalEventId::DEACTIVATEDOC ), aMac, this); ReloadFromHtml(aTempFile.GetURL(), pSrcView); nSlot = 0; } diff --git a/unotools/source/config/eventcfg.cxx b/unotools/source/config/eventcfg.cxx index e5b0d4de1f9c..313542ca1ef6 100644 --- a/unotools/source/config/eventcfg.cxx +++ b/unotools/source/config/eventcfg.cxx @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include @@ -43,7 +45,7 @@ static const char ROOTNODE_EVENTS[] = "Office.Events/ApplicationEvents"; #define SETNODE_BINDINGS "Bindings" #define PROPERTYNAME_BINDINGURL "BindingURL" -const char* pEventAsciiNames[] = +static o3tl::enumarray pEventAsciiNames = { "OnStartApp", "OnCloseApp", @@ -75,38 +77,43 @@ const char* pEventAsciiNames[] = "OnStorageChanged" }; +typedef std::unordered_map< OUString, OUString, OUStringHash, std::equal_to< OUString > > EventBindingHash; +typedef std::vector< css::uno::WeakReference< css::frame::XFrame > > FrameVector; +typedef o3tl::enumarray< GlobalEventId, OUString > SupportedEventsVector; + +class GlobalEventConfig_Impl : public utl::ConfigItem +{ +private: + EventBindingHash m_eventBindingHash; + FrameVector m_lFrames; + SupportedEventsVector m_supportedEvents; + + void initBindingInfo(); + + virtual void ImplCommit() SAL_OVERRIDE; + +public: + GlobalEventConfig_Impl( ); + virtual ~GlobalEventConfig_Impl( ); + + void Notify( const com::sun::star::uno::Sequence& aPropertyNames) SAL_OVERRIDE; + + void SAL_CALL replaceByName( const OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException); + bool SAL_CALL hasByName( const OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); + bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); + OUString GetEventName( GlobalEventId nID ); +}; + + GlobalEventConfig_Impl::GlobalEventConfig_Impl() : ConfigItem( ROOTNODE_EVENTS, CONFIG_MODE_IMMEDIATE_UPDATE ) { // the supported event names - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STARTAPP] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEAPP] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DOCCREATED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CREATEDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_LOADFINISHED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_OPENDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCDONE] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCFAILED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCDONE] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCFAILED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCDONE] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCFAILED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_ACTIVATEDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DEACTIVATEDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PRINTDOC] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VIEWCREATED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEVIEW] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEVIEW] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODIFYCHANGED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_TITLECHANGED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VISAREACHANGED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODECHANGED] ) ); - m_supportedEvents.push_back(OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STORAGECHANGED] ) ); + for (GlobalEventId id : o3tl::enumrange()) + m_supportedEvents[id] = OUString::createFromAscii( pEventAsciiNames[id] ); initBindingInfo(); @@ -125,12 +132,9 @@ GlobalEventConfig_Impl::~GlobalEventConfig_Impl() assert(!IsModified()); // should have been committed } -OUString GlobalEventConfig_Impl::GetEventName( sal_Int32 nIndex ) +OUString GlobalEventConfig_Impl::GetEventName( GlobalEventId nIndex ) { - if ( nIndex < (sal_Int32) m_supportedEvents.size() ) - return m_supportedEvents[nIndex]; - else - return OUString(); + return m_supportedEvents[nIndex]; } // public method @@ -257,7 +261,7 @@ Any SAL_CALL GlobalEventConfig_Impl::getByName( const OUString& aName ) throw (c else { // not yet accessed - is it a supported name? - SupportedEventsVector::const_iterator pos = ::std::find( + SupportedEventsVector::iterator pos = ::std::find( m_supportedEvents.begin(), m_supportedEvents.end(), aName ); if ( pos == m_supportedEvents.end() ) throw container::NoSuchElementException( aName ); @@ -270,7 +274,7 @@ Any SAL_CALL GlobalEventConfig_Impl::getByName( const OUString& aName ) throw (c Sequence< OUString > SAL_CALL GlobalEventConfig_Impl::getElementNames( ) throw (RuntimeException) { - return uno::Sequence< OUString >(m_supportedEvents.data(), m_supportedEvents.size()); + return uno::Sequence< OUString >(m_supportedEvents.data(), SupportedEventsVector::size()); } bool SAL_CALL GlobalEventConfig_Impl::hasByName( const OUString& aName ) throw (RuntimeException) @@ -279,7 +283,7 @@ bool SAL_CALL GlobalEventConfig_Impl::hasByName( const OUString& aName ) throw ( return true; // never accessed before - is it supported in general? - SupportedEventsVector::const_iterator pos = ::std::find( + SupportedEventsVector::iterator pos = ::std::find( m_supportedEvents.begin(), m_supportedEvents.end(), aName ); if ( pos != m_supportedEvents.end() ) return true; @@ -381,7 +385,7 @@ Mutex& GlobalEventConfig::GetOwnStaticMutex() return theGlobalEventConfigMutex::get(); } -OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex ) +OUString GlobalEventConfig::GetEventName( GlobalEventId nIndex ) { return GlobalEventConfig().m_pImpl->GetEventName( nIndex ); } diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx index c7a1e08a7733..e68105816ead 100644 --- a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx +++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx @@ -132,7 +132,7 @@ sal_Bool SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, cons void SAL_CALL VbaEventsHelperBase::notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException, std::exception) { SAL_INFO("vbahelper", "VbaEventsHelperBase::notifyEvent( \"" << rEvent.EventName << "\" )"); - if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) ) + if( rEvent.EventName == GlobalEventConfig::GetEventName( GlobalEventId::CLOSEDOC ) ) stopListening(); } -- cgit