- back().idx() = lastidx();
- back().par() = lastpar();
- back().pos() = lastpos();
+ top().idx() = lastidx();
+ top().pit() = lastpit();
+ top().pos() = lastpos();
+ }
+}
+
+
+bool DocIterator::hasPart(DocIterator const & it) const
+{
+ // it can't be a part if it is larger
+ if (it.depth() > depth())
+ return false;
+
+ // as inset adresses are the 'last' level
+ return &it.top().inset() == &slices_[it.depth() - 1].inset();
+}
+
+
+void DocIterator::updateInsets(InsetBase * inset)
+{
+ // this function re-creates the cache of inset pointers.
+ // code taken in part from StableDocIterator::asDocIterator.
+ //lyxerr << "converting:\n" << *this << endl;
+ DocIterator dit = DocIterator(*inset);
+ size_t const n = slices_.size();
+ for (size_t i = 0 ; i < n; ++i) {
+ BOOST_ASSERT(inset);
+ dit.push_back(slices_[i]);
+ dit.top().inset_ = inset;
+ if (i + 1 != n)
+ inset = dit.nextInset();