]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetspace.C
* In the process of fixing the math background color bug, this commit transfer backgr...
[lyx.git] / src / insets / insetspace.C
index 8ececce4e5ba2994f863fd233627840ff34d1b90..343133c0fe9571309ad60e92c44d43b318996bd6 100644 (file)
@@ -25,6 +25,8 @@
 #include "frontends/Painter.h"
 
 
+namespace lyx {
+
 using std::string;
 using std::max;
 using std::auto_ptr;
@@ -46,9 +48,9 @@ InsetSpace::Kind InsetSpace::kind() const
 }
 
 
-void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
+bool InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       lyx::frontend::FontMetrics const & fm =
+       frontend::FontMetrics const & fm =
                theFontMetrics(mi.base.font);
        dim.asc = fm.maxAscent();
        dim.des = fm.maxDescent();
@@ -56,11 +58,11 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
        switch (kind_) {
                case THIN:
                case NEGTHIN:
-                    dim.wid = fm.width(lyx::char_type('x')) / 3;
+                    dim.wid = fm.width(char_type('x')) / 3;
                        break;
                case PROTECTED:
                case NORMAL:
-                    dim.wid = fm.width(lyx::char_type('x'));
+                    dim.wid = fm.width(char_type('x'));
                        break;
                case QUAD:
                        dim.wid = 20;
@@ -73,7 +75,9 @@ void InsetSpace::metrics(MetricsInfo & mi, Dimension & dim) const
                        dim.wid = 10;
                        break;
        }
+       bool const changed = dim_ != dim;
        dim_ = dim;
+       return changed;
 }
 
 
@@ -162,8 +166,8 @@ void InsetSpace::read(Buffer const &, LyXLex & lex)
 }
 
 
-int InsetSpace::latex(Buffer const &, ostream & os,
-                     OutputParams const & runparams) const
+int InsetSpace::latex(Buffer const &, odocstream & os,
+                      OutputParams const & runparams) const
 {
        switch (kind_) {
        case NORMAL:
@@ -195,27 +199,16 @@ int InsetSpace::latex(Buffer const &, ostream & os,
 }
 
 
-int InsetSpace::plaintext(Buffer const &, ostream & os,
-                     OutputParams const &) const
+int InsetSpace::plaintext(Buffer const &, odocstream & os,
+                          OutputParams const &) const
 {
-       switch (kind_) {
-       case NORMAL:
-       case PROTECTED:
-       case THIN:
-       case QUAD:
-       case QQUAD:
-       case ENSPACE:
-       case ENSKIP:
-       case NEGTHIN:
-               os << ' ';
-               break;
-       }
-       return 0;
+       os << ' ';
+       return 1;
 }
 
 
-int InsetSpace::docbook(Buffer const &, ostream & os,
-                       OutputParams const &) const
+int InsetSpace::docbook(Buffer const &, odocstream & os,
+                        OutputParams const &) const
 {
        switch (kind_) {
        case NORMAL:
@@ -235,7 +228,7 @@ int InsetSpace::docbook(Buffer const &, ostream & os,
 }
 
 
-int InsetSpace::textString(Buffer const & buf, ostream & os,
+int InsetSpace::textString(Buffer const & buf, odocstream & os,
                       OutputParams const & op) const
 {
        return plaintext(buf, os, op);
@@ -262,3 +255,6 @@ bool InsetSpace::isSpace() const
 {
        return true;
 }
+
+
+} // namespace lyx