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 &);
48 void update(bool full_source);
52 GuiViewSource & controller_;
54 QTextDocument * document_;
55 /// LaTeX syntax highlighter
56 LaTeXHighlighter * highlighter_;
60 class GuiViewSource : public DockView
66 GuiView & parent, ///< the main window where to dock.
67 Qt::DockWidgetArea area = Qt::BottomDockWidgetArea, ///< Position of the dock (and also drawer)
68 Qt::WindowFlags flags = 0);
72 /// Controller inherited method.
74 bool initialiseParams(std::string const & source);
76 void dispatchParams() {}
77 bool isBufferDependent() const { return true; }
78 bool canApply() const { return true; }
79 bool canApplyToReadOnly() const { return true; }
83 /// The title displayed by the dialog reflects source type.
84 QString title() const;
86 /** get the source code of selected paragraphs, or the whole document
87 \param fullSource get full source code
89 QString getContent(bool fullSource);
90 /** get the cursor position in the source code
92 std::pair<int, int> getRows() const;
95 /// The encapsulated widget.
96 ViewSourceWidget * widget_;
99 } // namespace frontend
102 #endif // GUIVIEWSOURCE_H