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:
libwps_tools_win::Font::unicodeFromCP1257
static unsigned long unicodeFromCP1257(unsigned char c)
Windows3© baltic to unicode.
Definition:
libwps_tools_win.cpp:344
libwps_tools_win::Language::getDefault
long getDefault()
returns the default language: 0x409 : english(US)
Definition:
libwps_tools_win.cpp:404
libwps_tools_win::Font::WIN3_BALTIC
Definition:
libwps_tools_win.h:48
libwps_tools_win::Font::WIN3_VIETNAMESE
Definition:
libwps_tools_win.h:50
libwps_tools_win::Font::WIN3_TURKISH
Definition:
libwps_tools_win.h:49
libwps_tools_win::Font::WIN3_ARABIC
Definition:
libwps_tools_win.h:48
libwps_tools_win::Font::WIN3_CYRILLIC
Definition:
libwps_tools_win.h:48
libwps_tools_win::Font::Type
Type
enum Type
Definition:
libwps_tools_win.h:47
libwps_tools_win::Font::unicode
static unsigned long unicode(unsigned char c, Type type)
converts a character in unicode, knowing the character and the font type
Definition:
libwps_tools_win.h:54
libwps_tools_win::Font::WIN3_GREEK
Definition:
libwps_tools_win.h:49
libwps_internal.h
libwps_tools_win::Font::WIN3_HEBREW
Definition:
libwps_tools_win.h:49
libwps_tools_win::Font::unicodeFromCP1252
static unsigned long unicodeFromCP1252(unsigned char c)
Windows3© western europe (the default) to unicode.
Definition:
libwps_tools_win.cpp:207
libwps_tools_win::Language::name
std::string name(long id)
returns the name given Windows© id
Definition:
libwps_tools_win.cpp:409
libwps_tools_win::Font::unicodeFromCP1255
static unsigned long unicodeFromCP1255(unsigned char c)
Windows3© hebrew to unicode.
Definition:
libwps_tools_win.cpp:285
libwps_tools_win::Font::unicodeFromCP1250
static unsigned long unicodeFromCP1250(unsigned char c)
Windows3© central europe to unicode.
Definition:
libwps_tools_win.cpp:148
libwps_tools_win::Font
a class to convert a DOS© or Windows3© character in unicode
Definition:
libwps_tools_win.h:43
libwps_tools_win::Font::unicodeFromCP1253
static unsigned long unicodeFromCP1253(unsigned char c)
Windows3© greek to unicode.
Definition:
libwps_tools_win.cpp:226
libwps_tools_win::Font::unicodeFromCP1254
static unsigned long unicodeFromCP1254(unsigned char c)
Windows3© turkish to unicode.
Definition:
libwps_tools_win.cpp:256
libwps_tools_win::Font::DOS_850
Definition:
libwps_tools_win.h:47
libwps_tools_win::Font::unicodeFromCP850
static unsigned long unicodeFromCP850(unsigned char c)
dos850 to unicode
Definition:
libwps_tools_win.cpp:117
libwps_tools_win::Font::unicodeFromCP1251
static unsigned long unicodeFromCP1251(unsigned char c)
Windows3© cyrillic to unicode.
Definition:
libwps_tools_win.cpp:177
libwps_tools_win::Font::WIN3_CEUROPE
Definition:
libwps_tools_win.h:48
libwps_tools_win::Font::unicodeFromCP1256
static unsigned long unicodeFromCP1256(unsigned char c)
Windows3© arabic to unicode.
Definition:
libwps_tools_win.cpp:314
libwps_tools_win::Font::getWin3Type
static Type getWin3Type(std::string &name)
returns the type of the font using the fontName
Definition:
libwps_tools_win.cpp:39
libwps_tools_win::Font::WIN3_WEUROPE
Definition:
libwps_tools_win.h:50
libwps_tools_win::Font::unicodeFromCP1258
static unsigned long unicodeFromCP1258(unsigned char c)
Windows3© vietnamese to unicode.
Definition:
libwps_tools_win.cpp:373
libwps_tools_win::Language::localeName
std::string localeName(long id)
returns the simplified locale name
Definition:
libwps_tools_win.cpp:500
Generated on Wed Jun 11 2014 02:26:00 for libwps by
doxygen
1.8.5