[Libreoffice-commits] core.git: sc/inc sc/source

Noel Grandin noelgrandin at gmail.com
Tue Sep 22 11:48:05 PDT 2015


 sc/inc/document.hxx                 |    7 ++--
 sc/inc/sheetevents.hxx              |   22 ++++++---------
 sc/source/core/data/documen3.cxx    |    4 +-
 sc/source/core/data/documen7.cxx    |    2 -
 sc/source/core/data/sheetevents.cxx |   52 +++++++++++-------------------------
 sc/source/ui/docshell/docsh4.cxx    |    2 -
 sc/source/ui/unoobj/docuno.cxx      |   12 ++++----
 sc/source/ui/unoobj/eventuno.cxx    |   28 +++++++++----------
 sc/source/ui/unoobj/viewuno.cxx     |   20 ++++++-------
 9 files changed, 63 insertions(+), 86 deletions(-)

New commits:
commit 015eb39d963acf534bd5beaf9331a6d37af2acd6
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Mon Sep 21 16:57:00 2015 +0200

    convert SC_SHEETEVENT to scoped enum
    
    Change-Id: I472e3f0a78f979bcf8333076f7560ebb7dd859d6
    Reviewed-on: https://gerrit.libreoffice.org/18767
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 92fbdfc..97384ae 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -188,6 +188,7 @@ struct ScQueryParam;
 class ScHint;
 class SvtBroadcaster;
 enum class ScDBDataPortion;
