3 * \file ControlTabular.C
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS
12 #include "ControlTabular.h"
14 #include "ButtonControllerBase.h"
16 #include "support/LAssert.h"
18 #include "frontends/LyXView.h"
19 #include "BufferView.h"
22 #include "insets/insettabular.h"
24 #include <boost/bind.hpp>
26 ControlTabular::ControlTabular(LyXView & lv, Dialogs & d)
27 : ControlConnectBD(lv, d),
28 inset_(0), dialog_built_(false)
32 void ControlTabular::showInset(InsetTabular * inset)
39 // The widgets may not be valid, so refresh the button controller
45 void ControlTabular::updateInset(InsetTabular * inset)
60 void ControlTabular::show(InsetTabular * inset)
64 if (emergency_exit_) {
74 bc().readOnly(bufferIsReadonly());
79 void ControlTabular::update()
81 if (emergency_exit_) {
86 bc().readOnly(bufferIsReadonly());
89 // The widgets may not be valid, so refresh the button controller
95 void ControlTabular::hide()
97 emergency_exit_ = false;
106 void ControlTabular::updateSlot(bool switched)
115 void ControlTabular::connectInset(InsetTabular * inset)
117 // If connected to another inset, disconnect from it.
125 ih_ = inset->hideDialog.connect(
126 boost::bind(&ControlTabular::hide, this));
132 InsetTabular * ControlTabular::inset() const
139 LyXTabular * ControlTabular::tabular() const
142 return inset_->tabular.get();
146 void ControlTabular::set(LyXTabular::Feature f, string const & arg)
149 inset_->tabularFeatures(lv_.view().get(), f, arg);
153 bool ControlTabular::metric() const
155 return lyxrc.default_papersize > BufferParams::PAPER_EXECUTIVEPAPER;
158 bool ControlTabular::isMulticolumnCell() const
160 int cell(inset()->getActCell());
161 return tabular()->IsMultiColumn(cell);