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