1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetSpecialChar.h
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
1999-09-27 18:44:28 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* \author Asger Alstrup Nielsen
|
|
|
|
* \author Jean-Marc Lasgouttes
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-25 14:26:13 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef INSET_SPECIALCHAR_H
|
|
|
|
#define INSET_SPECIALCHAR_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
#include "Inset.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
class LaTeXFeatures;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Used to insert special chars
|
2007-04-29 13:39:47 +00:00
|
|
|
class InsetSpecialChar : public Inset {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
/// The different kinds of special chars we support
|
|
|
|
enum Kind {
|
|
|
|
/// Optional hyphenation point (\-)
|
|
|
|
HYPHENATION,
|
2001-07-20 13:04:36 +00:00
|
|
|
/// Ligature break point (\textcompwordmark)
|
|
|
|
LIGATURE_BREAK,
|
1999-09-27 18:44:28 +00:00
|
|
|
/// ... (\ldots)
|
|
|
|
LDOTS,
|
|
|
|
/// End of sentence punctuation (\@)
|
|
|
|
END_OF_SENTENCE,
|
|
|
|
/// Menu separator
|
2000-02-29 02:19:17 +00:00
|
|
|
MENU_SEPARATOR,
|
2007-12-06 11:04:56 +00:00
|
|
|
/// breakable slash
|
|
|
|
SLASH,
|
|
|
|
/// protected dash
|
|
|
|
NOBREAKDASH,
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
InsetSpecialChar() {}
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
explicit InsetSpecialChar(Kind k);
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2001-07-23 09:11:14 +00:00
|
|
|
Kind kind() const;
|
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2003-05-30 06:48:24 +00:00
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Will not be used when lyxf3
|
2008-02-27 20:43:16 +00:00
|
|
|
void read(Lexer & lex);
|
2002-03-21 17:09:55 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int latex(odocstream &, OutputParams const &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2005-11-25 14:40:34 +00:00
|
|
|
/// the string that is passed to the TOC
|
2008-11-10 22:45:14 +00:00
|
|
|
void tocString(odocstream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return SPECIALCHAR_CODE; }
|
1999-09-27 18:44:28 +00:00
|
|
|
/// We don't need \begin_inset and \end_inset
|
2003-03-11 15:01:29 +00:00
|
|
|
bool directWrite() const { return true; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
2002-03-21 17:09:55 +00:00
|
|
|
|
2002-01-08 14:24:49 +00:00
|
|
|
// should this inset be handled like a normal charater
|
|
|
|
bool isChar() const;
|
2001-11-13 14:47:35 +00:00
|
|
|
/// is this equivalent to a letter?
|
|
|
|
bool isLetter() const;
|
2002-02-13 10:37:28 +00:00
|
|
|
// should we break lines after this inset?
|
|
|
|
bool isLineSeparator() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2008-02-29 20:16:04 +00:00
|
|
|
Inset * clone() const { return new InsetSpecialChar(*this); };
|
2004-11-23 23:04:52 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// And which kind is this?
|
2001-07-23 09:11:14 +00:00
|
|
|
Kind kind_;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|