32#include <QContextMenuEvent>
34#include <QSyntaxHighlighter>
35#include <QTextCharFormat>
45struct KLFLatexEditPrivate;
127struct KLFLatexParenSpecsPrivate;
171 int identifyParen(
const QString& parenstr, uint identflags);
177 int identifyModifier(
const QString& modstr, uint identflags);
240 QList<ParsedBlock> parsedBlocksForPos(
int pos,
unsigned int filter_type = 0xffffffff)
const;
242 virtual void highlightBlock(
const QString& text);
275 QTextEdit *_textedit;
279 enum Format { FNormal = 0, FKeyWord, FComment, FParenMatch, FParenMismatch, FLonelyParen };
282 FormatRule(
int ps = -1,
int l = 0, Format f = FNormal,
bool needsfocus =
false)
283 : pos(ps), len(l),
format(f), onlyIfFocus(needsfocus)
292 int end()
const {
return pos + len; }
297 QList<FormatRule> _rulestoapply;
299 QList<ParsedBlock> pParsedBlocks;
301 void parseEverything();
303 QTextCharFormat charfmtForFormat(Format f);
307 QStringList pTypedSymbols;
311 bool highlightParensOnly;
312 bool highlightLonelyParens;
313 QTextCharFormat fmtKeyword;
314 QTextCharFormat fmtComment;
315 QTextCharFormat fmtParenMatch;
316 QTextCharFormat fmtParenMismatch;
317 QTextCharFormat fmtLonelyParen;
An abstract handler for when data is dropped.
void setPalette(const QPalette &palette)
KLFLatexSyntaxHighlighter * syntaxHighlighter()
void setLatex(const QString &latex)
virtual void contextMenuEvent(QContextMenuEvent *event)
KLFLatexEdit(QWidget *parent)
virtual void insertFromMimeData(const QMimeData *source)
virtual QSize sizeHint() const
void setDropDataHandler(KLFDropDataHandler *handler)
void insertDelimiter(const QString &delim, int charsBack=1)
void setWrapLines(bool wrap)
void setHeightHintLines(int lines)
void insertContextMenuActions(const QPoint &pos, QList< QAction * > *actionList)
virtual bool canInsertFromMimeData(const QMimeData *source) const
QStringList openParenList() const
QList< ParenModifierSpec > parenModifierSpecList() const
QStringList openParenModifiers() const
QList< ParenSpec > parenSpecList() const
@ IdentifyFlagClose
Identify the paren as closing only.
@ IdentifyFlagOpen
Identify the paren as opening only.
@ IdentifyFlagOpenClose
Identify the paren as opening or closing.
QStringList closeParenModifiers() const
QStringList closeParenList() const
QTextFormat fmtParenMismatch
void setFmtParenMatch(const QTextFormat &f)
QTextCharFormat fmtLonelyParen() const
QTextFormat fmtLonelyParen
KLFLatexSyntaxHighlighter(QTextEdit *textedit, QObject *parent)
bool highlightLonelyParens() const
QTextCharFormat fmtParenMatch() const
void setFmtKeyword(const QTextFormat &f)
void setFmtLonelyParen(const QTextFormat &f)
bool highlightEnabled() const
void setFmtParenMismatch(const QTextFormat &f)
void newSymbolTyped(const QString &symbolName)
bool highlightParensOnly() const
void setCaretPos(int position)
QList< ParsedBlock > parsedContent() const
void setHighlightEnabled(bool on)
bool highlightLonelyParens
void setHighlightParensOnly(bool on)
QTextCharFormat fmtParenMismatch() const
QTextFormat fmtParenMatch
void setFmtComment(const QTextFormat &f)
QTextCharFormat fmtComment() const
void setHighlightLonelyParens(bool on)
QTextCharFormat fmtKeyword() const
Base declarations for klatexformula and some utilities.
#define KLF_DECLARE_PRIVATE(ClassName)
KLF_EXPORT QDebug operator<<(QDebug str, const KLFLatexSyntaxHighlighter::ParsedBlock &p)
QSyntaxHighlighter(QObject *parent)
ParenModifierSpec(const QString &o, const QString &c)
ParenSpec(const QString &o, const QString &c, uint f=0x00)
static KLFLatexParenSpecs parenSpecs
bool parenIsLatexBrace() const
ParsedBlock(Type t=Normal, int a=-1, int l=-1)