3 * \file GuiViewSource.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * \author Abdelrazak Younes
11 * Full author contact details are available in file CREDITS.
14 #ifndef GUIVIEWSOURCE_H
15 #define GUIVIEWSOURCE_H
17 #include "ui_ViewSourceUi.h"
21 #include "qt_helpers.h"
23 #include <QDockWidget>
25 #include <QTextCharFormat>
33 class LaTeXHighlighter;
35 class ViewSourceWidget : public QWidget, public Ui::ViewSourceUi
42 void setBufferView(BufferView const * bv);
50 void updateDefaultFormat();
52 void contentsChanged();
56 BufferView const * bv_;
58 QTextDocument * document_;
59 /// LaTeX syntax highlighter
60 LaTeXHighlighter * highlighter_;
62 bool force_getcontent_;
68 class GuiViewSource : public DockView
74 GuiView & parent, ///< the main window where to dock.
75 Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, ///< Position of the dock (and also drawer)
76 Qt::WindowFlags flags = 0);
80 /// Controller inherited method.
82 bool initialiseParams(std::string const & source);
84 void dispatchParams() {}
85 bool isBufferDependent() const { return true; }
86 bool canApply() const { return true; }
87 bool canApplyToReadOnly() const { return true; }
89 void enableView(bool enable);
90 void saveSession() const;
91 void restoreSession();
92 bool wantInitialFocus() const { return false; }
95 /// The title displayed by the dialog reflects source type.
96 QString title() const;
99 /// The encapsulated widget.
100 ViewSourceWidget * widget_;
103 } // namespace frontend
106 #endif // GUIVIEWSOURCE_H