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.
15 #include "InsetFoot.h"
18 #include "BufferParams.h"
22 // FIXME: the following is needed just to get the layout of the enclosing
23 // paragraph. This seems a bit too much to me (JMarc)
24 #include "OutputParams.h"
25 #include "ParIterator.h"
26 #include "TextClass.h"
28 #include "support/lstrings.h"
39 InsetFoot::InsetFoot(BufferParams const & bp)
44 InsetFoot::InsetFoot(InsetFoot const & in)
49 Inset * InsetFoot::clone() const
51 return new InsetFoot(*this);
55 docstring const InsetFoot::editMessage() const
57 return _("Opened Footnote Inset");
61 void InsetFoot::updateLabels(Buffer const & buf, ParIterator const & it)
63 TextClass const & tclass = buf.params().getTextClass();
64 Counters & cnts = tclass.counters();
65 docstring const & foot = from_ascii("footnote");
66 Paragraph const & outer = it.paragraph();
67 if (!outer.layout()->intitle && cnts.hasCounter(foot)) {
69 //FIXME: the counter should format itself.
70 setLabel(support::bformat(from_ascii("%1$s %2$s"),
71 getLayout(buf.params()).labelstring,
72 cnts.theCounter(foot)));
75 InsetCollapsable::updateLabels(buf, it);
79 int InsetFoot::latex(Buffer const & buf, odocstream & os,
80 OutputParams const & runparams_in) const
82 OutputParams runparams = runparams_in;
83 // footnotes in titling commands like \title have moving arguments
84 runparams.moving_arg |= runparams_in.intitle;
86 // in titling commands, \thanks should be used instead of \footnote.
87 // some classes (e.g. memoir) do not understand \footnote.
88 if (runparams_in.intitle)
91 os << "%\n\\footnote{";
93 int const i = InsetText::latex(buf, os, runparams);
95 runparams_in.encoding = runparams.encoding;
101 int InsetFoot::plaintext(Buffer const & buf, odocstream & os,
102 OutputParams const & runparams) const
104 os << '[' << buf.B_("footnote") << ":\n";
105 InsetText::plaintext(buf, os, runparams);
108 return PLAINTEXT_NEWLINE + 1; // one char on a separate line
112 int InsetFoot::docbook(Buffer const & buf, odocstream & os,
113 OutputParams const & runparams) const
116 int const i = InsetText::docbook(buf, os, runparams);