Changeset View
Changeset View
Standalone View
Standalone View
src/part/KgvPageLayoutDia.h
Show All 24 Lines | 19 | /* This file was part of the KDE project | |||
---|---|---|---|---|---|
25 | version 2 of the License, or (at your option) any later version. | 25 | version 2 of the License, or (at your option) any later version. | ||
26 | */ | 26 | */ | ||
27 | 27 | | |||
28 | // Description: Page Layout Dialog (header) | 28 | // Description: Page Layout Dialog (header) | ||
29 | 29 | | |||
30 | #ifndef KGVPAGELAYOUTDIA_H | 30 | #ifndef KGVPAGELAYOUTDIA_H | ||
31 | #define KGVPAGELAYOUTDIA_H | 31 | #define KGVPAGELAYOUTDIA_H | ||
32 | 32 | | |||
33 | #include <QGroupBox> | | |||
34 | #include <KgvUnit.h> | | |||
35 | #include <kpagedialog.h> | | |||
36 | #include <KgvPageLayout.h> | 33 | #include <KgvPageLayout.h> | ||
34 | #include <KgvUnit.h> | ||||
35 | #include <QGroupBox> | ||||
37 | #include <QLineEdit> | 36 | #include <QLineEdit> | ||
37 | #include <kpagedialog.h> | ||||
38 | 38 | | |||
39 | class KLineEdit; | 39 | class KLineEdit; | ||
40 | class QPaintEvent; | 40 | class QPaintEvent; | ||
41 | 41 | | |||
42 | class KgvPageLayoutColumns; | 42 | class KgvPageLayoutColumns; | ||
43 | class KgvPageLayoutSize; | 43 | class KgvPageLayoutSize; | ||
44 | class KgvPageLayoutHeader; | 44 | class KgvPageLayoutHeader; | ||
45 | 45 | | |||
46 | enum { FORMAT_AND_BORDERS = 1, HEADER_AND_FOOTER = 2, COLUMNS = 4, DISABLE_BORDERS = 8, | 46 | enum { FORMAT_AND_BORDERS = 1, HEADER_AND_FOOTER = 2, COLUMNS = 4, DISABLE_BORDERS = 8, KW_HEADER_AND_FOOTER = 16, DISABLE_UNIT = 32 }; | ||
47 | KW_HEADER_AND_FOOTER = 16, DISABLE_UNIT = 32 }; | | |||
48 | 47 | | |||
49 | /** | 48 | /** | ||
50 | * KgvPagePreview. | 49 | * KgvPagePreview. | ||
51 | * Internal to KgvPageLayoutDia. | 50 | * Internal to KgvPageLayoutDia. | ||
52 | */ | 51 | */ | ||
53 | class KgvPagePreview : public QGroupBox | 52 | class KgvPagePreview : public QGroupBox | ||
54 | { | 53 | { | ||
55 | Q_OBJECT | 54 | Q_OBJECT | ||
56 | 55 | | |||
57 | public: | 56 | public: | ||
58 | | ||||
59 | /** | 57 | /** | ||
60 | * constructor | 58 | * constructor | ||
61 | */ | 59 | */ | ||
62 | KgvPagePreview( QWidget*, const char*, const KgvPageLayout & ); | 60 | KgvPagePreview(QWidget *, const char *, const KgvPageLayout &); | ||
63 | /** | 61 | /** | ||
64 | * destructor | 62 | * destructor | ||
65 | */ | 63 | */ | ||
66 | ~KgvPagePreview(); | 64 | ~KgvPagePreview(); | ||
67 | 65 | | |||
68 | /** | 66 | /** | ||
69 | * set page layout | 67 | * set page layout | ||
70 | */ | 68 | */ | ||
71 | void setPageLayout( const KgvPageLayout& ); | 69 | void setPageLayout(const KgvPageLayout &); | ||
72 | void setPageColumns( const KgvColumns& ); | 70 | void setPageColumns(const KgvColumns &); | ||
73 | 71 | | |||
74 | protected: | 72 | protected: | ||
75 | | ||||
76 | // paint page | 73 | // paint page | ||
77 | void paintEvent(QPaintEvent* event) override; | 74 | void paintEvent(QPaintEvent *event) override; | ||
78 | 75 | | |||
79 | double m_pageHeight, m_pageWidth, m_textFrameX, m_textFrameY, m_textFrameWidth, m_textFrameHeight; | 76 | double m_pageHeight, m_pageWidth, m_textFrameX, m_textFrameY, m_textFrameWidth, m_textFrameHeight; | ||
80 | int columns; | 77 | int columns; | ||
81 | }; | 78 | }; | ||
82 | 79 | | |||
83 | class KgvPageLayoutDiaPrivate; | 80 | class KgvPageLayoutDiaPrivate; | ||
84 | 81 | | |||
85 | /** | 82 | /** | ||
86 | * With this dialog the user can specify the layout of the paper during printing. | 83 | * With this dialog the user can specify the layout of the paper during printing. | ||
87 | */ | 84 | */ | ||
88 | class KgvPageLayoutDia : public KPageDialog | 85 | class KgvPageLayoutDia : public KPageDialog | ||
89 | { | 86 | { | ||
90 | Q_OBJECT | 87 | Q_OBJECT | ||
91 | 88 | | |||
92 | public: | 89 | public: | ||
93 | | ||||
94 | /** | 90 | /** | ||
95 | * Constructor. | 91 | * Constructor. | ||
96 | * | 92 | * | ||
97 | * @param parent The parent of the dialog. | 93 | * @param parent The parent of the dialog. | ||
98 | * @param name The name of the dialog. | 94 | * @param name The name of the dialog. | ||
99 | * @param layout The layout. | 95 | * @param layout The layout. | ||
100 | * @param headfoot The header and the footer. | 96 | * @param headfoot The header and the footer. | ||
101 | * @param flags a variable with all features this dialog should show. | 97 | * @param flags a variable with all features this dialog should show. | ||
102 | * @param unit The unit to use for displaying the values to the user. | 98 | * @param unit The unit to use for displaying the values to the user. | ||
103 | * @param modal Whether the dialog is modal or not. | 99 | * @param modal Whether the dialog is modal or not. | ||
104 | */ | 100 | */ | ||
105 | KgvPageLayoutDia( QWidget* parent, | 101 | KgvPageLayoutDia(QWidget *parent, KgvPageLayout &layout, int flags, KgvUnit::Unit unit); | ||
106 | KgvPageLayout& layout, | | |||
107 | int flags, KgvUnit::Unit unit); | | |||
108 | 102 | | |||
109 | /** | 103 | /** | ||
110 | * Constructor. | 104 | * Constructor. | ||
111 | * | 105 | * | ||
112 | * @param parent The parent of the dialog. | 106 | * @param parent The parent of the dialog. | ||
113 | * @param name The name of the dialog. | 107 | * @param name The name of the dialog. | ||
114 | * @param layout The layout. | 108 | * @param layout The layout. | ||
115 | * @param headfoot The header and the footer. | 109 | * @param headfoot The header and the footer. | ||
116 | * @param columns The number of columns on the page. | 110 | * @param columns The number of columns on the page. | ||
117 | * @param kwheadfoot The KWord header and footer. | 111 | * @param kwheadfoot The KWord header and footer. | ||
118 | * @param tabs The number of tabs. | 112 | * @param tabs The number of tabs. | ||
119 | * @param unit The unit to use for displaying the values to the user | 113 | * @param unit The unit to use for displaying the values to the user | ||
120 | */ | 114 | */ | ||
121 | KgvPageLayoutDia( QWidget* parent, | 115 | KgvPageLayoutDia(QWidget *parent, KgvPageLayout &layout, const KgvColumns &columns, int tabs, KgvUnit::Unit unit); | ||
122 | KgvPageLayout& layout, | | |||
123 | const KgvColumns& columns, | | |||
124 | int tabs, KgvUnit::Unit unit ); | | |||
125 | 116 | | |||
126 | /** | 117 | /** | ||
127 | * Destructor. | 118 | * Destructor. | ||
128 | */ | 119 | */ | ||
129 | ~KgvPageLayoutDia(); | 120 | ~KgvPageLayoutDia(); | ||
130 | 121 | | |||
131 | /** | 122 | /** | ||
132 | * Show page layout dialog. | 123 | * Show page layout dialog. | ||
133 | * See constructor for documentation on the parameters | 124 | * See constructor for documentation on the parameters | ||
134 | */ | 125 | */ | ||
135 | static bool pageLayout(KgvPageLayout&, KgvHeadFoot&, int tabs, KgvUnit::Unit& unit, QWidget* parent = nullptr); | 126 | static bool pageLayout(KgvPageLayout &, KgvHeadFoot &, int tabs, KgvUnit::Unit &unit, QWidget *parent = nullptr); | ||
136 | 127 | | |||
137 | /** | 128 | /** | ||
138 | * Show page layout dialog. | 129 | * Show page layout dialog. | ||
139 | * See constructor for documentation on the parameters | 130 | * See constructor for documentation on the parameters | ||
140 | */ | 131 | */ | ||
141 | static bool pageLayout(KgvPageLayout&, KgvHeadFoot&, KgvColumns&, KgvKWHeaderFooter&, int tabs, KgvUnit::Unit& unit, QWidget* parent = nullptr); | 132 | static bool pageLayout(KgvPageLayout &, KgvHeadFoot &, KgvColumns &, KgvKWHeaderFooter &, int tabs, KgvUnit::Unit &unit, QWidget *parent = nullptr); | ||
142 | 133 | | |||
143 | /** | 134 | /** | ||
144 | * Returns the layout | 135 | * Returns the layout | ||
145 | */ | 136 | */ | ||
146 | const KgvPageLayout& layout() const { return m_layout; } | 137 | const KgvPageLayout &layout() const | ||
138 | { | ||||
139 | return m_layout; | ||||
140 | } | ||||
147 | 141 | | |||
148 | /** | 142 | /** | ||
149 | * Returns the header and footer information | 143 | * Returns the header and footer information | ||
150 | */ | 144 | */ | ||
151 | struct ::KgvHeadFoot headFoot() const; | 145 | struct ::KgvHeadFoot headFoot() const; | ||
152 | 146 | | |||
153 | /** | 147 | /** | ||
154 | * Returns the unit | 148 | * Returns the unit | ||
155 | */ | 149 | */ | ||
156 | KgvUnit::Unit unit() const { return m_unit; } | 150 | KgvUnit::Unit unit() const | ||
151 | { | ||||
152 | return m_unit; | ||||
153 | } | ||||
157 | 154 | | |||
158 | private: | 155 | private: | ||
159 | const KgvColumns& columns() { return m_column; } | 156 | const KgvColumns &columns() | ||
157 | { | ||||
158 | return m_column; | ||||
159 | } | ||||
160 | const KgvKWHeaderFooter& headerFooter(); | 160 | const KgvKWHeaderFooter &headerFooter(); | ||
161 | 161 | | |||
162 | // setup tabs | 162 | // setup tabs | ||
163 | void setupTab1( bool enableBorders ); | 163 | void setupTab1(bool enableBorders); | ||
164 | // void setupTab2( const KgvHeadFoot& hf ); | 164 | // void setupTab2( const KgvHeadFoot& hf ); | ||
165 | // void setupTab3(); | 165 | // void setupTab3(); | ||
166 | // void setupTab4( const KgvKWHeaderFooter kwhf ); | 166 | // void setupTab4( const KgvKWHeaderFooter kwhf ); | ||
167 | 167 | | |||
168 | // dialog objects | 168 | // dialog objects | ||
169 | QLineEdit *eHeadLeft; | 169 | QLineEdit *eHeadLeft; | ||
170 | QLineEdit *eHeadMid; | 170 | QLineEdit *eHeadMid; | ||
171 | QLineEdit *eHeadRight; | 171 | QLineEdit *eHeadRight; | ||
172 | QLineEdit *eFootLeft; | 172 | QLineEdit *eFootLeft; | ||
173 | QLineEdit *eFootMid; | 173 | QLineEdit *eFootMid; | ||
174 | QLineEdit *eFootRight; | 174 | QLineEdit *eFootRight; | ||
175 | 175 | | |||
176 | // layout | 176 | // layout | ||
177 | struct ::KgvPageLayout& m_layout; | 177 | struct ::KgvPageLayout &m_layout; | ||
178 | KgvColumns m_column; | 178 | KgvColumns m_column; | ||
179 | 179 | | |||
180 | KgvUnit::Unit m_unit; | 180 | KgvUnit::Unit m_unit; | ||
181 | 181 | | |||
182 | int flags; | 182 | int flags; | ||
183 | 183 | | |||
184 | protected Q_SLOTS: | 184 | protected Q_SLOTS: | ||
185 | void slotOk(); | 185 | void slotOk(); | ||
Show All 13 Lines |