]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetSpecialChar.cpp
The last commit was, uhh, not what I intended.
[lyx.git] / src / insets / InsetSpecialChar.cpp
index 0463795ee1210df7279b7b2d904edaab2c116365..1dd92c5901a1d46a0f078fdfde7dfe8988a5afff 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "InsetSpecialChar.h"
 
-#include "support/debug.h"
 #include "Dimension.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
+#include "support/debug.h"
 #include "support/docstream.h"
 
-namespace lyx {
+using namespace std;
 
-using std::string;
-using std::ostream;
+namespace lyx {
 
 
 InsetSpecialChar::InsetSpecialChar(Kind k)
@@ -149,7 +148,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
 
 
 // In lyxf3 this will be just LaTeX
-void InsetSpecialChar::write(Buffer const &, ostream & os) const
+void InsetSpecialChar::write(ostream & os) const
 {
        string command;
        switch (kind_) {
@@ -180,7 +179,7 @@ void InsetSpecialChar::write(Buffer const &, ostream & os) const
 
 
 // This function will not be necessary when lyx3
-void InsetSpecialChar::read(Buffer const &, Lexer & lex)
+void InsetSpecialChar::read(Lexer & lex)
 {
        lex.next();
        string const command = lex.getString();
@@ -204,8 +203,8 @@ void InsetSpecialChar::read(Buffer const &, Lexer & lex)
 }
 
 
-int InsetSpecialChar::latex(Buffer const &, odocstream & os,
-                           OutputParams const &) const
+int InsetSpecialChar::latex(odocstream & os,
+                           OutputParams const & rp) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -227,6 +226,8 @@ int InsetSpecialChar::latex(Buffer const &, odocstream & os,
                os << "\\slash{}";
                break;
        case NOBREAKDASH:
+               if (rp.moving_arg)
+                       os << "\\protect";
                os << "\\nobreakdash-";
                break;
        }
@@ -234,8 +235,7 @@ int InsetSpecialChar::latex(Buffer const &, odocstream & os,
 }
 
 
-int InsetSpecialChar::plaintext(Buffer const &, odocstream & os,
-                               OutputParams const &) const
+int InsetSpecialChar::plaintext(odocstream & os, OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -261,8 +261,7 @@ int InsetSpecialChar::plaintext(Buffer const &, odocstream & os,
 }
 
 
-int InsetSpecialChar::docbook(Buffer const &, odocstream & os,
-                             OutputParams const &) const
+int InsetSpecialChar::docbook(odocstream & os, OutputParams const &) const
 {
        switch (kind_) {
        case HYPHENATION:
@@ -288,16 +287,9 @@ int InsetSpecialChar::docbook(Buffer const &, odocstream & os,
 }
 
 
-int InsetSpecialChar::textString(Buffer const & buf, odocstream & os,
-                      OutputParams const & op) const
-{
-       return plaintext(buf, os, op);
-}
-
-
-Inset * InsetSpecialChar::clone() const
+void InsetSpecialChar::textString(odocstream & os) const
 {
-       return new InsetSpecialChar(kind_);
+       plaintext(os, OutputParams(0));
 }