summaryrefslogtreecommitdiff
path: root/vcl/source/control/field2.cxx
diff options
context:
space:
mode:
authorMalte Timmermann <mt@openoffice.org>2002-09-02 12:41:36 +0000
committerMalte Timmermann <mt@openoffice.org>2002-09-02 12:41:36 +0000
commite43b4bf7b1e55b2d3dd8446717bdc12b65b7dd41 (patch)
tree7d0974562e767dcb5b11775b4e67a4f86b7f37fd /vcl/source/control/field2.cxx
parent5c2c3e83d5933cda482e9048fd3b30051d4adfa4 (diff)
#84536# Use I18N
Diffstat (limited to 'vcl/source/control/field2.cxx')
-rw-r--r--vcl/source/control/field2.cxx49
1 files changed, 29 insertions, 20 deletions
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index da762fd7dfc1..be85cd5f19b1 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: field2.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: mt $ $Date: 2002-09-02 12:27:42 $
+ * last change: $Author: mt $ $Date: 2002-09-02 13:41:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,6 +116,10 @@
#include <unotools/calendarwrapper.hxx>
#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
+#endif
+
using namespace ::com::sun::star;
// =======================================================================
@@ -228,32 +232,42 @@ static void ImplSkipDelimiters( const sal_Unicode*& rpBuf )
static int ImplIsPatternChar( xub_Unicode cChar, sal_Char cEditMask )
{
+ sal_Int32 nType = 0;
+
+ try
+ {
+ String aCharStr( cChar );
+ nType = ImplGetCharClass()->getStringType( aCharStr, 0, aCharStr.Len(), Application::GetSettings().GetLocale() );
+ }
+ catch ( ::com::sun::star::uno::Exception& )
+ {
+ DBG_ERRORFILE( "ImplIsPatternChar: Exception caught!" );
+ return FALSE;
+ }
+
if ( (cEditMask == EDITMASK_ALPHA) || (cEditMask == EDITMASK_UPPERALPHA) )
{
- if ( ((cChar < 'A') || (cChar > 'Z')) &&
- ((cChar < 'a') || (cChar > 'z')) )
+ if( !CharClass::isLetterType( nType ) )
return FALSE;
}
- else if ( (cEditMask == EDITMASK_ALPHANUM) || (cEditMask == EDITMASK_UPPERALPHANUM) )
+ else if ( cEditMask == EDITMASK_NUM )
{
- if ( ((cChar < 'A') || (cChar > 'Z')) &&
- ((cChar < 'a') || (cChar > 'z')) &&
- ((cChar < '0') || (cChar > '9')) )
+ if( !CharClass::isNumericType( nType ) )
return FALSE;
}
- else if ( (cEditMask == EDITMASK_ALLCHAR) || (cEditMask == EDITMASK_UPPERALLCHAR) )
+ else if ( (cEditMask == EDITMASK_ALPHANUM) || (cEditMask == EDITMASK_UPPERALPHANUM) )
{
- if ( cChar < 32 )
+ if( !CharClass::isLetterNumericType( nType ) )
return FALSE;
}
- else if ( cEditMask == EDITMASK_NUM )
+ else if ( (cEditMask == EDITMASK_ALLCHAR) || (cEditMask == EDITMASK_UPPERALLCHAR) )
{
- if ( (cChar < '0') || (cChar > '9') )
+ if ( cChar < 32 )
return FALSE;
}
else if ( cEditMask == EDITMASK_NUMSPACE )
{
- if ( ((cChar < '0') || (cChar > '9')) && (cChar != ' ') )
+ if ( !CharClass::isNumericType( nType ) && ( cChar != ' ' ) )
return FALSE;
}
else
@@ -269,16 +283,11 @@ static xub_Unicode ImplPatternChar( xub_Unicode cChar, sal_Char cEditMask )
if ( ImplIsPatternChar( cChar, cEditMask ) )
{
if ( (cEditMask == EDITMASK_UPPERALPHA) ||
- (cEditMask == EDITMASK_UPPERALPHANUM) )
- {
- if ( (cChar >= 'a') && (cChar <= 'z') )
- cChar = (cChar - 'a') + 'A';
- }
- else if ( cEditMask == EDITMASK_UPPERALLCHAR )
+ (cEditMask == EDITMASK_UPPERALPHANUM) ||
+ ( cEditMask == EDITMASK_UPPERALLCHAR ) )
{
cChar = ImplGetCharClass()->toUpper( String(cChar),0,1,Application::GetSettings().GetLocale() )[0];
}
-
return cChar;
}
else