]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetSpecialChar.cpp
Remove all BufferParam arguments in InsetXXX methods (since insets know about their...
[lyx.git] / src / insets / InsetSpecialChar.cpp
index 09d14be295bc6532288b5d73f3dbb6e3851f8d0b..205e1f9f1dd5b93884d880f807bf14ea7628cadc 100644 (file)
@@ -5,7 +5,7 @@
  *
  * \author Asger Alstrup Nielsen
  * \author Jean-Marc Lasgouttes
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -14,8 +14,8 @@
 
 #include "InsetSpecialChar.h"
 
-#include "support/debug.h"
 #include "Dimension.h"
+#include "Font.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
@@ -23,6 +23,7 @@
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
+#include "support/debug.h"
 #include "support/docstream.h"
 
 using namespace std;
@@ -148,7 +149,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_) {
@@ -179,7 +180,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();
@@ -203,8 +204,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:
@@ -220,12 +221,17 @@ int InsetSpecialChar::latex(Buffer const &, odocstream & os,
                os << "\\ldots{}";
                break;
        case MENU_SEPARATOR:
-               os << "\\lyxarrow{}";
+               if (rp.local_font->isRightToLeft())
+                       os << "\\lyxarrow*{}";
+               else
+                       os << "\\lyxarrow{}";
                break;
        case SLASH:
                os << "\\slash{}";
                break;
        case NOBREAKDASH:
+               if (rp.moving_arg)
+                       os << "\\protect";
                os << "\\nobreakdash-";
                break;
        }
@@ -233,8 +239,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:
@@ -260,8 +265,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:
@@ -287,15 +291,35 @@ int InsetSpecialChar::docbook(Buffer const &, odocstream & os,
 }
 
 
-void InsetSpecialChar::textString(Buffer const & buf, odocstream & os) const
+docstring InsetSpecialChar::xhtml(odocstream & os, OutputParams const &) const
 {
-       plaintext(buf, os, OutputParams(0));
+       switch (kind_) {
+       case HYPHENATION:
+       case LIGATURE_BREAK:
+               break;
+       case END_OF_SENTENCE:
+               os << '.';
+               break;
+       case LDOTS:
+               os << "&hellip;";
+               break;
+       case MENU_SEPARATOR:
+               os << "&rArr;";
+               break;
+       case SLASH:
+               os << "&frasl;";
+               break;
+       case NOBREAKDASH:
+               os << '-';
+               break;
+       }
+       return docstring();
 }
 
 
-Inset * InsetSpecialChar::clone() const
+void InsetSpecialChar::tocString(odocstream & os) const
 {
-       return new InsetSpecialChar(kind_);
+       plaintext(os, OutputParams(0));
 }