3 * \file insetlatexaccent.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
12 #ifndef INSET_LATEX_ACCENT_H
13 #define INSET_LATEX_ACCENT_H
16 #include "support/types.h"
21 /** Insertion of accents
23 Proper handling of accented characters.
24 This is class is supposed to handle all LaTeX accents, it
25 is also possible that the class will change a bit so that
26 it also can handle other special characters (e.g. Hstroke)
27 Initiated by Ivan Schreter, later modified by Lgb.
29 class InsetLatexAccent : public InsetOld {
34 explicit InsetLatexAccent(std::string const & str);
36 void metrics(MetricsInfo &, Dimension &) const;
38 void draw(PainterInfo & pi, int x, int y) const;
40 int lbearing(LyXFont const & font) const;
42 int rbearing(LyXFont const & font) const;
44 bool displayISO8859_9(PainterInfo & pi, int x, int y) const;
46 void write(Buffer const &, std::ostream &) const;
48 void read(Buffer const &, LyXLex & lex);
50 int latex(Buffer const &, std::ostream &,
51 OutputParams const &) const;
53 int plaintext(Buffer const &, std::ostream &,
54 OutputParams const &) const;
56 int linuxdoc(Buffer const &, std::ostream &,
57 OutputParams const &) const;
59 int docbook(Buffer const &, std::ostream &,
60 OutputParams const &) const;
61 /// the string that is passed to the TOC
62 virtual int textString(Buffer const &, std::ostream & os,
63 OutputParams const &) const;
65 bool directWrite() const;
67 InsetBase::Code lyxCode()const;
69 inline bool canDisplay();
70 // should this inset be handled like a normal charater
71 bool isChar() const { return true; }
73 /// is this equivalent to a letter?
74 virtual bool isLetter() const { return candisp; }
76 /// all the accent types
122 friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
124 virtual std::auto_ptr<InsetBase> doClone() const;
126 /// Check if we know the modifier and can display it ok on screen.
127 void checkContents();
129 void drawAccent(PainterInfo const & pi, int x, int y, lyx::char_type accent) const;
131 std::string contents;
132 /// can display as proper char
135 ACCENT_TYPES modtype;
137 /// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
139 /// add something to ascent - accent at the top
141 /// add something to descent - underlined char
143 /// international char
148 bool InsetLatexAccent::canDisplay()