libwps_tools_win.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
00002 /* libwps
00003  * Version: MPL 2.0 / LGPLv2.1+
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * Major Contributor(s):
00010  * Copyright (C) 2009, 2011 Alonso Laurent (alonso@loria.fr)
00011  * Copyright (C) 2006, 2007 Andrew Ziem
00012  * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
00013  * Copyright (C) 2004 Marc Maurer (uwog@uwog.net)
00014  * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
00015  *
00016  * For minor contributions see the git repository.
00017  *
00018  * Alternatively, the contents of this file may be used under the terms
00019  * of the GNU Lesser General Public License Version 2.1 or later
00020  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
00021  * applicable instead of those above.
00022  *
00023  * For further information visit http://libwps.sourceforge.net
00024  */
00025 
00026 /* This header contains code specific to windows file :
00027  *     - a class used to convert DOS/Win3 font characters in unicode
00028  *     - a class used to defined the text Language
00029  */
00030 
00031 #ifndef WPS_WIN
00032 #  define WPS_WIN
00033 
00034 #  include <string>
00035 
00036 #  include "libwps_internal.h"
00037 
00039 namespace libwps_tools_win
00040 {
00042 class Font
00043 {
00044 public:
00046         enum Type { CP_037, CP_424, CP_437, CP_500, CP_737, CP_775,
00047                     DOS_850, CP_852, CP_855, CP_856, CP_857, CP_860,
00048                     CP_861, CP_862, CP_863, CP_864, CP_865, CP_866,
00049                     CP_869, CP_874, CP_875, CP_932, CP_950, CP_1006,
00050                     CP_1026, WIN3_ARABIC, WIN3_BALTIC, WIN3_CEUROPE,
00051                     WIN3_CYRILLIC, WIN3_GREEK, WIN3_HEBREW, WIN3_TURKISH,
00052                     WIN3_VIETNAMESE, WIN3_WEUROPE,
00053 
00054                     MAC_ARABIC, MAC_CELTIC, MAC_CEUROPE, MAC_CROATIAN,
00055                     MAC_CYRILLIC, MAC_DEVANAGA, MAC_FARSI, MAC_GAELIC,
00056                     MAC_GREEK, MAC_GUJARATI, MAC_GURMUKHI, MAC_HEBREW,
00057                     MAC_ICELAND, MAC_INUIT, MAC_ROMAN, MAC_ROMANIAN,
00058                     MAC_THAI, MAC_TURKISH,
00059 
00060                     MAC_SYMBOL, WIN3_WINGDINGS,
00061                     UNKNOWN
00062                   };
00063         // CP_10006, CP_10007, CP_10029, CP_10079, CP_10081
00065         static unsigned long unicode(unsigned char c, Type type);
00067         static unsigned long LICSunicode(unsigned char c, Type type);
00069         static Type getTypeForOEM(int oem);
00071         static Type getTypeForString(char const *encoding);
00077         static Type getFontType(librevenge::RVNGString &name);
00079         static librevenge::RVNGString getTypeName(Type type);
00080         static librevenge::RVNGString unicodeString(const unsigned char *p, unsigned size, Type type);
00081 protected:
00082 };
00083 
00084 // see http://msdn.microsoft.com/en-us/library/bb213877.aspx (Community Content)
00086 namespace Language
00087 {
00089 std::string name(long id);
00091 std::string localeName(long id);
00093 void addLocaleName(long id, librevenge::RVNGPropertyList &propList);
00095 long getDefault();
00096 }
00097 
00098 }
00099 
00100 
00101 #endif
00102 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: