LibreOffice Module tools (master) 1
tenccvt.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <rtl/tencinfo.h>
21#include <tools/tenccvt.hxx>
22
23rtl_TextEncoding GetExtendedCompatibilityTextEncoding( rtl_TextEncoding eEncoding )
24{
25 // Latin1
26 if ( eEncoding == RTL_TEXTENCODING_ISO_8859_1 )
27 return RTL_TEXTENCODING_MS_1252;
28 // Turkey
29 else if ( eEncoding == RTL_TEXTENCODING_ISO_8859_9 )
30 return RTL_TEXTENCODING_MS_1254;
31 else
32 return eEncoding;
33}
34
35rtl_TextEncoding GetExtendedTextEncoding( rtl_TextEncoding eEncoding )
36{
37 // Cyr
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 with euro sign
48 else if ( eEncoding == RTL_TEXTENCODING_ISO_8859_15 )
49 return RTL_TEXTENCODING_MS_1252;
50 else
51 return GetExtendedCompatibilityTextEncoding( eEncoding );
52}
53
54rtl_TextEncoding GetOneByteTextEncoding( rtl_TextEncoding eEncoding )
55{
56 rtl_TextEncodingInfo aTextEncInfo;
57 aTextEncInfo.StructSize = sizeof( aTextEncInfo );
58 if ( rtl_getTextEncodingInfo( eEncoding, &aTextEncInfo ) )
59 {
60 if ( aTextEncInfo.MaximumCharSize > 1 )
61 return RTL_TEXTENCODING_MS_1252;
62 else
63 return eEncoding;
64 }
65 else
66 return RTL_TEXTENCODING_MS_1252;
67}
68
69rtl_TextEncoding GetSOLoadTextEncoding( rtl_TextEncoding eEncoding )
70{
72}
73
74rtl_TextEncoding GetSOStoreTextEncoding( rtl_TextEncoding eEncoding )
75{
77}
78
79/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
rtl_TextEncoding GetExtendedCompatibilityTextEncoding(rtl_TextEncoding eEncoding)
return an encoding which has more defined Characters as the given encoding, but have the same definit...
Definition: tenccvt.cxx:23
rtl_TextEncoding GetSOLoadTextEncoding(rtl_TextEncoding eEncoding)
Definition: tenccvt.cxx:69
rtl_TextEncoding GetSOStoreTextEncoding(rtl_TextEncoding eEncoding)
Definition: tenccvt.cxx:74
rtl_TextEncoding GetOneByteTextEncoding(rtl_TextEncoding eEncoding)
if the given encoding is an multi-byte encoding (which allows more than one byte per char,...
Definition: tenccvt.cxx:54
rtl_TextEncoding GetExtendedTextEncoding(rtl_TextEncoding eEncoding)
return an encoding which has more defined Characters as the given encoding.
Definition: tenccvt.cxx:35