]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiParagraph.h
Fix a crash following the input of an invalid paragraph separation value in the docum...
[lyx.git] / src / frontends / qt4 / GuiParagraph.h
1 // -*- C++ -*-
2 /**
3  * \file GuiParagraph.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Edwin Leuven
8  * \author John Levon
9  * \author Abdelrazak Younes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUIPARAGRAPH_H
15 #define GUIPARAGRAPH_H
16
17 // Uncomment this if you prefer dock widget
18 //#define USE_DOCK_WIDGET
19
20 #include "Layout.h"
21 #include "ui_ParagraphUi.h"
22 #include "DialogView.h"
23 #include "ParagraphParameters.h"
24 #include "GuiView.h"
25 #include "qt_helpers.h"
26 #include "support/debug.h"
27
28 #include <QCloseEvent>
29 #include <QDialog>
30 #include <QSettings>
31 #include <QShowEvent>
32 #include <QGridLayout>
33
34 #include <map>
35 #include <string>
36
37 namespace lyx {
38 namespace frontend {
39
40 class GuiParagraph
41         : public DialogView, public Ui::ParagraphUi
42 {
43         Q_OBJECT
44 public:
45         GuiParagraph(GuiView & lv);
46
47         /// Dialog inherited methods
48         //@{
49         void updateView();
50         void dispatchParams();
51         void enableView(bool enable);
52         bool isBufferDependent() const { return true; }
53         virtual kb_action getLfun() const { return LFUN_PARAGRAPH_PARAMS_APPLY; }
54         //@}
55
56 private:
57         ///
58         void checkAlignmentRadioButtons();
59         ///
60         void alignmentToRadioButtons(LyXAlignment align = LYX_ALIGN_LAYOUT);
61         ///
62         LyXAlignment getAlignmentFromDialog();
63         ///
64         ParagraphParameters & params();
65         ///
66         ParagraphParameters const & params() const;
67         ///
68         bool haveMultiParSelection();
69         ///
70         bool canIndent() const;
71         ///
72         LyXAlignment alignPossible() const;
73         ///
74         LyXAlignment alignDefault() const;
75
76 private Q_SLOTS:
77         ///
78         void changed();
79         ///
80         void on_synchronizedViewCB_toggled();
81         ///
82         void on_restorePB_clicked();
83         ///
84         void on_linespacing_activated(int);
85         /// Apply changes
86         void on_applyPB_clicked();
87
88 private:
89         ///
90         typedef std::map<LyXAlignment, QRadioButton *> RadioMap;
91         ///
92         RadioMap radioMap;
93         ///
94         typedef std::map<LyXAlignment, docstring> AlignmentLabels;
95         ///
96         AlignmentLabels labelMap;
97         ///
98         QString const alignDefaultLabel;
99         ///
100         ParagraphParameters multiparsel_;
101 };
102
103 } // namespace frontend
104 } // namespace lyx
105
106 #endif // QPARAGRAPH_H