]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetMarginal.cpp
Improve handling of top and bottom margin
[lyx.git] / src / insets / InsetMarginal.cpp
index cb85ab3c2045bf2028a2890f3569165ea9c5cb98..119c636877ecb31df33634b0a6118784d68c1136 100644 (file)
@@ -16,6 +16,7 @@
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "OutputParams.h"
+#include "output_docbook.h"
 #include "TocBackend.h"
 
 #include "support/docstream.h"
@@ -41,33 +42,16 @@ int InsetMarginal::plaintext(odocstringstream & os,
 }
 
 
-int InsetMarginal::docbook(odocstream & os,
-                          OutputParams const & runparams) const
+void InsetMarginal::docbook(XMLStream & xs, OutputParams const & runparams) const
 {
-       os << "<note role=\"margin\">";
-       int const i = InsetText::docbook(os, runparams);
-       os << "</note>";
-
-       return i;
+       // Implementation as per http://www.sagehill.net/docbookxsl/SideFloats.html
+       // Unfortunately, only for XSL-FO output with the default style sheets, hence the role.
+       xs << xml::StartTag("sidebar", "role=\"margin\"");
+       xs << xml::CR();
+       xs << "<?dbfo float-type=\"margin.note\"?>";
+       InsetText::docbook(xs, runparams);
+       xs << xml::EndTag("sidebar");
 }
 
 
-void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active,
-                                 UpdateType utype) const
-{
-       DocIterator pit = cpit;
-       pit.push_back(CursorSlice(const_cast<InsetMarginal &>(*this)));
-
-       docstring tooltip;
-       text().forOutliner(tooltip, TOC_ENTRY_LENGTH);
-       docstring const str = tooltip;
-       tooltip = support::wrapParas(tooltip, 0, 60, 2);
-       
-       shared_ptr<Toc> toc = buffer().tocBackend().toc("marginalnote");
-       toc->push_back(TocItem(pit, 0, str, output_active, tooltip));
-
-       // Proceed with the rest of the inset.
-       InsetFootlike::addToToc(cpit, output_active, utype);
-}
-
 } // namespace lyx