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.
16 #include "ControlTabular.h"
19 #include "QTabularDialog.h"
20 #include "qt_helpers.h"
22 #include <qcheckbox.h>
23 #include <qpushbutton.h>
24 #include <qlineedit.h>
29 QTabularDialog::QTabularDialog(QTabular * form)
30 : QTabularDialogBase(0, 0, false, 0),
33 connect(closePB, SIGNAL(clicked()),
34 form, SLOT(slotClose()));
38 void QTabularDialog::change_adaptor()
44 void QTabularDialog::closeEvent(QCloseEvent * e)
51 void QTabularDialog::close_clicked()
57 void QTabularDialog::borderSet_clicked()
59 form_->controller().set(LyXTabular::SET_ALL_LINES);
60 form_->update_borders();
65 void QTabularDialog::borderUnset_clicked()
67 form_->controller().set(LyXTabular::UNSET_ALL_LINES);
68 form_->update_borders();
73 void QTabularDialog::leftBorder_changed()
75 form_->controller().toggleLeftLine();
80 void QTabularDialog::rightBorder_changed()
82 form_->controller().toggleRightLine();
87 void QTabularDialog::topBorder_changed()
89 form_->controller().toggleTopLine();
94 void QTabularDialog::bottomBorder_changed()
96 form_->controller().toggleBottomLine();
101 void QTabularDialog::specialAlignment_changed()
103 string special = fromqstr(specialAlignmentED->text());
104 form_->controller().setSpecial(special);
109 void QTabularDialog::width_changed()
112 string const width = widgetsToLength(widthED, widthUnit);
113 form_->controller().setWidth(width);
117 void QTabularDialog::multicolumn_clicked()
119 form_->controller().toggleMultiColumn();
124 void QTabularDialog::rotateTabular()
126 form_->controller().rotateTabular(rotateTabularCB->isChecked());
131 void QTabularDialog::rotateCell()
133 form_->controller().rotateCell(rotateCellCB->isChecked());
138 void QTabularDialog::hAlign_changed(int align)
140 ControlTabular::HALIGN h = ControlTabular::LEFT;
143 case 0: h = ControlTabular::LEFT; break;
144 case 1: h = ControlTabular::CENTER; break;
145 case 2: h = ControlTabular::RIGHT; break;
146 case 3: h = ControlTabular::BLOCK; break;
149 form_->controller().halign(h);
153 void QTabularDialog::vAlign_changed(int align)
155 ControlTabular::VALIGN v = ControlTabular::TOP;
158 case 0: v = ControlTabular::TOP; break;
159 case 1: v = ControlTabular::MIDDLE; break;
160 case 2: v = ControlTabular::BOTTOM; break;
163 form_->controller().valign(v);
167 void QTabularDialog::longTabular()
169 form_->controller().longTabular(longTabularCB->isChecked());
174 void QTabularDialog::ltNewpage_clicked()
176 form_->controller().set(LyXTabular::SET_LTNEWPAGE);
181 void QTabularDialog::ltHeaderStatus_clicked()
183 bool enable(headerStatusCB->isChecked());
185 form_->controller().set(LyXTabular::SET_LTHEAD, "");
187 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
188 headerBorderAboveCB->setEnabled(enable);
189 headerBorderBelowCB->setEnabled(enable);
190 firstheaderNoContentsCB->setEnabled(enable);
195 void QTabularDialog::ltHeaderBorderAbove_clicked()
197 if (headerBorderAboveCB->isChecked())
198 form_->controller().set(LyXTabular::SET_LTHEAD, "dl_above");
200 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
205 void QTabularDialog::ltHeaderBorderBelow_clicked()
207 if (headerBorderBelowCB->isChecked())
208 form_->controller().set(LyXTabular::SET_LTHEAD, "dl_below");
210 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
215 void QTabularDialog::ltFirstHeaderBorderAbove_clicked()
217 if (firstheaderBorderAboveCB->isChecked())
218 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_above");
220 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
225 void QTabularDialog::ltFirstHeaderBorderBelow_clicked()
227 if (firstheaderBorderBelowCB->isChecked())
228 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_below");
230 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
235 void QTabularDialog::ltFirstHeaderStatus_clicked()
237 bool enable(firstheaderStatusCB->isChecked());
239 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "");
241 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
242 firstheaderBorderAboveCB->setEnabled(enable);
243 firstheaderBorderBelowCB->setEnabled(enable);
248 void QTabularDialog::ltFirstHeaderEmpty_clicked()
250 bool enable(firstheaderNoContentsCB->isChecked());
252 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "empty");
254 ltFirstHeaderBorderBelow_clicked();
255 ltFirstHeaderBorderAbove_clicked();
257 firstheaderStatusCB->setEnabled(!enable);
258 firstheaderBorderAboveCB->setEnabled(!enable);
259 firstheaderBorderBelowCB->setEnabled(!enable);
264 void QTabularDialog::ltFooterStatus_clicked()
266 bool enable(footerStatusCB->isChecked());
268 form_->controller().set(LyXTabular::SET_LTFOOT, "");
270 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
271 footerBorderAboveCB->setEnabled(enable);
272 footerBorderBelowCB->setEnabled(enable);
273 lastfooterNoContentsCB->setEnabled(enable);
278 void QTabularDialog::ltFooterBorderAbove_clicked()
280 if (footerBorderAboveCB->isChecked())
281 form_->controller().set(LyXTabular::SET_LTFOOT, "dl_above");
283 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
288 void QTabularDialog::ltFooterBorderBelow_clicked()
290 if (footerBorderBelowCB->isChecked())
291 form_->controller().set(LyXTabular::SET_LTFOOT, "dl_below");
293 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
298 void QTabularDialog::ltLastFooterStatus_clicked()
300 bool enable(lastfooterStatusCB->isChecked());
302 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "");
304 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
305 lastfooterBorderAboveCB->setEnabled(enable);
306 lastfooterBorderBelowCB->setEnabled(enable);
311 void QTabularDialog::ltLastFooterBorderAbove_clicked()
313 if (lastfooterBorderAboveCB->isChecked())
314 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_above");
316 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
321 void QTabularDialog::ltLastFooterBorderBelow_clicked()
323 if (lastfooterBorderBelowCB->isChecked())
324 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_below");
326 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
331 void QTabularDialog::ltLastFooterEmpty_clicked()
333 bool enable(lastfooterNoContentsCB->isChecked());
335 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "empty");
337 ltLastFooterBorderBelow_clicked();
338 ltLastFooterBorderAbove_clicked();
340 lastfooterStatusCB->setEnabled(!enable);
341 lastfooterBorderAboveCB->setEnabled(!enable);
342 lastfooterBorderBelowCB->setEnabled(!enable);