summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2014-11-04 05:31:53 -0800
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-11-07 22:07:33 +0100
commitd30a8ec448bcd08c6a52a37d6ae41a4b71c235da (patch)
treef2b98f28a26d2dde0f136d0565a4043881e27c02 /writerfilter
parent5cf2cd7934893efbec3b9c5dbcd76ca8eee80ecf (diff)
Correct number format mapping for CJK numbered lists in rtf/doc/docx filters.
Reviewed on: https://gerrit.libreoffice.org/12252 Change-Id: I2d8760c7ecb3677464e167528b2424aaca19a0d7
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/ConversionHelper.cxx30
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx66
2 files changed, 77 insertions, 19 deletions
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index ad19d0860acf..7b6dc5f93c50 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -450,40 +450,28 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt)
switch(nFmt)
{
case NS_ooxml::LN_Value_ST_NumberFormat_decimal:
- case 0:
nRet = style::NumberingType::ARABIC;
break;
case NS_ooxml::LN_Value_ST_NumberFormat_upperRoman:
- case 1:
nRet = style::NumberingType::ROMAN_UPPER;
break;
case NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman:
- case 2:
nRet = style::NumberingType::ROMAN_LOWER;
break;
- case 3:
- nRet = style::NumberingType::CHARS_UPPER_LETTER_N;
- break;
- case 4:
- nRet = style::NumberingType::CHARS_LOWER_LETTER_N;
- break;
- case 5:
+ case NS_ooxml::LN_Value_ST_NumberFormat_ordinal:
nRet = style::NumberingType::ARABIC;
- break;//ORDINAL
+ break;
case NS_ooxml::LN_Value_ST_NumberFormat_bullet:
- case 23:
- case 25:
nRet = style::NumberingType::CHAR_SPECIAL;
break;
case NS_ooxml::LN_Value_ST_NumberFormat_none:
- case 255:
nRet = style::NumberingType::NUMBER_NONE;
break;
case NS_ooxml::LN_Value_ST_NumberFormat_upperLetter:
- nRet = style::NumberingType::CHARS_UPPER_LETTER;
+ nRet = style::NumberingType::CHARS_UPPER_LETTER_N;
break;
case NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter:
- nRet = style::NumberingType::CHARS_LOWER_LETTER;
+ nRet = style::NumberingType::CHARS_LOWER_LETTER_N;
break;
case NS_ooxml::LN_Value_ST_NumberFormat_iroha:
nRet = style::NumberingType::IROHA_HALFWIDTH_JA;
@@ -525,9 +513,9 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt)
case NS_ooxml::LN_Value_ST_NumberFormat_chosung:
nRet = style::NumberingType::HANGUL_JAMO_KO;
break;
+ case NS_ooxml::LN_Value_ST_NumberFormat_koreanLegal:
case NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital:
case NS_ooxml::LN_Value_ST_NumberFormat_koreanCounting:
- case NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital2:
nRet = style::NumberingType::NUMBER_HANGUL_KO;
break;
case NS_ooxml::LN_Value_ST_NumberFormat_ideographLegalTraditional:
@@ -545,8 +533,10 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt)
case NS_ooxml::LN_Value_ST_NumberFormat_chineseCounting:
case NS_ooxml::LN_Value_ST_NumberFormat_japaneseCounting:
case NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCounting:
+ case NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCountingThousand:
case NS_ooxml::LN_Value_ST_NumberFormat_ideographDigital:
case NS_ooxml::LN_Value_ST_NumberFormat_chineseCountingThousand:
+ case NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital2:
nRet = style::NumberingType::NUMBER_LOWER_ZH;
break;
case NS_ooxml::LN_Value_ST_NumberFormat_chineseLegalSimplified:
@@ -556,6 +546,10 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt)
//91726
nRet = style::NumberingType::CHARS_HEBREW;
break;
+ case NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth:
+ case NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth2:
+ nRet = style::NumberingType::FULLWIDTH_ARABIC;
+ break;
default: nRet = style::NumberingType::ARABIC;
}
/* TODO: Lots of additional values are available - some are supported in the I18 framework
@@ -568,12 +562,10 @@ sal_Int16 ConvertNumberingType(sal_Int32 nFmt)
NS_ooxml::LN_Value_ST_NumberFormat_decimalHalfWidth = 91692;
NS_ooxml::LN_Value_ST_NumberFormat_japaneseDigitalTenThousand = 91694;
NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircle = 91695;
- NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth2 = 91696;
NS_ooxml::LN_Value_ST_NumberFormat_decimalZero = 91699;
NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedFullstop = 91703;
NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedParen = 91704;
NS_ooxml::LN_Value_ST_NumberFormat_ideographZodiacTraditional = 91709;
- NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCountingThousand = 91712;
NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseDigital = 91713;
NS_ooxml::LN_Value_ST_NumberFormat_chineseLegalSimplified = 91715;
NS_ooxml::LN_Value_ST_NumberFormat_chineseCountingThousand = 91716;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index a568d954d548..3c7b5d3c8464 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2394,6 +2394,71 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
return 0;
}
+
+static int lcl_getNumberFormat(int nParam)
+{
+ static const int aMap[] =
+ {
+ NS_ooxml::LN_Value_ST_NumberFormat_decimal,
+ NS_ooxml::LN_Value_ST_NumberFormat_upperRoman,
+ NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman,
+ NS_ooxml::LN_Value_ST_NumberFormat_upperLetter,
+ NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter,
+ NS_ooxml::LN_Value_ST_NumberFormat_ordinal,
+ NS_ooxml::LN_Value_ST_NumberFormat_cardinalText,
+ NS_ooxml::LN_Value_ST_NumberFormat_ordinalText,
+ NS_ooxml::LN_Value_ST_NumberFormat_none, // Undefined in RTF 1.8 spec.
+ NS_ooxml::LN_Value_ST_NumberFormat_none, // Undefined in RTF 1.8 spec.
+ NS_ooxml::LN_Value_ST_NumberFormat_ideographDigital,
+ NS_ooxml::LN_Value_ST_NumberFormat_japaneseCounting,
+ NS_ooxml::LN_Value_ST_NumberFormat_aiueo,
+ NS_ooxml::LN_Value_ST_NumberFormat_iroha,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimalHalfWidth,
+ NS_ooxml::LN_Value_ST_NumberFormat_japaneseLegal,
+ NS_ooxml::LN_Value_ST_NumberFormat_japaneseDigitalTenThousand ,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircleChinese,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimalFullWidth2,
+ NS_ooxml::LN_Value_ST_NumberFormat_aiueoFullWidth,
+ NS_ooxml::LN_Value_ST_NumberFormat_irohaFullWidth,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimalZero,
+ NS_ooxml::LN_Value_ST_NumberFormat_bullet,
+ NS_ooxml::LN_Value_ST_NumberFormat_ganada,
+ NS_ooxml::LN_Value_ST_NumberFormat_chosung,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedFullstop,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedParen,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimalEnclosedCircleChinese,
+ NS_ooxml::LN_Value_ST_NumberFormat_ideographEnclosedCircle,
+ NS_ooxml::LN_Value_ST_NumberFormat_ideographTraditional,
+ NS_ooxml::LN_Value_ST_NumberFormat_ideographZodiac,
+ NS_ooxml::LN_Value_ST_NumberFormat_ideographZodiacTraditional,
+ NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCounting,
+ NS_ooxml::LN_Value_ST_NumberFormat_ideographLegalTraditional,
+ NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseCountingThousand,
+ NS_ooxml::LN_Value_ST_NumberFormat_taiwaneseDigital,
+ NS_ooxml::LN_Value_ST_NumberFormat_chineseCounting,
+ NS_ooxml::LN_Value_ST_NumberFormat_chineseLegalSimplified,
+ NS_ooxml::LN_Value_ST_NumberFormat_chineseCountingThousand,
+ NS_ooxml::LN_Value_ST_NumberFormat_decimal,
+ NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital,
+ NS_ooxml::LN_Value_ST_NumberFormat_koreanCounting,
+ NS_ooxml::LN_Value_ST_NumberFormat_koreanLegal,
+ NS_ooxml::LN_Value_ST_NumberFormat_koreanDigital2,
+ NS_ooxml::LN_Value_ST_NumberFormat_hebrew1,
+ NS_ooxml::LN_Value_ST_NumberFormat_arabicAlpha,
+ NS_ooxml::LN_Value_ST_NumberFormat_hebrew2,
+ NS_ooxml::LN_Value_ST_NumberFormat_arabicAbjad
+ };
+ const int nLen = SAL_N_ELEMENTS(aMap);
+ int nValue = 0;
+ if (nParam >= 0 && nParam < nLen)
+ nValue = aMap[nParam];
+ else // 255 and the other cases.
+ nValue = NS_ooxml::LN_Value_ST_NumberFormat_none;
+ return nValue;
+}
+
+
// Checks if rName is contained at least once in rProperties as a key.
bool lcl_findPropertyName(const std::vector<beans::PropertyValue>& rProperties, const OUString& rName)
{
@@ -3453,6 +3518,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
}
case RTF_LEVELNFC:
nSprm = NS_ooxml::LN_CT_Lvl_numFmt;
+ pIntValue.reset(new RTFValue(lcl_getNumberFormat(nParam)));
break;
case RTF_LEVELSTARTAT:
nSprm = NS_ooxml::LN_CT_Lvl_start;