using namespace lyx::support;
+using namespace lyx::graphics;
using std::vector;
using std::ostream;
using std::swap;
using std::max;
-namespace grfx = lyx::graphics;
namespace {
InsetTabular::~InsetTabular()
{
- InsetTabularMailer mailer(*this);
- mailer.hideDialog();
+ InsetTabularMailer(*this).hideDialog();
}
if (the_locking_inset->unlockInsetInInset(bv, inset, lr)) {
if (inset->lyxCode() == TABULAR_CODE &&
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) {
- InsetTabularMailer mailer(*this);
- mailer.updateDialog(bv);
+ InsetTabularMailer(*this).updateDialog(bv);
oldcell = actcell;
}
return true;
case LFUN_ENDBUFSEL:
break;
case LFUN_LAYOUT_TABULAR: {
- InsetTabularMailer mailer(*this);
- mailer.showDialog(bv);
+ InsetTabularMailer(*this).showDialog(bv);
break;
}
case LFUN_INSET_DIALOG_UPDATE: {
- InsetTabularMailer mailer(*this);
- mailer.updateDialog(bv);
+ InsetTabularMailer(*this).updateDialog(bv);
break;
}
case LFUN_TABULAR_FEATURE:
if ((!the_locking_inset ||
!the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE)) &&
actcell != oldcell) {
- InsetTabular * inset = const_cast<InsetTabular *>(this);
- InsetTabularMailer mailer(*inset);
- mailer.updateDialog(bv);
+ InsetTabularMailer(*this).updateDialog(bv);
oldcell = actcell;
}
in_reset_pos = 0;
break;
}
- InsetTabularMailer mailer(*this);
- mailer.updateDialog(bv);
+ InsetTabularMailer(*this).updateDialog(bv);
}
{
if (the_locking_inset)
return the_locking_inset->getLyXText(bv, recursive);
-#if 0
- // if we're locked lock the actual insettext and return it's LyXText!!!
- if (locked) {
- UpdatableInset * inset =
- static_cast<UpdatableInset*>(tabular.getCellInset(actcell));
- inset->edit(const_cast<BufferView *>(bv), 0, 0, 0);
- return the_locking_inset->getLyXText(bv, recursive);
- }
-#endif
return Inset::getLyXText(bv, recursive);
}
bool InsetTabular::showInsetDialog(BufferView * bv) const
{
- if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv)) {
- InsetTabular * tmp = const_cast<InsetTabular *>(this);
- InsetTabularMailer mailer(*tmp);
- mailer.showDialog(bv);
- }
+ if (!the_locking_inset || !the_locking_inset->showInsetDialog(bv))
+ InsetTabularMailer(*this).showDialog(bv);
return true;
}
return;
}
}
- InsetTabular * tmp = const_cast<InsetTabular *>(this);
- InsetTabularMailer mailer(*tmp);
- mailer.showDialog(bv);
+ InsetTabularMailer(*this).showDialog(bv);
}
if (id_arg == id())
return const_cast<InsetTabular *>(this);
- Inset * result;
- for(int i = 0; i < tabular.rows(); ++i) {
- for(int j = 0; j < tabular.columns(); ++j) {
- if ((result = tabular.getCellInset(i, j)->getInsetFromID(id_arg)))
- return result;
+ for (int i = 0; i < tabular.rows(); ++i) {
+ for (int j = 0; j < tabular.columns(); ++j) {
+ Inset * inset = tabular.getCellInset(i, j)->getInsetFromID(id_arg);
+ if (inset)
+ return inset;
}
}
return 0;
++actcell;
}
// otherwise we have to lock the next inset and ask for it's selecttion
- UpdatableInset * inset =
- static_cast<UpdatableInset*>(tabular.getCellInset(actcell));
- inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
+ tabular.getCellInset(actcell)
+ ->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
WordLangTuple word(selectNextWordInt(bv, value));
nodraw(false);
if (!word.word().empty())
}
// otherwise we have to lock the next inset and ask for it's selecttion
- UpdatableInset * inset =
- static_cast<UpdatableInset*>(tabular.getCellInset(++actcell));
- inset->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
+ ++actcell;
+ tabular.getCellInset(actcell)
+ ->localDispatch(FuncRequest(bv, LFUN_INSET_EDIT));
return selectNextWordInt(bv, value);
}
void InsetTabular::selectSelectedWord(BufferView * bv)
{
- if (the_locking_inset) {
+ if (the_locking_inset)
the_locking_inset->selectSelectedWord(bv);
- return;
- }
- return;
}
void InsetTabular::toggleSelection(BufferView * bv, bool kill_selection)
{
- if (the_locking_inset) {
+ if (the_locking_inset)
the_locking_inset->toggleSelection(bv, kill_selection);
- }
}
void InsetTabular::markErased()
{
- int cell = 0;
-
- while (cell < tabular.getNumberOfCells()) {
- InsetText * inset = tabular.getCellInset(cell);
- inset->markErased();
- ++cell;
- }
+ for (int cell = 0; cell < tabular.getNumberOfCells(); ++cell)
+ tabular.getCellInset(cell)->markErased();
}
return false;
}
+
bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
bool usePaste)
{
rows = loctab->rows();
int const columns = loctab->columns();
- while ((cell < cells) && (p < len) && (row < rows) &&
+ while (cell < cells && p < len && row < rows &&
(p = buf.find_first_of("\t\n", p)) != string::npos)
{
if (p >= len)
op = p;
}
// check for the last cell if there is no trailing '\n'
- if ((cell < cells) && (op < len)) {
+ if (cell < cells && op < len) {
InsetText * ti = loctab->getCellInset(cell);
LyXFont const font = ti->getLyXText(bv)->
getFont(bv->buffer(), ti->paragraphs.begin(), 0);
}
-void InsetTabular::addPreview(grfx::PreviewLoader & loader) const
+void InsetTabular::addPreview(PreviewLoader & loader) const
{
int const rows = tabular.rows();
int const columns = tabular.columns();
}
-string const InsetTabularMailer:: name_("tabular");
+string const InsetTabularMailer::name_("tabular");
-InsetTabularMailer::InsetTabularMailer(InsetTabular & inset)
- : inset_(inset)
+InsetTabularMailer::InsetTabularMailer(InsetTabular const & inset)
+ : inset_(const_cast<InsetTabular &>(inset))
{}