]> git.lyx.org Git - lyx.git/blob - src/lengthcommon.C
fix arabtex-related problems (bug 1225 and bug 1404)
[lyx.git] / src / lengthcommon.C
1 /**
2  * \file lengthcommon.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author Matthias Ettrich
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "lengthcommon.h"
16
17 #include "gettext.h"
18
19 using std::string;
20
21 // I am not sure if "mu" should be possible to select (Lgb)
22
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%", "" };
31
32 int const num_units = int(sizeof(unit_name) / sizeof(unit_name[0]));
33
34 // the latex units
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%", "" };
44
45 // the LyX gui units
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%"), "" };
51
52         // this one maybe better ???? but there can be problems with
53         // xforms (Herbert)
54 //      N_("textwidth%"), N_("columnwidth%"), N_("pagewidth%"), N_("linewidth%"),
55 //      N_("textheight%"), N_("pageheight%") };
56
57         // or altenative this ones
58 //      N_("twidth%"), N_("cwidth%"), N_("pwidth%"), N_("lwidth%"),
59 //      N_("theight%"), N_("pheight%") };
60
61 LyXLength::UNIT unitFromString(string const & data)
62 {
63         int i = 0;
64         while (i < num_units && data != unit_name[i])
65                 ++i;
66         return static_cast<LyXLength::UNIT>(i);
67 }