summaryrefslogtreecommitdiff
path: root/vcl/source/control/field.cxx
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-12-02 12:00:43 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-12-02 12:00:43 +0100
commitcda10a2d67d77b74cafb41c5ce294c2fd195dc66 (patch)
tree002c9e55808000786b31f67f329baf7d02545c8d /vcl/source/control/field.cxx
parent0fbdce7fd45d8e11e7b5482d79dd3f53899d7be3 (diff)
parent8dc3743ca56382374183bec5cd1a11d53f3085b8 (diff)
Automated merge with ssh://hg.services.openoffice.org/cws/gridcontrol07
Diffstat (limited to 'vcl/source/control/field.cxx')
-rw-r--r--vcl/source/control/field.cxx41
1 files changed, 21 insertions, 20 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index 6c2b06783984..4c4e3c870429 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -52,8 +52,6 @@
using namespace ::com::sun::star;
-static ResStringArray *strAllUnits = NULL;
-
// -----------------------------------------------------------------------
#define FORMAT_NUMERIC 1
@@ -1131,34 +1129,37 @@ static XubString ImplMetricGetUnitText( const XubString& rStr )
// #104355# support localized mesaurements
-static String ImplMetricToString( FieldUnit rUnit )
+static const String& ImplMetricToString( FieldUnit rUnit )
{
- if( !strAllUnits )
+ FieldUnitStringList* pList = ImplGetFieldUnits();
+ if( pList )
{
- ResMgr* pResMgr = ImplGetResMgr();
- strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) );
+ // return unit's default string (ie, the first one )
+ for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it )
+ {
+ if ( it->second == rUnit )
+ return it->first;
+ }
}
- // return unit's default string (ie, the first one )
- for( USHORT i=0; i < strAllUnits->Count(); i++ )
- if( (FieldUnit) strAllUnits->GetValue( i ) == rUnit )
- return strAllUnits->GetString( i );
- return String();
+ return String::EmptyString();
}
static FieldUnit ImplStringToMetric( const String &rMetricString )
{
- if( !strAllUnits )
+ FieldUnitStringList* pList = ImplGetCleanedFieldUnits();
+ if( pList )
{
- ResMgr* pResMgr = ImplGetResMgr();
- strAllUnits = new ResStringArray( ResId (SV_FUNIT_STRINGS, *pResMgr) );
+ // return FieldUnit
+ String aStr( rMetricString );
+ aStr.ToLowerAscii();
+ aStr.EraseAllChars( sal_Unicode( ' ' ) );
+ for( FieldUnitStringList::const_iterator it = pList->begin(); it != pList->end(); ++it )
+ {
+ if ( it->first.Equals( aStr ) )
+ return it->second;
+ }
}
- // return FieldUnit
- String aStr( rMetricString );
- aStr.ToLowerAscii();
- for( USHORT i=0; i < strAllUnits->Count(); i++ )
- if ( strAllUnits->GetString( i ).Equals( aStr ) )
- return (FieldUnit) strAllUnits->GetValue( i );
return FUNIT_NONE;
}