lyx_mirror/src/frontends/qt4/GuiViewSource.h

85 lines
1.5 KiB
C
Raw Normal View History

// -*- C++ -*-
/**
* \file GuiViewSource.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
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef GUIVIEWSOURCE_H
#define GUIVIEWSOURCE_H
#include "ControlViewSource.h"
#include "GuiDialog.h"
#include "Application.h"
#include "ui_ViewSourceUi.h"
#include <QWidget>
#include <QSyntaxHighlighter>
#include <QTextCharFormat>
class QTextDocument;
namespace lyx {
namespace frontend {
// used already twice...
class LaTeXHighlighter : public QSyntaxHighlighter
{
public:
LaTeXHighlighter(QTextDocument * parent);
protected:
void highlightBlock(QString const & text);
private:
QTextCharFormat commentFormat;
QTextCharFormat keywordFormat;
QTextCharFormat mathFormat;
};
class GuiViewSource;
class GuiViewSourceDialog : public QWidget, public Ui::ViewSourceUi {
Q_OBJECT
public:
GuiViewSourceDialog(GuiViewSource * form);
public Q_SLOTS:
// update content
void update();
private:
GuiViewSource * form_;
};
///
class GuiViewSource : public QObject, public ControlViewSource {
public:
///
GuiViewSource(GuiDialog &);
///
QTextDocument * document() { return document_; }
///
void update(bool full_source);
private:
///
QTextDocument * document_;
/// LaTeX syntax highlighter
LaTeXHighlighter * highlighter_;
};
} // namespace frontend
} // namespace lyx
#endif // GUIVIEWSOURCE_H