]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNote.cpp
Improve handling of top and bottom margin
[lyx.git] / src / insets / InsetNote.cpp
index 02f47ba30e78075cc6385168b9ea902bdd778d5e..fa84c61c87c7df75914027e180e48e0fff6e3be2 100644 (file)
@@ -28,6 +28,7 @@
 #include "Lexer.h"
 #include "LyXRC.h"
 #include "OutputParams.h"
+#include "output_docbook.h"
 #include "ParIterator.h"
 #include "TextClass.h"
 #include "TocBackend.h"
@@ -116,12 +117,6 @@ docstring InsetNote::layoutName() const
 }
 
 
-Inset::DisplayType InsetNote::display() const
-{
-       return Inline;
-}
-
-
 void InsetNote::write(ostream & os) const
 {
        params_.write(os);
@@ -266,31 +261,32 @@ int InsetNote::plaintext(odocstringstream & os,
 }
 
 
-int InsetNote::docbook(odocstream & os, OutputParams const & runparams_in) const
+void InsetNote::docbook(XMLStream & xs, OutputParams const & runparams_in) const
 {
        if (params_.type == InsetNoteParams::Note)
-               return 0;
+               return;
 
        OutputParams runparams(runparams_in);
        if (params_.type == InsetNoteParams::Comment) {
-               os << "<remark>\n";
+               xs << xml::StartTag("remark");
+               xs << xml::CR();
                runparams.inComment = true;
                // Ignore files that are exported inside a comment
                runparams.exportdata.reset(new ExportData);
        }
+       // Greyed out text is output as such (no way to mark text as greyed out with DocBook).
 
-       int const n = InsetText::docbook(os, runparams);
-
-       if (params_.type == InsetNoteParams::Comment)
-               os << "\n</remark>\n";
+       InsetText::docbook(xs, runparams);
 
-       // Return how many newlines we issued.
-       //return int(count(str.begin(), str.end(), '\n'));
-       return n + 1 + 2;
+       if (params_.type == InsetNoteParams::Comment) {
+               xs << xml::CR();
+               xs << xml::EndTag("remark");
+               xs << xml::CR();
+       }
 }
 
 
-docstring InsetNote::xhtml(XHTMLStream & xs, OutputParams const & rp) const
+docstring InsetNote::xhtml(XMLStream & xs, OutputParams const & rp) const
 {
        if (params_.type == InsetNoteParams::Note)
                return docstring();
@@ -312,6 +308,8 @@ void InsetNote::validate(LaTeXFeatures & features) const
                        features.useInsetLayout(getLayout());
                break;
        case InsetNoteParams::Greyedout:
+               if (features.hasRTLLanguage())
+                       features.require("environ");
                InsetCollapsible::validate(features);
                break;
        case InsetNoteParams::Note: