1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/* This file is part of*
|
2002-03-21 17:09:55 +00:00
|
|
|
* ======================================================
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2000-02-04 09:38:32 +00:00
|
|
|
* Copyright 1995 Matthias Ettrich
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
1999-11-15 10:58:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
#ifndef INSET_LATEX_ACCENT_H
|
|
|
|
#define INSET_LATEX_ACCENT_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
#include "inset.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "LString.h"
|
|
|
|
#include "lyxlex.h"
|
|
|
|
|
|
|
|
/** Insertion of accents
|
2002-03-21 17:09:55 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
Proper handling of accented characters.
|
|
|
|
This is class is supposed to handle all LaTeX accents, it
|
|
|
|
is also possible that the class will change a bit so that
|
|
|
|
it also can handle other special characters (e.g. Hstroke)
|
|
|
|
Initiated by Ivan Schreter, later modified by Lgb.
|
|
|
|
*/
|
1999-11-24 22:14:46 +00:00
|
|
|
class InsetLatexAccent : public Inset {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2000-07-15 23:51:46 +00:00
|
|
|
InsetLatexAccent();
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit
|
1999-10-02 16:21:10 +00:00
|
|
|
InsetLatexAccent(string const & string);
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int ascent(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int descent(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-07-05 14:57:48 +00:00
|
|
|
int width(BufferView *, LyXFont const &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2000-06-23 15:02:46 +00:00
|
|
|
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
int lbearing(LyXFont const & font) const;
|
1999-12-15 06:12:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
int rbearing(LyXFont const & font) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
bool displayISO8859_9(BufferView *, LyXFont const & font,
|
2000-02-10 17:53:36 +00:00
|
|
|
int baseline, float & x) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void write(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void read(Buffer const *, LyXLex & lex);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
int latex(Buffer const *, std::ostream &,
|
2000-07-15 23:51:46 +00:00
|
|
|
bool fragile, bool free_spc) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
int ascii(Buffer const *, std::ostream &, int linelen) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
int linuxdoc(Buffer const *, std::ostream &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2001-09-04 11:02:09 +00:00
|
|
|
int docbook(Buffer const *, std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
bool deletable() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
bool directWrite() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-07-06 15:57:54 +00:00
|
|
|
virtual Inset * clone(Buffer const &, bool same_id = false) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
Inset::Code lyxCode()const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
inline bool canDisplay();
|
2002-01-08 14:24:49 +00:00
|
|
|
// should this inset be handled like a normal charater
|
|
|
|
bool isChar() const { return true; }
|
2002-03-21 17:09:55 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// all the accent types
|
|
|
|
enum ACCENT_TYPES{
|
|
|
|
///
|
|
|
|
ACUTE, // 0
|
|
|
|
///
|
|
|
|
GRAVE,
|
|
|
|
///
|
|
|
|
MACRON,
|
|
|
|
///
|
|
|
|
TILDE,
|
|
|
|
///
|
|
|
|
UNDERBAR,
|
|
|
|
///
|
|
|
|
CEDILLA, // 5
|
|
|
|
///
|
|
|
|
UNDERDOT,
|
|
|
|
///
|
|
|
|
CIRCLE,
|
|
|
|
///
|
|
|
|
TIE,
|
|
|
|
///
|
|
|
|
BREVE,
|
|
|
|
///
|
|
|
|
CARON, // 10
|
|
|
|
///
|
|
|
|
SPECIAL_CARON,
|
|
|
|
///
|
|
|
|
HUNGARIAN_UMLAUT,
|
|
|
|
///
|
|
|
|
UMLAUT,
|
|
|
|
///
|
|
|
|
DOT,
|
|
|
|
///
|
|
|
|
CIRCUMFLEX, // 15
|
|
|
|
///
|
|
|
|
OGONEK,
|
|
|
|
///
|
|
|
|
DOT_LESS_I,
|
|
|
|
///
|
2002-03-21 17:09:55 +00:00
|
|
|
DOT_LESS_J, // 18
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2002-03-21 17:09:55 +00:00
|
|
|
lSLASH,
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2002-03-21 17:09:55 +00:00
|
|
|
LSLASH
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
1999-12-20 17:38:37 +00:00
|
|
|
private:
|
2000-04-04 00:19:15 +00:00
|
|
|
friend std::ostream & operator<<(std::ostream &, ACCENT_TYPES);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Check if we know the modifier and can display it ok on screen.
|
|
|
|
void checkContents();
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
string contents;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// can display as proper char
|
|
|
|
bool candisp;
|
|
|
|
/// modifier type
|
|
|
|
ACCENT_TYPES modtype;
|
2002-03-21 17:09:55 +00:00
|
|
|
|
1999-11-15 10:58:38 +00:00
|
|
|
/// remove dot from 'i' and 'j' or transform l, L into lslash, LSLaSH
|
1999-09-27 18:44:28 +00:00
|
|
|
bool remdot;
|
|
|
|
/// add something to ascent - accent at the top
|
|
|
|
bool plusasc;
|
|
|
|
/// add something to descent - underlined char
|
|
|
|
bool plusdesc;
|
|
|
|
/// international char
|
2002-03-21 17:09:55 +00:00
|
|
|
mutable char ic;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2000-07-15 23:51:46 +00:00
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
bool InsetLatexAccent::canDisplay()
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
return candisp;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|