]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiParagraph.h
bc0e96d42a0a4cb7af039bef4aade27f7bd3a673
[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 <QDialog>
29 #include <QSettings>
30 #include <QShowEvent>
31 #include <QGridLayout>
32
33 #include <map>
34 #include <string>
35
36 namespace lyx {
37 namespace frontend {
38
39 class GuiParagraph
40         : public DialogView, public Ui::ParagraphUi
41 {
42         Q_OBJECT
43 public:
44         GuiParagraph(GuiView & lv);
45
46         /// Dialog inherited methods
47         //@{
48         void updateView();
49         void dispatchParams();
50         void enableView(bool enable);
51         bool isBufferDependent() const { return true; }
52         virtual kb_action getLfun() const { return LFUN_PARAGRAPH_PARAMS_APPLY; }
53         //@}
54
55 private:
56         ///
57         void checkAlignmentRadioButtons();
58         ///
59         void alignmentToRadioButtons(LyXAlignment align = LYX_ALIGN_LAYOUT);
60         ///
61         LyXAlignment getAlignmentFromDialog();
62         ///
63         ParagraphParameters & params();
64         ///
65         ParagraphParameters const & params() const;
66         ///
67         bool haveMultiParSelection();
68         ///
69         bool canIndent() const;
70         ///
71         LyXAlignment alignPossible() const;
72         ///
73         LyXAlignment alignDefault() const;
74
75 private Q_SLOTS:
76         ///
77         void changed();
78         ///
79         void on_synchronizedViewCB_toggled();
80         ///
81         void on_restorePB_clicked();
82         ///
83         void on_linespacing_activated(int);
84         /// Apply changes
85         void on_applyPB_clicked();
86
87 private:
88         ///
89         typedef std::map<LyXAlignment, QRadioButton *> RadioMap;
90         ///
91         RadioMap radioMap;
92         ///
93         typedef std::map<LyXAlignment, docstring> AlignmentLabels;
94         ///
95         AlignmentLabels labelMap;
96         ///
97         QString const alignDefaultLabel;
98         ///
99         ParagraphParameters multiparsel_;
100 };
101
102 } // namespace frontend
103 } // namespace lyx
104
105 #endif // QPARAGRAPH_H