Index: source/misc/makefile.mk =================================================================== --- source/misc/makefile.mk (revision 270629) +++ source/misc/makefile.mk (working copy) @@ -85,7 +85,8 @@ $(SLO)$/lockfilecommon.obj \ $(SLO)$/sharecontrolfile.obj \ $(SLO)$/documentlockfile.obj \ - $(SLO)$/langtab.obj + $(SLO)$/langtab.obj \ + $(SLO)$/winenchelper.obj # --- Targets ------------------------------------------------------- Index: source/filter.vcl/wmf/wmfwr.cxx =================================================================== --- source/filter.vcl/wmf/wmfwr.cxx (revision 270629) +++ source/filter.vcl/wmf/wmfwr.cxx (working copy) @@ -36,13 +36,10 @@ #include #include #include +#include #include #include -#ifndef INCLUDED_I18NUTIL_UNICODE_HXX -#include //unicode::getUnicodeScriptType -#endif - #include //====================== MS-Windows-defines =============================== @@ -248,34 +245,8 @@ #define PRIVATE_ESCAPE_UNICODE 2 -/// copied from writerwordglue.cxx +using winenchelper::getBestLegacyWindowsTextEncodingByScriptType; -/* - Utility to categorize unicode characters into the best fit windows charset - range for exporting to ww6, or as a hint to non \u unicode token aware rtf - readers -*/ -rtl_TextEncoding getScriptClass(sal_Unicode cChar) -{ - using namespace com::sun::star::i18n; - - static ScriptTypeList aScripts[] = - { - { UnicodeScript_kBasicLatin, UnicodeScript_kBasicLatin, RTL_TEXTENCODING_MS_1252}, - { UnicodeScript_kLatin1Supplement, UnicodeScript_kLatin1Supplement, RTL_TEXTENCODING_MS_1252}, - { UnicodeScript_kLatinExtendedA, UnicodeScript_kLatinExtendedA, RTL_TEXTENCODING_MS_1250}, - { UnicodeScript_kLatinExtendedB, UnicodeScript_kLatinExtendedB, RTL_TEXTENCODING_MS_1257}, - { UnicodeScript_kGreek, UnicodeScript_kGreek, RTL_TEXTENCODING_MS_1253}, - { UnicodeScript_kCyrillic, UnicodeScript_kCyrillic, RTL_TEXTENCODING_MS_1251}, - { UnicodeScript_kHebrew, UnicodeScript_kHebrew, RTL_TEXTENCODING_MS_1255}, - { UnicodeScript_kArabic, UnicodeScript_kArabic, RTL_TEXTENCODING_MS_1256}, - { UnicodeScript_kThai, UnicodeScript_kThai, RTL_TEXTENCODING_MS_1258}, - { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, RTL_TEXTENCODING_MS_1252} - }; - return unicode::getUnicodeScriptType(cChar, aScripts, - RTL_TEXTENCODING_MS_1252); -} - //========================== Methoden von WMFWriter ========================== void WMFWriter::MayCallback() @@ -609,13 +580,13 @@ { // try again, with determining a better charset from unicode char pBuf = rUniStr.GetBuffer(); const sal_Unicode* pCheckChar = pBuf; - rtl_TextEncoding aTextEncoding = getScriptClass (*pCheckChar); // try the first character + rtl_TextEncoding aTextEncoding = getBestLegacyWindowsTextEncodingByScriptType(*pCheckChar); // try the first character for ( i = 1; i < nStringLen; i++) { if (aTextEncoding != aTextEncodingOrg) // found something break; pCheckChar++; - aTextEncoding = getScriptClass (*pCheckChar); // try the next character + aTextEncoding = getBestLegacyWindowsTextEncodingByScriptType(*pCheckChar); // try the next character } aByteStr = ByteString ( rUniStr, aTextEncoding ); --- /dev/null 2009-04-07 16:05:24.272007079 +0100 +++ inc/svtools/winenchelper.hxx 2009-04-10 10:53:28.000000000 +0100 @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: eventcfg.hxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _WINENCHELPER_HXX +#define _WINENCHELPER_HXX + +namespace winenchelper +{ + rtl_TextEncoding SAL_CALL getBestLegacyWindowsTextEncodingByScriptType(sal_Unicode cChar); +}; + +#endif // _WINENCHELPER_HXX --- /dev/null 2009-04-07 16:05:24.272007079 +0100 +++ source/misc/winenchelper.cxx 2009-04-13 23:03:42.000000000 +0100 @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: winenchelper.cxx,v $ + * $Revision: 1.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include + +namespace winenchelper +{ + + rtl_TextEncoding SAL_CALL getBestLegacyWindowsTextEncodingByScriptType(sal_Unicode cChar) + { + using namespace com::sun::star::i18n; + + static ScriptTypeList aScripts[] = + { + {UnicodeScript_kBasicLatin, UnicodeScript_kBasicLatin, RTL_TEXTENCODING_MS_1252}, + {UnicodeScript_kLatin1Supplement, UnicodeScript_kLatin1Supplement, RTL_TEXTENCODING_MS_1252}, + {UnicodeScript_kLatinExtendedA, UnicodeScript_kLatinExtendedA, RTL_TEXTENCODING_MS_1250}, + {UnicodeScript_kLatinExtendedB, UnicodeScript_kLatinExtendedB, RTL_TEXTENCODING_MS_1257}, + {UnicodeScript_kGreek, UnicodeScript_kGreek, RTL_TEXTENCODING_MS_1253}, + {UnicodeScript_kCyrillic, UnicodeScript_kCyrillic, RTL_TEXTENCODING_MS_1251}, + {UnicodeScript_kHebrew, UnicodeScript_kHebrew, RTL_TEXTENCODING_MS_1255}, + {UnicodeScript_kArabic, UnicodeScript_kArabic, RTL_TEXTENCODING_MS_1256}, + {UnicodeScript_kThai, UnicodeScript_kThai, RTL_TEXTENCODING_MS_1258}, + {UnicodeScript_kHangulJamo, UnicodeScript_kHangulJamo, RTL_TEXTENCODING_MS_949}, + {UnicodeScript_kHangulCompatibilityJamo, UnicodeScript_kHangulCompatibilityJamo, RTL_TEXTENCODING_MS_949}, + {UnicodeScript_kHangulSyllable, UnicodeScript_kHangulSyllable, RTL_TEXTENCODING_MS_949}, + {UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, RTL_TEXTENCODING_MS_1252} + }; + + return unicode::getUnicodeScriptType(cChar, aScripts, RTL_TEXTENCODING_MS_1252); + } +}