convert SHOWDIALOG_ID constants to scoped enum
Change-Id: I58fffa7345f6b5050b8a1b3ac1022c630e64dbb4 Reviewed-on: https://gerrit.libreoffice.org/15651 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
committed by
Noel Grandin
parent
d4f90e1a2a
commit
cce752b1ba
@@ -114,16 +114,16 @@ IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, void*, pParam)
|
|||||||
if ( ! pData)
|
if ( ! pData)
|
||||||
return 0L;
|
return 0L;
|
||||||
|
|
||||||
const int nCommand = pData->GetDialogId();
|
const ShowDialogId nCommand = pData->GetDialogId();
|
||||||
OUString sCommand;
|
OUString sCommand;
|
||||||
|
|
||||||
switch (nCommand)
|
switch (nCommand)
|
||||||
{
|
{
|
||||||
case SHOWDIALOG_ID_PREFERENCES :
|
case ShowDialogId::Preferences :
|
||||||
sCommand = ".uno:OptionsTreeDialog";
|
sCommand = ".uno:OptionsTreeDialog";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOWDIALOG_ID_ABOUT :
|
case ShowDialogId::About :
|
||||||
sCommand = ".uno:About";
|
sCommand = ".uno:About";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -253,21 +253,24 @@ inline CommandModKeyData::CommandModKeyData( sal_uInt16 nCode )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// - CommanDialogData -
|
// - CommandDialogData -
|
||||||
|
|
||||||
|
|
||||||
#define SHOWDIALOG_ID_PREFERENCES 1
|
enum class ShowDialogId
|
||||||
#define SHOWDIALOG_ID_ABOUT 2
|
{
|
||||||
|
Preferences = 1,
|
||||||
|
About = 2,
|
||||||
|
};
|
||||||
|
|
||||||
class VCL_DLLPUBLIC CommandDialogData
|
class VCL_DLLPUBLIC CommandDialogData
|
||||||
{
|
{
|
||||||
int m_nDialogId;
|
ShowDialogId m_nDialogId;
|
||||||
public:
|
public:
|
||||||
CommandDialogData( int nDialogId = SHOWDIALOG_ID_PREFERENCES )
|
CommandDialogData( ShowDialogId nDialogId = ShowDialogId::Preferences )
|
||||||
: m_nDialogId( nDialogId )
|
: m_nDialogId( nDialogId )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
int GetDialogId() const { return m_nDialogId; }
|
ShowDialogId GetDialogId() const { return m_nDialogId; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Media Commands
|
// Media Commands
|
||||||
|
@@ -44,13 +44,13 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
|
|||||||
@interface MainMenuSelector : NSObject
|
@interface MainMenuSelector : NSObject
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
-(void)showDialog: (int)nDialog;
|
-(void)showDialog: (ShowDialogId)nDialog;
|
||||||
-(void)showPreferences: (id)sender;
|
-(void)showPreferences: (id)sender;
|
||||||
-(void)showAbout: (id)sender;
|
-(void)showAbout: (id)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MainMenuSelector
|
@implementation MainMenuSelector
|
||||||
-(void)showDialog: (int)nDialog
|
-(void)showDialog: (ShowDialogId)nDialog
|
||||||
{
|
{
|
||||||
if( AquaSalMenu::pCurrentMenuBar )
|
if( AquaSalMenu::pCurrentMenuBar )
|
||||||
{
|
{
|
||||||
@@ -63,9 +63,9 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
OUString aDialog;
|
OUString aDialog;
|
||||||
if( nDialog == SHOWDIALOG_ID_ABOUT )
|
if( nDialog == ShowDialogId::About )
|
||||||
aDialog = "ABOUT";
|
aDialog = "ABOUT";
|
||||||
else if( nDialog == SHOWDIALOG_ID_PREFERENCES )
|
else if( nDialog == ShowDialogId::Preferences )
|
||||||
aDialog = "PREFERENCES";
|
aDialog = "PREFERENCES";
|
||||||
const ApplicationEvent* pAppEvent = new ApplicationEvent(
|
const ApplicationEvent* pAppEvent = new ApplicationEvent(
|
||||||
ApplicationEvent::TYPE_SHOWDIALOG, aDialog);
|
ApplicationEvent::TYPE_SHOWDIALOG, aDialog);
|
||||||
@@ -78,14 +78,14 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = NULL;
|
|||||||
(void)sender;
|
(void)sender;
|
||||||
YIELD_GUARD;
|
YIELD_GUARD;
|
||||||
|
|
||||||
[self showDialog: SHOWDIALOG_ID_PREFERENCES];
|
[self showDialog: ShowDialogId::Preferences];
|
||||||
}
|
}
|
||||||
-(void)showAbout: (id) sender
|
-(void)showAbout: (id) sender
|
||||||
{
|
{
|
||||||
(void)sender;
|
(void)sender;
|
||||||
YIELD_GUARD;
|
YIELD_GUARD;
|
||||||
|
|
||||||
[self showDialog: SHOWDIALOG_ID_ABOUT];
|
[self showDialog: ShowDialogId::About];
|
||||||
}
|
}
|
||||||
@end
|
@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 )
|
if( ! pWindow )
|
||||||
return false;
|
return false;
|
||||||
@@ -2605,7 +2605,7 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, SalFrame* /*pFrame*/,
|
|||||||
break;
|
break;
|
||||||
case SALEVENT_SHOWDIALOG:
|
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 );
|
nRet = ImplHandleShowDialog( pWindow, nDialogID );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user