]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetMarginal.cpp
New DocBook support
[lyx.git] / src / insets / InsetMarginal.cpp
index 9543e8f52749ebe27b1c5e1701cf04a3bde59c4a..54922fced5acec533d95d8d254c0775b7474fb6a 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <config.h>
+#include <output_docbook.h>
 
 #include "InsetMarginal.h"
 
@@ -20,6 +21,7 @@
 
 #include "support/docstream.h"
 #include "support/gettext.h"
+#include "support/lstrings.h"
 
 namespace lyx {
 
@@ -40,28 +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) const
-{
-       DocIterator pit = cpit;
-       pit.push_back(CursorSlice(const_cast<InsetMarginal &>(*this)));
-
-       Toc & toc = buffer().tocBackend().toc("marginalnote");
-       docstring str;
-       text().forToc(str, TOC_ENTRY_LENGTH);
-       toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
-       // Proceed with the rest of the inset.
-       InsetFootlike::addToToc(cpit, output_active);
-}
-
 } // namespace lyx