2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetMarginal.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-03-21 17:09:55 +00:00
|
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2002-03-21 17:09:55 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-06-28 16:03:01 +00:00
|
|
|
|
*/
|
2000-06-26 18:48:45 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "InsetMarginal.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
|
2007-05-01 08:26:40 +00:00
|
|
|
|
#include "Buffer.h"
|
2000-06-26 18:48:45 +00:00
|
|
|
|
#include "gettext.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Paragraph.h"
|
|
|
|
|
#include "OutputParams.h"
|
2000-06-26 18:48:45 +00:00
|
|
|
|
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
2000-06-26 18:48:45 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
2003-09-05 09:01:27 +00:00
|
|
|
|
using std::ostream;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
|
|
|
|
|
|
2002-03-03 20:25:07 +00:00
|
|
|
|
InsetMarginal::InsetMarginal(BufferParams const & bp)
|
|
|
|
|
: InsetFootlike(bp)
|
2000-06-28 13:35:52 +00:00
|
|
|
|
{
|
2006-10-08 09:36:16 +00:00
|
|
|
|
setLabel(_("margin"));
|
2000-06-28 13:35:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
|
InsetMarginal::InsetMarginal(InsetMarginal const & in)
|
|
|
|
|
: InsetFootlike(in)
|
2001-07-27 12:03:36 +00:00
|
|
|
|
{
|
2006-10-08 09:36:16 +00:00
|
|
|
|
setLabel(_("margin"));
|
2001-07-27 12:03:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
auto_ptr<Inset> InsetMarginal::doClone() const
|
2001-07-27 12:03:36 +00:00
|
|
|
|
{
|
2007-04-29 13:39:47 +00:00
|
|
|
|
return auto_ptr<Inset>(new InsetMarginal(*this));
|
2001-07-27 12:03:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-09 18:52:00 +00:00
|
|
|
|
docstring const InsetMarginal::editMessage() const
|
2000-06-26 18:48:45 +00:00
|
|
|
|
{
|
2006-09-09 18:52:00 +00:00
|
|
|
|
return _("Opened Marginal Note Inset");
|
2000-06-26 18:48:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
int InsetMarginal::latex(Buffer const & buf, odocstream & os,
|
2007-02-16 08:15:16 +00:00
|
|
|
|
OutputParams const & runparams) const
|
2000-06-26 18:48:45 +00:00
|
|
|
|
{
|
2001-06-29 14:01:29 +00:00
|
|
|
|
os << "%\n\\marginpar{";
|
2004-03-25 09:16:36 +00:00
|
|
|
|
int const i = InsetText::latex(buf, os, runparams);
|
2001-06-29 14:01:29 +00:00
|
|
|
|
os << "%\n}";
|
2000-07-15 23:51:46 +00:00
|
|
|
|
return i + 2;
|
2000-06-26 18:48:45 +00:00
|
|
|
|
}
|
2005-02-28 13:14:48 +00:00
|
|
|
|
|
2007-02-16 08:15:16 +00:00
|
|
|
|
|
|
|
|
|
int InsetMarginal::plaintext(Buffer const & buf, odocstream & os,
|
|
|
|
|
OutputParams const & runparams) const
|
|
|
|
|
{
|
2007-05-01 08:26:40 +00:00
|
|
|
|
os << '[' << buf.B_("margin") << ":\n";
|
2007-02-16 08:15:16 +00:00
|
|
|
|
InsetText::plaintext(buf, os, runparams);
|
|
|
|
|
os << "\n]";
|
|
|
|
|
|
2007-02-20 17:52:41 +00:00
|
|
|
|
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
|
2007-02-16 08:15:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 21:00:33 +00:00
|
|
|
|
int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
|
2007-02-16 08:15:16 +00:00
|
|
|
|
OutputParams const & runparams) const
|
2005-02-28 13:14:48 +00:00
|
|
|
|
{
|
|
|
|
|
os << "<note role=\"margin\">";
|
|
|
|
|
int const i = InsetText::docbook(buf, os, runparams);
|
|
|
|
|
os << "</note>";
|
|
|
|
|
|
|
|
|
|
return i;
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|