lyx_mirror/src/insets/InsetOptArg.cpp
André Pönitz db8c16d554 progress on buffer-reference-in-insets. beware of instabilities...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23289 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-27 20:43:16 +00:00

85 lines
1.4 KiB
C++

/**
* \file InsetOptArg.cpp
* 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 "support/debug.h"
#include "support/docstream.h"
#include "support/gettext.h"
using namespace std;
namespace lyx {
InsetOptArg::InsetOptArg(BufferParams const & ins)
: InsetCollapsable(ins)
{}
InsetOptArg::InsetOptArg(InsetOptArg const & in)
: InsetCollapsable(in)
{}
Inset * InsetOptArg::clone() const
{
return new InsetOptArg(*this);
}
docstring InsetOptArg::editMessage() const
{
return _("Opened Optional Argument Inset");
}
void InsetOptArg::write(ostream & os) const
{
os << "OptArg" << "\n";
InsetCollapsable::write(os);
}
int InsetOptArg::latex(odocstream &, OutputParams const &) const
{
return 0;
}
int InsetOptArg::plaintext(odocstream &, OutputParams const &) const
{
return 0; // do not output optional arguments
}
int InsetOptArg::docbook(odocstream &, OutputParams const &) const
{
return 0;
}
int InsetOptArg::latexOptional(odocstream & os,
OutputParams const & runparams) const
{
odocstringstream ss;
int ret = InsetText::latex(ss, runparams);
docstring str = ss.str();
if (str.find(']') != docstring::npos)
str = '{' + str + '}';
os << '[' << str << ']';
return ret;
}
} // namespace lyx