+2005-11-17 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
+
+ * dociterator.[Ch]: new member realInset() that returns the cell
+ for tabulars and the inset for the rest (bug 1952).
+ * undo.C (textUndoOrRedo): use realInset when resetting insetOwner
+ (bug 1952).
+
2005-11-15 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text.C (leftMargin): honor the NextNoIndent tag in layouts.
#include "mathed/math_data.h"
#include "mathed/math_inset.h"
+#include "insets/insettabular.h"
#include <boost/assert.hpp>
#include <boost/current_function.hpp>
}
+InsetBase * DocIterator::realInset() const
+{
+ BOOST_ASSERT(inTexted());
+ // if we are in a tabular, we need the cell
+ if (inset().lyxCode() == InsetBase::TABULAR_CODE) {
+ InsetTabular & tabular = static_cast<InsetTabular&>(inset());
+ return tabular.cell(idx()).get();
+ }
+ return &inset();
+}
+
+
MathAtom const & DocIterator::prevAtom() const
{
BOOST_ASSERT(!empty());
LyXText * text();
///
LyXText const * text() const;
+ /// the containing inset or the cell, respectively
+ InsetBase * realInset() const;
///
InsetBase * innerInsetOfType(int code) const;
///
// this ugly stuff is needed until we get rid of the
// inset_owner backpointer
- ParagraphList::const_iterator pit = undo.pars.begin();
- ParagraphList::const_iterator end = undo.pars.end();
+ ParagraphList::iterator pit = undo.pars.begin();
+ ParagraphList::iterator const end = undo.pars.end();
for (; pit != end; ++pit)
- const_cast<Paragraph &>(*pit).setInsetOwner(&dit.inset());
+ pit->setInsetOwner(dit.realInset());
plist.insert(first, undo.pars.begin(), undo.pars.end());
}