]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBox.cpp
Remove all BufferParam arguments in InsetXXX methods (since insets know about their...
[lyx.git] / src / insets / InsetBox.cpp
index 9948e94e91804aa80fbe7b40acd943a4eb450e96..1300533feeac126c4655aa4e7b249c4e864b31e7 100644 (file)
@@ -27,6 +27,7 @@
 #include "TextClass.h"
 
 #include "support/debug.h"
+#include "support/docstream.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/Translator.h"
@@ -212,7 +213,7 @@ void InsetBox::doDispatch(Cursor & cur, FuncRequest & cmd)
                        params_.type = cmd.getArg(1);
                else
                        string2params(to_utf8(cmd.argument()), params_);
-               setLayout(cur.buffer()->params());
+               setLayout();
                break;
        }
 
@@ -484,14 +485,24 @@ int InsetBox::docbook(odocstream & os, OutputParams const & runparams) const
 }
 
 
-int InsetBox::xhtml(odocstream & os, OutputParams const & runparams) const
+docstring InsetBox::xhtml(odocstream &, OutputParams const & runparams) const
 {
-       // FIXME We also want to do something with the length info, etc,
-       // presumably as "style='...'".
-       os << from_ascii("<span class='" + params_.type + "'>\n");
-       int ret = InsetText::xhtml(os, runparams);
-       os << "</span>\n";
-       return ret;
+       string style;
+       if (!params_.width.empty())
+               style += ("width: " + params_.width.asHTMLString() + ";");
+       if (!params_.height.empty())
+               style += ("height: " + params_.height.asHTMLString() + ";");
+       
+       docstring retval = from_ascii("<div class='" + params_.type + "'");
+       if (!style.empty())
+               retval += from_ascii(" style='" + style + "'");
+       retval += ">\n";
+       odocstringstream os;
+       docstring defer = InsetText::xhtml(os, runparams);
+       retval += os.str();
+       retval += "</div>\n";
+       retval += defer + "\n";
+       return retval;
 }