basctl/source/basicide/basides1.cxx |   20 ++++++++++----------
 basctl/source/basicide/basidesh.cxx |    6 +++---
 basctl/source/basicide/basobj2.cxx  |    2 +-
 basctl/source/basicide/basobj3.cxx  |    2 +-
 basctl/source/basicide/bastype2.hxx |    2 +-
 basctl/source/basicide/bastype3.cxx |   14 +++++++-------
 basctl/source/basicide/bastypes.cxx |    4 ++--
 basctl/source/basicide/moduldl2.cxx |    2 +-
 basctl/source/basicide/moduldlg.cxx |    4 ++--
 basctl/source/inc/basidesh.hxx      |    2 +-
 basctl/source/inc/sbxitem.hxx       |   25 ++++++++++++++-----------
 11 files changed, 43 insertions(+), 40 deletions(-)

New commits:
commit 1eb974c1429967ce76db4b16192a9a95b3e8cc6f
Author: August Sodora <aug...@gmail.com>
Date:   Wed Nov 30 02:11:15 2011 -0500

    Convert group of consts to enum

diff --git a/basctl/source/basicide/basides1.cxx 
b/basctl/source/basicide/basides1.cxx
index 8d184e2..2aff96e 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -615,9 +615,9 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
             String aName( rSbxItem.GetName() );
             if ( !m_aCurLibName.Len() || ( aDocument == m_aCurDocument && 
aLibName == m_aCurLibName ) )
             {
-                if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE )
+                if ( rSbxItem.GetType() == BasicIDEType::Module )
                     FindBasWin( aDocument, aLibName, aName, sal_True );
-                else if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG )
+                else if ( rSbxItem.GetType() == BasicIDEType::Dialog )
                     FindDlgWin( aDocument, aLibName, aName, sal_True );
             }
         }
@@ -641,15 +641,15 @@ void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
             String aName( rSbxItem.GetName() );
             SetCurLib( aDocument, aLibName );
             IDEBaseWindow* pWin = 0;
-            if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG )
+            if ( rSbxItem.GetType() == BasicIDEType::Dialog )
             {
                 pWin = FindDlgWin( aDocument, aLibName, aName, sal_True );
             }
-            else if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE )
+            else if ( rSbxItem.GetType() == BasicIDEType::Module )
             {
                 pWin = FindBasWin( aDocument, aLibName, aName, sal_True );
             }
-            else if ( rSbxItem.GetType() == BASICIDE_TYPE_METHOD )
+            else if ( rSbxItem.GetType() == BasicIDEType::Method )
             {
                 pWin = FindBasWin( aDocument, aLibName, aName, sal_True );
                 ((ModulWindow*)pWin)->EditMacro( rSbxItem.GetMethodName() );
@@ -1137,7 +1137,7 @@ void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, 
sal_Bool bUpdateTabBar
                 BasicIDEData* pData = BasicIDEGlobals::GetExtraData();
                 if ( pData )
                 {
-                    sal_uInt16 nCurrentType = pCurWin->IsA( TYPE( ModulWindow 
) ) ? BASICIDE_TYPE_MODULE : BASICIDE_TYPE_DIALOG;
+                    sal_uInt16 nCurrentType = pCurWin->IsA( TYPE( ModulWindow 
) ) ? BasicIDEType::Module : BasicIDEType::Dialog;
                     LibInfoItem* pLibInfoItem = new LibInfoItem( 
pCurWin->GetDocument(), pCurWin->GetLibName(), pCurWin->GetName(), nCurrentType 
);
                     pData->GetLibInfos().InsertInfo( pLibInfoItem );
                 }
@@ -1240,21 +1240,21 @@ IDEBaseWindow* BasicIDEShell::FindApplicationWindow()
     return FindWindow( ScriptDocument::getApplicationScriptDocument() );
 }
 
-IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, 
const String& rLibName, const String& rName, sal_uInt16 nType, sal_Bool 
bFindSuspended )
+IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, 
const String& rLibName, const String& rName, BasicIDEType nType, sal_Bool 
bFindSuspended )
 {
     IDEBaseWindow* pWin = aIDEWindowTable.First();
     while ( pWin )
     {
         if ( !pWin->IsSuspended() || bFindSuspended )
         {
-            if ( !rLibName.Len() || !rName.Len() || nType == 
BASICIDE_TYPE_UNKNOWN )
+            if ( !rLibName.Len() || !rName.Len() || nType == 
BasicIDEType::Unknown )
             {
                 // return any non-suspended window
                 return pWin;
             }
             else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == 
rLibName && pWin->GetName() == rName &&
-                      ( ( pWin->IsA( TYPE( ModulWindow ) )  && nType == 
BASICIDE_TYPE_MODULE ) ||
-                        ( pWin->IsA( TYPE( DialogWindow ) ) && nType == 
BASICIDE_TYPE_DIALOG ) ) )
+                      ( ( pWin->IsA( TYPE( ModulWindow ) )  && nType == 
BasicIDEType::Module ) ||
+                        ( pWin->IsA( TYPE( DialogWindow ) ) && nType == 
BasicIDEType::Dialog ) ) )
             {
                 return pWin;
             }
diff --git a/basctl/source/basicide/basidesh.cxx 
b/basctl/source/basicide/basidesh.cxx
index b9d2dc2..0e77823 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -131,7 +131,7 @@ public:
         rtl::OUString sModuleName;
         if( mpShell  && ( Event.Accessor >>= sModuleName ) )
         {
-            IDEBaseWindow* pWin = mpShell->FindWindow( 
mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, 
BASICIDE_TYPE_MODULE, sal_True );
+            IDEBaseWindow* pWin = mpShell->FindWindow( 
mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, 
BasicIDEType::Module, sal_True );
             if( pWin )
                 mpShell->RemoveWindow( pWin, sal_True, sal_True );
         }
@@ -804,7 +804,7 @@ void BasicIDEShell::UpdateWindows()
                                 if ( !pWin )
                                     pWin = CreateBasWin( *doc, aLibName, 
aModName );
                                 if ( !pNextActiveWindow && pLibInfoItem && 
pLibInfoItem->GetCurrentName() == aModName &&
-                                        pLibInfoItem->GetCurrentType() == 
BASICIDE_TYPE_MODULE )
+                                     pLibInfoItem->GetCurrentType() == 
BasicIDEType::Module )
                                 {
                                     pNextActiveWindow = (IDEBaseWindow*)pWin;
                                 }
@@ -835,7 +835,7 @@ void BasicIDEShell::UpdateWindows()
                                 if ( !pWin )
                                     pWin = CreateDlgWin( *doc, aLibName, 
aDlgName );
                                 if ( !pNextActiveWindow && pLibInfoItem && 
pLibInfoItem->GetCurrentName() == aDlgName &&
-                                        pLibInfoItem->GetCurrentType() == 
BASICIDE_TYPE_DIALOG )
+                                     pLibInfoItem->GetCurrentType() == 
BasicIDEType::Dialog )
                                 {
                                     pNextActiveWindow = (IDEBaseWindow*)pWin;
                                 }
diff --git a/basctl/source/basicide/basobj2.cxx 
b/basctl/source/basicide/basobj2.cxx
index af7e904..373b91f 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -197,7 +197,7 @@ bool RenameModule( Window* pErrorParent, const 
ScriptDocument& rDocument, const
     BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell();
     if ( pIDEShell )
     {
-        IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, 
rNewName, BASICIDE_TYPE_MODULE, sal_True );
+        IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, 
rNewName, BasicIDEType::Module, sal_True );
         if ( pWin )
         {
             // set new name in window
diff --git a/basctl/source/basicide/basobj3.cxx 
b/basctl/source/basicide/basobj3.cxx
index 437569a..f4f18e0 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -197,7 +197,7 @@ bool RenameDialog( Window* pErrorParent, const 
ScriptDocument& rDocument, const
     }
 
     BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell();
-    IDEBaseWindow* pWin = pIDEShell ? pIDEShell->FindWindow( rDocument, 
rLibName, rOldName, BASICIDE_TYPE_DIALOG, sal_False ) : NULL;
+    IDEBaseWindow* pWin = pIDEShell ? pIDEShell->FindWindow( rDocument, 
rLibName, rOldName, BasicIDEType::Dialog, sal_False ) : NULL;
     Reference< XNameContainer > xExistingDialog;
     if ( pWin )
         xExistingDialog = ((DialogWindow*)pWin)->GetEditor()->GetDialog();
diff --git a/basctl/source/basicide/bastype2.hxx 
b/basctl/source/basicide/bastype2.hxx
index fa5deaf..645cbe0 100644
--- a/basctl/source/basicide/bastype2.hxx
+++ b/basctl/source/basicide/bastype2.hxx
@@ -201,7 +201,7 @@ public:
 
     BasicEntryDescriptor    GetEntryDescriptor( SvLBoxEntry* pEntry );
 
-    sal_uInt16          ConvertType( BasicEntryType eType );
+    BasicIDEType    ConvertType( BasicEntryType eType );
     bool            IsValidEntry( SvLBoxEntry* pEntry );
 
     SvLBoxEntry*    AddEntry( const ::rtl::OUString& rText, const Image& 
rImage,
diff --git a/basctl/source/basicide/bastype3.cxx 
b/basctl/source/basicide/bastype3.cxx
index 7cddd8a..2324c4d 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -375,35 +375,35 @@ BasicEntryDescriptor 
BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
     return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, 
aName, aMethodName, eType );
 }
 
