Commit 325c2300 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

исправление багов конвертации doc & rtf под linux

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62427 954022d7-b5bf-4e40-9824-e11837661b57
parent cfefcad4
......@@ -63,7 +63,7 @@ bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const CString& sSrcFileName,
return true;
}
}
return false;
return false;
}
bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions)
{
......
......@@ -773,9 +773,9 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
RENDER_OOX_INT( m_nUp, sResult, _T("w:position") )
if (m_nLanguage != PROP_DEF)
if (m_nLanguage != PROP_DEF) //todooo сделаь map для используемых в доке
{
CString str_lang;
std::wstring str_lang;
#if defined(_WIN32) || defined(_WIN64)
wchar_t buf[29] = {};
......@@ -783,22 +783,32 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
if (ccBuf > 0)
{
str_lang.Append(buf);
str_lang.Append(_T("-"));
str_lang.append(buf);
str_lang.append(_T("-"));
}
ccBuf = GetLocaleInfo(m_nLanguage, LOCALE_SISO3166CTRYNAME, buf, 29);
if (ccBuf > 0) str_lang.Append(buf);
if (ccBuf > 0) str_lang.append(buf);
#else
for (int i = 0; i < 136; i++)
{
if (LCID_ms_convert[i].LCID_int == m_nLanguage)
{
str_lang = LCID_ms_convert[i].LCID_string;
break;
}
}
#endif
RENDER_OOX_STRING(str_lang, sResult, _T("w:lang") )
}
if (str_lang.length() > 0)
sResult += CString(_T("<w:lang=\"")) + str_lang.c_str() + _T("\">");
}
sResult.Append( m_poBorder.RenderToOOX( oRenderParameter ));
sResult.Append( m_poShading.RenderToOOX( oRenderParameter ));
return sResult;
}
#include <langinfo.h>
CString RtfListLevelProperty::RenderToRtf(RenderParameter oRenderParameter)
{
RtfDocument* poRtfDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument);
......
......@@ -46,10 +46,6 @@
if( PROP_DEF != prop )\
sResult.AppendFormat( _T(" %ls=\"%d\""), sName, prop );
#define RENDER_OOX_STRING( prop, sResult, sName)\
if( false == prop.IsEmpty() )\
sResult.AppendFormat( _T("<%ls w:val=\"%ls\"/>"), sName, prop );
#define RENDER_RTF_BOOL( prop, sResult, sName)\
if( 0 == prop )\
......
......@@ -185,6 +185,150 @@ static const int aCodePages[][2] = {
255, 850//OEM
};
static const struct
{
std::wstring LCID_string;
int LCID_int;
} LCID_ms_convert[] =
{
{ L"af-ZA" , 0x0436 },
{ L"sq-AL" , 0x041C },
{ L"ar-DZ" , 0x1401 },
{ L"ar-BH" , 0x3C01 },
{ L"ar-EG" , 0x0C01 },
{ L"ar-IQ" , 0x0801 },
{ L"ar-JO" , 0x2C01 },
{ L"ar-KW" , 0x3401 },
{ L"ar-LB" , 0x3001 },
{ L"ar-LY" , 0x1001 },
{ L"ar-MA" , 0x1801 },
{ L"ar-OM" , 0x2001 },
{ L"ar-QA" , 0x4001 },
{ L"ar-SA" , 0x0401 },
{ L"ar-SY" , 0x2801 },
{ L"ar-TN" , 0x1C01 },
{ L"ar-AE" , 0x3801 },
{ L"ar-YE" , 0x2401 },
{ L"hy-AM" , 0x042B },
{ L"Cy-az-AZ" , 0x082C },
{ L"Lt-az-AZ" , 0x042C },
{ L"eu-ES" , 0x042D },
{ L"be-BY" , 0x0423 },
{ L"bg-BG" , 0x0402 },
{ L"ca-ES" , 0x0403 },
{ L"zh-CN" , 0x0804 },
{ L"zh-HK" , 0x0C04 },
{ L"zh-MO" , 0x1404 },
{ L"zh-SG" , 0x1004 },
{ L"zh-TW" , 0x0404 },
{ L"zh-CHS" , 0x0004 },
{ L"zh-CHT" , 0x7C04 },
{ L"hr-HR" , 0x041A },
{ L"cs-CZ" , 0x0405 },
{ L"da-DK" , 0x0406 },
{ L"div-MV" , 0x0465 },
{ L"nl-BE" , 0x0813 },
{ L"nl-NL" , 0x0413 },
{ L"en-AU" , 0x0C09 },
{ L"en-BZ" , 0x2809 },
{ L"en-CA" , 0x1009 },
{ L"en-CB" , 0x2409 },
{ L"en-IE" , 0x1809 },
{ L"en-JM" , 0x2009 },
{ L"en-NZ" , 0x1409 },
{ L"en-PH" , 0x3409 },
{ L"en-ZA" , 0x1C09 },
{ L"en-TT" , 0x2C09 },
{ L"en-GB" , 0x0809 },
{ L"en-US" , 0x0409 },
{ L"en-ZW" , 0x3009 },
{ L"et-EE" , 0x0425 },
{ L"fo-FO" , 0x0438 },
{ L"fa-IR" , 0x0429 },
{ L"fi-FI" , 0x040B },
{ L"fr-BE" , 0x080C },
{ L"fr-CA" , 0x0C0C },
{ L"fr-FR" , 0x040C },
{ L"fr-LU" , 0x140C },
{ L"fr-MC" , 0x180C },
{ L"fr-CH" , 0x100C },
{ L"gl-ES" , 0x0456 },
{ L"ka-GE" , 0x0437 },
{ L"de-AT" , 0x0C07 },
{ L"de-DE" , 0x0407 },
{ L"de-LI" , 0x1407 },
{ L"de-LU" , 0x1007 },
{ L"de-CH" , 0x0807 },
{ L"el-GR" , 0x0408 },
{ L"gu-IN" , 0x0447 },
{ L"he-IL" , 0x040D },
{ L"hi-IN" , 0x0439 },
{ L"hu-HU" , 0x040E },
{ L"is-IS" , 0x040F },
{ L"id-ID" , 0x0421 },
{ L"it-IT" , 0x0410 },
{ L"it-CH" , 0x0810 },
{ L"ja-JP" , 0x0411 },
{ L"kn-IN" , 0x044B },
{ L"kk-KZ" , 0x043F },
{ L"kok-IN" , 0x0457 },
{ L"ko-KR" , 0x0412 },
{ L"ky-KZ" , 0x0440 },
{ L"lv-LV" , 0x0426 },
{ L"lt-LT" , 0x0427 },
{ L"mk-MK" , 0x042F },
{ L"ms-BN" , 0x083E },
{ L"ms-MY" , 0x043E },
{ L"mr-IN" , 0x044E },
{ L"mn-MN" , 0x0450 },
{ L"nb-NO" , 0x0414 },
{ L"nn-NO" , 0x0814 },
{ L"pl-PL" , 0x0415 },
{ L"pt-BR" , 0x0416 },
{ L"pt-PT" , 0x0816 },
{ L"pa-IN" , 0x0446 },
{ L"ro-RO" , 0x0418 },
{ L"ru-RU" , 0x0419 },
{ L"sa-IN" , 0x044F },
{ L"Cy-sr-SP" , 0x0C1A },
{ L"Lt-sr-SP" , 0x081A },
{ L"sk-SK" , 0x041B },
{ L"sl-SI" , 0x0424 },
{ L"es-AR" , 0x2C0A },
{ L"es-BO" , 0x400A },
{ L"es-CL" , 0x340A },
{ L"es-CO" , 0x240A },
{ L"es-CR" , 0x140A },
{ L"es-DO" , 0x1C0A },
{ L"es-EC" , 0x300A },
{ L"es-SV" , 0x440A },
{ L"es-GT" , 0x100A },
{ L"es-HN" , 0x480A },
{ L"es-MX" , 0x080A },
{ L"es-NI" , 0x4C0A },
{ L"es-PA" , 0x180A },
{ L"es-PY" , 0x3C0A },
{ L"es-PE" , 0x280A },
{ L"es-PR" , 0x500A },
{ L"es-ES" , 0x0C0A },
{ L"es-UY" , 0x380A },
{ L"es-VE" , 0x200A },
{ L"sw-KE" , 0x0441 },
{ L"sv-FI" , 0x081D },
{ L"sv-SE" , 0x041D },
{ L"syr-SY" , 0x045A },
{ L"ta-IN" , 0x0449 },
{ L"tt-RU" , 0x0444 },
{ L"te-IN" , 0x044A },
{ L"th-TH" , 0x041E },
{ L"tr-TR" , 0x041F },
{ L"uk-UA" , 0x0422 },
{ L"ur-PK" , 0x0420 },
{ L"Cy-uz-UZ" , 0x0843 },
{ L"Lt-uz-UZ" , 0x0443 },
{ L"vi-VN" , 0x042A }
};
class RtfUtility
{
public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment