summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-05-09 17:25:36 +0200
committerEike Rathke <erack@redhat.com>2012-05-09 17:36:52 +0200
commitcb7ff0d3801868d6ed7ba9be79095cdce9e29915 (patch)
tree1135aa098d05a4d5111c3b278d1fd9b87708b434
parent0b8d8ab30305212c3606d9218f1e017132d4772b (diff)
changes to fdo#44738 patch to make it work with other locales
Using some fixed format code for whatever locale is wrong anyway, use NfIndexTableOffset and NfKeywordIndex instead. Probably those didn't exist back at that time.
-rw-r--r--sc/source/filter/lotus/tool.cxx35
1 files changed, 19 insertions, 16 deletions
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index b8928ea1dd3e..3795b537533e 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -213,11 +213,11 @@ SfxUInt32Item* FormCache::NewAttr( sal_uInt8 nFormat, sal_uInt8 nSt )
// creates a new format
sal_uInt8 nL, nH; // Low-/High-Nibble
sal_uInt8 nForm = nFormat;
- String aFormString;
- const sal_Char* pFormString = 0;
+ String aFormString;
sal_Int16 eType = NUMBERFORMAT_ALL;
sal_uInt32 nIndex1;
sal_uInt32 nHandle;
+ NfIndexTableOffset eIndexTableOffset = NF_NUMERIC_START;
sal_Bool bDefault = false;
//void GenerateFormat( aFormString, eType, COUNTRY_SYSTEM, LANGUAGE_SYSTEM,
// sal_Bool bThousand, sal_Bool IsRed, sal_uInt16 nPrecision, sal_uInt16 nAnzLeading );
@@ -302,57 +302,61 @@ SfxUInt32Item* FormCache::NewAttr( sal_uInt8 nFormat, sal_uInt8 nSt )
case 0x02: // Date: Day, Month, Year
//fDate;dfDayMonthYearLong;
eType = NUMBERFORMAT_DATE;
- pFormString = "DD.MM.YYYY";
+ eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
break;
case 0x03: // Date: Day, Month
//fDate;dfDayMonthLong;
eType = NUMBERFORMAT_DATE;
- pFormString = "DD.MMMM";
+ aFormString = pFormTable->GetKeyword( eLanguage, NF_KEY_DD);
+ aFormString += pFormTable->GetDateSep(); // matches last eLanguage
+ aFormString += pFormTable->GetKeyword( eLanguage, NF_KEY_MMMM);
break;
case 0x04: // Date: Month, Year
//fDate;dfMonthYearLong;
eType = NUMBERFORMAT_DATE;
- pFormString = "MM.YYYY";
+ aFormString = pFormTable->GetKeyword( eLanguage, NF_KEY_MM);
+ aFormString += pFormTable->GetDateSep(); // matches last eLanguage
+ aFormString += pFormTable->GetKeyword( eLanguage, NF_KEY_YYYY);
break;
case 0x05: // text format
//fString;nSt;
eType = NUMBERFORMAT_TEXT;
- pFormString = "@";
+ eIndexTableOffset = NF_TEXT;
break;
case 0x06: // hidden
//wFlag |= paHideAll;bSetFormat = sal_False;
eType = NUMBERFORMAT_NUMBER;
- pFormString = "";
+ aFormString = "\"\"";
break;
case 0x07: // Time: hour, min, sec
//fTime;tfHourMinSec24;
eType = NUMBERFORMAT_TIME;
- pFormString = "HH:MM:SS";
+ eIndexTableOffset = NF_TIME_HHMMSS;
break;
case 0x08: // Time: hour, min
//fTime;tfHourMin24;
eType = NUMBERFORMAT_TIME;
- pFormString = "HH:MM";
+ eIndexTableOffset = NF_TIME_HHMM;
break;
case 0x09: // Date, intern sal_Int32 1
//fDate;dfDayMonthYearLong;
eType = NUMBERFORMAT_DATE;
- pFormString = "DD.MM.YYYY";
+ eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
break;
case 0x0A: // Date, intern sal_Int32 2
//fDate;dfDayMonthYearLong;
eType = NUMBERFORMAT_DATE;
- pFormString = "DD.MM.YYYY";
+ eIndexTableOffset = NF_DATE_SYS_DDMMYYYY;
break;
case 0x0B: // Time, intern sal_Int32 1
//fTime;tfHourMinSec24;
eType = NUMBERFORMAT_TIME;
- pFormString = "HH:MM:SS";
+ eIndexTableOffset = NF_TIME_HHMMSS;
break;
case 0x0C: // Time, intern sal_Int32 2
//fTime;tfHourMinSec24;
eType = NUMBERFORMAT_TIME;
- pFormString = "HH:MM:SS";
+ eIndexTableOffset = NF_TIME_HHMMSS;
break;
case 0x0F: // standard
//fStandard;nSt;
@@ -377,11 +381,10 @@ SfxUInt32Item* FormCache::NewAttr( sal_uInt8 nFormat, sal_uInt8 nSt )
// put format into table
if( bDefault )
nHandle = 0;
+ else if (eIndexTableOffset != NF_NUMERIC_START)
+ nHandle = pFormTable->GetFormatIndex( eIndexTableOffset, eLanguage);
else
{
- if( pFormString )
- aFormString.AssignAscii( pFormString );
-
xub_StrLen nDummy;
pFormTable->PutEntry( aFormString, nDummy, eType, nHandle, eLanguage );
}