-sal_uInt16 BasicTreeListBox::ConvertType( BasicEntryType eType )
+BasicIDEType BasicTreeListBox::ConvertType( BasicEntryType eType )
 {
-    sal_uInt16 nType = OBJ_TYPE_UNKNOWN;
+    BasicIDEType nType = static_cast<BasicIDEType>(OBJ_TYPE_UNKNOWN);
 
     switch ( eType )
     {
         case OBJ_TYPE_DOCUMENT:
         {
-            nType = BASICIDE_TYPE_SHELL;
+            nType = BasicIDEType::Shell;
         }
         break;
         case OBJ_TYPE_LIBRARY:
         {
-            nType = BASICIDE_TYPE_LIBRARY;
+            nType = BasicIDEType::Library;
         }
         break;
         case OBJ_TYPE_MODULE:
         {
-            nType = BASICIDE_TYPE_MODULE;
+            nType = BasicIDEType::Module;
         }
         break;
         case OBJ_TYPE_DIALOG:
         {
-            nType = BASICIDE_TYPE_DIALOG;
+            nType = BasicIDEType::Dialog;
         }
         break;
         case OBJ_TYPE_METHOD:
         {
-            nType = BASICIDE_TYPE_METHOD;
+            nType = BasicIDEType::Method;
         }
         break;
         default: ;
diff --git a/basctl/source/basicide/bastypes.cxx 
b/basctl/source/basicide/bastypes.cxx
index 4dcc710..008fa99 100644
--- a/basctl/source/basicide/bastypes.cxx
+++ b/basctl/source/basicide/bastypes.cxx
@@ -886,7 +886,7 @@ LibInfoItem* LibInfos::GetInfo( const LibInfoKey& rKey )
     return pItem;
 }
 
-SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const 
::rtl::OUString& aLibName, const ::rtl::OUString& aName, sal_uInt16 nType )
+SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const 
::rtl::OUString& aLibName, const ::rtl::OUString& aName, BasicIDEType nType )
     :SfxPoolItem( nWhich_ )
     ,m_aDocument(rDocument)
     ,m_aLibName(aLibName)
@@ -895,7 +895,7 @@ SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& 
rDocument, const ::rt
 {
 }
 
-SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const 
::rtl::OUString& aLibName, const ::rtl::OUString& aName, const ::rtl::OUString& 
aMethodName, sal_uInt16 nType )
+SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const 
::rtl::OUString& aLibName, const ::rtl::OUString& aName, const ::rtl::OUString& 
aMethodName, BasicIDEType nType )
     :SfxPoolItem( nWhich_ )
     ,m_aDocument(rDocument)
     ,m_aLibName(aLibName)
diff --git a/basctl/source/basicide/moduldl2.cxx 
b/basctl/source/basicide/moduldl2.cxx
index 5777fe8..68b6a01 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -1681,7 +1681,7 @@ void createLibImpl( Window* pWin, const ScriptDocument& 
rDocument,
                 if ( !rDocument.createModule( aLibName, aModName, sal_True, 
sModuleCode ) )
                     throw Exception();
 
-                SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, 
aModName, BASICIDE_TYPE_MODULE );
+                SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, 
aModName, BasicIDEType::Module );
                 BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell();
                 SfxViewFrame* pViewFrame = pIDEShell ? 
pIDEShell->GetViewFrame() : NULL;
                 SfxDispatcher* pDispatcher = pViewFrame ? 
pViewFrame->GetDispatcher() : NULL;
diff --git a/basctl/source/basicide/moduldlg.cxx 
b/basctl/source/basicide/moduldlg.cxx
index c37926b..57f8939 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -838,7 +838,7 @@ void ObjectPage::NewDialog()
                 if ( !aDocument.createDialog( aLibName, aDlgName, xISP ) )
                     return;
 
-                SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, 
aDlgName, BASICIDE_TYPE_DIALOG );
+                SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, 
aDlgName, BasicIDEType::Dialog );
                 BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell();
                 SfxViewFrame* pViewFrame = pIDEShell ? 
pIDEShell->GetViewFrame() : NULL;
                 SfxDispatcher* pDispatcher = pViewFrame ? 
