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

Noel Grandin noelgrandin at gmail.com
Mon Sep 21 01:18:18 PDT 2015


 sc/inc/hints.hxx                |   12 +++++-------
 sc/source/core/tool/hints.cxx   |    8 ++++----
 sc/source/ui/unoobj/linkuno.cxx |    6 +++---
 3 files changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 921686a827e663199c040f376249de727613751f
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Sep 20 21:21:54 2015 +0200

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

diff --git a/sc/inc/hints.hxx b/sc/inc/hints.hxx
index cedbb00..f219973 100644
--- a/sc/inc/hints.hxx
+++ b/sc/inc/hints.hxx
@@ -81,15 +81,13 @@ public:
 };
 
 //! move ScLinkRefreshedHint to a different file?
-
-#define SC_LINKREFTYPE_NONE     0
-#define SC_LINKREFTYPE_SHEET    1
-#define SC_LINKREFTYPE_AREA     2
-#define SC_LINKREFTYPE_DDE      3
+enum class ScLinkRefType {
+    NONE, SHEET, AREA, DDE
+};
 
 class ScLinkRefreshedHint : public SfxHint
 {
-    sal_uInt16  nLinkType;  // SC_LINKREFTYPE_...
+    ScLinkRefType nLinkType;
     OUString    aUrl;       // used for sheet links
     OUString    aDdeAppl;   // used for dde links:
     OUString    aDdeTopic;
@@ -106,7 +104,7 @@ public:
     void            SetDdeLink( const OUString& rA, const OUString& rT, const OUString& rI, sal_uInt8 nM );
     void            SetAreaLink( const ScAddress& rPos );
 
-    sal_uInt16          GetLinkType() const { return nLinkType; }
+    ScLinkRefType       GetLinkType() const { return nLinkType; }
     const OUString&     GetUrl() const      { return aUrl; }
     const OUString&     GetDdeAppl() const  { return aDdeAppl; }
     const OUString&     GetDdeTopic() const { return aDdeTopic; }
diff --git a/sc/source/core/tool/hints.cxx b/sc/source/core/tool/hints.cxx
index 3d7a69b..3cbd133 100644
--- a/sc/source/core/tool/hints.cxx
+++ b/sc/source/core/tool/hints.cxx
@@ -57,7 +57,7 @@ ScPointerChangedHint::~ScPointerChangedHint()
 //      ScLinkRefreshedHint - a link has been refreshed
 
 ScLinkRefreshedHint::ScLinkRefreshedHint() :
-    nLinkType( SC_LINKREFTYPE_NONE ),
+    nLinkType( ScLinkRefType::NONE ),
     nDdeMode( 0 )
 {
 }
@@ -68,14 +68,14 @@ ScLinkRefreshedHint::~ScLinkRefreshedHint()
 
 void ScLinkRefreshedHint::SetSheetLink( const OUString& rSourceUrl )
 {
-    nLinkType = SC_LINKREFTYPE_SHEET;
+    nLinkType = ScLinkRefType::SHEET;
     aUrl = rSourceUrl;
 }
 
 void ScLinkRefreshedHint::SetDdeLink(
             const OUString& rA, const OUString& rT, const OUString& rI, sal_uInt8 nM )
 {
-    nLinkType = SC_LINKREFTYPE_DDE;
+    nLinkType = ScLinkRefType::DDE;
     aDdeAppl  = rA;
     aDdeTopic = rT;
     aDdeItem  = rI;
@@ -84,7 +84,7 @@ void ScLinkRefreshedHint::SetDdeLink(
 
 void ScLinkRefreshedHint::SetAreaLink( const ScAddress& rPos )
 {
-    nLinkType = SC_LINKREFTYPE_AREA;
+    nLinkType = ScLinkRefType::AREA;
     aDestPos = rPos;
 }
 
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index 693c7d9..eb2b8b9 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -102,7 +102,7 @@ void ScSheetLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
     else if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
     {
         const ScLinkRefreshedHint& rLH = static_cast<const ScLinkRefreshedHint&>(rHint);
-        if ( rLH.GetLinkType() == SC_LINKREFTYPE_SHEET && rLH.GetUrl() == aFileName )
+        if ( rLH.GetLinkType() == ScLinkRefType::SHEET && rLH.GetUrl() == aFileName )
             Refreshed_Impl();
     }
 }
@@ -628,7 +628,7 @@ void ScAreaLinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
     else if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
     {
         const ScLinkRefreshedHint& rLH = static_cast<const ScLinkRefreshedHint&>(rHint);
-        if ( rLH.GetLinkType() == SC_LINKREFTYPE_AREA )
+        if ( rLH.GetLinkType() == ScLinkRefType::AREA )
         {
             //  get this link to compare dest position
             ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, nPos);
@@ -1074,7 +1074,7 @@ void ScDDELinkObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
     else if ( dynamic_cast<const ScLinkRefreshedHint*>(&rHint) )
     {
         const ScLinkRefreshedHint& rLH = static_cast<const ScLinkRefreshedHint&>(rHint);
-        if ( rLH.GetLinkType() == SC_LINKREFTYPE_DDE &&
+        if ( rLH.GetLinkType() == ScLinkRefType::DDE &&
              rLH.GetDdeAppl()  == aAppl &&
              rLH.GetDdeTopic() == aTopic &&
              rLH.GetDdeItem()  == aItem )       //! mode is ignored


More information about the Libreoffice-commits mailing list