diff options
author | August Sodora <augsod@gmail.com> | 2011-12-10 17:35:13 -0500 |
---|---|---|
committer | August Sodora <augsod@gmail.com> | 2011-12-10 18:00:22 -0500 |
commit | c1cddefe213524038d3c97357f888150e0d0c243 (patch) | |
tree | 709fa7a06b4ea23382df8e6762d9e5ce86d77123 /basctl | |
parent | 75aacd87bbbddb860efb57f046c84e4f107a8839 (diff) |
Avoid use of preprocessor
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/moduldl2.cxx | 33 | ||||
-rw-r--r-- | basctl/source/basicide/moduldlg.hxx | 20 |
2 files changed, 27 insertions, 26 deletions
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index c8960a411d79..be83c826b917 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -163,7 +163,7 @@ BasicCheckBox::BasicCheckBox( Window* pParent, const ResId& rResId ) :SvTabListBox( pParent, rResId ) ,m_aDocument( ScriptDocument::getApplicationScriptDocument() ) { - nMode = LIBMODE_MANAGER; + nMode = NEWOBJECTMODE_MOD; long aTabs_[] = { 1, 12 }; // TabPos needs at least one... // 12 because of the CheckBox SetTabs( aTabs_ ); @@ -201,7 +201,7 @@ void BasicCheckBox::Init() //---------------------------------------------------------------------------- -void BasicCheckBox::SetMode( sal_uInt16 n ) +void BasicCheckBox::SetMode( NewObjectMode n ) { nMode = n; @@ -264,7 +264,7 @@ void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const { SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind ); - if ( nMode == LIBMODE_MANAGER ) + if ( nMode == NEWOBJECTMODE_MOD ) { // initialize all columns with own string class (column 0 == bitmap) sal_uInt16 nCount = pEntry->ItemCount(); @@ -281,7 +281,7 @@ void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const sal_Bool BasicCheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) { - if ( nMode != LIBMODE_MANAGER ) + if ( nMode != NEWOBJECTMODE_MOD ) return sal_False; DBG_ASSERT( pEntry, "Kein Eintrag?" ); @@ -399,7 +399,7 @@ IMPL_LINK(NewObjectDialog, OkButtonHandler, Button *, EMPTYARG) return 0; } -NewObjectDialog::NewObjectDialog(Window * pParent, sal_uInt16 nMode, +NewObjectDialog::NewObjectDialog(Window * pParent, NewObjectMode nMode, bool bCheckName) : ModalDialog( pParent, IDEResId( RID_DLG_NEWLIB ) ), aText( this, IDEResId( RID_FT_NEWLIB ) ), @@ -410,21 +410,20 @@ NewObjectDialog::NewObjectDialog(Window * pParent, sal_uInt16 nMode, FreeResource(); aEdit.GrabFocus(); - if ( nMode == NEWOBJECTMODE_LIB ) + switch (nMode) { + case NEWOBJECTMODE_LIB: SetText( String( IDEResId( RID_STR_NEWLIB ) ) ); - } - else if ( nMode == NEWOBJECTMODE_MOD ) - { + break; + case NEWOBJECTMODE_MOD: SetText( String( IDEResId( RID_STR_NEWMOD ) ) ); - } - else if ( nMode == NEWOBJECTMODE_METH ) - { + break; + case NEWOBJECTMODE_METH: SetText( String( IDEResId( RID_STR_NEWMETH ) ) ); - } - else - { + break; + default: SetText( String( IDEResId( RID_STR_NEWDLG ) ) ); + break; } if (bCheckName) @@ -535,7 +534,7 @@ LibPage::LibPage( Window * pParent ) aBasicsBox.SetSelectHdl( LINK( this, LibPage, BasicSelectHdl ) ); - aLibBox.SetMode( LIBMODE_MANAGER ); + aLibBox.SetMode( NEWOBJECTMODE_MOD ); aLibBox.EnableInplaceEditing( sal_True ); aLibBox.SetStyle( WB_HSCROLL | WB_BORDER | WB_TABSTOP ); aCloseButton.GrabFocus(); @@ -916,7 +915,7 @@ void LibPage::InsertLib() { pLibDlg = new LibDialog( this ); pLibDlg->SetStorageName( aURLObj.getName() ); - pLibDlg->GetLibBox().SetMode( LIBMODE_CHOOSER ); + pLibDlg->GetLibBox().SetMode( NEWOBJECTMODE_LIB ); } // libbox entries diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx index f61f64c60534..91db695e5492 100644 --- a/basctl/source/basicide/moduldlg.hxx +++ b/basctl/source/basicide/moduldlg.hxx @@ -46,11 +46,13 @@ class StarBASIC; - -#define NEWOBJECTMODE_LIB 1 -#define NEWOBJECTMODE_MOD 2 -#define NEWOBJECTMODE_DLG 3 -#define NEWOBJECTMODE_METH 4 +enum NewObjectMode +{ + NEWOBJECTMODE_LIB = 1, + NEWOBJECTMODE_MOD = 2, + NEWOBJECTMODE_DLG = 3, + NEWOBJECTMODE_METH = 4 +}; class NewObjectDialog : public ModalDialog { @@ -63,7 +65,7 @@ private: DECL_LINK(OkButtonHandler, Button *); public: - NewObjectDialog(Window * pParent, sal_uInt16 nMode, bool bCheckName = false); + NewObjectDialog(Window * pParent, NewObjectMode nMode, bool bCheckName = false); ~NewObjectDialog(); String GetObjectName() const { return aEdit.GetText(); } @@ -129,7 +131,7 @@ public: class BasicCheckBox : public SvTabListBox { private: - sal_uInt16 nMode; + NewObjectMode nMode; SvLBoxButtonData* pCheckButton; ScriptDocument m_aDocument; void Init(); @@ -150,8 +152,8 @@ public: void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } - void SetMode( sal_uInt16 n ); - sal_uInt16 GetMode() const { return nMode; } + void SetMode( NewObjectMode n ); + NewObjectMode GetMode() const { return nMode; } }; class LibDialog: public ModalDialog |