2006-04-15 14:13:41 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file QViewSource.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
* \author Bo Peng
|
2007-03-25 01:25:29 +00:00
|
|
|
* \author Abdelrazak Younes
|
2006-04-15 14:13:41 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef QVIEWSOURCE_H
|
|
|
|
#define QVIEWSOURCE_H
|
|
|
|
|
2007-03-25 01:25:29 +00:00
|
|
|
#include "frontends/controllers/ControlViewSource.h"
|
2007-02-13 18:27:46 +00:00
|
|
|
|
2007-03-25 01:25:29 +00:00
|
|
|
#include <QObject>
|
2006-04-15 14:13:41 +00:00
|
|
|
#include <QSyntaxHighlighter>
|
2007-03-25 01:25:29 +00:00
|
|
|
#include <QTextCharFormat>
|
|
|
|
#include <QTextDocument>
|
2006-04-15 14:13:41 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
///
|
|
|
|
class latexHighlighter : public QSyntaxHighlighter
|
|
|
|
{
|
2007-03-25 01:25:29 +00:00
|
|
|
Q_OBJECT
|
2006-04-15 14:13:41 +00:00
|
|
|
public:
|
|
|
|
latexHighlighter(QTextDocument * parent);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void highlightBlock(QString const & text);
|
|
|
|
|
|
|
|
private:
|
|
|
|
QTextCharFormat commentFormat;
|
|
|
|
QTextCharFormat keywordFormat;
|
|
|
|
QTextCharFormat mathFormat;
|
|
|
|
};
|
|
|
|
|
2007-03-25 01:25:29 +00:00
|
|
|
///
|
|
|
|
class QViewSource: public QObject, public ControlViewSource
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
QViewSource(Dialog &);
|
|
|
|
virtual ~QViewSource() {}
|
|
|
|
|
|
|
|
QTextDocument * document() { return document_; }
|
|
|
|
|
|
|
|
void update(bool full_source);
|
|
|
|
|
|
|
|
private:
|
|
|
|
///
|
|
|
|
QTextDocument * document_;
|
|
|
|
|
|
|
|
/// latex syntax highlighter
|
|
|
|
latexHighlighter * highlighter_;
|
|
|
|
};
|
|
|
|
|
2006-04-15 14:13:41 +00:00
|
|
|
|
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif // QVIEWSOURCE_H
|