diff options
author | DaeHyun Sung <sungdh86+git@gmail.com> | 2021-07-26 23:36:50 +0900 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-07-29 08:43:18 +0200 |
commit | 4598a385ffaaf8fdc124962d347fead994450bea (patch) | |
tree | d718b0245699ccca3d70eec79639f76574c85ac3 /i18npool/source/defaultnumberingprovider | |
parent | ff1d4168dd8620431a4f9da64c8d25a7c8f69693 (diff) |
tdf#143526 fix and add Korean numbering
fix Korean NumberFormat, compare with MS Word
change mapping of style::NumberingType::NUMBER_HANGUL_KO,
from "koreanLegal" to "koreanCounting"
"koreanDigital" add new reserved words "일, 일영, 일영영, etc"
- style::NumberingType::NUMBER_DIGITAL_KO
"koreanLegal" is new reserved words "하나, 둘, 셋, 넷, 다섯, 여섯, 일곱, 여덟, 아홉, 열"
- style::NumberingType::NUMBER_LEGAL_KO
"koreanDigital2" is new reserved words "一, 一零, 一零零, etc"
- style::NumberingType::NUMBER_DIGITAL2_KO
Reference:
1: "[MS-OE376]: Office Implementation Information for ECMA-376 Standards Support"
https://docs.microsoft.com/en-us/openspecs/office_standards/ms-oe376/a5deef83-bb01-410f-bde0-9c35abe4ca52
2.1.350 Part 4 Section 2.13.5.30, numberingChange (Previous Paragraph Numbering Properties)
2: "[MS-DOCX]: Word Extensions to the Office Open XML (.docx) File Format" shows example of not only Korean Numbering also others Numbering examples.
https://docs.microsoft.com/en-us/openspecs/office_standards/ms-docx/b839fe1f-e1ca-4fa6-8c26-5954d0abbccd
2.4 numFmt Extensions
https://docs.microsoft.com/en-us/openspecs/office_standards/ms-docx/a1bb5809-e361-4e49-8e16-7f1a67da4121
Change-Id: I535b2aa3cf4111d86b9b7b788afe4aa64e8e4545
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119518
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'i18npool/source/defaultnumberingprovider')
-rw-r--r-- | i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index dadfc13b86a0..b7ee64cac5eb 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -288,6 +288,29 @@ const sal_Unicode table_PersianWord_decadeX[][8]={ {0x0645, 0x06cc, 0x0644, 0x06cc, 0x0627, 0x0631, 0x062f, 0} // 1000000000 }; +const sal_Unicode table_KoreanLegalWord_decade1[][3] = { + {0xd558, 0xb098, 0}, // 1 + {0xb458, 0}, // 2 + {0xc14b, 0}, // 3 + {0xb137, 0}, // 4 + {0xb2e4, 0xc12f, 0}, // 5 + {0xc5ec, 0xc12f, 0}, // 6 + {0xc77c, 0xacf1, 0}, // 7 + {0xc5ec, 0xb35f, 0}, // 8 + {0xc544, 0xd649, 0} // 9 +}; + +const sal_Unicode table_KoreanLegalWord_decade2[][3] = { + {0xc5f4, 0}, // 10 + {0xc2a4, 0xbb3c, 0}, // 20 + {0xc11c, 0xb978, 0}, // 30 + {0xb9c8, 0xd754, 0}, // 40 + {0xc270, 0}, // 50 + {0xc608, 0xc21c, 0}, // 60 + {0xc77c, 0xd754, 0}, // 70 + {0xc5ec, 0xb4e0, 0}, // 80 + {0xc544, 0xd754, 0} // 90 +}; DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XComponentContext >& rxContext ) : m_xContext(rxContext) { @@ -468,6 +491,16 @@ void lcl_formatPersianWord( sal_Int32 nNumber, OUString& rsResult ) rsResult += aTemp; } +static void lcl_formatKoreanLegalWord(sal_Int32 nNumber, OUString& rsResult) { + OUStringBuffer aTemp(64); + int digit1 = nNumber % 10; + int digit2 = nNumber / 10; + if (digit1 > 0) + aTemp.insert(0, (table_KoreanLegalWord_decade1[digit1 - 1])); + if (digit2 > 0) + aTemp.insert(0, (table_KoreanLegalWord_decade2[digit2 - 1])); + rsResult += aTemp.makeStringAndClear(); +} // Greek Letter Numbering @@ -743,6 +776,25 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal natNum = NativeNumberMode::NATNUM11; locale.Language = "ko"; break; + case NUMBER_DIGITAL_KO: + natNum = NativeNumberMode::NATNUM9; + locale.Language = "ko"; + break; + case NUMBER_DIGITAL2_KO: + natNum = NativeNumberMode::NATNUM1; + locale.Language = "ko"; + break; + case NUMBER_LEGAL_KO: + if (number < 1 || number >= 100) + { + natNum = NativeNumberMode::NATNUM11; + locale.Language = "ko"; + } + else + { + lcl_formatKoreanLegalWord(number, result); + } + break; case CIRCLE_NUMBER: table = table_CircledNumber; @@ -1016,6 +1068,9 @@ const Supported_NumberingType aSupportedTypes[] = {style::NumberingType::HANGUL_SYLLABLE_KO, nullptr, LANG_CJK}, {style::NumberingType::HANGUL_CIRCLED_JAMO_KO, nullptr, LANG_CJK}, {style::NumberingType::HANGUL_CIRCLED_SYLLABLE_KO, nullptr, LANG_CJK}, + {style::NumberingType::NUMBER_LEGAL_KO, nullptr, LANG_CJK}, + {style::NumberingType::NUMBER_DIGITAL_KO, nullptr, LANG_CJK}, + {style::NumberingType::NUMBER_DIGITAL2_KO, nullptr, LANG_CJK}, {style::NumberingType::CHARS_ARABIC, nullptr, LANG_CTL}, {style::NumberingType::CHARS_ARABIC_ABJAD, nullptr, LANG_CTL}, {style::NumberingType::NUMBER_ARABIC_INDIC, S_AR_ONE ", " S_AR_TWO ", " S_AR_THREE ", ...", LANG_CTL}, |