X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetspecialchar.C;h=5de4d19e84d49899b586f4d5404a6485692eadbe;hb=b922cdd796f9e4b9a46a79808cdee596e04903eb;hp=7d322c1bc2ccc34c23baaf5b970ac15f00998efa;hpb=da7667356810c250a0875649d0b0291c90462c65;p=lyx.git diff --git a/src/insets/insetspecialchar.C b/src/insets/insetspecialchar.C index 7d322c1bc2..5de4d19e84 100644 --- a/src/insets/insetspecialchar.C +++ b/src/insets/insetspecialchar.C @@ -20,6 +20,7 @@ #include "Painter.h" #include "font.h" #include "lyxlex.h" +#include "lyxfont.h" using std::ostream; using std::max; @@ -193,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; @@ -263,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; } @@ -284,6 +319,18 @@ 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::isLetter() const +{ + return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK; +} + + +bool InsetSpecialChar::isSpace() const +{ + return kind_ == PROTECTED_SEPARATOR; +}