Kaydet (Commit) b5f5a386 authored tarafından Noel Grandin's avatar Noel Grandin

convert SHOWEXTRAS constants to scoped enum

Change-Id: I84bff53e55fc93ad423835ebc3bf129546dfb7c3
üst f2109254
...@@ -193,7 +193,7 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton ) ...@@ -193,7 +193,7 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
if(pButton == m_pNEWUSER) if(pButton == m_pNEWUSER)
{ {
SfxPasswordDialog aPwdDlg(this); SfxPasswordDialog aPwdDlg(this);
aPwdDlg.ShowExtras(SHOWEXTRAS_ALL); aPwdDlg.ShowExtras(SfxShowExtras::ALL);
if(aPwdDlg.Execute()) if(aPwdDlg.Execute())
{ {
Reference<XDataDescriptorFactory> xUserFactory(m_xUsers,UNO_QUERY); Reference<XDataDescriptorFactory> xUserFactory(m_xUsers,UNO_QUERY);
......
...@@ -1194,7 +1194,7 @@ IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl) ...@@ -1194,7 +1194,7 @@ IMPL_LINK_NOARG(ImpPDFTabSecurityPage, ClickmaPbSetPwdHdl)
SfxPasswordDialog aPwdDialog( this, &msUserPwdTitle ); SfxPasswordDialog aPwdDialog( this, &msUserPwdTitle );
aPwdDialog.SetMinLen( 0 ); aPwdDialog.SetMinLen( 0 );
aPwdDialog.ShowMinLengthText(false); aPwdDialog.ShowMinLengthText(false);
aPwdDialog.ShowExtras( SHOWEXTRAS_CONFIRM | SHOWEXTRAS_PASSWORD2 | SHOWEXTRAS_CONFIRM2 ); aPwdDialog.ShowExtras( SfxShowExtras::CONFIRM | SfxShowExtras::PASSWORD2 | SfxShowExtras::CONFIRM2 );
aPwdDialog.SetText(msStrSetPwd); aPwdDialog.SetText(msStrSetPwd);
aPwdDialog.SetGroup2Text(msOwnerPwdTitle); aPwdDialog.SetGroup2Text(msOwnerPwdTitle);
aPwdDialog.AllowAsciiOnly(); aPwdDialog.AllowAsciiOnly();
......
...@@ -27,15 +27,23 @@ ...@@ -27,15 +27,23 @@
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <sfx2/app.hxx> #include <sfx2/app.hxx>
#include <o3tl/typed_flags_set.hxx>
// defines --------------------------------------------------------------- // defines ---------------------------------------------------------------
#define SHOWEXTRAS_NONE ((sal_uInt16)0x0000) enum class SfxShowExtras
#define SHOWEXTRAS_USER ((sal_uInt16)0x0001) {
#define SHOWEXTRAS_CONFIRM ((sal_uInt16)0x0002) NONE = 0x0000,
#define SHOWEXTRAS_PASSWORD2 ((sal_uInt16)0x0004) USER = 0x0001,
#define SHOWEXTRAS_CONFIRM2 ((sal_uInt16)0x0008) CONFIRM = 0x0002,
#define SHOWEXTRAS_ALL ((sal_uInt16)(SHOWEXTRAS_USER | SHOWEXTRAS_CONFIRM)) PASSWORD2 = 0x0004,
CONFIRM2 = 0x0008,
ALL = USER | CONFIRM
};
namespace o3tl
{
template<> struct typed_flags<SfxShowExtras> : is_typed_flags<SfxShowExtras, 0x0f> {};
}
// class SfxPasswordDialog ----------------------------------------------- // class SfxPasswordDialog -----------------------------------------------
...@@ -65,7 +73,7 @@ private: ...@@ -65,7 +73,7 @@ private:
OUString maEmptyPwdStr; OUString maEmptyPwdStr;
OUString maMainPwdStr; OUString maMainPwdStr;
sal_uInt16 mnMinLen; sal_uInt16 mnMinLen;
sal_uInt16 mnExtras; SfxShowExtras mnExtras;
bool mbAsciiOnly; bool mbAsciiOnly;
DECL_DLLPRIVATE_LINK(EditModifyHdl, Edit*); DECL_DLLPRIVATE_LINK(EditModifyHdl, Edit*);
...@@ -105,7 +113,7 @@ public: ...@@ -105,7 +113,7 @@ public:
{ {
mpPassword1ED->SetHelpId( rId ); mpPassword1ED->SetHelpId( rId );
} }
void ShowExtras(sal_uInt16 nExtras) void ShowExtras(SfxShowExtras nExtras)
{ {
mnExtras = nExtras; mnExtras = nExtras;
} }
......
...@@ -1137,7 +1137,7 @@ bool ScDocShell::ExecuteChangeProtectionDialog( vcl::Window* _pParent, bool bJus ...@@ -1137,7 +1137,7 @@ bool ScDocShell::ExecuteChangeProtectionDialog( vcl::Window* _pParent, bool bJus
pDlg->SetHelpId( GetStaticInterface()->GetSlot(SID_CHG_PROTECT)->GetCommand() ); pDlg->SetHelpId( GetStaticInterface()->GetSlot(SID_CHG_PROTECT)->GetCommand() );
pDlg->SetEditHelpId( HID_CHG_PROTECT ); pDlg->SetEditHelpId( HID_CHG_PROTECT );
if ( !bProtected ) if ( !bProtected )
pDlg->ShowExtras( SHOWEXTRAS_CONFIRM ); pDlg->ShowExtras( SfxShowExtras::CONFIRM );
if ( pDlg->Execute() == RET_OK ) if ( pDlg->Execute() == RET_OK )
aPassword = pDlg->GetPassword(); aPassword = pDlg->GetPassword();
pDlg.reset(); pDlg.reset();
......
...@@ -1002,7 +1002,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) ...@@ -1002,7 +1002,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
pDlg->SetMinLen( 0 ); pDlg->SetMinLen( 0 );
pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand() ); pDlg->SetHelpId( GetStaticInterface()->GetSlot(FID_PROTECT_DOC)->GetCommand() );
pDlg->SetEditHelpId( HID_PASSWD_DOC ); pDlg->SetEditHelpId( HID_PASSWD_DOC );
pDlg->ShowExtras( SHOWEXTRAS_CONFIRM ); pDlg->ShowExtras( SfxShowExtras::CONFIRM );
if (pDlg->Execute() == RET_OK) if (pDlg->Execute() == RET_OK)
{ {
......
...@@ -65,9 +65,9 @@ IMPL_LINK_INLINE_END(SfxPasswordDialog, EditModifyHdl, Edit *, pEdit) ...@@ -65,9 +65,9 @@ IMPL_LINK_INLINE_END(SfxPasswordDialog, EditModifyHdl, Edit *, pEdit)
IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl) IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl)
{ {
bool bConfirmFailed = ( ( mnExtras & SHOWEXTRAS_CONFIRM ) == SHOWEXTRAS_CONFIRM ) && bool bConfirmFailed = bool( mnExtras & SfxShowExtras::CONFIRM ) &&
( GetConfirm() != GetPassword() ); ( GetConfirm() != GetPassword() );
if( ( mnExtras & SHOWEXTRAS_CONFIRM2 ) == SHOWEXTRAS_CONFIRM2 && ( GetConfirm2() != GetPassword2() ) ) if( ( mnExtras & SfxShowExtras::CONFIRM2 ) && ( GetConfirm2() != GetPassword2() ) )
bConfirmFailed = true; bConfirmFailed = true;
if ( bConfirmFailed ) if ( bConfirmFailed )
{ {
...@@ -89,7 +89,7 @@ SfxPasswordDialog::SfxPasswordDialog(vcl::Window* pParent, const OUString* pGrou ...@@ -89,7 +89,7 @@ SfxPasswordDialog::SfxPasswordDialog(vcl::Window* pParent, const OUString* pGrou
, maMinLenPwdStr1(SFX2_RESSTR(STR_PASSWD_MIN_LEN1)) , maMinLenPwdStr1(SFX2_RESSTR(STR_PASSWD_MIN_LEN1))
, maEmptyPwdStr(SFX2_RESSTR(STR_PASSWD_EMPTY)) , maEmptyPwdStr(SFX2_RESSTR(STR_PASSWD_EMPTY))
, mnMinLen(5) , mnMinLen(5)
, mnExtras(0) , mnExtras(SfxShowExtras::NONE)
, mbAsciiOnly(false) , mbAsciiOnly(false)
{ {
get(mpPassword1Box, "password1frame"); get(mpPassword1Box, "password1frame");
...@@ -175,25 +175,25 @@ short SfxPasswordDialog::Execute() ...@@ -175,25 +175,25 @@ short SfxPasswordDialog::Execute()
mpConfirm2FT->Hide(); mpConfirm2FT->Hide();
mpConfirm2ED->Hide(); mpConfirm2ED->Hide();
if (mnExtras != SHOWEXTRAS_NONE) if (mnExtras != SfxShowExtras::NONE)
mpPassword1FT->Show(); mpPassword1FT->Show();
if (mnExtras & SHOWEXTRAS_USER) if (mnExtras & SfxShowExtras::USER)
{ {
mpUserFT->Show(); mpUserFT->Show();
mpUserED->Show(); mpUserED->Show();
} }
if (mnExtras & SHOWEXTRAS_CONFIRM) if (mnExtras & SfxShowExtras::CONFIRM)
{ {
mpConfirm1FT->Show(); mpConfirm1FT->Show();
mpConfirm1ED->Show(); mpConfirm1ED->Show();
} }
if (mnExtras & SHOWEXTRAS_PASSWORD2) if (mnExtras & SfxShowExtras::PASSWORD2)
{ {
mpPassword2Box->Show(); mpPassword2Box->Show();
mpPassword2FT->Show(); mpPassword2FT->Show();
mpPassword2ED->Show(); mpPassword2ED->Show();
} }
if (mnExtras & SHOWEXTRAS_CONFIRM2) if (mnExtras & SfxShowExtras::CONFIRM2)
{ {
mpConfirm2FT->Show(); mpConfirm2FT->Show();
mpConfirm2ED->Show(); mpConfirm2ED->Show();
......
...@@ -102,7 +102,7 @@ static bool lcl_GetPassword( ...@@ -102,7 +102,7 @@ static bool lcl_GetPassword(
SfxPasswordDialog aPasswdDlg( pParent ); SfxPasswordDialog aPasswdDlg( pParent );
aPasswdDlg.SetMinLen( 1 ); aPasswdDlg.SetMinLen( 1 );
if (bProtect) if (bProtect)
aPasswdDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); aPasswdDlg.ShowExtras( SfxShowExtras::CONFIRM );
if (RET_OK == aPasswdDlg.Execute() && !aPasswdDlg.GetPassword().isEmpty()) if (RET_OK == aPasswdDlg.Execute() && !aPasswdDlg.GetPassword().isEmpty())
{ {
rPassword = aPasswdDlg.GetPassword(); rPassword = aPasswdDlg.GetPassword();
......
...@@ -191,7 +191,7 @@ IMPL_LINK_NOARG(DocumentInserter, DialogClosedHdl) ...@@ -191,7 +191,7 @@ IMPL_LINK_NOARG(DocumentInserter, DialogClosedHdl)
{ {
// ask for the password // ask for the password
SfxPasswordDialog aPasswordDlg( NULL ); SfxPasswordDialog aPasswordDlg( NULL );
aPasswordDlg.ShowExtras( SHOWEXTRAS_CONFIRM ); aPasswordDlg.ShowExtras( SfxShowExtras::CONFIRM );
short nRet = aPasswordDlg.Execute(); short nRet = aPasswordDlg.Execute();
if ( RET_OK == nRet ) if ( RET_OK == nRet )
{ {
......
...@@ -1233,7 +1233,7 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox ) ...@@ -1233,7 +1233,7 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox )
if(!pRepr->GetTempPasswd().getLength() || bChange) if(!pRepr->GetTempPasswd().getLength() || bChange)
{ {
SfxPasswordDialog aPasswdDlg(this); SfxPasswordDialog aPasswdDlg(this);
aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
if(RET_OK == aPasswdDlg.Execute()) if(RET_OK == aPasswdDlg.Execute())
{ {
const OUString sNewPasswd( aPasswdDlg.GetPassword() ); const OUString sNewPasswd( aPasswdDlg.GetPassword() );
...@@ -1671,7 +1671,7 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton ) ...@@ -1671,7 +1671,7 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton )
if(!m_aNewPasswd.getLength() || bChange) if(!m_aNewPasswd.getLength() || bChange)
{ {
SfxPasswordDialog aPasswdDlg(this); SfxPasswordDialog aPasswdDlg(this);
aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
if(RET_OK == aPasswdDlg.Execute()) if(RET_OK == aPasswdDlg.Execute())
{ {
const OUString sNewPasswd( aPasswdDlg.GetPassword() ); const OUString sNewPasswd( aPasswdDlg.GetPassword() );
......
...@@ -626,7 +626,7 @@ void SwView::Execute(SfxRequest &rReq) ...@@ -626,7 +626,7 @@ void SwView::Execute(SfxRequest &rReq)
SfxPasswordDialog aPasswdDlg( pParent ); SfxPasswordDialog aPasswdDlg( pParent );
aPasswdDlg.SetMinLen( 1 ); aPasswdDlg.SetMinLen( 1 );
if(!aPasswd.getLength()) if(!aPasswd.getLength())
aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); aPasswdDlg.ShowExtras(SfxShowExtras::CONFIRM);
if (aPasswdDlg.Execute()) if (aPasswdDlg.Execute())
{ {
sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON; sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON;
......
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