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,
|
2017-03-06 13:49:30 +00:00
|
|
|
/// Optional line wrap point without hyphen (ZWSP)
|
|
|
|
ALLOWBREAK,
|
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
|
2015-03-01 10:16:57 +00:00
|
|
|
NOBREAKDASH,
|
|
|
|
/// LyX logo
|
|
|
|
PHRASE_LYX,
|
|
|
|
/// TeX logo
|
|
|
|
PHRASE_TEX,
|
|
|
|
/// LaTeX2e logo
|
|
|
|
PHRASE_LATEX2E,
|
|
|
|
/// LaTeX logo
|
|
|
|
PHRASE_LATEX
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
///
|
2015-09-13 17:47:21 +00:00
|
|
|
InsetSpecialChar() : Inset(0), kind_(HYPHENATION) {}
|
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;
|
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
docstring toolTip(BufferView const & bv, int x, int y) const override;
|
2020-06-23 21:34:49 +00:00
|
|
|
/// some special chars allow line breaking after them
|
2021-07-11 22:07:59 +00:00
|
|
|
int rowFlags() const override;
|
2017-03-06 13:49:30 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void metrics(MetricsInfo &, Dimension &) const override;
|
2000-02-10 17:53:36 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void draw(PainterInfo & pi, int x, int y) const override;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void write(std::ostream &) const override;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Will not be used when lyxf3
|
2020-10-01 07:42:11 +00:00
|
|
|
void read(Lexer & lex) override;
|
2002-03-21 17:09:55 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const override;
|
2000-03-06 02:42:40 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
2020-10-01 07:42:11 +00:00
|
|
|
size_t max_length = INT_MAX) const override;
|
2000-04-24 20:58:23 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void docbook(XMLStream &, OutputParams const &) const override;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
docstring xhtml(XMLStream &, OutputParams const &) const override;
|
2010-12-15 01:34:04 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void toString(odocstream &) const override;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
bool isInToc() const override { return true; }
|
2016-08-05 01:09:32 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void forOutliner(docstring &, size_t const, bool const) const override;
|
2010-12-20 21:55:09 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
InsetCode lyxCode() const override { return SPECIALCHAR_CODE; }
|
1999-09-27 18:44:28 +00:00
|
|
|
/// We don't need \begin_inset and \end_inset
|
2020-10-01 07:42:11 +00:00
|
|
|
bool directWrite() const override { return true; }
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void validate(LaTeXFeatures &) const override;
|
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?
|
2020-10-01 07:42:11 +00:00
|
|
|
bool isChar() const override;
|
2001-11-13 14:47:35 +00:00
|
|
|
/// is this equivalent to a letter?
|
2020-10-01 07:42:11 +00:00
|
|
|
bool isLetter() const override;
|
2011-03-15 13:19:55 +00:00
|
|
|
/// should we break lines after this inset?
|
2020-10-01 07:42:11 +00:00
|
|
|
bool isLineSeparator() const override;
|
2016-12-27 11:06:54 +00:00
|
|
|
/// Is the content of this inset part of the immediate (visible) text sequence?
|
2020-10-01 07:42:11 +00:00
|
|
|
bool isPartOfTextSequence() const override { return isChar(); }
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2020-10-01 07:42:11 +00:00
|
|
|
Inset * clone() const override { 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
|