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
|
2010-12-17 19:56:51 +00:00
|
|
|
NOBREAKDASH
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
///
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetSpecialChar() : Inset(0) {}
|
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
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
|
|
size_t max_length = INT_MAX) const;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2009-11-25 22:04:41 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2010-12-15 01:34:04 +00:00
|
|
|
///
|
|
|
|
void toString(odocstream &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2010-12-20 21:55:09 +00:00
|
|
|
void forToc(docstring &, size_t) const;
|
|
|
|
///
|
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
|
|
|
|
2011-03-15 13:27:08 +00:00
|
|
|
/// should this inset be handled like a normal character?
|
2010-09-14 12:39:33 +00:00
|
|
|
bool isChar() const { return true; }
|
2001-11-13 14:47:35 +00:00
|
|
|
/// is this equivalent to a letter?
|
|
|
|
bool isLetter() const;
|
2011-03-15 13:19:55 +00:00
|
|
|
/// should we break lines after this inset?
|
2002-02-13 10:37:28 +00:00
|
|
|
bool isLineSeparator() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2013-05-12 11:00:02 +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
|