2 * \file InsetMarginal.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
14 #include "InsetMarginal.h"
17 #include "BufferParams.h"
18 #include "OutputParams.h"
19 #include "TocBackend.h"
21 #include "support/docstream.h"
22 #include "support/gettext.h"
23 #include "support/lstrings.h"
28 InsetMarginal::InsetMarginal(Buffer * buf)
33 int InsetMarginal::plaintext(odocstringstream & os,
34 OutputParams const & runparams, size_t max_length) const
36 os << '[' << buffer().B_("margin") << ":\n";
37 InsetText::plaintext(os, runparams, max_length);
40 return PLAINTEXT_NEWLINE + 1; // one char on a separate line
44 int InsetMarginal::docbook(odocstream & os,
45 OutputParams const & runparams) const
47 os << "<note role=\"margin\">";
48 int const i = InsetText::docbook(os, runparams);
55 void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active,
56 UpdateType utype) const
58 DocIterator pit = cpit;
59 pit.push_back(CursorSlice(const_cast<InsetMarginal &>(*this)));
62 text().forOutliner(tooltip, TOC_ENTRY_LENGTH);
63 docstring const str = tooltip;
64 tooltip = support::wrapParas(tooltip, 0, 60, 2);
66 shared_ptr<Toc> toc = buffer().tocBackend().toc("marginalnote");
67 toc->push_back(TocItem(pit, 0, str, output_active, tooltip));
69 // Proceed with the rest of the inset.
70 InsetFootlike::addToToc(cpit, output_active, utype);