summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/passwd.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/dialog/passwd.cxx')
-rw-r--r--sfx2/source/dialog/passwd.cxx28
1 files changed, 27 insertions, 1 deletions
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index cbe47d39b704..981657d476fa 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -43,10 +43,35 @@
#include "dialog.hrc"
#include "passwd.hrc"
+#include "vcl/sound.hxx"
+
// -----------------------------------------------------------------------
IMPL_LINK_INLINE_START( SfxPasswordDialog, EditModifyHdl, Edit *, EMPTYARG )
{
+ if( mbAsciiOnly )
+ {
+ rtl::OUString aTest( maPasswordED.GetText() );
+ const sal_Unicode* pTest = aTest.getStr();
+ sal_Int32 nLen = aTest.getLength();
+ rtl::OUStringBuffer aFilter( nLen );
+ bool bReset = false;
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ if( *pTest > 0x007f )
+ bReset = true;
+ else
+ aFilter.append( *pTest );
+ pTest++;
+ }
+ if( bReset )
+ {
+ Sound::Beep( SOUND_ERROR );
+ maPasswordED.SetSelection( Selection( 0, nLen ) );
+ maPasswordED.ReplaceSelected( aFilter.makeStringAndClear() );
+ }
+
+ }
maOKBtn.Enable( maPasswordED.GetText().Len() >= mnMinLen );
return 0;
}
@@ -88,7 +113,8 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
maConfirmStr ( SfxResId( STR_PASSWD_CONFIRM ) ),
mnMinLen ( 5 ),
- mnExtras ( 0 )
+ mnExtras ( 0 ),
+ mbAsciiOnly ( false )
{
FreeResource();