+enum class ScSheetEventId;
 
 namespace com { namespace sun { namespace star {
     namespace lang {
@@ -815,8 +816,8 @@ public:
 
     const ScSheetEvents* GetSheetEvents( SCTAB nTab ) const;
     void            SetSheetEvents( SCTAB nTab, const ScSheetEvents* pNew );
-    bool            HasSheetEventScript( SCTAB nTab, sal_Int32 nEvent, bool bWithVbaEvents = false ) const;
-    bool            HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents = false ) const;  // on any sheet
+    bool            HasSheetEventScript( SCTAB nTab, ScSheetEventId nEvent, bool bWithVbaEvents = false ) const;
+    bool            HasAnySheetEventScript( ScSheetEventId nEvent, bool bWithVbaEvents = false ) const;  // on any sheet
 
     bool            HasAnyCalcNotification() const;
     bool            HasCalcNotification( SCTAB nTab ) const;
@@ -837,7 +838,7 @@ public:
     SC_DLLPUBLIC void EnsureTable( SCTAB nTab );
 
                     //  return TRUE = number format is set
-    SC_DLLPUBLIC bool           SetString(
+    SC_DLLPUBLIC bool SetString(
         SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
         ScSetStringParam* pParam = NULL );
     SC_DLLPUBLIC bool SetString( const ScAddress& rPos, const OUString& rString, ScSetStringParam* pParam = NULL );
diff --git a/sc/inc/sheetevents.hxx b/sc/inc/sheetevents.hxx
index 46549b8..c943360 100644
--- a/sc/inc/sheetevents.hxx
+++ b/sc/inc/sheetevents.hxx
@@ -22,14 +22,10 @@
 
 #include <rtl/ustring.hxx>
 
-#define SC_SHEETEVENT_FOCUS         0
-#define SC_SHEETEVENT_UNFOCUS       1
-#define SC_SHEETEVENT_SELECT        2
-#define SC_SHEETEVENT_DOUBLECLICK   3
-#define SC_SHEETEVENT_RIGHTCLICK    4
-#define SC_SHEETEVENT_CHANGE        5
-#define SC_SHEETEVENT_CALCULATE     6
-#define SC_SHEETEVENT_COUNT         7
+enum class ScSheetEventId {
+    FOCUS, UNFOCUS, SELECT, DOUBLECLICK, RIGHTCLICK, CHANGE, CALCULATE, COUNT,
+    NOTFOUND = -1 // used as a an error return value
+};
 
 class ScSheetEvents
 {
@@ -44,12 +40,12 @@ public:
 
     const ScSheetEvents&    operator= (const ScSheetEvents& rOther);
 
-    const OUString*    GetScript(sal_Int32 nEvent) const;
-    void                    SetScript(sal_Int32 nEvent, const OUString* pNew);
+    const OUString*         GetScript(ScSheetEventId nEvent) const;
+    void                    SetScript(ScSheetEventId nEvent, const OUString* pNew);
 
-    static OUString    GetEventName(sal_Int32 nEvent);
-    static sal_Int32        GetVbaSheetEventId(sal_Int32 nEvent);
-    static sal_Int32        GetVbaDocumentEventId(sal_Int32 nEvent);
+    static OUString         GetEventName(ScSheetEventId nEvent);
+    static sal_Int32        GetVbaSheetEventId(ScSheetEventId nEvent);
+    static sal_Int32        GetVbaDocumentEventId(ScSheetEventId nEvent);
 };
 
 #endif
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index df944a3..e9b2f55 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -630,7 +630,7 @@ void ScDocument::SetSheetEvents( SCTAB nTab, const ScSheetEvents* pNew )
         maTabs[nTab]->SetSheetEvents( pNew );
 }
 
-bool ScDocument::HasSheetEventScript( SCTAB nTab, sal_Int32 nEvent, bool bWithVbaEvents ) const
+bool ScDocument::HasSheetEventScript( SCTAB nTab, ScSheetEventId nEvent, bool bWithVbaEvents ) const
 {
     if (nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
     {
@@ -654,7 +654,7 @@ bool ScDocument::HasSheetEventScript( SCTAB nTab, sal_Int32 nEvent, bool bWithVb
     return false;
 }
 
-bool ScDocument::HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents ) const
+bool ScDocument::HasAnySheetEventScript( ScSheetEventId nEvent, bool bWithVbaEvents ) const
 {
     SCTAB nSize = static_cast<SCTAB>(maTabs.size());
     for (SCTAB nTab = 0; nTab < nSize; nTab++)
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index cb3ba05..864a77b 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -595,7 +595,7 @@ void ScDocument::TrackFormulas( sal_uLong nHintId )
     if ( pFormulaTrack )
     {
         // outside the loop, check if any sheet has a "calculate" event script
-        bool bCalcEvent = HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true );
+        bool bCalcEvent = HasAnySheetEventScript( ScSheetEventId::CALCULATE, true );
         ScFormulaCell* pTrack;
         ScFormulaCell* pNext;
         pTrack = pFormulaTrack;
diff --git a/sc/source/core/data/sheetevents.cxx b/sc/source/core/data/sheetevents.cxx
index 2a75d8a..b332879 100644
--- a/sc/source/core/data/sheetevents.cxx
+++ b/sc/source/core/data/sheetevents.cxx
@@ -21,14 +21,8 @@
 #include <com/sun/star/script/vba/VBAEventId.hpp>
 #include <osl/diagnose.h>
 
-OUString ScSheetEvents::GetEventName(sal_Int32 nEvent)
+OUString ScSheetEvents::GetEventName(ScSheetEventId nEvent)
 {
-    if (nEvent<0 || nEvent>=SC_SHEETEVENT_COUNT)
-    {
-        OSL_FAIL("invalid event number");
-        return OUString();
-    }
-
     static const sal_Char* aEventNames[] =
     {
         "OnFocus",                  // SC_SHEETEVENT_FOCUS
@@ -39,17 +33,12 @@ OUString ScSheetEvents::GetEventName(sal_Int32 nEvent)
         "OnChange",                 // SC_SHEETEVENT_CHANGE
         "OnCalculate"               // SC_SHEETEVENT_CALCULATE
     };
-    return OUString::createFromAscii(aEventNames[nEvent]);
+    return OUString::createFromAscii(aEventNames[static_cast<int>(nEvent)]);
 }
 
-sal_Int32 ScSheetEvents::GetVbaSheetEventId(sal_Int32 nEvent)
+sal_Int32 ScSheetEvents::GetVbaSheetEventId(ScSheetEventId nEvent)
 {
     using namespace ::com::sun::star::script::vba::VBAEventId;
-    if (nEvent<0 || nEvent>=SC_SHEETEVENT_COUNT)
-    {
-        OSL_FAIL("invalid event number");
-        return NO_EVENT;
-    }
 
     static const sal_Int32 nVbaEventIds[] =
     {
@@ -61,10 +50,12 @@ sal_Int32 ScSheetEvents::GetVbaSheetEventId(sal_Int32 nEvent)
         WORKSHEET_CHANGE,               // SC_SHEETEVENT_CHANGE
         WORKSHEET_CALCULATE             // SC_SHEETEVENT_CALCULATE
     };
-    return nVbaEventIds[nEvent];
+    return nVbaEventIds[static_cast<int>(nEvent)];
 }
 
-sal_Int32 ScSheetEvents::GetVbaDocumentEventId(sal_Int32 nEvent)
+static const int COUNT = static_cast<int>(ScSheetEventId::COUNT);
+
+sal_Int32 ScSheetEvents::GetVbaDocumentEventId(ScSheetEventId nEvent)
 {
     using namespace ::com::sun::star::script::vba::VBAEventId;
     sal_Int32 nSheetEventId = GetVbaSheetEventId(nEvent);
@@ -85,7 +76,7 @@ void ScSheetEvents::Clear()
 {
     if (mpScriptNames)
     {
-        for (sal_Int32 nEvent=0; nEvent<SC_SHEETEVENT_COUNT; ++nEvent)
+        for (sal_Int32 nEvent=0; nEvent<COUNT; ++nEvent)
             delete mpScriptNames[nEvent];
         delete[] mpScriptNames;
         mpScriptNames = NULL;
@@ -103,8 +94,8 @@ const ScSheetEvents& ScSheetEvents::operator=(const ScSheetEvents& rOther)
     Clear();
     if (rOther.mpScriptNames)
     {
-        mpScriptNames = new OUString*[SC_SHEETEVENT_COUNT];
-        for (sal_Int32 nEvent=0; nEvent<SC_SHEETEVENT_COUNT; ++nEvent)
+        mpScriptNames = new OUString*[COUNT];
+        for (sal_Int32 nEvent=0; nEvent<COUNT; ++nEvent)
             if (rOther.mpScriptNames[nEvent])
                 mpScriptNames[nEvent] = new OUString(*rOther.mpScriptNames[nEvent]);
             else
@@ -113,31 +104,20 @@ const ScSheetEvents& ScSheetEvents::operator=(const ScSheetEvents& rOther)
     return *this;
 }
 
-const OUString* ScSheetEvents::GetScript(sal_Int32 nEvent) const
+const OUString* ScSheetEvents::GetScript(ScSheetEventId nEvent) const
 {
-    if (nEvent<0 || nEvent>=SC_SHEETEVENT_COUNT)
-    {
-        OSL_FAIL("invalid event number");
-        return NULL;
-    }
-
     if (mpScriptNames)
-        return mpScriptNames[nEvent];
+        return mpScriptNames[static_cast<int>(nEvent)];
     return NULL;
 }
 
-void ScSheetEvents::SetScript(sal_Int32 nEvent, const OUString* pNew)
+void ScSheetEvents::SetScript(ScSheetEventId eEvent, const OUString* pNew)
 {
-    if (nEvent<0 || nEvent>=SC_SHEETEVENT_COUNT)
-    {
-        OSL_FAIL("invalid event number");
-        return;
-    }
-
+    int nEvent = static_cast<int>(eEvent);
     if (!mpScriptNames)
     {
-        mpScriptNames = new OUString*[SC_SHEETEVENT_COUNT];
-        for (sal_Int32 nEventIdx=0; nEventIdx<SC_SHEETEVENT_COUNT; ++nEventIdx)
+        mpScriptNames = new OUString*[COUNT];
+        for (sal_Int32 nEventIdx=0; nEventIdx<COUNT; ++nEventIdx)
             mpScriptNames[nEventIdx] = NULL;
     }
     delete mpScriptNames[nEvent];
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index a38c85f..6e1717fe 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1249,7 +1249,7 @@ void ScDocShell::DoHardRecalc( bool /* bApi */ )
     // (might check for the presence of any formulas on each sheet)
     SCTAB nTabCount = aDocument.GetTableCount();
     SCTAB nTab;
-    if (aDocument.HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true )) // search also for VBA hendler
+    if (aDocument.HasAnySheetEventScript( ScSheetEventId::CALCULATE, true )) // search also for VBA hendler
         for (nTab=0; nTab<nTabCount; nTab++)
             aDocument.SetCalcNotification(nTab);
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 128b408..15d694a 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1002,12 +1002,12 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                 if ( rDoc.GetVbaEventProcessor().is() )
                 {
                     // If the VBA event processor is set, HasAnyCalcNotification is much faster than HasAnySheetEventScript
-                    if ( rDoc.HasAnyCalcNotification() && rDoc.HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true ) )
+                    if ( rDoc.HasAnyCalcNotification() && rDoc.HasAnySheetEventScript( ScSheetEventId::CALCULATE, true ) )
                         HandleCalculateEvents();
                 }
                 else
                 {
-                    if ( rDoc.HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE ) )
+                    if ( rDoc.HasAnySheetEventScript( ScSheetEventId::CALCULATE ) )
                         HandleCalculateEvents();
                 }
             }
@@ -2565,7 +2565,7 @@ bool ScModelObj::HasChangesListeners() const
         return true;
 
     // "change" event set in any sheet?
-    return pDocShell && pDocShell->GetDocument().HasAnySheetEventScript(SC_SHEETEVENT_CHANGE);
+    return pDocShell && pDocShell->GetDocument().HasAnySheetEventScript(ScSheetEventId::CHANGE);
 }
 
 void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& rRanges,
@@ -2627,7 +2627,7 @@ void ScModelObj::NotifyChanges( const OUString& rOperation, const ScRangeList& r
             const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
             if (pEvents)
             {
-                const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_CHANGE);
+                const OUString* pScript = pEvents->GetScript(ScSheetEventId::CHANGE);
                 if (pScript)
                 {
                     ScRangeList aTabRanges;     // collect ranges on this sheet
@@ -2684,7 +2684,7 @@ void ScModelObj::HandleCalculateEvents()
                 {
                     if (const ScSheetEvents* pEvents = rDoc.GetSheetEvents( nTab ))
                     {
-                        if (const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_CALCULATE))
+                        if (const OUString* pScript = pEvents->GetScript(ScSheetEventId::CALCULATE))
                         {
                             uno::Any aRet;
                             uno::Sequence<uno::Any> aParams;
@@ -2699,7 +2699,7 @@ void ScModelObj::HandleCalculateEvents()
                         uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
                         uno::Sequence< uno::Any > aArgs( 1 );
                         aArgs[ 0 ] <<= nTab;
-                        xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_CALCULATE ), aArgs );
+                        xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::CALCULATE ), aArgs );
                     }
                     catch( uno::Exception& )
                     {
diff --git a/sc/source/ui/unoobj/eventuno.cxx b/sc/source/ui/unoobj/eventuno.cxx
index 3b51ebd..01e42c4 100644
--- a/sc/source/ui/unoobj/eventuno.cxx
+++ b/sc/source/ui/unoobj/eventuno.cxx
@@ -53,13 +53,13 @@ void ScSheetEventsObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
     }
 }
 
-static sal_Int32 lcl_GetEventFromName( const OUString& aName )
+static ScSheetEventId lcl_GetEventFromName( const OUString& aName )
 {
-    for (sal_Int32 nEvent=0; nEvent<SC_SHEETEVENT_COUNT; ++nEvent)
-        if ( aName == ScSheetEvents::GetEventName(nEvent) )
-            return nEvent;
+    for (sal_Int32 nEvent=0; nEvent<static_cast<sal_Int32>(ScSheetEventId::COUNT); ++nEvent)
+        if ( aName == ScSheetEvents::GetEventName(static_cast<ScSheetEventId>(nEvent)) )
+            return static_cast<ScSheetEventId>(nEvent);
 
-    return -1;      // not found
+    return ScSheetEventId::NOTFOUND;      // not found
 }
 
 // XNameReplace
@@ -72,8 +72,8 @@ void SAL_CALL ScSheetEventsObj::replaceByName( const OUString& aName, const uno:
     if (!mpDocShell)
         throw uno::RuntimeException();
 
-    sal_Int32 nEvent = lcl_GetEventFromName(aName);
-    if (nEvent < 0)
+    ScSheetEventId nEvent = lcl_GetEventFromName(aName);
+    if (nEvent == ScSheetEventId::NOTFOUND)
         throw container::NoSuchElementException();
 
     ScSheetEvents aNewEvents;
@@ -121,8 +121,8 @@ uno::Any SAL_CALL ScSheetEventsObj::getByName( const OUString& aName )
     throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    sal_Int32 nEvent = lcl_GetEventFromName(aName);
-    if (nEvent < 0)
+    ScSheetEventId nEvent = lcl_GetEventFromName(aName);
+    if (nEvent == ScSheetEventId::NOTFOUND)
         throw container::NoSuchElementException();
 
     const OUString* pScript = NULL;
@@ -152,17 +152,17 @@ uno::Any SAL_CALL ScSheetEventsObj::getByName( const OUString& aName )
 uno::Sequence<OUString> SAL_CALL ScSheetEventsObj::getElementNames() throw(uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    uno::Sequence<OUString> aNames(SC_SHEETEVENT_COUNT);
-    for (sal_Int32 nEvent=0; nEvent<SC_SHEETEVENT_COUNT; ++nEvent)
-        aNames[nEvent] = ScSheetEvents::GetEventName(nEvent);
+    uno::Sequence<OUString> aNames((int)ScSheetEventId::COUNT);
+    for (sal_Int32 nEvent=0; nEvent<(int)ScSheetEventId::COUNT; ++nEvent)
+        aNames[nEvent] = ScSheetEvents::GetEventName((ScSheetEventId)nEvent);
     return aNames;
 }
 
 sal_Bool SAL_CALL ScSheetEventsObj::hasByName( const OUString& aName ) throw(uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
-    sal_Int32 nEvent = lcl_GetEventFromName(aName);
-    return (nEvent >= 0);
+    ScSheetEventId nEvent = lcl_GetEventFromName(aName);
+    return (nEvent != ScSheetEventId::NOTFOUND);
 }
 
 // XElementAccess
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 9254cc9..a810a5f 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -510,7 +510,7 @@ void SAL_CALL ScTabViewObj::release() throw()
     SfxBaseController::release();
 }
 
-static void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, sal_Int32 nEvent )
+static void lcl_CallActivate( ScDocShell* pDocSh, SCTAB nTab, ScSheetEventId nEvent )
 {
     ScDocument& rDoc = pDocSh->GetDocument();
     // when deleting a sheet, nPreviousTab can be invalid
@@ -579,8 +579,8 @@ void ScTabViewObj::SheetChanged( bool bSameTabButMoved )
     SCTAB nNewTab = rViewData.GetTabNo();
     if ( !bSameTabButMoved && (nNewTab != nPreviousTab) )
     {
-        lcl_CallActivate( pDocSh, nPreviousTab, SC_SHEETEVENT_UNFOCUS );
-        lcl_CallActivate( pDocSh, nNewTab, SC_SHEETEVENT_FOCUS );
+        lcl_CallActivate( pDocSh, nPreviousTab, ScSheetEventId::UNFOCUS );
+        lcl_CallActivate( pDocSh, nNewTab, ScSheetEventId::FOCUS );
     }
     nPreviousTab = nNewTab;
 }
@@ -1171,9 +1171,9 @@ bool ScTabViewObj::IsMouseListening() const
     ScDocument* pDoc = rViewData.GetDocument();
     SCTAB nTab = rViewData.GetTabNo();
     return
-        pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_RIGHTCLICK, true ) ||
-        pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_DOUBLECLICK, true ) ||
-        pDoc->HasSheetEventScript( nTab, SC_SHEETEVENT_SELECT, true );
+        pDoc->HasSheetEventScript( nTab, ScSheetEventId::RIGHTCLICK, true ) ||
+        pDoc->HasSheetEventScript( nTab, ScSheetEventId::DOUBLECLICK, true ) ||
+        pDoc->HasSheetEventScript( nTab, ScSheetEventId::SELECT, true );
 
 }
 
