X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetoptarg.C;h=6b889fd726c74141f2e78636ec03fbf3a8b6471c;hb=10ba1b8918e7da14334bb5573ce2a707671c8b51;hp=30086b6276678ba2f1822008d7b2b798638bdc10;hpb=c5c7a9e56854dea886977f8e11cbfe31d8a7464f;p=lyx.git diff --git a/src/insets/insetoptarg.C b/src/insets/insetoptarg.C index 30086b6276..6b889fd726 100644 --- a/src/insets/insetoptarg.C +++ b/src/insets/insetoptarg.C @@ -14,15 +14,19 @@ #include "debug.h" #include "gettext.h" +#include "LColor.h" +#include "paragraph.h" +#include + +using std::string; using std::auto_ptr; using std::ostream; -using std::pair; -using std::vector; +using std::ostringstream; InsetOptArg::InsetOptArg(BufferParams const & ins) - : InsetCollapsable(ins, true) + : InsetCollapsable(ins, Collapsed) { LyXFont font(LyXFont::ALL_SANE); font.setColor(LColor::collapsable); @@ -41,7 +45,7 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in) } -auto_ptr InsetOptArg::clone() const +auto_ptr InsetOptArg::doClone() const { return auto_ptr(new InsetOptArg(*this)); } @@ -61,17 +65,20 @@ void InsetOptArg::write(Buffer const & buf, ostream & os) const 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; }