]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetspecialchar.C
Don't remove cell selections after fontchange.
[lyx.git] / src / insets / insetspecialchar.C
index 7d322c1bc2ccc34c23baaf5b970ac15f00998efa..0c03dde33cea8adad5b0a3fd02d71bdd545a99de 100644 (file)
@@ -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 << "&nbsp;";
+               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 << "&nbsp;";
+               break;
+       }
+       return 0;
 }
 
 
@@ -284,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;
+}