2002-08-24 20:25:17 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetOptArg.cpp
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-23 09:05:32 +00:00
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Martin Vermeer
|
2002-09-25 14:26:13 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-08-24 20:25:17 +00:00
|
|
|
*/
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetOptArg.h"
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
#include "gettext.h"
|
2007-04-26 17:34:20 +00:00
|
|
|
#include "Color.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "Paragraph.h"
|
2002-08-23 09:05:32 +00:00
|
|
|
|
2004-08-13 23:30:26 +00:00
|
|
|
#include <sstream>
|
2003-10-06 15:43:21 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
2006-09-09 18:52:00 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
using std::string;
|
2003-09-05 09:01:27 +00:00
|
|
|
using std::auto_ptr;
|
2002-08-23 09:05:32 +00:00
|
|
|
using std::ostream;
|
2004-08-13 23:30:26 +00:00
|
|
|
using std::ostringstream;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
2005-06-02 15:01:16 +00:00
|
|
|
: InsetCollapsable(ins)
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2002-08-24 20:25:17 +00:00
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
2007-04-26 17:34:20 +00:00
|
|
|
font.setColor(Color::collapsable);
|
2002-08-23 09:05:32 +00:00
|
|
|
setLabelFont(font);
|
2006-10-08 09:36:16 +00:00
|
|
|
setLabel(_("opt"));
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
InsetOptArg::InsetOptArg(InsetOptArg const & in)
|
|
|
|
: InsetCollapsable(in)
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2002-08-24 20:25:17 +00:00
|
|
|
LyXFont font(LyXFont::ALL_SANE);
|
2007-04-26 17:34:20 +00:00
|
|
|
font.setColor(Color::collapsable);
|
2002-08-23 09:05:32 +00:00
|
|
|
setLabelFont(font);
|
2006-10-08 09:36:16 +00:00
|
|
|
setLabel(_("opt"));
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2004-11-23 23:04:52 +00:00
|
|
|
auto_ptr<InsetBase> InsetOptArg::doClone() const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
return auto_ptr<InsetBase>(new InsetOptArg(*this));
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2006-09-09 18:52:00 +00:00
|
|
|
docstring const InsetOptArg::editMessage() const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2006-09-09 18:52:00 +00:00
|
|
|
return _("Opened Optional Argument Inset");
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
|
|
|
|
2002-08-24 20:25:17 +00:00
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
void InsetOptArg::write(Buffer const & buf, ostream & os) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
os << "OptArg" << "\n";
|
|
|
|
InsetCollapsable::write(buf, os);
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
int InsetOptArg::latex(Buffer const &, odocstream &,
|
2007-02-15 23:44:33 +00:00
|
|
|
OutputParams const &) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-02-15 23:44:33 +00:00
|
|
|
|
|
|
|
int InsetOptArg::plaintext(Buffer const &, odocstream &,
|
|
|
|
OutputParams const &) const
|
2005-02-28 13:14:48 +00:00
|
|
|
{
|
2007-02-18 18:55:11 +00:00
|
|
|
return 0; // do not output optional arguments
|
2005-02-28 13:14:48 +00:00
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2007-02-15 23:44:33 +00:00
|
|
|
int InsetOptArg::docbook(Buffer const &, odocstream &,
|
|
|
|
OutputParams const &) const
|
2005-05-11 09:47:54 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
int InsetOptArg::latexOptional(Buffer const & buf, odocstream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
OutputParams const & runparams) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2006-10-21 00:16:43 +00:00
|
|
|
odocstringstream ss;
|
2004-11-19 16:17:52 +00:00
|
|
|
int ret = InsetText::latex(buf, ss, runparams);
|
2006-10-19 16:51:30 +00:00
|
|
|
docstring str = ss.str();
|
|
|
|
if (str.find(']') != docstring::npos)
|
2004-08-13 23:30:26 +00:00
|
|
|
str = '{' + str + '}';
|
|
|
|
os << '[' << str << ']';
|
2004-11-19 16:17:52 +00:00
|
|
|
return ret;
|
2002-08-23 09:05:32 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|