]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathBox.cpp
Routines for calculating numerical labels for BibTeX citations.
[lyx.git] / src / mathed / InsetMathBox.cpp
index 701a0bb6344b75725356870b5bf559c8b1fc224d..17d2b13346d78f187f7d565db3211d54b7aee2e6 100644 (file)
@@ -52,15 +52,10 @@ void InsetMathBox::normalize(NormalStream & os) const
 }
 
 
-docstring InsetMathBox::mathmlize(MathStream & ms) const
+void InsetMathBox::mathmlize(MathStream & ms) const
 {      
-       // FIXME This doesn't actually work yet. We need to be able to signal 
-       // that we are in text mode and then just call ms << cell(0). So we
-       // need something like ModeSpecifier for MathStream.
-       ms << MTag("mtext");
-       ms.os() << cell(0);
-       ms << ETag("mtext");
-       return docstring();
+       SetMode textmode(ms, true, from_ascii("class='mathbox'"));
+       ms << cell(0);
 }
 
 
@@ -139,12 +134,32 @@ void InsetMathFBox::normalize(NormalStream & os) const
 }
 
 
+void InsetMathFBox::mathmlize(MathStream & ms) const
+{      
+       SetMode textmode(ms, true, from_ascii("class='fbox'"));
+       ms << cell(0);
+}
+
+
 void InsetMathFBox::infoize(odocstream & os) const
 {
        os << "FBox: ";
 }
 
 
+void InsetMathFBox::validate(LaTeXFeatures & features) const
+{
+       // FIXME XHTML
+       // It'd be better to be able to get this from an InsetLayout, but at present
+       // InsetLayouts do not seem really to work for things that aren't InsetTexts.
+       if (features.runparams().flavor == OutputParams::HTML)
+               features.addPreambleSnippet("<style type=\"text/css\">\n"
+                       "mtext.fbox { border: 1px solid black; }\n"
+                       "</style>");
+}
+
+
+
 /////////////////////////////////////////////////////////////////////
 //
 // InsetMathMakebox
@@ -251,6 +266,28 @@ void InsetMathMakebox::infoize(odocstream & os) const
 }
 
 
+void InsetMathMakebox::mathmlize(MathStream & ms) const
+{
+       // FIXME We could do something with the other arguments.
+       std::string const cssclass = framebox_ ? "framebox" : "makebox";
+       SetMode textmode(ms, true, from_ascii("class='" + cssclass + "'"));
+       ms << cell(2);
+}
+
+
+void InsetMathMakebox::validate(LaTeXFeatures & features) const
+{
+       // FIXME XHTML
+       // It'd be better to be able to get this from an InsetLayout, but at present
+       // InsetLayouts do not seem really to work for things that aren't InsetTexts.
+       if (features.runparams().flavor == OutputParams::HTML)
+               features.addPreambleSnippet("<style type=\"text/css\">\n"
+                       "mtext.framebox { border: 1px solid black; }\n"
+                       "</style>");
+}
+
+
+
 /////////////////////////////////////////////////////////////////////
 //
 // InsetMathBoxed
@@ -298,9 +335,23 @@ void InsetMathBoxed::infoize(odocstream & os) const
 }
 
 
+void InsetMathBoxed::mathmlize(MathStream & ms) const
+{
+       SetMode mathmode(ms, false, from_ascii("class='boxed'"));
+       ms << cell(0);
+}
+
+
 void InsetMathBoxed::validate(LaTeXFeatures & features) const
 {
        features.require("amsmath");
+       // FIXME XHTML
+       // It'd be better to be able to get this from an InsetLayout, but at present
+       // InsetLayouts do not seem really to work for things that aren't InsetTexts.
+       if (features.runparams().flavor == OutputParams::HTML)
+               features.addPreambleSnippet("<style type=\"text/css\">\n"
+                       "mstyle.boxed { border: 1px solid black; }\n"
+                       "</style>");
        InsetMathNest::validate(features);
 }