lyx_mirror/src/frontends/qt4/GuiViewSource.h
André Pönitz 212386be8a merge ButtonController and its view (Qt2BC in this case)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20018 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-03 05:59:32 +00:00

85 lines
1.5 KiB
C++

// -*- 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