3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Matthias Ettrich
10 * Full author contact details are available in file CREDITS.
15 #include "lengthcommon.h"
22 int const num_units = LyXLength::UNIT_NONE;
24 // I am not sure if "mu" should be possible to select (Lgb)
26 // unit_name is for compatibility. Can be deleted when all works well.
27 // means, when we have full language support for the lengths
28 // in all gui's (Herbert 2002-11-01)
29 char const * unit_name[num_units + 1] = {
30 "sp", "pt", "bp", "dd", "mm", "pc",
31 "cc", "cm", "in", "ex", "em", "mu",
32 "text%", "col%", "page%", "line%",
33 "theight%", "pheight%", "" };
36 char const * unit_name_ltx[num_units + 1] = {
37 "sp", "pt", "bp", "dd", "mm", "pc",
38 "cc", "cm", "in", "ex", "em", "mu",
39 // in 1.4 the following names should be used. then no
40 // translation into the latex ones are needed
41 // "textheight", "columnwidth", "pagewidth", "linewidth",
42 // "textheight", "pageheight" };
43 "text%", "col%", "page%", "line%",
44 "theight%", "pheight%", "" };
47 char const * unit_name_gui[num_units + 1] = {
48 N_("sp"), N_("pt"), N_("bp"), N_("dd"), N_("mm"), N_("pc"),
49 N_("cc"), N_("cm"), N_("in"), N_("ex"), N_("em"), N_("mu"),
50 N_("text%"), N_("col%"), N_("page%"), N_("line%"),
51 N_("theight%"), N_("pheight%"), "" };
53 // this one maybe better ???? but there can be problems with
55 // N_("textwidth%"), N_("columnwidth%"), N_("pagewidth%"), N_("linewidth%"),
56 // N_("textheight%"), N_("pageheight%") };
58 // or altenative this ones
59 // N_("twidth%"), N_("cwidth%"), N_("pwidth%"), N_("lwidth%"),
60 // N_("theight%"), N_("pheight%") };
62 LyXLength::UNIT unitFromString(string const & data)
65 while (i < num_units && data != unit_name[i])
67 return static_cast<LyXLength::UNIT>(i);