X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetoptarg.C;h=d5ed89d3c9a3c4e8cbe75258857e58af8fac750a;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=2e47c6b6a4f9641a6ca16c6fecd40deffd43e7b8;hpb=0786aa3247b1b063a54364ede636d75b45f683a3;p=lyx.git diff --git a/src/insets/insetoptarg.C b/src/insets/insetoptarg.C index 2e47c6b6a4..d5ed89d3c9 100644 --- a/src/insets/insetoptarg.C +++ b/src/insets/insetoptarg.C @@ -19,6 +19,9 @@ #include + +namespace lyx { + using std::string; using std::auto_ptr; using std::ostream; @@ -26,7 +29,7 @@ using std::ostringstream; InsetOptArg::InsetOptArg(BufferParams const & ins) - : InsetCollapsable(ins, Collapsed) + : InsetCollapsable(ins) { LyXFont font(LyXFont::ALL_SANE); font.setColor(LColor::collapsable); @@ -45,13 +48,13 @@ InsetOptArg::InsetOptArg(InsetOptArg const & in) } -auto_ptr InsetOptArg::clone() const +auto_ptr InsetOptArg::doClone() const { return auto_ptr(new InsetOptArg(*this)); } -string const InsetOptArg::editMessage() const +docstring const InsetOptArg::editMessage() const { return _("Opened Optional Argument Inset"); } @@ -64,21 +67,37 @@ void InsetOptArg::write(Buffer const & buf, ostream & os) const } -int InsetOptArg::latex(Buffer const &, ostream &, +int InsetOptArg::latex(Buffer const &, odocstream &, + OutputParams const &) const +{ + return 0; +} + +int InsetOptArg::docbook(Buffer const &, odocstream &, OutputParams const &) const { return 0; } -int InsetOptArg::latexOptional(Buffer const & buf, ostream & os, +int InsetOptArg::plaintext(Buffer const &, odocstream &, + OutputParams const &) const +{ + return 0; +} + + +int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os, OutputParams const & runparams) const { - ostringstream ss; - InsetText::latex(buf, ss, runparams); - string str = ss.str(); - if (str.find(']') != string::npos) + odocstringstream ss; + int ret = InsetText::latex(buf, ss, runparams); + docstring str = ss.str(); + if (str.find(']') != docstring::npos) str = '{' + str + '}'; os << '[' << str << ']'; - return str.length() + 2; + return ret; } + + +} // namespace lyx