]> git.lyx.org Git - lyx.git/blobdiff - src/DocIterator.cpp
Move bind file format tag to LyXAction.cpp, and rename it.
[lyx.git] / src / DocIterator.cpp
index db9cd5d103dc76b9046f5c9f20fdbdd550b561eb..3af7dcba93b96762e5055b8a8c6479ae89cdb38b 100644 (file)
@@ -76,12 +76,11 @@ DocIterator DocIterator::clone(Buffer * buffer) const
 {
        LASSERT(buffer->isClone(), return DocIterator());
        Inset * inset = &buffer->inset();
-       DocIterator dit = *this;
-       dit.buffer_ = buffer;
-       dit.inset_ = inset;
+       DocIterator dit(buffer);
        size_t const n = slices_.size();
        for (size_t i = 0 ; i != n; ++i) {
                LASSERT(inset, /**/);
+               dit.push_back(slices_[i]);
                dit.top().inset_ = inset;
                if (i + 1 != n)
                        inset = dit.nextInset();
@@ -92,8 +91,11 @@ DocIterator DocIterator::clone(Buffer * buffer) const
 
 bool DocIterator::inRegexped() const
 {
-       InsetMathHull * i = dynamic_cast<InsetMathHull *>(inset().asInsetMath());
-       return i && i->getType() == hullRegexp;
+       InsetMath * im = inset().asInsetMath();
+       if (!im) 
+               return false;
+       InsetMathHull * hull = im->asHullInset();
+       return hull && hull->getType() == hullRegexp;
 }
 
 
@@ -143,8 +145,8 @@ Inset * DocIterator::realInset() const
        LASSERT(inTexted(), /**/);
        // if we are in a tabular, we need the cell
        if (inset().lyxCode() == TABULAR_CODE) {
-               InsetTabular & tabular = static_cast<InsetTabular&>(inset());
-               return tabular.cell(idx()).get();
+               InsetTabular * tabular = inset().asInsetTabular();
+               return tabular->cell(idx()).get();
        }
        return &inset();
 }