1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <rtl/tencinfo.h>
21 #include <tools/tenccvt.hxx>
23 rtl_TextEncoding
GetExtendedCompatibilityTextEncoding( rtl_TextEncoding eEncoding
)
26 if ( eEncoding
== RTL_TEXTENCODING_ISO_8859_1
)
27 return RTL_TEXTENCODING_MS_1252
;
29 else if ( eEncoding
== RTL_TEXTENCODING_ISO_8859_9
)
30 return RTL_TEXTENCODING_MS_1254
;
35 rtl_TextEncoding
GetExtendedTextEncoding( rtl_TextEncoding eEncoding
)
38 if ( eEncoding
== RTL_TEXTENCODING_ISO_8859_5
)
39 return RTL_TEXTENCODING_MS_1251
;
40 // Greek (2 Characters different: A1 (0x2018/0x0385), A2 (0x2019/0x0386) -
41 // so it is handled in this function and not in GetExtendedCompatibilityTextEncoding)
42 else if ( eEncoding
== RTL_TEXTENCODING_ISO_8859_7
)
43 return RTL_TEXTENCODING_MS_1253
;
44 // East-Europe - Latin2
45 else if ( eEncoding
== RTL_TEXTENCODING_ISO_8859_2
)
46 return RTL_TEXTENCODING_MS_1250
;
47 // Latin-15 - Latin 1 mit Euro-Sign
48 else if ( eEncoding
== RTL_TEXTENCODING_ISO_8859_15
)
49 return RTL_TEXTENCODING_MS_1252
;
51 return GetExtendedCompatibilityTextEncoding( eEncoding
);
54 rtl_TextEncoding
GetOneByteTextEncoding( rtl_TextEncoding eEncoding
)
56 rtl_TextEncodingInfo aTextEncInfo
;
57 aTextEncInfo
.StructSize
= sizeof( aTextEncInfo
);
58 if ( rtl_getTextEncodingInfo( eEncoding
, &aTextEncInfo
) )
60 if ( aTextEncInfo
.MaximumCharSize
> 1 )
61 return RTL_TEXTENCODING_MS_1252
;
66 return RTL_TEXTENCODING_MS_1252
;
69 rtl_TextEncoding
GetSOLoadTextEncoding( rtl_TextEncoding eEncoding
)
71 return GetExtendedCompatibilityTextEncoding( GetOneByteTextEncoding( eEncoding
) );
74 rtl_TextEncoding
GetSOStoreTextEncoding( rtl_TextEncoding eEncoding
)
76 return GetExtendedTextEncoding( GetOneByteTextEncoding( eEncoding
) );
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */