update dev300-m57
[ooovba.git] / lotuswordpro / source / filter / lwpcharsetmgr.cxx
blob4a796994ddbb59a5386e60518ac3f6bb84d7017e
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /*************************************************************************
56 * @file
57 * For LWP filter architecture prototype
58 ************************************************************************/
59 /*************************************************************************
60 * Change History
61 Jan 2005 Created
62 ************************************************************************/
63 #include "lwpcharsetmgr.hxx"
64 //Added by yanjun for SS migration : 2007-12-21
65 #include "rtl/textenc.h"
66 //End
67 LwpCharSetMgr* LwpCharSetMgr::Instance = NULL;
69 LwpCharSetMgr* LwpCharSetMgr::GetInstance()
71 if (Instance == NULL)
72 Instance = new LwpCharSetMgr;
73 return Instance;
76 void LwpCharSetMgr::SetCodePageMap()
77 {//sal_uInt16 wordproCode,rtl_TextEncoding encoding, tmp hardcoding, 1-18
78 /* m_CodePageMap[256] =
79 m_CodePageMap[259] =
80 m_CodePageMap[819] =
81 m_CodePageMap[921] =*/
82 m_CodePageMap[437] = RTL_TEXTENCODING_ASCII_US;
83 m_CodePageMap[850] = RTL_TEXTENCODING_IBM_850;
84 //m_CodePageMap[851] = RTL_TEXTENCODING_IBM_851;
85 m_CodePageMap[852] = RTL_TEXTENCODING_IBM_852;
86 m_CodePageMap[857] = RTL_TEXTENCODING_IBM_857;
87 m_CodePageMap[860] = RTL_TEXTENCODING_IBM_860;
88 m_CodePageMap[863] = RTL_TEXTENCODING_IBM_863;
89 m_CodePageMap[865] = RTL_TEXTENCODING_IBM_865;
90 m_CodePageMap[866] = RTL_TEXTENCODING_IBM_866;
91 m_CodePageMap[869] = RTL_TEXTENCODING_IBM_869;
92 m_CodePageMap[874] = RTL_TEXTENCODING_MS_874;//thai
93 m_CodePageMap[932] = RTL_TEXTENCODING_MS_932; //japanese
94 m_CodePageMap[936] = RTL_TEXTENCODING_MS_936; //chinese simple
95 m_CodePageMap[949] = RTL_TEXTENCODING_MS_949;//korean
96 m_CodePageMap[950] = RTL_TEXTENCODING_BIG5;//chinese traditional
97 m_CodePageMap[1250] = RTL_TEXTENCODING_MS_1250;//Central European
98 m_CodePageMap[1252] = RTL_TEXTENCODING_MS_1252;
99 m_CodePageMap[1251] = RTL_TEXTENCODING_MS_1251; //ukrainian belarusian macedonian russian
100 m_CodePageMap[1253] = RTL_TEXTENCODING_MS_1253;//greek
101 m_CodePageMap[1254] = RTL_TEXTENCODING_MS_1254;//Turkish
102 m_CodePageMap[1255] = RTL_TEXTENCODING_MS_1255;//hebrew
103 m_CodePageMap[1256] = RTL_TEXTENCODING_MS_1256;//arabic
104 m_CodePageMap[1257] = RTL_TEXTENCODING_MS_1257;//estonian
107 rtl_TextEncoding LwpCharSetMgr::GetTextCharEncoding(sal_uInt16 wordproCode)
109 std::map<sal_uInt16,rtl_TextEncoding>::iterator
110 pos = m_CodePageMap.find(wordproCode);
111 if (pos != m_CodePageMap.end())
112 return m_CodePageMap[wordproCode];
113 return GetTextCharEncoding();
116 rtl_TextEncoding LwpCharSetMgr::GetTextCharEncoding()
118 return RTL_TEXTENCODING_MS_1252;//here should be a default value,1252 or get from platform, 1-18