mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 13:46:43 +00:00
00e305c9d9
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18018 a592a061-630c-0410-9148-cb99ea01b6c8
105 lines
1.9 KiB
C++
105 lines
1.9 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 "debug.h"
|
|
#include "gettext.h"
|
|
#include "LColor.h"
|
|
#include "Paragraph.h"
|
|
|
|
#include <sstream>
|
|
|
|
|
|
namespace lyx {
|
|
|
|
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 &, odocstream &,
|
|
OutputParams const &) const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|
|
int InsetOptArg::plaintext(Buffer const &, odocstream &,
|
|
OutputParams const &) const
|
|
{
|
|
return 0; // do not output optional arguments
|
|
}
|
|
|
|
|
|
int InsetOptArg::docbook(Buffer const &, odocstream &,
|
|
OutputParams const &) const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
|
|
int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
|
|
OutputParams const & runparams) const
|
|
{
|
|
odocstringstream ss;
|
|
int ret = InsetText::latex(buf, ss, runparams);
|
|
docstring str = ss.str();
|
|
if (str.find(']') != docstring::npos)
|
|
str = '{' + str + '}';
|
|
os << '[' << str << ']';
|
|
return ret;
|
|
}
|
|
|
|
|
|
} // namespace lyx
|