diff -uNr old/cppcanvas/source/mtfrenderer/implrenderer.cxx new/cppcanvas/source/mtfrenderer/implrenderer.cxx --- old/cppcanvas/source/mtfrenderer/implrenderer.cxx 2007-06-21 11:51:54.000000000 +0800 +++ new/cppcanvas/source/mtfrenderer/implrenderer.cxx 2007-06-21 11:59:48.000000000 +0800 @@ -1252,6 +1252,112 @@ } } + 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; + } + bool ImplRenderer::createActions( const CanvasSharedPtr& rCanvas, VirtualDevice& rVDev, GDIMetaFile& rMtf, @@ -2408,6 +2514,27 @@ case META_TEXTARRAY_ACTION: { MetaTextArrayAction* pAct = static_cast(pCurrAct); + LanguageType meTextLanguage; + meTextLanguage = rVDev.GetDigitLanguage(); + if( meTextLanguage) + { + XubString &rStr = const_cast ( pAct->GetText() ); + const sal_Unicode* pBase = rStr.GetBuffer(); + const sal_Unicode* pStr = pBase + 0; + xub_StrLen nEndIndex = rStr.Len(); + const sal_Unicode* pEnd = pBase + nEndIndex; + for( ; pStr < pEnd; ++pStr ) + { + // TODO: are there non-digit localizations? + if( (*pStr >= '0') && (*pStr <= '9') ) + { + // translate characters to local preference + sal_Unicode cChar = GetLocalizedChar( *pStr, meTextLanguage ); + if( cChar != *pStr ) + rStr.SetChar( sal::static_int_cast(pStr - pBase), cChar ); + } + } + } createTextAction( pAct->GetPoint(), diff -uNr old/svx/source/unodraw/UnoGraphicExporter.cxx new/svx/source/unodraw/UnoGraphicExporter.cxx --- old/svx/source/unodraw/UnoGraphicExporter.cxx 2007-06-21 14:19:22.000000000 +0800 +++ new/svx/source/unodraw/UnoGraphicExporter.cxx 2007-06-21 14:21:22.000000000 +0800 @@ -37,7 +37,7 @@ #include "precompiled_svx.hxx" - +#include #include @@ -693,6 +693,18 @@ // 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 ) ) {