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"
20 int const num_units = LyXLength::UNIT_NONE;
22 // I am not sure if "mu" should be possible to select (Lgb)
24 // unit_name is for compatibility. Can be deleted when all works well.
25 // means, when we have full language support for the lengths
26 // in all gui's (Herbert 2002-11-01)
27 char const * unit_name[num_units] = {
28 "sp", "pt", "bp", "dd", "mm", "pc",
29 "cc", "cm", "in", "ex", "em", "mu",
30 "text%", "col%", "page%", "line%",
31 "theight%", "pheight%" };
34 char const * unit_name_ltx[num_units] = {
35 "sp", "pt", "bp", "dd", "mm", "pc",
36 "cc", "cm", "in", "ex", "em", "mu",
37 // in 1.4 the following names should be used. then no
38 // translation into the latex ones are needed
39 // "textheight", "columnwidth", "pagewidth", "linewidth",
40 // "textheight", "pageheight" };
41 "text%", "col%", "page%", "line%",
42 "theight%", "pheight%" };
45 char const * unit_name_gui[num_units] = {
46 N_("sp"), N_("pt"), N_("bp"), N_("dd"), N_("mm"), N_("pc"),
47 N_("cc"), N_("cm"), N_("in"), N_("ex"), N_("em"), N_("mu"),
48 N_("text%"), N_("col%"), N_("page%"), N_("line%"),
49 N_("theight%"), N_("pheight%") };
51 // this one maybe better ???? but there can be problems with
53 // N_("textwidth%"), N_("columnwidth%"), N_("pagewidth%"), N_("linewidth%"),
54 // N_("textheight%"), N_("pageheight%") };
56 // or altenative this ones
57 // N_("twidth%"), N_("cwidth%"), N_("pwidth%"), N_("lwidth%"),
58 // N_("theight%"), N_("pheight%") };
60 LyXLength::UNIT unitFromString(string const & data)
63 while (i < num_units && data != unit_name[i])
65 return static_cast<LyXLength::UNIT>(i);