X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxlength.C;h=fded92c19bcfe53b595f0d24e86a7cc713607f6f;hb=d2574b7d8e2716d3d3aea92df6576bd01c421a6c;hp=f08d9191a4cc494c57e9f4c5364f83fe6daa39d3;hpb=00edcc582ff7cfe9cbbc8f7458ea29649bd642d9;p=lyx.git diff --git a/src/lyxlength.C b/src/lyxlength.C index f08d9191a4..fded92c19b 100644 --- a/src/lyxlength.C +++ b/src/lyxlength.C @@ -19,10 +19,14 @@ #include "lengthcommon.h" #include "lyxrc.h" +#include "support/docstream.h" #include #include +namespace lyx { + + using std::ostringstream; using std::string; @@ -58,6 +62,14 @@ string const LyXLength::asString() const } +docstring const LyXLength::asDocstring() const +{ + odocstringstream os; + os << val_ << unit_name[unit_]; // setw? + return os.str(); +} + + string const LyXLength::asLatexString() const { ostringstream os; @@ -136,7 +148,7 @@ int LyXLength::inPixels(int text_width, int em_width_base) const ? em_width_base : 10*(dpi/72.27)*zoom; // A different estimate for em_width is - // theApp->fontLoader().metrics(LyXFont(LyXFont::ALL_SANE)).width('M') + // theFontMetrics(LyXFont(LyXFont::ALL_SANE)).width('M') // but this estimate might not be more accurate as the screen font // is different then the latex font. @@ -264,3 +276,6 @@ bool operator!=(LyXLength const & l1, LyXLength const & l2) { return !(l1 == l2); } + + +} // namespace lyx