Main Page
Namespaces
Classes
Files
File List
File Members
libwps_tools_win.h
Go to the documentation of this file.
1
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
/* libwps
3
* Version: MPL 2.0 / LGPLv2.1+
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
* Major Contributor(s):
10
* Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
11
* Copyright (C) 2006, 2007 Andrew Ziem
12
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
13
* Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
14
* Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
15
*
16
* For minor contributions see the git repository.
17
*
18
* Alternatively, the contents of this file may be used under the terms
19
* of the GNU Lesser General Public License Version 2.1 or later
20
* (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
21
* applicable instead of those above.
22
*
23
* For further information visit http://libwps.sourceforge.net
24
*/
25
26
/* This header contains code specific to windows file :
27
* - a class used to convert DOS/Win3 font characters in unicode
28
* - a class used to defined the text Language
29
*/
30
31
#ifndef WPS_WIN
32
# define WPS_WIN
33
34
# include <assert.h>
35
# include <string>
36
37
# include "
libwps_internal.h
"
38
40
namespace
libwps_tools_win
41
{
43
class
Font
44
{
45
public
:
47
enum
Type
{
DOS_850
,
48
WIN3_ARABIC
,
WIN3_BALTIC
,
WIN3_CEUROPE
,
WIN3_CYRILLIC
,
49
WIN3_GREEK
,
WIN3_HEBREW
,
WIN3_TURKISH
,
50
WIN3_VIETNAMESE
,
WIN3_WEUROPE
51
};
52
54
static
unsigned
long
unicode
(
unsigned
char
c,
Type
type)
55
{
56
switch
(type)
57
{
58
case
DOS_850
:
59
return
unicodeFromCP850
(c);
60
case
WIN3_ARABIC
:
61
return
unicodeFromCP1256
(c);
62
case
WIN3_BALTIC
:
63
return
unicodeFromCP1257
(c);
64
case
WIN3_CEUROPE
:
65
return
unicodeFromCP1250
(c);
66
case
WIN3_CYRILLIC
:
67
return
unicodeFromCP1251
(c);
68
case
WIN3_GREEK
:
69
return
unicodeFromCP1253
(c);
70
case
WIN3_HEBREW
:
71
return
unicodeFromCP1255
(c);
72
case
WIN3_TURKISH
:
73
return
unicodeFromCP1254
(c);
74
case
WIN3_VIETNAMESE
:
75
return
unicodeFromCP1258
(c);
76
case
WIN3_WEUROPE
:
77
return
unicodeFromCP1252
(c);
78
default
:
79
assert(0);
80
return
c;
81
}
82
}
83
89
static
Type
getWin3Type
(std::string &
name
);
90
91
protected
:
92
//
93
// DOS FONTS
94
//
95
97
static
unsigned
long
unicodeFromCP850
(
unsigned
char
c);
98
100
static
unsigned
long
unicodeFromCP1250
(
unsigned
char
c);
102
static
unsigned
long
unicodeFromCP1251
(
unsigned
char
c);
104
static
unsigned
long
unicodeFromCP1252
(
unsigned
char
c);
106
static
unsigned
long
unicodeFromCP1253
(
unsigned
char
c);
108
static
unsigned
long
unicodeFromCP1254
(
unsigned
char
c);
110
static
unsigned
long
unicodeFromCP1255
(
unsigned
char
c);
112
static
unsigned
long
unicodeFromCP1256
(
unsigned
char
c);
114
static
unsigned
long
unicodeFromCP1257
(
unsigned
char
c);
116
static
unsigned
long
unicodeFromCP1258
(
unsigned
char
c);
117
};
118
119
// see http://msdn.microsoft.com/en-us/library/bb213877.aspx (Community Content)
121
namespace
Language
122
{
124
std::string
name
(
long
id
);
126
std::string
localeName
(
long
id
);
128
long
getDefault
();
129
}
130
131
}
132
133
134
#endif
135
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
Generated on Tue Sep 10 2013 10:32:58 for libwps by
doxygen
1.8.3.1