2 * \file QTabularDialog.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Jürgen Spitzmüller
10 * Full author contact details are available in file CREDITS.
15 #include "QTabularDialog.h"
17 #include "qt_helpers.h"
19 #include "controllers/ControlTabular.h"
21 #include <qcheckbox.h>
22 #include <qpushbutton.h>
23 #include <qlineedit.h>
31 QTabularDialog::QTabularDialog(QTabular * form)
32 : QTabularDialogBase(0, 0, false, 0),
35 connect(closePB, SIGNAL(clicked()),
36 form, SLOT(slotClose()));
40 void QTabularDialog::change_adaptor()
46 void QTabularDialog::closeEvent(QCloseEvent * e)
53 void QTabularDialog::close_clicked()
59 void QTabularDialog::borderSet_clicked()
61 form_->controller().set(LyXTabular::SET_ALL_LINES);
62 form_->update_borders();
67 void QTabularDialog::borderUnset_clicked()
69 form_->controller().set(LyXTabular::UNSET_ALL_LINES);
70 form_->update_borders();
75 void QTabularDialog::leftBorder_changed()
77 form_->controller().toggleLeftLine();
82 void QTabularDialog::rightBorder_changed()
84 form_->controller().toggleRightLine();
89 void QTabularDialog::topBorder_changed()
91 form_->controller().toggleTopLine();
96 void QTabularDialog::bottomBorder_changed()
98 form_->controller().toggleBottomLine();
103 void QTabularDialog::specialAlignment_changed()
105 string special = fromqstr(specialAlignmentED->text());
106 form_->controller().setSpecial(special);
111 void QTabularDialog::width_changed()
114 string const width = widgetsToLength(widthED, widthUnit);
115 form_->controller().setWidth(width);
119 void QTabularDialog::multicolumn_clicked()
121 form_->controller().toggleMultiColumn();
126 void QTabularDialog::rotateTabular()
128 form_->controller().rotateTabular(rotateTabularCB->isChecked());
133 void QTabularDialog::rotateCell()
135 form_->controller().rotateCell(rotateCellCB->isChecked());
140 void QTabularDialog::hAlign_changed(int align)
142 ControlTabular::HALIGN h = ControlTabular::LEFT;
145 case 0: h = ControlTabular::LEFT; break;
146 case 1: h = ControlTabular::CENTER; break;
147 case 2: h = ControlTabular::RIGHT; break;
148 case 3: h = ControlTabular::BLOCK; break;
151 form_->controller().halign(h);
155 void QTabularDialog::vAlign_changed(int align)
157 ControlTabular::VALIGN v = ControlTabular::TOP;
160 case 0: v = ControlTabular::TOP; break;
161 case 1: v = ControlTabular::MIDDLE; break;
162 case 2: v = ControlTabular::BOTTOM; break;
165 form_->controller().valign(v);
169 void QTabularDialog::longTabular()
171 form_->controller().longTabular(longTabularCB->isChecked());
176 void QTabularDialog::ltNewpage_clicked()
178 form_->controller().set(LyXTabular::SET_LTNEWPAGE);
183 void QTabularDialog::ltHeaderStatus_clicked()
185 bool enable(headerStatusCB->isChecked());
187 form_->controller().set(LyXTabular::SET_LTHEAD, "");
189 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
190 headerBorderAboveCB->setEnabled(enable);
191 headerBorderBelowCB->setEnabled(enable);
192 firstheaderNoContentsCB->setEnabled(enable);
197 void QTabularDialog::ltHeaderBorderAbove_clicked()
199 if (headerBorderAboveCB->isChecked())
200 form_->controller().set(LyXTabular::SET_LTHEAD, "dl_above");
202 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
207 void QTabularDialog::ltHeaderBorderBelow_clicked()
209 if (headerBorderBelowCB->isChecked())
210 form_->controller().set(LyXTabular::SET_LTHEAD, "dl_below");
212 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
217 void QTabularDialog::ltFirstHeaderBorderAbove_clicked()
219 if (firstheaderBorderAboveCB->isChecked())
220 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_above");
222 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
227 void QTabularDialog::ltFirstHeaderBorderBelow_clicked()
229 if (firstheaderBorderBelowCB->isChecked())
230 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_below");
232 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
237 void QTabularDialog::ltFirstHeaderStatus_clicked()
239 bool enable(firstheaderStatusCB->isChecked());
241 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "");
243 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
244 firstheaderBorderAboveCB->setEnabled(enable);
245 firstheaderBorderBelowCB->setEnabled(enable);
250 void QTabularDialog::ltFirstHeaderEmpty_clicked()
252 bool enable(firstheaderNoContentsCB->isChecked());
254 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "empty");
256 ltFirstHeaderBorderBelow_clicked();
257 ltFirstHeaderBorderAbove_clicked();
259 firstheaderStatusCB->setEnabled(!enable);
260 firstheaderBorderAboveCB->setEnabled(!enable);
261 firstheaderBorderBelowCB->setEnabled(!enable);
266 void QTabularDialog::ltFooterStatus_clicked()
268 bool enable(footerStatusCB->isChecked());
270 form_->controller().set(LyXTabular::SET_LTFOOT, "");
272 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
273 footerBorderAboveCB->setEnabled(enable);
274 footerBorderBelowCB->setEnabled(enable);
275 lastfooterNoContentsCB->setEnabled(enable);
280 void QTabularDialog::ltFooterBorderAbove_clicked()
282 if (footerBorderAboveCB->isChecked())
283 form_->controller().set(LyXTabular::SET_LTFOOT, "dl_above");
285 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
290 void QTabularDialog::ltFooterBorderBelow_clicked()
292 if (footerBorderBelowCB->isChecked())
293 form_->controller().set(LyXTabular::SET_LTFOOT, "dl_below");
295 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
300 void QTabularDialog::ltLastFooterStatus_clicked()
302 bool enable(lastfooterStatusCB->isChecked());
304 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "");
306 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
307 lastfooterBorderAboveCB->setEnabled(enable);
308 lastfooterBorderBelowCB->setEnabled(enable);
313 void QTabularDialog::ltLastFooterBorderAbove_clicked()
315 if (lastfooterBorderAboveCB->isChecked())
316 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_above");
318 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
323 void QTabularDialog::ltLastFooterBorderBelow_clicked()
325 if (lastfooterBorderBelowCB->isChecked())
326 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_below");
328 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
333 void QTabularDialog::ltLastFooterEmpty_clicked()
335 bool enable(lastfooterNoContentsCB->isChecked());
337 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "empty");
339 ltLastFooterBorderBelow_clicked();
340 ltLastFooterBorderAbove_clicked();
342 lastfooterStatusCB->setEnabled(!enable);
343 lastfooterBorderAboveCB->setEnabled(!enable);
344 lastfooterBorderBelowCB->setEnabled(!enable);
348 } // namespace frontend