pViewFrame->GetDispatcher() : NULL;
@@ -1000,7 +1000,7 @@ SbModule* createModImpl( Window* pWin, const 
ScriptDocument& rDocument,
             StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0;
                 if ( pBasic )
                     pModule = pBasic->FindModule( aModName );
-            SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, 
aModName, BASICIDE_TYPE_MODULE );
+                SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, 
aModName, BasicIDEType::Module );
             BasicIDEShell* pIDEShell = BasicIDEGlobals::GetShell();
             SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : 
NULL;
             SfxDispatcher* pDispatcher = pViewFrame ? 
pViewFrame->GetDispatcher() : NULL;
diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx
index 9d66a6d..7241341 100644
--- a/basctl/source/inc/basidesh.hxx
+++ b/basctl/source/inc/basidesh.hxx
@@ -211,7 +211,7 @@ public:
 
     ModulWindowLayout*  GetLayoutWindow() const { return pModulLayout; }
 
-    IDEBaseWindow*      FindWindow( const ScriptDocument& rDocument, const 
String& rLibName = String(), const String& rName = String(), sal_uInt16 nType = 
BASICIDE_TYPE_UNKNOWN, sal_Bool bFindSuspended = sal_False );
+    IDEBaseWindow*      FindWindow( const ScriptDocument& rDocument, const 
String& rLibName = String(), const String& rName = String(), BasicIDEType nType 
= BasicIDEType::Unknown, sal_Bool bFindSuspended = sal_False );
     DialogWindow*       FindDlgWin( const ScriptDocument& rDocument, const 
String& rLibName, const String& rDlgName, sal_Bool bCreateIfNotExist, sal_Bool 
bFindSuspended = sal_False );
     IDEBaseWindow*      FindApplicationWindow();
     sal_Bool                NextPage( sal_Bool bPrev = sal_False );
diff --git a/basctl/source/inc/sbxitem.hxx b/basctl/source/inc/sbxitem.hxx
index 94a8b51..f80e049 100644
--- a/basctl/source/inc/sbxitem.hxx
+++ b/basctl/source/inc/sbxitem.hxx
@@ -31,12 +31,15 @@
 #include "scriptdocument.hxx"
 #include <svl/poolitem.hxx>
 
-const sal_uInt16 BASICIDE_TYPE_UNKNOWN  =   0;
-const sal_uInt16 BASICIDE_TYPE_SHELL    =   1;
-const sal_uInt16 BASICIDE_TYPE_LIBRARY  =   2;
-const sal_uInt16 BASICIDE_TYPE_MODULE   =   3;
-const sal_uInt16 BASICIDE_TYPE_DIALOG   =   4;
-const sal_uInt16 BASICIDE_TYPE_METHOD   =   5;
+enum BasicIDEType
+{
+    Unknown,
+    Shell,
+    Library,
+    Module,
+    Dialog,
+    Method
+};
 
 class SbxItem : public SfxPoolItem
 {
@@ -44,12 +47,12 @@ class SbxItem : public SfxPoolItem
     ::rtl::OUString         m_aLibName;
     ::rtl::OUString         m_aName;
     ::rtl::OUString         m_aMethodName;
-    sal_uInt16                  m_nType;
+    BasicIDEType            m_nType;
 
 public:
     TYPEINFO();
-    SbxItem( sal_uInt16 nWhich, const ScriptDocument& rDocument, const 
::rtl::OUString& aLibName, const ::rtl::OUString& aName, sal_uInt16 nType );
-    SbxItem( sal_uInt16 nWhich, const ScriptDocument& rDocument, const 
::rtl::OUString& aLibName, const ::rtl::OUString& aName, const ::rtl::OUString& 
aMethodName, sal_uInt16 nType );
+    SbxItem( sal_uInt16 nWhich, const ScriptDocument& rDocument, const 
::rtl::OUString& aLibName, const ::rtl::OUString& aName, BasicIDEType nType );
+    SbxItem( sal_uInt16 nWhich, const ScriptDocument& rDocument, const 
::rtl::OUString& aLibName, const ::rtl::OUString& aName, const ::rtl::OUString& 
aMethodName, BasicIDEType nType );
     SbxItem( const SbxItem& );
 
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = 0 ) const;
@@ -68,8 +71,8 @@ public:
     const ::rtl::OUString&  GetMethodName() const { return m_aMethodName; }
     void                    SetMethodName( const ::rtl::OUString& aMethodName 
) { m_aMethodName = aMethodName; }
 
-    sal_uInt16                  GetType() const { return m_nType; }
-    void                    SetType( sal_uInt16 nType ) { m_nType = nType; }
+    BasicIDEType            GetType() const { return m_nType; }
+    void                    SetType( BasicIDEType nType ) { m_nType = nType; }
 };
 
 #endif
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to