lyx_mirror/src/insets/insetoptarg.C
Georg Baum 34b7650cbb Introduce wide streams. This fixes the remaining problems of plain text
export (e.g. the ToC) and the navigate menu.

	* src/insets/insetbase.h
	(InsetBase::plaintext): output to a docstream
	(InsetBase::textString): ditto

	* src/mathed/TextPainter.h
	(TextPainter::show): ditto

	* src/support/docstream.[Ch] New file and string streams for
	docstring. The file streams convert to UTF8 on the fly.

	* many more files: Adjust to the changes above


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15301 a592a061-630c-0410-9148-cb99ea01b6c8
2006-10-11 19:40:50 +00:00

100 lines
1.8 KiB
C

/**
* \file insetoptarg.C
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Martin Vermeer
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "insetoptarg.h"
#include "debug.h"
#include "gettext.h"
#include "LColor.h"
#include "paragraph.h"
#include <sstream>
using lyx::docstring;
using std::string;
using std::auto_ptr;
using std::ostream;
using std::ostringstream;
InsetOptArg::InsetOptArg(BufferParams const & ins)
: InsetCollapsable(ins)
{
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::collapsable);
setLabelFont(font);
setLabel(_("opt"));
}
InsetOptArg::InsetOptArg(InsetOptArg const & in)
: InsetCollapsable(in)
{
LyXFont font(LyXFont::ALL_SANE);
font.setColor(LColor::collapsable);
setLabelFont(font);
setLabel(_("opt"));
}
auto_ptr<InsetBase> InsetOptArg::doClone() const
{
return auto_ptr<InsetBase>(new InsetOptArg(*this));
}
docstring const InsetOptArg::editMessage() const
{
return _("Opened Optional Argument Inset");
}
void InsetOptArg::write(Buffer const & buf, ostream & os) const
{
os << "OptArg" << "\n";
InsetCollapsable::write(buf, os);
}
int InsetOptArg::latex(Buffer const &, ostream &,
OutputParams const &) const
{
return 0;
}
int InsetOptArg::docbook(Buffer const &, ostream &,
OutputParams const &) const
{
return 0;
}
int InsetOptArg::plaintext(Buffer const &, lyx::odocstream &,
OutputParams const &) const
{
return 0;
}
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
ostringstream ss;
int ret = InsetText::latex(buf, ss, runparams);
string str = ss.str();
if (str.find(']') != string::npos)
str = '{' + str + '}';
os << '[' << str << ']';
return ret;
}