2007-11-07 16:41:48 +00:00
|
|
|
/**
|
|
|
|
* \file lengthcommon.cpp
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2007-11-07 16:41:48 +00:00
|
|
|
* \author Matthias Ettrich
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-11-29 07:04:28 +00:00
|
|
|
#include "support/gettext.h"
|
2007-11-07 16:41:48 +00:00
|
|
|
#include "Length.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2007-11-07 16:41:48 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
namespace lyx {
|
2007-11-07 16:41:48 +00:00
|
|
|
|
|
|
|
// I am not sure if "mu" should be possible to select (Lgb)
|
|
|
|
|
|
|
|
// the latex units
|
|
|
|
char const * const unit_name[] = {
|
2009-07-14 22:38:47 +00:00
|
|
|
"bp", "cc", "cm", "dd", "em", "ex", "in", "mm", "mu",
|
|
|
|
"pc", "pt", "sp",
|
2007-11-07 16:41:48 +00:00
|
|
|
"text%", "col%", "page%", "line%",
|
|
|
|
"theight%", "pheight%", "" };
|
|
|
|
|
|
|
|
int const num_units = int(sizeof(unit_name) / sizeof(unit_name[0]) - 1);
|
|
|
|
|
|
|
|
// the LyX gui units
|
|
|
|
char const * const unit_name_gui[] = {
|
2009-07-14 22:38:47 +00:00
|
|
|
N_("bp"), N_("cc[[unit of measure]]"), N_("cm"), N_("dd"), N_("em"),
|
|
|
|
N_("ex"), N_("in"), N_("mm"), N_("mu[[unit of measure]]"), N_("pc"),
|
|
|
|
N_("pt"), N_("sp"), N_("Text Width %"),
|
2009-01-12 09:23:06 +00:00
|
|
|
N_("Column Width %"), N_("Page Width %"), N_("Line Width %"),
|
2007-11-07 16:41:48 +00:00
|
|
|
N_("Text Height %"), N_("Page Height %"), "" };
|
|
|
|
|
|
|
|
Length::UNIT unitFromString(string const & data)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
while (i < num_units && data != unit_name[i])
|
|
|
|
++i;
|
|
|
|
return static_cast<Length::UNIT>(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|