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 "support/debug.h"
25 #include <QDockWidget>
27 #include <QTextCharFormat>
35 class LaTeXHighlighter;
37 class ViewSourceWidget : public QWidget, public Ui::ViewSourceUi
42 ViewSourceWidget(GuiViewSource &);
50 GuiViewSource & controller_;
52 QTextDocument * document_;
53 /// LaTeX syntax highlighter
54 LaTeXHighlighter * highlighter_;
58 class GuiViewSource : public DockView
64 GuiView & parent, ///< the main window where to dock.
65 Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, ///< Position of the dock (and also drawer)
66 Qt::WindowFlags flags = 0);
70 /// Controller inherited method.
72 bool initialiseParams(std::string const & source);
74 void dispatchParams() {}
75 bool isBufferDependent() const { return true; }
76 bool canApply() const { return true; }
77 bool canApplyToReadOnly() const { return true; }
79 void enableView(bool enable);
80 void saveSession() const;
81 void restoreSession();
84 /// The title displayed by the dialog reflects source type.
85 QString title() const;
87 /** get the source code of selected paragraphs, or the whole document
88 \param fullSource get full source code
90 QString getContent(bool fullSource);
91 // cursor position in the source code
92 struct Row { int begin; int end; };
96 /// The encapsulated widget.
97 ViewSourceWidget * widget_;
100 } // namespace frontend
103 #endif // GUIVIEWSOURCE_H