*
* \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.
*/
#include "InsetSpecialChar.h"
#include "Dimension.h"
+#include "Font.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "MetricsInfo.h"
+#include "output_xhtml.h"
#include "frontends/FontMetrics.h"
#include "frontends/Painter.h"
InsetSpecialChar::InsetSpecialChar(Kind k)
- : kind_(k)
+ : Inset(0), kind_(k)
{}
}
-int InsetSpecialChar::latex(odocstream & os,
- OutputParams const & rp) const
+void InsetSpecialChar::latex(otexstream & os,
+ OutputParams const & rp) const
{
switch (kind_) {
case HYPHENATION:
os << "\\ldots{}";
break;
case MENU_SEPARATOR:
- os << "\\lyxarrow{}";
+ if (rp.local_font->isRightToLeft())
+ os << "\\lyxarrow*{}";
+ else
+ os << "\\lyxarrow{}";
break;
case SLASH:
os << "\\slash{}";
os << "\\nobreakdash-";
break;
}
- return 0;
}
}
-void InsetSpecialChar::tocString(odocstream & os) const
+docstring InsetSpecialChar::xhtml(XHTMLStream & xs, OutputParams const &) const
+{
+ switch (kind_) {
+ case HYPHENATION:
+ case LIGATURE_BREAK:
+ break;
+ case END_OF_SENTENCE:
+ xs << '.';
+ break;
+ case LDOTS:
+ xs << XHTMLStream::ESCAPE_NONE << "…";
+ break;
+ case MENU_SEPARATOR:
+ xs << XHTMLStream::ESCAPE_NONE << "⇒";
+ break;
+ case SLASH:
+ xs << XHTMLStream::ESCAPE_NONE << "⁄";
+ break;
+ case NOBREAKDASH:
+ xs << '-';
+ break;
+ }
+ return docstring();
+}
+
+
+void InsetSpecialChar::toString(odocstream & os) const
{
plaintext(os, OutputParams(0));
}
+void InsetSpecialChar::forToc(docstring & os, size_t) const
+{
+ odocstringstream ods;
+ plaintext(ods, OutputParams(0));
+ os += ods.str();
+}
+
+
void InsetSpecialChar::validate(LaTeXFeatures & features) const
{
if (kind_ == MENU_SEPARATOR)
}
-bool InsetSpecialChar::isChar() const
-{
- return true;
-}
-
-
bool InsetSpecialChar::isLetter() const
{
- return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK;
+ return kind_ == HYPHENATION || kind_ == LIGATURE_BREAK
+ || kind_ == NOBREAKDASH;
}
// Paragraph::stripLeadingSpaces nukes the characters which
// have this property. I leave the code here, since it should
// eventually be made to work. (JMarc 20020327)
- return kind_ == HYPHENATION || kind_ == MENU_SEPARATOR;
+ return kind_ == HYPHENATION || kind_ == MENU_SEPARATOR
+ || kind_ == SLASH;
#else
return false;
#endif