X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetspecialchar.C;h=0c03dde33cea8adad5b0a3fd02d71bdd545a99de;hb=4a5b7a5952ad2381fcdf4830511293e184c7c5a1;hp=fd4181bc6c0048be6af520602f974cd536aa37a1;hpb=55bf6460f304a4632af2136a62c8a82fb86053f3;p=lyx.git diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index fd4181bc6c..0c03dde33c 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -19,6 +19,8 @@ #include "BufferView.h" #include "Painter.h" #include "font.h" +#include "lyxlex.h" +#include "lyxfont.h" using std::ostream; using std::max; @@ -192,7 +194,7 @@ void InsetSpecialChar::write(Buffer const *, ostream & os) const void InsetSpecialChar::read(Buffer const *, LyXLex & lex) { lex.nextToken(); - string const command = lex.GetString(); + string const command = lex.getString(); if (command == "\\-") kind_ = HYPHENATION; @@ -262,15 +264,49 @@ int InsetSpecialChar::ascii(Buffer const *, ostream & os, int) const } -int InsetSpecialChar::linuxdoc(Buffer const * buf, ostream & os) const +int InsetSpecialChar::linuxdoc(Buffer const *, ostream & os) const { - return ascii(buf, os, 0); + switch (kind_) { + case HYPHENATION: + case LIGATURE_BREAK: + break; + case END_OF_SENTENCE: + os << "."; + break; + case LDOTS: + os << "..."; + break; + case MENU_SEPARATOR: + os << "&lyxarrow;"; + break; + case PROTECTED_SEPARATOR: + os << " "; + break; + } + return 0; } -int InsetSpecialChar::docBook(Buffer const * buf, ostream & os) const +int InsetSpecialChar::docbook(Buffer const *, ostream & os) const { - return ascii(buf, os, 0); + switch (kind_) { + case HYPHENATION: + case LIGATURE_BREAK: + break; + case END_OF_SENTENCE: + os << "."; + break; + case LDOTS: + os << "..."; + break; + case MENU_SEPARATOR: + os << "&lyxarrow;"; + break; + case PROTECTED_SEPARATOR: + os << " "; + break; + } + return 0; } @@ -283,6 +319,30 @@ Inset * InsetSpecialChar::clone(Buffer const &, bool) const void InsetSpecialChar::validate(LaTeXFeatures & features) const { if (kind_ == MENU_SEPARATOR) { - features.lyxarrow = true; + features.require("lyxarrow"); } } + + +bool InsetSpecialChar::isChar() const +{ + return true; +} + + +bool InsetSpecialChar::isLetter() const +{ + return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK; +} + + +bool InsetSpecialChar::isSpace() const +{ + return kind_ == PROTECTED_SEPARATOR; +} + + +bool InsetSpecialChar::isLineSeparator() const +{ + return kind_ == HYPHENATION || kind_ == MENU_SEPARATOR; +}