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()
115 string const width = widgetsToLength(widthED, widthUnit);
116 form_->controller().setWidth(width);
120 void QTabularDialog::multicolumn_clicked()
122 form_->controller().toggleMultiColumn();
127 void QTabularDialog::rotateTabular()
129 form_->controller().rotateTabular(rotateTabularCB->isChecked());
134 void QTabularDialog::rotateCell()
136 form_->controller().rotateCell(rotateCellCB->isChecked());
141 void QTabularDialog::hAlign_changed(int align)
143 ControlTabular::HALIGN h;
146 case 0: h = ControlTabular::LEFT; break;
147 case 1: h = ControlTabular::CENTER; break;
148 case 2: h = ControlTabular::RIGHT; break;
149 case 3: h = ControlTabular::BLOCK; break;
152 form_->controller().halign(h);
156 void QTabularDialog::vAlign_changed(int align)
158 ControlTabular::VALIGN v;
161 case 0: v = ControlTabular::TOP; break;
162 case 1: v = ControlTabular::VCENTER; break;
163 case 2: v = ControlTabular::BOTTOM; break;
166 form_->controller().valign(v);
170 void QTabularDialog::longTabular()
172 form_->controller().longTabular(longTabularCB->isChecked());
177 void QTabularDialog::ltNewpage_clicked()
179 form_->controller().set(LyXTabular::SET_LTNEWPAGE);
184 void QTabularDialog::ltHeaderStatus_clicked()
186 bool enable(headerStatusCB->isChecked());
188 form_->controller().set(LyXTabular::SET_LTHEAD, "");
190 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
191 headerBorderAboveCB->setEnabled(enable);
192 headerBorderBelowCB->setEnabled(enable);
193 firstheaderNoContentsCB->setEnabled(enable);
198 void QTabularDialog::ltHeaderBorderAbove_clicked()
200 if (headerBorderAboveCB->isChecked())
201 form_->controller().set(LyXTabular::SET_LTHEAD, "dl_above");
203 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
208 void QTabularDialog::ltHeaderBorderBelow_clicked()
210 if (headerBorderBelowCB->isChecked())
211 form_->controller().set(LyXTabular::SET_LTHEAD, "dl_below");
213 form_->controller().set(LyXTabular::UNSET_LTHEAD, "");
218 void QTabularDialog::ltFirstHeaderBorderAbove_clicked()
220 if (firstheaderBorderAboveCB->isChecked())
221 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_above");
223 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
228 void QTabularDialog::ltFirstHeaderBorderBelow_clicked()
230 if (firstheaderBorderBelowCB->isChecked())
231 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "dl_below");
233 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
238 void QTabularDialog::ltFirstHeaderStatus_clicked()
240 bool enable(firstheaderStatusCB->isChecked());
242 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "");
244 form_->controller().set(LyXTabular::UNSET_LTFIRSTHEAD, "");
245 firstheaderBorderAboveCB->setEnabled(enable);
246 firstheaderBorderBelowCB->setEnabled(enable);
251 void QTabularDialog::ltFirstHeaderEmpty_clicked()
253 bool enable(firstheaderNoContentsCB->isChecked());
255 form_->controller().set(LyXTabular::SET_LTFIRSTHEAD, "empty");
257 ltFirstHeaderBorderBelow_clicked();
258 ltFirstHeaderBorderAbove_clicked();
260 firstheaderStatusCB->setEnabled(!enable);
261 firstheaderBorderAboveCB->setEnabled(!enable);
262 firstheaderBorderBelowCB->setEnabled(!enable);
267 void QTabularDialog::ltFooterStatus_clicked()
269 bool enable(footerStatusCB->isChecked());
271 form_->controller().set(LyXTabular::SET_LTFOOT, "");
273 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
274 footerBorderAboveCB->setEnabled(enable);
275 footerBorderBelowCB->setEnabled(enable);
276 lastfooterNoContentsCB->setEnabled(enable);
281 void QTabularDialog::ltFooterBorderAbove_clicked()
283 if (footerBorderAboveCB->isChecked())
284 form_->controller().set(LyXTabular::SET_LTFOOT, "dl_above");
286 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
291 void QTabularDialog::ltFooterBorderBelow_clicked()
293 if (footerBorderBelowCB->isChecked())
294 form_->controller().set(LyXTabular::SET_LTFOOT, "dl_below");
296 form_->controller().set(LyXTabular::UNSET_LTFOOT, "");
301 void QTabularDialog::ltLastFooterStatus_clicked()
303 bool enable(lastfooterStatusCB->isChecked());
305 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "");
307 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
308 lastfooterBorderAboveCB->setEnabled(enable);
309 lastfooterBorderBelowCB->setEnabled(enable);
314 void QTabularDialog::ltLastFooterBorderAbove_clicked()
316 if (lastfooterBorderAboveCB->isChecked())
317 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_above");
319 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
324 void QTabularDialog::ltLastFooterBorderBelow_clicked()
326 if (lastfooterBorderBelowCB->isChecked())
327 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "dl_below");
329 form_->controller().set(LyXTabular::UNSET_LTLASTFOOT, "");
334 void QTabularDialog::ltLastFooterEmpty_clicked()
336 bool enable(lastfooterNoContentsCB->isChecked());
338 form_->controller().set(LyXTabular::SET_LTLASTFOOT, "empty");
340 ltLastFooterBorderBelow_clicked();
341 ltLastFooterBorderAbove_clicked();
343 lastfooterStatusCB->setEnabled(!enable);
344 lastfooterBorderAboveCB->setEnabled(!enable);
345 lastfooterBorderBelowCB->setEnabled(!enable);