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[] = {
|
|
|
|
"sp", "pt", "bp", "dd", "mm", "pc",
|
|
|
|
"cc", "cm", "in", "ex", "em", "mu",
|
|
|
|
"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[] = {
|
|
|
|
N_("sp"), N_("pt"), N_("bp"), N_("dd"), N_("mm"), N_("pc"),
|
2009-01-12 09:23:06 +00:00
|
|
|
N_("cc[[unit of measure]]"), N_("cm"), N_("in"), N_("ex"), N_("em"),
|
|
|
|
N_("mu[[unit of measure]]"), N_("Text Width %"),
|
|
|
|
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
|