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 Juergen Spitzmueller
10 * Full author contact details are available in file CREDITS
16 #include "ControlTabular.h"
19 #include "QTabularDialog.h"
21 #include "lengthcombo.h"
22 #include "qsetborder.h"
23 #include "qt_helpers.h"
26 #include <qcheckbox.h>
27 #include <qpushbutton.h>
28 #include <qlineedit.h>
32 QTabularDialog::QTabularDialog(QTabular * form)
33 : QTabularDialogBase(0, 0, false, 0),
36 connect(closePB, SIGNAL(clicked()),
37 form, SLOT(slotClose()));
41 void QTabularDialog::change_adaptor()
47 void QTabularDialog::closeEvent(QCloseEvent * e)
54 void QTabularDialog::close_clicked()
60 void QTabularDialog::borderSet_clicked()
62 form_->controller().set(LyXTabular::SET_ALL_LINES);
63 form_->update_borders();
68 void QTabularDialog::borderUnset_clicked()
70 form_->controller().set(LyXTabular::UNSET_ALL_LINES);
71 form_->update_borders();
76 void QTabularDialog::leftBorder_changed()
78 form_->controller().toggleLeftLine();
83 void QTabularDialog::rightBorder_changed()
85 form_->controller().toggleRightLine();
90 void QTabularDialog::topBorder_changed()
92 form_->controller().toggleTopLine();
97 void QTabularDialog::bottomBorder_changed()
99 form_->controller().toggleBottomLine();
104 void QTabularDialog::specialAlignment_changed()
106 string special = fromqstr(specialAlignmentED->text());
107 form_->controller().setSpecial(special);
112 void QTabularDialog::width_changed()
116 LyXLength(widthED->text().toDouble(),
117 widthUnit->currentLengthItem()).asString();
118 form_->controller().setWidth(width);
122 void QTabularDialog::multicolumn_clicked()
124 form_->controller().toggleMultiColumn();
129 void QTabularDialog::rotateTabular()
131 form_->controller().rotateTabular(rotateTabularCB->isChecked());
136 void QTabularDialog::rotateCell()
138 form_->controller().rotateCell(rotateCellCB->isChecked());
143 void QTabularDialog::hAlign_changed(int align)
145 ControlTabular::HALIGN h;
148 case 0: h = ControlTabular::LEFT; break;
149 case 1: h = ControlTabular::CENTER; break;
150 case 2: h = ControlTabular::RIGHT; break;
151 case 3: h = ControlTabular::BLOCK; break;
154 form_->controller().halign(h);
158 void QTabularDialog::vAlign_changed(int align)
160 ControlTabular::VALIGN v;
163 case 0: v = ControlTabular::TOP; break;
164 case 1: v = ControlTabular::VCENTER; break;
165 case 2: v = ControlTabular::BOTTOM; break;
168 form_->controller().valign(v);
172 void QTabularDialog::longTabular()
174 form_->controller().longTabular(longTabularCB->isChecked());
179 void QTabularDialog::ltNewpage_clicked()
181 form_->controller().set(LyXTabular::SET_LTNEWPAGE);
186 void QTabularDialog::ltHeaderStatus_clicked()
188 bool enable(headerStatusCB->isChecked());
190 form_->controller().set(LyXTabular::SET_LTHEAD, "");
192 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
193 headerBorderAboveCB->setEnabled(enable);
194 headerBorderBelowCB->setEnabled(enable);
195 firstheaderNoContentsCB->setEnabled(enable);
200 void QTabularDialog::ltHeaderBorderAbove_clicked()
202 if (headerBorderAboveCB->isChecked())
203 form_->controller().set(LyXTabular::SET_LTHEAD, "dl_above");
205 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
210 void QTabularDialog::ltHeaderBorderBelow_clicked()
212 if (headerBorderBelowCB->isChecked())
213 form_->controller().set(LyXTabular::SET_LTHEAD, "dl_below");
215 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
220 void QTabularDialog::ltFirstHeaderBorderAbove_clicked()
222 if (firstheaderBorderAboveCB->isChecked())
223 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_above");
225 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
230 void QTabularDialog::ltFirstHeaderBorderBelow_clicked()
232 if (firstheaderBorderBelowCB->isChecked())
233 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_below");
235 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
240 void QTabularDialog::ltFirstHeaderStatus_clicked()
242 bool enable(firstheaderStatusCB->isChecked());
244 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "");
246 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
247 firstheaderBorderAboveCB->setEnabled(enable);
248 firstheaderBorderBelowCB->setEnabled(enable);
253 void QTabularDialog::ltFirstHeaderEmpty_clicked()
255 bool enable(firstheaderNoContentsCB->isChecked());
257 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "empty");
259 ltFirstHeaderBorderBelow_clicked();
260 ltFirstHeaderBorderAbove_clicked();
262 firstheaderStatusCB->setEnabled(!enable);
263 firstheaderBorderAboveCB->setEnabled(!enable);
264 firstheaderBorderBelowCB->setEnabled(!enable);
269 void QTabularDialog::ltFooterStatus_clicked()
271 bool enable(footerStatusCB->isChecked());
273 form_->controller().set(LyXTabular::SET_LTFOOT, "");
275 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
276 footerBorderAboveCB->setEnabled(enable);
277 footerBorderBelowCB->setEnabled(enable);
278 lastfooterNoContentsCB->setEnabled(enable);
283 void QTabularDialog::ltFooterBorderAbove_clicked()
285 if (footerBorderAboveCB->isChecked())
286 form_->controller().set(LyXTabular::SET_LTFOOT, "dl_above");
288 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
293 void QTabularDialog::ltFooterBorderBelow_clicked()
295 if (footerBorderBelowCB->isChecked())
296 form_->controller().set(LyXTabular::SET_LTFOOT, "dl_below");
298 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
303 void QTabularDialog::ltLastFooterStatus_clicked()
305 bool enable(lastfooterStatusCB->isChecked());
307 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "");
309 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
310 lastfooterBorderAboveCB->setEnabled(enable);
311 lastfooterBorderBelowCB->setEnabled(enable);
316 void QTabularDialog::ltLastFooterBorderAbove_clicked()
318 if (lastfooterBorderAboveCB->isChecked())
319 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_above");
321 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
326 void QTabularDialog::ltLastFooterBorderBelow_clicked()
328 if (lastfooterBorderBelowCB->isChecked())
329 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_below");
331 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
336 void QTabularDialog::ltLastFooterEmpty_clicked()
338 bool enable(lastfooterNoContentsCB->isChecked());
340 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "empty");
342 ltLastFooterBorderBelow_clicked();
343 ltLastFooterBorderAbove_clicked();
345 lastfooterStatusCB->setEnabled(!enable);
346 lastfooterBorderAboveCB->setEnabled(!enable);
347 lastfooterBorderBelowCB->setEnabled(!enable);