diff options
Diffstat (limited to 'i18npool/source/textconversion')
5 files changed, 48 insertions, 48 deletions
diff --git a/i18npool/source/textconversion/genconv_dict.cxx b/i18npool/source/textconversion/genconv_dict.cxx index 3b3e5d4e9c0a..28f4d3b77181 100644 --- a/i18npool/source/textconversion/genconv_dict.cxx +++ b/i18npool/source/textconversion/genconv_dict.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -53,8 +53,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) if (argc < 4) exit(-1); - sfp = fopen(argv[2], "rb"); // open the source file for read; - if (sfp == NULL) + sfp = fopen(argv[2], "rb"); // open the source file for read; + if (sfp == NULL) { printf("Open the dictionary source file failed."); return -1; @@ -131,7 +131,7 @@ void make_hhc_char(FILE *sfp, FILE *cfp) fprintf(cfp, "\nstatic const com::sun::star::i18n::Hangul_Index Hangul2HanjaIndex[] = {\n"); for (i = 0; i < count; i++) - fprintf(cfp, "\t{ 0x%04x, 0x%04x, 0x%02x },\n", + fprintf(cfp, "\t{ 0x%04x, 0x%04x, 0x%02x },\n", Hangul2HanjaData[i][0], Hangul2HanjaData[i][1], Hangul2HanjaData[i][2]); diff --git a/i18npool/source/textconversion/textconversion.cxx b/i18npool/source/textconversion/textconversion.cxx index 51bd7a4c1bf4..e3c5d7994476 100644 --- a/i18npool/source/textconversion/textconversion.cxx +++ b/i18npool/source/textconversion/textconversion.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -60,9 +60,9 @@ static void* nullFunc() } oslGenericFunction SAL_CALL -TextConversion::getFunctionBySymbol(const sal_Char* func) +TextConversion::getFunctionBySymbol(const sal_Char* func) { - if (hModule) + if (hModule) return osl_getFunctionSymbol(hModule, OUString::createFromAscii(func).pData); else return reinterpret_cast< oslGenericFunction >(nullFunc); diff --git a/i18npool/source/textconversion/textconversionImpl.cxx b/i18npool/source/textconversion/textconversionImpl.cxx index 1e433737efe7..b393b0be656c 100644 --- a/i18npool/source/textconversion/textconversionImpl.cxx +++ b/i18npool/source/textconversion/textconversionImpl.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -76,8 +76,8 @@ TextConversionImpl::getConversionWithOffset( const OUString& aText, sal_Int32 nS return xTC->getConversionWithOffset(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions, offset); } -sal_Bool SAL_CALL -TextConversionImpl::interactiveConversion( const Locale& rLocale, sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions ) +sal_Bool SAL_CALL +TextConversionImpl::interactiveConversion( const Locale& rLocale, sal_Int16 nTextConversionType, sal_Int32 nTextConversionOptions ) throw( RuntimeException, IllegalArgumentException, NoSupportException ) { getLocaleSpecificTextConversion(rLocale); @@ -96,7 +96,7 @@ TextConversionImpl::getLocaleSpecificTextConversion(const Locale& rLocale) throw aLocale = rLocale; Reference < XInterface > xI; - + xI = xMSF->createInstance( OUString::createFromAscii("com.sun.star.i18n.TextConversion_") + aLocale.Language); @@ -109,7 +109,7 @@ TextConversionImpl::getLocaleSpecificTextConversion(const Locale& rLocale) throw OUString::createFromAscii("com.sun.star.i18n.TextConversion_") + aLocale.Language + OUString::createFromAscii("_") + aLocale.Country + OUString::createFromAscii("_") + aLocale.Variant); - + if (xI.is()) xI->queryInterface( getCppuType((const Reference< XTextConversion>*)0) ) >>= xTC; else if (xTC.is()) diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx index 862076501153..8318cc32e345 100644 --- a/i18npool/source/textconversion/textconversion_ko.cxx +++ b/i18npool/source/textconversion/textconversion_ko.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,13 +46,13 @@ using namespace rtl; namespace com { namespace sun { namespace star { namespace i18n { #define SCRIPT_OTHERS 0 -#define SCRIPT_HANJA 1 +#define SCRIPT_HANJA 1 #define SCRIPT_HANGUL 2 TextConversion_ko::TextConversion_ko( const Reference < XMultiServiceFactory >& xMSF ) { Reference < XInterface > xI; - + xI = xMSF->createInstance( OUString::createFromAscii("com.sun.star.i18n.ConversionDictionary_ko")); @@ -64,13 +64,13 @@ TextConversion_ko::TextConversion_ko( const Reference < XMultiServiceFactory >& if ( xI.is() ) xI->queryInterface( getCppuType((const Reference< XConversionDictionaryList>*)0) ) >>= xCDL; - + maxLeftLength = maxRightLength = 1; // get maximum length of word in dictionary if (xCDL.is()) { - Locale loc(OUString::createFromAscii("ko"), - OUString::createFromAscii("KR"), + Locale loc(OUString::createFromAscii("ko"), + OUString::createFromAscii("KR"), OUString()); maxLeftLength = xCDL->queryMaxCharCount(loc, ConversionDictionaryType::HANGUL_HANJA, @@ -123,7 +123,7 @@ sal_Int16 SAL_CALL checkScriptType(sal_Unicode c) return (i < scriptListCount && block >= scriptList[i].from) ? scriptList[i].script : SCRIPT_OTHERS; } -Sequence< OUString > SAL_CALL +Sequence< OUString > SAL_CALL TextConversion_ko::getCharConversions(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toHanja) { sal_Unicode ch; @@ -167,7 +167,7 @@ TextConversion_ko::getCharConversions(const OUString& aText, sal_Int32 nStartPos if (address != 0xFFFF) newStr->buffer[count++] = address; - else + else break; } if (count > 0) { @@ -252,25 +252,25 @@ TextConversion_ko::getConversions( const OUString& aText, sal_Int32 nStartPos, s if (len > 1) { try { if (xCDL.is()) - result.Candidates = xCDL->queryConversions(aText, start + nStartPos, len, + result.Candidates = xCDL->queryConversions(aText, start + nStartPos, len, aLocale, ConversionDictionaryType::HANGUL_HANJA, eDirection, nConversionOptions); // user dictionary } catch ( NoSupportException & ) { - // clear reference (when there is no user dictionary) in order - // to not always have to catch this exception again + // clear reference (when there is no user dictionary) in order + // to not always have to catch this exception again // in further calls. (save time) xCDL = 0; } catch (...) { - // catch all other exceptions to allow + // catch all other exceptions to allow // querying the system dictionary in the next line } - if (xCD.is() && toHanja) { // System dictionary would not do Hanja_to_Hangul conversion. + if (xCD.is() && toHanja) { // System dictionary would not do Hanja_to_Hangul conversion. candidates = xCD->getConversions(aText, start + nStartPos, len, eDirection, nConversionOptions); result.Candidates += candidates; } } else if (! toHanja) { // do whole word character 2 character conversion for Hanja to Hangul conversion - result.Candidates = getCharConversions(aText, nStartPos + start, length - start, toHanja); + result.Candidates = getCharConversions(aText, nStartPos + start, length - start, toHanja); if (result.Candidates.hasElements()) len = result.Candidates[0].getLength(); } @@ -333,8 +333,8 @@ TextConversion_ko::getConversionWithOffset( const OUString& aText, sal_Int32 nSt return getConversion(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions); } -sal_Bool SAL_CALL -TextConversion_ko::interactiveConversion( const Locale& /*rLocale*/, sal_Int16 /*nTextConversionType*/, sal_Int32 /*nTextConversionOptions*/ ) +sal_Bool SAL_CALL +TextConversion_ko::interactiveConversion( const Locale& /*rLocale*/, sal_Int16 /*nTextConversionType*/, sal_Int32 /*nTextConversionOptions*/ ) throw( RuntimeException, IllegalArgumentException, NoSupportException ) { return sal_True; diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx index 2c0682d93205..16172dc9b3fb 100644 --- a/i18npool/source/textconversion/textconversion_zh.cxx +++ b/i18npool/source/textconversion/textconversion_zh.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -67,7 +67,7 @@ sal_Unicode SAL_CALL getOneCharConversion(sal_Unicode ch, const sal_Unicode* Dat } } -OUString SAL_CALL +OUString SAL_CALL TextConversion_zh::getCharConversion(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions) { const sal_Unicode *Data; @@ -86,12 +86,12 @@ TextConversion_zh::getCharConversion(const OUString& aText, sal_Int32 nStartPos, rtl_uString * newStr = x_rtl_uString_new_WithLength( nLength ); // defined in x_rtl_ustring.h for (sal_Int32 i = 0; i < nLength; i++) - newStr->buffer[i] = + newStr->buffer[i] = getOneCharConversion(aText[nStartPos+i], Data, Index); return OUString( newStr->buffer, nLength); } -OUString SAL_CALL +OUString SAL_CALL TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength, sal_Bool toSChinese, sal_Int32 nConversionOptions, Sequence<sal_Int32>& offset) { sal_Int32 dictLen = 0; @@ -133,23 +133,23 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos, for (; len > 0 && ! found; len--) { OUString word = aText.copy(nStartPos + currPos, len); sal_Int32 current = 0; - // user dictionary + // user dictionary if (xCDL.is()) { Sequence < OUString > conversions; try { - conversions = xCDL->queryConversions(word, 0, len, - aLocale, ConversionDictionaryType::SCHINESE_TCHINESE, + conversions = xCDL->queryConversions(word, 0, len, + aLocale, ConversionDictionaryType::SCHINESE_TCHINESE, /*toSChinese ?*/ ConversionDirection_FROM_LEFT /*: ConversionDirection_FROM_RIGHT*/, - nConversionOptions); + nConversionOptions); } catch ( NoSupportException & ) { - // clear reference (when there is no user dictionary) in order - // to not always have to catch this exception again + // clear reference (when there is no user dictionary) in order + // to not always have to catch this exception again // in further calls. (save time) xCDL = 0; } catch (...) { - // catch all other exceptions to allow + // catch all other exceptions to allow // querying the system dictionary in the next line } if (conversions.getLength() > 0) { @@ -157,7 +157,7 @@ TextConversion_zh::getWordConversion(const OUString& aText, sal_Int32 nStartPos, if (word.getLength() != conversions[0].getLength()) one2one=sal_False; while (current < conversions[0].getLength()) { - offset[count] = nStartPos + currPos + (current * + offset[count] = nStartPos + currPos + (current * word.getLength() / conversions[0].getLength()); newStr->buffer[count++] = conversions[0][current++]; } @@ -241,7 +241,7 @@ TextConversion_zh::getConversion( const OUString& aText, sal_Int32 nStartPos, sa const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions) throw( RuntimeException, IllegalArgumentException, NoSupportException ) { - if (rLocale.Language.equalsAscii("zh") && + if (rLocale.Language.equalsAscii("zh") && ( nConversionType == TextConversionType::TO_SCHINESE || nConversionType == TextConversionType::TO_TCHINESE) ) { @@ -250,13 +250,13 @@ TextConversion_zh::getConversion( const OUString& aText, sal_Int32 nStartPos, sa if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER) // char to char dictionary - return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions); + return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions); else { Sequence <sal_Int32> offset; // word to word dictionary return getWordConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions, offset); } - } else + } else throw NoSupportException(); // Conversion type is not supported in this service. } @@ -265,7 +265,7 @@ TextConversion_zh::getConversionWithOffset( const OUString& aText, sal_Int32 nSt const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions, Sequence<sal_Int32>& offset) throw( RuntimeException, IllegalArgumentException, NoSupportException ) { - if (rLocale.Language.equalsAscii("zh") && + if (rLocale.Language.equalsAscii("zh") && ( nConversionType == TextConversionType::TO_SCHINESE || nConversionType == TextConversionType::TO_TCHINESE) ) { @@ -275,19 +275,19 @@ TextConversion_zh::getConversionWithOffset( const OUString& aText, sal_Int32 nSt if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER) { offset.realloc(0); // char to char dictionary - return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions); + return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions); } else { if (offset.getLength() < 2*nLength) offset.realloc(2*nLength); // word to word dictionary return getWordConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions, offset); } - } else + } else throw NoSupportException(); // Conversion type is not supported in this service. } -sal_Bool SAL_CALL -TextConversion_zh::interactiveConversion( const Locale& /*rLocale*/, sal_Int16 /*nTextConversionType*/, sal_Int32 /*nTextConversionOptions*/ ) +sal_Bool SAL_CALL +TextConversion_zh::interactiveConversion( const Locale& /*rLocale*/, sal_Int16 /*nTextConversionType*/, sal_Int32 /*nTextConversionOptions*/ ) throw( RuntimeException, IllegalArgumentException, NoSupportException ) { return sal_False; |