]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetMarginal.cpp
Andre's s/getTextClass/textClass/ cleanup.
[lyx.git] / src / insets / InsetMarginal.cpp
index aa0214f22f2fe0a936068633c4a9de4d75430ac8..094d2a22cb9e9e488add4e3cb5026f30749af7cb 100644 (file)
 
 #include "InsetMarginal.h"
 
-#include "gettext.h"
-#include "Paragraph.h"
+#include "Buffer.h"
 #include "OutputParams.h"
+#include "TocBackend.h"
 
-#include "support/std_ostream.h"
+#include "support/gettext.h"
 
+#include <ostream>
 
-namespace lyx {
 
-using std::string;
-using std::auto_ptr;
-using std::ostream;
+namespace lyx {
 
 
 InsetMarginal::InsetMarginal(BufferParams const & bp)
        : InsetFootlike(bp)
-{
-       setLabel(_("margin"));
-}
+{}
 
 
 InsetMarginal::InsetMarginal(InsetMarginal const & in)
        : InsetFootlike(in)
-{
-       setLabel(_("margin"));
-}
+{}
 
 
-auto_ptr<Inset> InsetMarginal::doClone() const
+Inset * InsetMarginal::clone() const
 {
-       return auto_ptr<Inset>(new InsetMarginal(*this));
+       return new InsetMarginal(*this);
 }
 
 
@@ -54,7 +48,7 @@ docstring const InsetMarginal::editMessage() const
 
 
 int InsetMarginal::latex(Buffer const & buf, odocstream & os,
-                         OutputParams const & runparams) const
+                        OutputParams const & runparams) const
 {
        os << "%\n\\marginpar{";
        int const i = InsetText::latex(buf, os, runparams);
@@ -64,9 +58,9 @@ int InsetMarginal::latex(Buffer const & buf, odocstream & os,
 
 
 int InsetMarginal::plaintext(Buffer const & buf, odocstream & os,
-                             OutputParams const & runparams) const
+                            OutputParams const & runparams) const
 {
-       os << '[' << _("margin") << ":\n";
+       os << '[' << buf.B_("margin") << ":\n";
        InsetText::plaintext(buf, os, runparams);
        os << "\n]";
 
@@ -75,7 +69,7 @@ int InsetMarginal::plaintext(Buffer const & buf, odocstream & os,
 
 
 int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
-                           OutputParams const & runparams) const
+                          OutputParams const & runparams) const
 {
        os << "<note role=\"margin\">";
        int const i = InsetText::docbook(buf, os, runparams);
@@ -85,4 +79,16 @@ int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
 }
 
 
+void InsetMarginal::addToToc(Buffer const & buf,
+       ParConstIterator const & cpit) const
+{
+       ParConstIterator pit = cpit;
+       pit.push_back(*this);
+
+       Toc & toc = buf.tocBackend().toc("marginalnote");
+       docstring str;
+       str = getNewLabel(str);
+       toc.push_back(TocItem(pit, 0, str));
+}
+
 } // namespace lyx