@@ -1217,7 +1217,7 @@ bool ScTabViewObj::MousePressed( const awt::MouseEvent& e )
     bool bRightClick = ( e.Buttons == awt::MouseButton::RIGHT && e.ClickCount == 1 );
     if ( ( bDoubleClick || bRightClick ) && !bReturn && xTarget.is())
     {
-        sal_Int32 nEvent = bDoubleClick ? SC_SHEETEVENT_DOUBLECLICK : SC_SHEETEVENT_RIGHTCLICK;
+        ScSheetEventId nEvent = bDoubleClick ? ScSheetEventId::DOUBLECLICK : ScSheetEventId::RIGHTCLICK;
 
         ScTabViewShell* pViewSh = GetViewShell();
         ScViewData& rViewData = pViewSh->GetViewData();
@@ -1286,7 +1286,7 @@ bool ScTabViewObj::MouseReleased( const awt::MouseEvent& e )
             uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
             uno::Sequence< uno::Any > aArgs( 1 );
             aArgs[ 0 ] <<= getSelection();
-            xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_SELECT ), aArgs );
+            xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::SELECT ), aArgs );
         }
         catch( uno::Exception& )
         {
@@ -1741,7 +1741,7 @@ void ScTabViewObj::SelectionChanged()
     const ScSheetEvents* pEvents = rDoc.GetSheetEvents(nTab);
     if (pEvents)
     {
-        const OUString* pScript = pEvents->GetScript(SC_SHEETEVENT_SELECT);
+        const OUString* pScript = pEvents->GetScript(ScSheetEventId::SELECT);
         if (pScript)
         {
             // the macro parameter is the selection as returned by getSelection
@@ -1761,7 +1761,7 @@ void ScTabViewObj::SelectionChanged()
             uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents( rDoc.GetVbaEventProcessor(), uno::UNO_SET_THROW );
             uno::Sequence< uno::Any > aArgs( 1 );
             aArgs[ 0 ] <<= getSelection();
-            xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( SC_SHEETEVENT_SELECT ), aArgs );
+            xVbaEvents->processVbaEvent( ScSheetEvents::GetVbaSheetEventId( ScSheetEventId::SELECT ), aArgs );
         }
         catch( uno::Exception& )
         {


More information about the Libreoffice-commits mailing list