Kaydet (Commit) cce752b1 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Noel Grandin

convert SHOWDIALOG_ID constants to scoped enum

Change-Id: I58fffa7345f6b5050b8a1b3ac1022c630e64dbb4
Reviewed-on: https://gerrit.libreoffice.org/15651Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst d4f90e1a
......@@ -114,16 +114,16 @@ IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, void*, pParam)
if ( ! pData)
return 0L;
const int nCommand = pData->GetDialogId();
const ShowDialogId nCommand = pData->GetDialogId();
OUString sCommand;
switch (nCommand)
{
case SHOWDIALOG_ID_PREFERENCES :
case ShowDialogId::Preferences :
sCommand = ".uno:OptionsTreeDialog";
break;
case SHOWDIALOG_ID_ABOUT :
case ShowDialogId::About :
sCommand = ".uno:About";
break;
......
......@@ -253,21 +253,24 @@ inline CommandModKeyData::CommandModKeyData( sal_uInt16 nCode )
}
// - CommanDialogData -
// - CommandDialogData -
#define SHOWDIALOG_ID_PREFERENCES 1
#define SHOWDIALOG_ID_ABOUT 2
enum class ShowDialogId
{
Preferences = 1,
About = 2,
};
class VCL_DLLPUBLIC CommandDialogData
{
int m_nDialogId;
public:
CommandDialogData( int nDialogId = SHOWDIALOG_ID_PREFERENCES )
ShowDialogId m_nDialogId;
public:
CommandDialogData( ShowDialogId nDialogId = ShowDialogId::Preferences )
: m_nDialogId( nDialogId )
{}
int GetDialogId() const { return m_nDialogId; }
ShowDialogId GetDialogId() const { return m_nDialogId; }
};
// Media Commands
......
......@@ -44,13 +44,13 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
@interface MainMenuSelector : NSObject
{
}
-(void)showDialog: (int)nDialog;
-(void)showDialog: (ShowDialogId)nDialog;
-(void)showPreferences: (id)sender;
-(void)showAbout: (id)sender;
@end
@implementation MainMenuSelector
-(void)showDialog: (int)nDialog
-(void)showDialog: (ShowDialogId)nDialog
{
if( AquaSalMenu::pCurrentMenuBar )
{
......@@ -63,9 +63,9 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
else
{
OUString aDialog;
if( nDialog == SHOWDIALOG_ID_ABOUT )
if( nDialog == ShowDialogId::About )
aDialog = "ABOUT";
else if( nDialog == SHOWDIALOG_ID_PREFERENCES )
else if( nDialog == ShowDialogId::Preferences )
aDialog = "PREFERENCES";
const ApplicationEvent* pAppEvent = new ApplicationEvent(
ApplicationEvent::TYPE_SHOWDIALOG, aDialog);
......@@ -78,14 +78,14 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
(void)sender;
YIELD_GUARD;
[self showDialog: SHOWDIALOG_ID_PREFERENCES];
[self showDialog: ShowDialogId::Preferences];
}
-(void)showAbout: (id) sender
{
(void)sender;
YIELD_GUARD;
[self showDialog: SHOWDIALOG_ID_ABOUT];
[self showDialog: ShowDialogId::About];
}
@end
......
......@@ -2256,7 +2256,7 @@ static void ImplHandleSalExtTextInputPos( vcl::Window* pWindow, SalExtTextInputP
}
}
static bool ImplHandleShowDialog( vcl::Window* pWindow, int nDialogId )
static bool ImplHandleShowDialog( vcl::Window* pWindow, ShowDialogId nDialogId )
{
if( ! pWindow )
return false;
......@@ -2605,7 +2605,7 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, SalFrame* /*pFrame*/,
break;
case SALEVENT_SHOWDIALOG:
{
int nDialogID = static_cast<int>(reinterpret_cast<sal_IntPtr>(pEvent));
ShowDialogId nDialogID = static_cast<ShowDialogId>(reinterpret_cast<sal_IntPtr>(pEvent));
nRet = ImplHandleShowDialog( pWindow, nDialogID );
}
break;
......
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