#include "LyXRC.h"
#include "support/docstream.h"
+#include "support/lassert.h"
#include <sstream>
#include <iomanip>
string const Length::asString() const
{
ostringstream os;
- os << val_ << unit_name[unit_]; // setw?
+ if (unit_ != UNIT_NONE)
+ os << val_ << unit_name[unit_]; // setw?
return os.str();
}
docstring const Length::asDocstring() const
{
odocstringstream os;
- os << val_ << unit_name[unit_]; // setw?
+ if (unit_ != UNIT_NONE)
+ os << val_ << unit_name[unit_]; // setw?
return os.str();
}
case PPH:
os << val_ / 100.0 << "\\paperheight";
break;
+ case UNIT_NONE:
+ // One should not try to ouput latex code for an empty length
+ LASSERT(false, break);
default:
os << val_ << unit_name[unit_];
break;
string const GlueLength::asString() const
{
+ if (len_.empty())
+ return string();
+
ostringstream buffer;
buffer << len_.value();