diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-26 12:54:04 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-03-27 08:33:43 +0200 |
commit | 93ddb2cc0bedac9a97260826741f7dfcdca0947d (patch) | |
tree | ece9d5cc3e90cda21113c429439f0713a7921016 /vcl | |
parent | 402ae4c06c0935b0b2bfe9aeb6f961a65702e307 (diff) |
convert BUTTON_ constants to enum class
Change-Id: I0fd391a6b2850e5d7dcbf2cb95cfa39ee5561bd9
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/generic/app/gensys.cxx | 33 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/morebtn.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/btndlg.cxx | 12 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/msgbox.cxx | 28 |
6 files changed, 46 insertions, 45 deletions
diff --git a/vcl/generic/app/gensys.cxx b/vcl/generic/app/gensys.cxx index 9eda402b38dc..ea19ebb04dbb 100644 --- a/vcl/generic/app/gensys.cxx +++ b/vcl/generic/app/gensys.cxx @@ -42,7 +42,7 @@ using namespace com::sun::star; namespace { -OUString GetNativeMessageBoxButtonText( int nButtonId, bool bUseResources ) +OUString GetNativeMessageBoxButtonText( StandardButtonType nButtonId, bool bUseResources ) { OUString aText; if( bUseResources ) @@ -53,27 +53,28 @@ OUString GetNativeMessageBoxButtonText( int nButtonId, bool bUseResources ) { switch( nButtonId ) { - case BUTTON_OK: + case StandardButtonType::OK: aText = "OK"; break; - case BUTTON_CANCEL: + case StandardButtonType::CANCEL: aText = "Cancel"; break; - case BUTTON_ABORT: + case StandardButtonType::ABORT: aText = "Abort"; break; - case BUTTON_RETRY: + case StandardButtonType::RETRY: aText = "Retry"; break; - case BUTTON_IGNORE: + case StandardButtonType::IGNORE: aText = "Ignore"; break; - case BUTTON_YES: + case StandardButtonType::YES: aText = "Yes"; break; - case BUTTON_NO: + case StandardButtonType::NO: aText = "No"; break; + default: break; } } return aText; @@ -102,15 +103,15 @@ int SalGenericSystem::ShowNativeMessageBox( const OUString& rTitle, const OUStri if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK || nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL ) { - aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_OK, bUseResources ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::OK, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK; } if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO_CANCEL || nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_YES_NO ) { - aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_YES, bUseResources ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::YES, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_YES; - aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_NO, bUseResources ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::NO, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO; if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_NO ) nDefButton = 1; @@ -121,21 +122,21 @@ int SalGenericSystem::ShowNativeMessageBox( const OUString& rTitle, const OUStri { if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_RETRY_CANCEL ) { - aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_RETRY, bUseResources ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::RETRY, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; } - aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_CANCEL, bUseResources ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::CANCEL, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL; if( nDefaultButton == SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL ) nDefButton = aButtons.size()-1; } if( nButtonCombination == SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_ABORT_RETRY_IGNORE ) { - aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_ABORT, bUseResources ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::ABORT, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_ABORT; - aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_RETRY, bUseResources ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::RETRY, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_RETRY; - aButtons.push_back( GetNativeMessageBoxButtonText( BUTTON_IGNORE, bUseResources ) ); + aButtons.push_back( GetNativeMessageBoxButtonText( StandardButtonType::IGNORE, bUseResources ) ); nButtonIds[nBut++] = SALSYSTEM_SHOWNATIVEMSGBOX_BTN_IGNORE; switch( nDefaultButton ) { diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 83a248a8605d..e6a1d34ffbbd 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -115,7 +115,7 @@ OUString Button::GetStandardText( StandardButtonType eButton ) { sal_uInt32 nResId; const char* pDefText; - } aResIdAry[BUTTON_COUNT] = + } aResIdAry[static_cast<int>(StandardButtonType::COUNT)] = { { SV_BUTTONTEXT_OK, "~OK" }, { SV_BUTTONTEXT_CANCEL, "~Cancel" }, @@ -1653,7 +1653,7 @@ void OKButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) { PushButton::ImplInit( pParent, nStyle ); - SetText( Button::GetStandardText( BUTTON_OK ) ); + SetText( Button::GetStandardText( StandardButtonType::OK ) ); } OKButton::OKButton( vcl::Window* pParent, WinBits nStyle ) : @@ -1698,7 +1698,7 @@ void CancelButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) { PushButton::ImplInit( pParent, nStyle ); - SetText( Button::GetStandardText( BUTTON_CANCEL ) ); + SetText( Button::GetStandardText( StandardButtonType::CANCEL ) ); } CancelButton::CancelButton( vcl::Window* pParent, WinBits nStyle ) : @@ -1742,14 +1742,14 @@ void CancelButton::Click() CloseButton::CloseButton( vcl::Window* pParent, WinBits nStyle ) : CancelButton(pParent, nStyle) { - SetText( Button::GetStandardText( BUTTON_CLOSE ) ); + SetText( Button::GetStandardText( StandardButtonType::CLOSE ) ); } void HelpButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) { PushButton::ImplInit( pParent, nStyle | WB_NOPOINTERFOCUS ); - SetText( Button::GetStandardText( BUTTON_HELP ) ); + SetText( Button::GetStandardText( StandardButtonType::HELP ) ); } HelpButton::HelpButton( vcl::Window* pParent, WinBits nStyle ) : diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx index 0b585a1587a8..8e5e9a6a99be 100644 --- a/vcl/source/control/morebtn.cxx +++ b/vcl/source/control/morebtn.cxx @@ -42,8 +42,8 @@ void MoreButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) PushButton::ImplInit( pParent, nStyle ); - mpMBData->maMoreText = Button::GetStandardText( BUTTON_MORE ); - mpMBData->maLessText = Button::GetStandardText( BUTTON_LESS ); + mpMBData->maMoreText = Button::GetStandardText( StandardButtonType::MORE ); + mpMBData->maLessText = Button::GetStandardText( StandardButtonType::LESS ); ShowState(); diff --git a/vcl/source/window/btndlg.cxx b/vcl/source/window/btndlg.cxx index 94862da3826d..b211dcf5e6a0 100644 --- a/vcl/source/window/btndlg.cxx +++ b/vcl/source/window/btndlg.cxx @@ -296,18 +296,18 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId, pItem->mbOwnButton = true; pItem->mnSepSize = nSepPixel; - if ( eType == BUTTON_OK ) + if ( eType == StandardButtonType::OK ) nBtnFlags |= BUTTONDIALOG_OKBUTTON; - else if ( eType == BUTTON_HELP ) + else if ( eType == StandardButtonType::HELP ) nBtnFlags |= BUTTONDIALOG_HELPBUTTON; - else if ( (eType == BUTTON_CANCEL) || (eType == BUTTON_CLOSE) ) + else if ( (eType == StandardButtonType::CANCEL) || (eType == StandardButtonType::CLOSE) ) nBtnFlags |= BUTTONDIALOG_CANCELBUTTON; pItem->mpPushButton = ImplCreatePushButton( nBtnFlags ); // Standard-Buttons have the right text already - if ( !((eType == BUTTON_OK) && (pItem->mpPushButton->GetType() == WINDOW_OKBUTTON)) || - !((eType == BUTTON_CANCEL) && (pItem->mpPushButton->GetType() == WINDOW_CANCELBUTTON)) || - !((eType == BUTTON_HELP) && (pItem->mpPushButton->GetType() == WINDOW_HELPBUTTON)) ) + if ( !((eType == StandardButtonType::OK) && (pItem->mpPushButton->GetType() == WINDOW_OKBUTTON)) || + !((eType == StandardButtonType::CANCEL) && (pItem->mpPushButton->GetType() == WINDOW_CANCELBUTTON)) || + !((eType == StandardButtonType::HELP) && (pItem->mpPushButton->GetType() == WINDOW_HELPBUTTON)) ) { pItem->mpPushButton->SetText( Button::GetStandardText( eType ) ); } diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 5495e7c048e8..8548eafd5059 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -2171,14 +2171,14 @@ short MessageDialog::Execute() break; case VCL_BUTTONS_YES_NO: pBtn = new PushButton(pButtonBox); - pBtn->SetText(Button::GetStandardText(BUTTON_YES)); + pBtn->SetText(Button::GetStandardText(StandardButtonType::YES)); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_YES; pBtn = new PushButton(pButtonBox); pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON); - pBtn->SetText(Button::GetStandardText(BUTTON_NO)); + pBtn->SetText(Button::GetStandardText(StandardButtonType::NO)); pBtn->Show(); m_aOwnedButtons.push_back(pBtn); m_aResponses[pBtn] = RET_NO; diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 035d97f7e968..3fdb64787bc4 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -75,8 +75,8 @@ void MessBox::ImplInitButtons() else // WB_DEF_OK nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON; - AddButton( BUTTON_OK, RET_OK, nOKFlags ); - AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags ); + AddButton( StandardButtonType::OK, RET_OK, nOKFlags ); + AddButton( StandardButtonType::CANCEL, RET_CANCEL, nCancelFlags ); } else if ( nStyle & WB_YES_NO ) { @@ -86,8 +86,8 @@ void MessBox::ImplInitButtons() nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON; nNoFlags |= BUTTONDIALOG_CANCELBUTTON; - AddButton( BUTTON_YES, RET_YES, nYesFlags ); - AddButton( BUTTON_NO, RET_NO, nNoFlags ); + AddButton( StandardButtonType::YES, RET_YES, nYesFlags ); + AddButton( StandardButtonType::NO, RET_NO, nNoFlags ); } else if ( nStyle & WB_YES_NO_CANCEL ) { @@ -98,9 +98,9 @@ void MessBox::ImplInitButtons() else nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON; - AddButton( BUTTON_YES, RET_YES, nYesFlags ); - AddButton( BUTTON_NO, RET_NO, nNoFlags ); - AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags ); + AddButton( StandardButtonType::YES, RET_YES, nYesFlags ); + AddButton( StandardButtonType::NO, RET_NO, nNoFlags ); + AddButton( StandardButtonType::CANCEL, RET_CANCEL, nCancelFlags ); } else if ( nStyle & WB_RETRY_CANCEL ) { @@ -109,8 +109,8 @@ void MessBox::ImplInitButtons() else // WB_DEF_RETRY nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON; - AddButton( BUTTON_RETRY, RET_RETRY, nRetryFlags ); - AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags ); + AddButton( StandardButtonType::RETRY, RET_RETRY, nRetryFlags ); + AddButton( StandardButtonType::CANCEL, RET_CANCEL, nCancelFlags ); } else if ( nStyle & WB_ABORT_RETRY_IGNORE ) { @@ -124,15 +124,15 @@ void MessBox::ImplInitButtons() else if ( nStyle & WB_DEF_IGNORE ) nIgnoreFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON; - AddButton( BUTTON_ABORT, RET_CANCEL, nAbortFlags ); - AddButton( BUTTON_RETRY, RET_RETRY, nRetryFlags ); - AddButton( BUTTON_IGNORE, RET_IGNORE, nIgnoreFlags ); + AddButton( StandardButtonType::ABORT, RET_CANCEL, nAbortFlags ); + AddButton( StandardButtonType::RETRY, RET_RETRY, nRetryFlags ); + AddButton( StandardButtonType::IGNORE, RET_IGNORE, nIgnoreFlags ); } else if ( nStyle & WB_OK ) { nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON; - AddButton( BUTTON_OK, RET_OK, nOKFlags ); + AddButton( StandardButtonType::OK, RET_OK, nOKFlags ); } } @@ -162,7 +162,7 @@ void MessBox::ImplPosControls() { if ( !mbHelpBtn ) { - AddButton( BUTTON_HELP, RET_HELP, BUTTONDIALOG_HELPBUTTON, 3 ); + AddButton( StandardButtonType::HELP, RET_HELP, BUTTONDIALOG_HELPBUTTON, 3 ); mbHelpBtn = true; } } |