]> git.lyx.org Git - lyx.git/blobdiff - src/DocIterator.cpp
Squeeze warning.
[lyx.git] / src / DocIterator.cpp
index c0df50b446f8fc61f2b84eb5f37c1fdf22842602..310b85131ba8e1e3fe16eeaf69e58713d62cfc47 100644 (file)
@@ -91,8 +91,11 @@ DocIterator DocIterator::clone(Buffer * buffer) const
 
 bool DocIterator::inRegexped() const
 {
-       InsetMathHull * i = inset().asInsetMath()->asHullInset();
-       return i && i->getType() == hullRegexp;
+       InsetMath * im = inset().asInsetMath();
+       if (!im) 
+               return false;
+       InsetMathHull * hull = im->asHullInset();
+       return hull && hull->getType() == hullRegexp;
 }
 
 
@@ -142,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();
 }
@@ -189,6 +192,18 @@ Paragraph & DocIterator::innerParagraph() const
 }
 
 
+FontSpan DocIterator::locateWord(word_location const loc) const
+{
+       FontSpan f = FontSpan();
+
+       if (!top().text()->empty()) {
+               f.first = pos();
+               top().paragraph().locateWord(f.first, f.last, loc);
+       }
+       return f;
+}
+
+       
 CursorSlice const & DocIterator::innerTextSlice() const
 {
        LASSERT(!empty(), /**/);