Kaydet (Commit) c1cddefe authored tarafından August Sodora's avatar August Sodora

Avoid use of preprocessor

üst 75aacd87
...@@ -163,7 +163,7 @@ BasicCheckBox::BasicCheckBox( Window* pParent, const ResId& rResId ) ...@@ -163,7 +163,7 @@ BasicCheckBox::BasicCheckBox( Window* pParent, const ResId& rResId )
:SvTabListBox( pParent, rResId ) :SvTabListBox( pParent, rResId )
,m_aDocument( ScriptDocument::getApplicationScriptDocument() ) ,m_aDocument( ScriptDocument::getApplicationScriptDocument() )
{ {
nMode = LIBMODE_MANAGER; nMode = NEWOBJECTMODE_MOD;
long aTabs_[] = { 1, 12 }; // TabPos needs at least one... long aTabs_[] = { 1, 12 }; // TabPos needs at least one...
// 12 because of the CheckBox // 12 because of the CheckBox
SetTabs( aTabs_ ); SetTabs( aTabs_ );
...@@ -201,7 +201,7 @@ void BasicCheckBox::Init() ...@@ -201,7 +201,7 @@ void BasicCheckBox::Init()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void BasicCheckBox::SetMode( sal_uInt16 n ) void BasicCheckBox::SetMode( NewObjectMode n )
{ {
nMode = n; nMode = n;
...@@ -264,7 +264,7 @@ void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const ...@@ -264,7 +264,7 @@ void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const
{ {
SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind ); 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) // initialize all columns with own string class (column 0 == bitmap)
sal_uInt16 nCount = pEntry->ItemCount(); sal_uInt16 nCount = pEntry->ItemCount();
...@@ -281,7 +281,7 @@ void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const ...@@ -281,7 +281,7 @@ void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const
sal_Bool BasicCheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& ) sal_Bool BasicCheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& )
{ {
if ( nMode != LIBMODE_MANAGER ) if ( nMode != NEWOBJECTMODE_MOD )
return sal_False; return sal_False;
DBG_ASSERT( pEntry, "Kein Eintrag?" ); DBG_ASSERT( pEntry, "Kein Eintrag?" );
...@@ -399,7 +399,7 @@ IMPL_LINK(NewObjectDialog, OkButtonHandler, Button *, EMPTYARG) ...@@ -399,7 +399,7 @@ IMPL_LINK(NewObjectDialog, OkButtonHandler, Button *, EMPTYARG)
return 0; return 0;
} }
NewObjectDialog::NewObjectDialog(Window * pParent, sal_uInt16 nMode, NewObjectDialog::NewObjectDialog(Window * pParent, NewObjectMode nMode,
bool bCheckName) bool bCheckName)
: ModalDialog( pParent, IDEResId( RID_DLG_NEWLIB ) ), : ModalDialog( pParent, IDEResId( RID_DLG_NEWLIB ) ),
aText( this, IDEResId( RID_FT_NEWLIB ) ), aText( this, IDEResId( RID_FT_NEWLIB ) ),
...@@ -410,21 +410,20 @@ NewObjectDialog::NewObjectDialog(Window * pParent, sal_uInt16 nMode, ...@@ -410,21 +410,20 @@ NewObjectDialog::NewObjectDialog(Window * pParent, sal_uInt16 nMode,
FreeResource(); FreeResource();
aEdit.GrabFocus(); aEdit.GrabFocus();
if ( nMode == NEWOBJECTMODE_LIB ) switch (nMode)
{ {
case NEWOBJECTMODE_LIB:
SetText( String( IDEResId( RID_STR_NEWLIB ) ) ); SetText( String( IDEResId( RID_STR_NEWLIB ) ) );
} break;
else if ( nMode == NEWOBJECTMODE_MOD ) case NEWOBJECTMODE_MOD:
{
SetText( String( IDEResId( RID_STR_NEWMOD ) ) ); SetText( String( IDEResId( RID_STR_NEWMOD ) ) );
} break;
else if ( nMode == NEWOBJECTMODE_METH ) case NEWOBJECTMODE_METH:
{
SetText( String( IDEResId( RID_STR_NEWMETH ) ) ); SetText( String( IDEResId( RID_STR_NEWMETH ) ) );
} break;
else default:
{
SetText( String( IDEResId( RID_STR_NEWDLG ) ) ); SetText( String( IDEResId( RID_STR_NEWDLG ) ) );
break;
} }
if (bCheckName) if (bCheckName)
...@@ -535,7 +534,7 @@ LibPage::LibPage( Window * pParent ) ...@@ -535,7 +534,7 @@ LibPage::LibPage( Window * pParent )
aBasicsBox.SetSelectHdl( LINK( this, LibPage, BasicSelectHdl ) ); aBasicsBox.SetSelectHdl( LINK( this, LibPage, BasicSelectHdl ) );
aLibBox.SetMode( LIBMODE_MANAGER ); aLibBox.SetMode( NEWOBJECTMODE_MOD );
aLibBox.EnableInplaceEditing( sal_True ); aLibBox.EnableInplaceEditing( sal_True );
aLibBox.SetStyle( WB_HSCROLL | WB_BORDER | WB_TABSTOP ); aLibBox.SetStyle( WB_HSCROLL | WB_BORDER | WB_TABSTOP );
aCloseButton.GrabFocus(); aCloseButton.GrabFocus();
...@@ -916,7 +915,7 @@ void LibPage::InsertLib() ...@@ -916,7 +915,7 @@ void LibPage::InsertLib()
{ {
pLibDlg = new LibDialog( this ); pLibDlg = new LibDialog( this );
pLibDlg->SetStorageName( aURLObj.getName() ); pLibDlg->SetStorageName( aURLObj.getName() );
pLibDlg->GetLibBox().SetMode( LIBMODE_CHOOSER ); pLibDlg->GetLibBox().SetMode( NEWOBJECTMODE_LIB );
} }
// libbox entries // libbox entries
......
...@@ -46,11 +46,13 @@ ...@@ -46,11 +46,13 @@
class StarBASIC; class StarBASIC;
enum NewObjectMode
#define NEWOBJECTMODE_LIB 1 {
#define NEWOBJECTMODE_MOD 2 NEWOBJECTMODE_LIB = 1,
#define NEWOBJECTMODE_DLG 3 NEWOBJECTMODE_MOD = 2,
#define NEWOBJECTMODE_METH 4 NEWOBJECTMODE_DLG = 3,
NEWOBJECTMODE_METH = 4
};
class NewObjectDialog : public ModalDialog class NewObjectDialog : public ModalDialog
{ {
...@@ -63,7 +65,7 @@ private: ...@@ -63,7 +65,7 @@ private:
DECL_LINK(OkButtonHandler, Button *); DECL_LINK(OkButtonHandler, Button *);
public: public:
NewObjectDialog(Window * pParent, sal_uInt16 nMode, bool bCheckName = false); NewObjectDialog(Window * pParent, NewObjectMode nMode, bool bCheckName = false);
~NewObjectDialog(); ~NewObjectDialog();
String GetObjectName() const { return aEdit.GetText(); } String GetObjectName() const { return aEdit.GetText(); }
...@@ -129,7 +131,7 @@ public: ...@@ -129,7 +131,7 @@ public:
class BasicCheckBox : public SvTabListBox class BasicCheckBox : public SvTabListBox
{ {
private: private:
sal_uInt16 nMode; NewObjectMode nMode;
SvLBoxButtonData* pCheckButton; SvLBoxButtonData* pCheckButton;
ScriptDocument m_aDocument; ScriptDocument m_aDocument;
void Init(); void Init();
...@@ -150,8 +152,8 @@ public: ...@@ -150,8 +152,8 @@ public:
void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; } void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
void SetMode( sal_uInt16 n ); void SetMode( NewObjectMode n );
sal_uInt16 GetMode() const { return nMode; } NewObjectMode GetMode() const { return nMode; }
}; };
class LibDialog: public ModalDialog class LibDialog: public ModalDialog
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment