2002-08-24 20:25:17 +00:00
|
|
|
/**
|
|
|
|
* \file insetoptarg.C
|
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>
|
|
|
|
|
2003-09-05 09:01:27 +00:00
|
|
|
#include "insetoptarg.h"
|
2002-08-23 09:05:32 +00:00
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
#include "gettext.h"
|
2003-09-16 10:54:23 +00:00
|
|
|
#include "LColor.h"
|
2003-09-06 12:36: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
|
|
|
|
|
|
|
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);
|
2002-08-23 09:05:32 +00:00
|
|
|
font.setColor(LColor::collapsable);
|
|
|
|
setLabelFont(font);
|
2006-09-09 15:27:44 +00:00
|
|
|
// FIXME UNICODE
|
|
|
|
setLabel(lyx::to_utf8(_("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);
|
2002-08-23 09:05:32 +00:00
|
|
|
font.setColor(LColor::collapsable);
|
|
|
|
setLabelFont(font);
|
2006-09-09 15:27:44 +00:00
|
|
|
// FIXME UNICODE
|
|
|
|
setLabel(lyx::to_utf8(_("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
|
|
|
|
2002-08-23 09:05:32 +00:00
|
|
|
string const InsetOptArg::editMessage() const
|
|
|
|
{
|
2006-09-09 15:27:44 +00:00
|
|
|
// FIXME UNICODE
|
|
|
|
return lyx::to_utf8(_("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
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
int InsetOptArg::latex(Buffer const &, ostream &,
|
2003-11-05 12:06:20 +00:00
|
|
|
OutputParams const &) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-02-28 13:14:48 +00:00
|
|
|
int InsetOptArg::docbook(Buffer const &, ostream &,
|
|
|
|
OutputParams const &) const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2005-05-11 09:47:54 +00:00
|
|
|
int InsetOptArg::plaintext(Buffer const &, ostream &,
|
|
|
|
OutputParams const &) const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
int InsetOptArg::latexOptional(Buffer const & buf, ostream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
OutputParams const & runparams) const
|
2002-08-23 09:05:32 +00:00
|
|
|
{
|
2004-08-13 23:30:26 +00:00
|
|
|
ostringstream ss;
|
2004-11-19 16:17:52 +00:00
|
|
|
int ret = InsetText::latex(buf, ss, runparams);
|
2004-08-13 23:30:26 +00:00
|
|
|
string str = ss.str();
|
2004-10-05 10:11:42 +00:00
|
|
|
if (str.find(']') != string::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
|
|
|
}
|