X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetNote.cpp;h=adacef3bae267066beec930dacb5f5b707ca6f65;hb=6775d7c3a2bccdc064dc0fb37564b8941d956541;hp=1c039c3bc52e9742a6f031c90aa9c870d3bce72f;hpb=c19c21034b71fb531cf07839df3370bd76382452;p=features.git diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index 1c039c3bc5..adacef3bae 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -19,18 +19,15 @@ #include "BufferView.h" #include "ColorSet.h" #include "Cursor.h" -#include "DispatchResult.h" #include "Exporter.h" +#include "FontInfo.h" #include "FuncRequest.h" #include "FuncStatus.h" -#include "InsetIterator.h" +#include "InsetLayout.h" #include "LaTeXFeatures.h" #include "Lexer.h" #include "LyXRC.h" -#include "OutputParams.h" -#include "ParIterator.h" -#include "TextClass.h" -#include "TocBackend.h" +#include "output_docbook.h" #include "support/debug.h" #include "support/docstream.h" @@ -116,12 +113,6 @@ docstring InsetNote::layoutName() const } -Inset::DisplayType InsetNote::display() const -{ - return Inline; -} - - void InsetNote::write(ostream & os) const { params_.write(os); @@ -186,9 +177,6 @@ bool InsetNote::getStatus(Cursor & cur, FuncRequest const & cmd, switch (cmd.action()) { case LFUN_INSET_MODIFY: - // disallow comment and greyed out in commands - flag.setEnabled(!cur.paragraph().layout().isCommand() || - cmd.getArg(2) == "Note"); if (cmd.getArg(0) == "note") { InsetNoteParams params; string2params(to_utf8(cmd.argument()), params); @@ -269,31 +257,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 << "\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\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(); @@ -306,7 +295,7 @@ void InsetNote::validate(LaTeXFeatures & features) const { switch (params_.type) { case InsetNoteParams::Comment: - if (features.runparams().flavor == OutputParams::HTML) + if (features.runparams().flavor == Flavor::Html) // we do output this but set display to "none" by default, // but people might want to use it. InsetCollapsible::validate(features); @@ -315,6 +304,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: @@ -336,12 +327,15 @@ bool InsetNote::allowSpellCheck() const FontInfo InsetNote::getFont() const { FontInfo font = getLayout().font(); - // FIXME: This hardcoded color is a hack! if (params_.type == InsetNoteParams::Greyedout - && buffer().params().notefontcolor != lyx::rgbFromHexName("#cccccc")) { + && buffer().params().isnotefontcolor) { ColorCode c = lcolor.getFromLyXName("notefontcolor"); if (c != Color_none) font.setColor(c); + // This is the local color (not overridden by other documents) + ColorCode lc = lcolor.getFromLyXName("notefontcolor@" + buffer().fileName().absFileName()); + if (lc != Color_none) + font.setPaintColor(lc); } return font; }