[Libreoffice-commits] core.git: editeng/source include/editeng sc/source sd/source sw/source

Noel Grandin noel at peralex.com
Wed Mar 25 03:15:19 PDT 2015


 editeng/source/editeng/editview.cxx          |    8 ++++----
 include/editeng/editstat.hxx                 |   21 ++++++++++++---------
 sc/source/ui/view/gridwin.cxx                |    2 +-
 sd/source/core/drawdoc4.cxx                  |    8 ++++----
 sw/source/uibase/docvw/SidebarTxtControl.cxx |    2 +-
 sw/source/uibase/uiview/viewdraw.cxx         |    2 +-
 6 files changed, 23 insertions(+), 20 deletions(-)

New commits:
commit eb9c04ed215f9b12584c6e254c36303c6b3865ed
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Mar 25 12:13:52 2015 +0200

    convert SPELLCMD_ constants to enum class
    
    Change-Id: I0f57a60a44ddac63a73e0bb35df59b3b25857d43

diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index fa77d3c..cc2685d 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -938,7 +938,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
             OUString aWord = pImpEditView->SpellIgnoreOrAddWord( false );
             if ( pCallBack )
             {
-                SpellCallbackInfo aInf( SPELLCMD_IGNOREWORD, aWord );
+                SpellCallbackInfo aInf( SpellCallbackCommand::IGNOREWORD, aWord );
                 pCallBack->Call( &aInf );
             }
             SetSelection( aOldSel );
@@ -967,7 +967,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
 
             if ( pCallBack )
             {
-                SpellCallbackInfo aInf( ( nId == MN_WORDLANGUAGE ) ? SPELLCMD_WORDLANGUAGE : SPELLCMD_PARALANGUAGE, nLangToUse );
+                SpellCallbackInfo aInf( ( nId == MN_WORDLANGUAGE ) ? SpellCallbackCommand::WORDLANGUAGE : SpellCallbackCommand::PARALANGUAGE, nLangToUse );
                 pCallBack->Call( &aInf );
             }
             SetSelection( aOldSel );
@@ -986,7 +986,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
             }
             else
             {
-                SpellCallbackInfo aInf( SPELLCMD_STARTSPELLDLG, OUString() );
+                SpellCallbackInfo aInf( SpellCallbackCommand::STARTSPELLDLG, OUString() );
                 pCallBack->Call( &aInf );
             }
         }
@@ -1014,7 +1014,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
 
             if ( pCallBack )
             {
-                SpellCallbackInfo aInf( SPELLCMD_ADDTODICTIONARY, aSelected );
+                SpellCallbackInfo aInf( SpellCallbackCommand::ADDTODICTIONARY, aSelected );
                 pCallBack->Call( &aInf );
             }
             SetSelection( aOldSel );
diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx
index 2c2f5f8..b53c744c 100644
--- a/include/editeng/editstat.hxx
+++ b/include/editeng/editstat.hxx
@@ -138,26 +138,29 @@ public:
     sal_Int32&  GetPrevParagraph()          { return nPrevPara; }
 };
 
-#define SPELLCMD_IGNOREWORD         0x0001
-#define SPELLCMD_STARTSPELLDLG      0x0002
-#define SPELLCMD_ADDTODICTIONARY    0x0003
-#define SPELLCMD_WORDLANGUAGE       0x0004
-#define SPELLCMD_PARALANGUAGE       0x0005
+enum class SpellCallbackCommand
+{
+    IGNOREWORD         = 0x0001,
+    STARTSPELLDLG      = 0x0002,
+    ADDTODICTIONARY    = 0x0003,
+    WORDLANGUAGE       = 0x0004,
+    PARALANGUAGE       = 0x0005,
+};
 
 struct SpellCallbackInfo
 {
-    sal_uInt16      nCommand;
+    SpellCallbackCommand nCommand;
     OUString        aWord;
     LanguageType    eLanguage;
 
-    SpellCallbackInfo( sal_uInt16 nCMD, const OUString& rWord )
-    : aWord( rWord )
+    SpellCallbackInfo( SpellCallbackCommand nCMD, const OUString& rWord )
+        : aWord( rWord )
     {
         nCommand = nCMD;
         eLanguage = LANGUAGE_DONTKNOW;
     }
 
-    SpellCallbackInfo( sal_uInt16 nCMD, LanguageType eLang )
+    SpellCallbackInfo( SpellCallbackCommand nCMD, LanguageType eLang )
     {
         nCommand = nCMD;
         eLanguage = eLang;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 12fb75f..acb6bd2 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -554,7 +554,7 @@ IMPL_LINK_NOARG(ScGridWindow, PopupModeEndHdl)
 
 IMPL_LINK( ScGridWindow, PopupSpellingHdl, SpellCallbackInfo*, pInfo )
 {
-    if( pInfo->nCommand == SPELLCMD_STARTSPELLDLG )
+    if( pInfo->nCommand == SpellCallbackCommand::STARTSPELLDLG )
         pViewData->GetDispatcher().Execute( SID_SPELL_DIALOG, SfxCallMode::ASYNCHRON );
     return 0;
 }
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index 48ac39e..1c2b66c 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -973,11 +973,11 @@ void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject*
     delete mpOnlineSearchItem;
     mpOnlineSearchItem = NULL;
 
-    sal_uInt16 nCommand = pInfo->nCommand;
+    SpellCallbackCommand nCommand = pInfo->nCommand;
 
-    if (nCommand == SPELLCMD_IGNOREWORD
+    if (nCommand == SpellCallbackCommand::IGNOREWORD
         // restart when add to dictionary takes place, too.
-        || nCommand == SPELLCMD_ADDTODICTIONARY)
+        || nCommand == SpellCallbackCommand::ADDTODICTIONARY)
     {
         if(pObj && pOutl && pObj->ISA(SdrTextObj))
         {
@@ -991,7 +991,7 @@ void SdDrawDocument::ImpOnlineSpellCallback(SpellCallbackInfo* pInfo, SdrObject*
         mpOnlineSearchItem->SetSearchString(pInfo->aWord);
         StartOnlineSpelling();
     }
-    else if (nCommand == SPELLCMD_STARTSPELLDLG)
+    else if (nCommand == SpellCallbackCommand::STARTSPELLDLG)
     {
         SfxViewFrame::Current()->GetDispatcher()->Execute( SID_SPELL_DIALOG,
             SfxCallMode::ASYNCHRON );
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 918586e..88f5316 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -321,7 +321,7 @@ void SidebarTxtControl::MouseButtonUp( const MouseEvent& rMEvt )
 
 IMPL_LINK( SidebarTxtControl, OnlineSpellCallback, SpellCallbackInfo*, pInfo )
 {
-    if ( pInfo->nCommand == SPELLCMD_STARTSPELLDLG )
+    if ( pInfo->nCommand == SpellCallbackCommand::STARTSPELLDLG )
     {
         mrDocView.GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SfxCallMode::ASYNCHRON);
     }
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 249787a..ccc39a4 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -721,7 +721,7 @@ bool SwView::HasOnlyObj(SdrObject *pSdrObj, sal_uInt32 eObjInventor) const
 //#i87414# mod
 IMPL_LINK(SwView, OnlineSpellCallback, SpellCallbackInfo*, pInfo)
 {
-    if (pInfo->nCommand == SPELLCMD_STARTSPELLDLG)
+    if (pInfo->nCommand == SpellCallbackCommand::STARTSPELLDLG)
         GetViewFrame()->GetDispatcher()->Execute( FN_SPELL_GRAMMAR_DIALOG, SfxCallMode::ASYNCHRON);
     return 0;
 }


More information about the Libreoffice-commits mailing list