#include <config.h>
+#include "insetoptarg.h"
#include "debug.h"
-
-#include "insetoptarg.h"
-#include "support/LOstream.h"
-#include "frontends/Alert.h"
-#include "support/lstrings.h" // frontStrip, strip
-#include "lyxtext.h"
-#include "buffer.h"
#include "gettext.h"
-#include "BufferView.h"
-#include "support/lstrings.h"
+#include "LColor.h"
+#include "paragraph.h"
-using std::ostream;
-using std::vector;
-using std::pair;
+#include <sstream>
+
+using std::string;
using std::auto_ptr;
+using std::ostream;
+using std::ostringstream;
InsetOptArg::InsetOptArg(BufferParams const & ins)
- : InsetCollapsable(ins, true)
+ : InsetCollapsable(ins, Collapsed)
{
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::collapsable);
}
-auto_ptr<InsetBase> InsetOptArg::clone() const
+auto_ptr<InsetBase> InsetOptArg::doClone() const
{
return auto_ptr<InsetBase>(new InsetOptArg(*this));
}
int InsetOptArg::latex(Buffer const &, ostream &,
- LatexRunParams const &) const
+ OutputParams const &) const
{
return 0;
}
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
- LatexRunParams const & runparams) const
+ OutputParams const & runparams) const
{
- os << '[';
- int const i = inset.latex(buf, os, runparams);
- os << ']';
- return i + 2;
+ ostringstream ss;
+ int ret = InsetText::latex(buf, ss, runparams);
+ string str = ss.str();
+ if (str.find(']') != string::npos)
+ str = '{' + str + '}';
+ os << '[' << str << ']';
+ return ret;
}