diff -uNr old/cppcanvas/source/mtfrenderer/implrenderer.cxx new/cppcanvas/source/mtfrenderer/implrenderer.cxx --- old/cppcanvas/source/mtfrenderer/implrenderer.cxx 2007-06-28 11:29:46.000000000 +0800 +++ new/cppcanvas/source/mtfrenderer/implrenderer.cxx 2007-06-28 10:53:11.234375000 +0800 @@ -411,6 +411,132 @@ return BitmapEx( aSolid, aMask ); } + + sal_Unicode getLocalizedChar( sal_Unicode nChar, LanguageType eLang ) + { + // currently only conversion from ASCII digits is interesting + if( (nChar < '0') || ('9' < nChar) ) + return nChar; + + sal_Unicode nOffset; + switch( eLang ) + { + default: + nOffset = 0; + break; + case LANGUAGE_ARABIC: + case LANGUAGE_ARABIC_SAUDI_ARABIA: + case LANGUAGE_ARABIC_IRAQ: + case LANGUAGE_ARABIC_EGYPT: + case LANGUAGE_ARABIC_LIBYA: + case LANGUAGE_ARABIC_ALGERIA: + case LANGUAGE_ARABIC_MOROCCO: + case LANGUAGE_ARABIC_TUNISIA: + case LANGUAGE_ARABIC_OMAN: + case LANGUAGE_ARABIC_YEMEN: + case LANGUAGE_ARABIC_SYRIA: + case LANGUAGE_ARABIC_JORDAN: + case LANGUAGE_ARABIC_LEBANON: + case LANGUAGE_ARABIC_KUWAIT: + case LANGUAGE_ARABIC_UAE: + case LANGUAGE_ARABIC_BAHRAIN: + case LANGUAGE_ARABIC_QATAR: + case LANGUAGE_URDU: + case LANGUAGE_URDU_PAKISTAN: + case LANGUAGE_URDU_INDIA: + case LANGUAGE_PUNJABI: //??? + nOffset = 0x0660 - '0'; // arabic/persian/urdu + break; + case LANGUAGE_BENGALI: + nOffset = 0x09E6 - '0'; // bengali + break; + case LANGUAGE_HINDI: + nOffset = 0x0966 - '0'; // devanagari + break; +#if 0 + // TODO case: + nOffset = 0x1369 - '0'; // ethiopic + break; +#endif + case LANGUAGE_GUJARATI: + nOffset = 0x0AE6 - '0'; // gujarati + break; +#if 0 + // TODO case: + nOffset = 0x0A66 - '0'; // gurmukhi + break; +#endif + case LANGUAGE_KANNADA: + nOffset = 0x0CE6 - '0'; // kannada + break; + case LANGUAGE_KHMER: + nOffset = 0x17E0 - '0'; // khmer + break; + case LANGUAGE_LAO: + nOffset = 0x0ED0 - '0'; // lao + break; + case LANGUAGE_MALAYALAM: + nOffset = 0x0D66 - '0'; // malayalam + break; + case LANGUAGE_MONGOLIAN: + nOffset = 0x1810 - '0'; // mongolian + break; +#if 0 + // TODO case: + nOffset = 0x1040 - '0'; // myanmar + break; +#endif + case LANGUAGE_ORIYA: + nOffset = 0x0B66 - '0'; // oriya + break; + case LANGUAGE_TAMIL: + nOffset = 0x0BE7 - '0'; // tamil + break; + case LANGUAGE_TELUGU: + nOffset = 0x0C66 - '0'; // telugu + break; + case LANGUAGE_THAI: + nOffset = 0x0E50 - '0'; // thai + break; + case LANGUAGE_TIBETAN: + nOffset = 0x0F20 - '0'; // tibetan + break; +#if 0 // TODO: use language type for these digit substitutions? + // TODO case: + nOffset = 0x2776 - '0'; // dingbat circled + break; + // TODO case: + nOffset = 0x2070 - '0'; // superscript + break; + // TODO case: + nOffset = 0x2080 - '0'; // subscript + break; +#endif + } + + nChar = sal::static_int_cast(nChar + nOffset); + return nChar; + } + + void convertToLocalizedNumerals ( XubString &rStr,LanguageType eTextLanguage ) + { + const sal_Unicode* pBase = rStr.GetBuffer(); + const sal_Unicode* pBegin = pBase + 0; + const xub_StrLen nEndIndex = rStr.Len(); + const sal_Unicode* pEnd = pBase + nEndIndex; + + for( ; pBegin < pEnd; ++pBegin ) + { + // TODO: are there non-digit localizations? + if( (*pBegin >= '0') && (*pBegin <= '9') ) + { + // translate characters to local preference + sal_Unicode cChar = getLocalizedChar( *pBegin, eTextLanguage ); + if( cChar != *pBegin ) + rStr.SetChar( sal::static_int_cast(pBegin - pBase), cChar ); + } + } + } } @@ -2389,10 +2515,18 @@ case META_TEXT_ACTION: { MetaTextAction* pAct = static_cast(pCurrAct); + XubString sText; + + if( rVDev.GetDigitLanguage()) + { + sText = XubString( pAct->GetText() ); + convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() ); + } createTextAction( pAct->GetPoint(), - pAct->GetText(), + //pAct->GetText(), + sText, pAct->GetIndex(), pAct->GetLen() == (USHORT)STRING_LEN ? pAct->GetText().Len() - pAct->GetIndex() : pAct->GetLen(), NULL, @@ -2408,10 +2542,18 @@ case META_TEXTARRAY_ACTION: { MetaTextArrayAction* pAct = static_cast(pCurrAct); + XubString sText; + + if( rVDev.GetDigitLanguage()) + { + sText = XubString( pAct->GetText() ); + convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() ); + } createTextAction( pAct->GetPoint(), - pAct->GetText(), + //pAct->GetText(), + sText, pAct->GetIndex(), pAct->GetLen() == (USHORT)STRING_LEN ? pAct->GetText().Len() - pAct->GetIndex() : pAct->GetLen(), pAct->GetDXArray(), @@ -2489,6 +2631,13 @@ case META_STRETCHTEXT_ACTION: { MetaStretchTextAction* pAct = static_cast(pCurrAct); + XubString sText; + + if( rVDev.GetDigitLanguage()) + { + sText = XubString( pAct->GetText() ); + convertToLocalizedNumerals ( sText,rVDev.GetDigitLanguage() ); + } const USHORT nLen( pAct->GetLen() == (USHORT)STRING_LEN ? pAct->GetText().Len() - pAct->GetIndex() : pAct->GetLen() ); @@ -2520,7 +2669,8 @@ createTextAction( pAct->GetPoint(), - pAct->GetText(), + //pAct->GetText(), + sText, pAct->GetIndex(), pAct->GetLen() == (USHORT)STRING_LEN ? pAct->GetText().Len() - pAct->GetIndex() : pAct->GetLen(), pDXArray.get(), diff -uNr old/svx/source/unodraw/UnoGraphicExporter.cxx new/svx/source/unodraw/UnoGraphicExporter.cxx --- old/svx/source/unodraw/UnoGraphicExporter.cxx 2007-06-27 12:59:29.812500000 +0800 +++ new/svx/source/unodraw/UnoGraphicExporter.cxx 2007-06-28 11:40:42.656250000 +0800 @@ -36,7 +36,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" - +#include #include @@ -692,6 +692,17 @@ // create a view SdrView* pView; + LanguageType eLang; + SvtCTLOptions* pCTLOptions = new SvtCTLOptions; + + if ( SvtCTLOptions::NUMERALS_HINDI == pCTLOptions->GetCTLTextNumerals() ) + eLang = LANGUAGE_ARABIC; + else if ( SvtCTLOptions::NUMERALS_ARABIC == pCTLOptions->GetCTLTextNumerals() ) + eLang = LANGUAGE_ENGLISH; + else + eLang = (LanguageType) Application::GetSettings().GetLanguage(); + + aVDev.SetDigitLanguage( eLang ); if( PTR_CAST( FmFormModel, mpDoc ) ) {