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
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jürgen Vigna
|
|
|
|
* \author Lars Gullik Bjø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"
|
2008-04-10 10:05:00 +00:00
|
|
|
#include "BufferParams.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
#include "OutputParams.h"
|
2008-02-13 13:33:56 +00:00
|
|
|
#include "TocBackend.h"
|
|
|
|
|
2008-04-10 10:05:00 +00:00
|
|
|
#include "support/docstream.h"
|
2008-02-13 13:33:56 +00:00
|
|
|
#include "support/gettext.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
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetMarginal::InsetMarginal(Buffer * buf)
|
2008-03-04 22:28:18 +00:00
|
|
|
: InsetFootlike(buf)
|
2007-11-02 17:47:51 +00:00
|
|
|
{}
|
2000-06-28 13:35:52 +00:00
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
int InsetMarginal::plaintext(odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const & runparams) const
|
2007-02-16 08:15:16 +00:00
|
|
|
{
|
2008-02-27 20:43:16 +00:00
|
|
|
os << '[' << buffer().B_("margin") << ":\n";
|
|
|
|
InsetText::plaintext(os, runparams);
|
2007-02-16 08:15:16 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
int InsetMarginal::docbook(odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
OutputParams const & runparams) const
|
2005-02-28 13:14:48 +00:00
|
|
|
{
|
|
|
|
os << "<note role=\"margin\">";
|
2008-02-27 20:43:16 +00:00
|
|
|
int const i = InsetText::docbook(os, runparams);
|
2005-02-28 13:14:48 +00:00
|
|
|
os << "</note>";
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
2008-05-13 08:23:44 +00:00
|
|
|
void InsetMarginal::addToToc(DocIterator const & cpit)
|
2008-02-13 13:33:56 +00:00
|
|
|
{
|
2008-05-13 08:23:44 +00:00
|
|
|
DocIterator pit = cpit;
|
|
|
|
pit.push_back(CursorSlice(*this));
|
2008-02-13 13:33:56 +00:00
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
Toc & toc = buffer().tocBackend().toc("marginalnote");
|
2008-02-13 13:33:56 +00:00
|
|
|
docstring str;
|
2010-04-25 22:18:46 +00:00
|
|
|
str = text().getPar(0).asString();
|
2010-04-26 00:43:08 +00:00
|
|
|
toc.push_back(TocItem(pit, 0, str, toolTipText()));
|
2008-06-03 11:33:13 +00:00
|
|
|
// Proceed with the rest of the inset.
|
|
|
|
InsetFootlike::addToToc(cpit);
|
2008-02-13 13:33:56 +00:00
|
|
|
}
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|