X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FDocIterator.cpp;h=0555a9f75f1db9dc2b467c22ee80f54415e4becf;hb=13739f37d5208e87e97c44ef2eeba35807ddb9c5;hp=f396ef5869f931b2c92454baa49f55a131106402;hpb=62d11f1f3bc28b917b22bfe28a43984f77d31531;p=lyx.git diff --git a/src/DocIterator.cpp b/src/DocIterator.cpp index f396ef5869..0555a9f75f 100644 --- a/src/DocIterator.cpp +++ b/src/DocIterator.cpp @@ -91,8 +91,11 @@ DocIterator DocIterator::clone(Buffer * buffer) const bool DocIterator::inRegexped() const { - InsetMathHull * i = dynamic_cast(inset().asInsetMath()); - 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(inset()); - return tabular.cell(idx()).get(); + InsetTabular * tabular = inset().asInsetTabular(); + return tabular->cell(idx()).get(); } return &inset(); } @@ -189,6 +192,16 @@ Paragraph & DocIterator::innerParagraph() const } +FontSpan DocIterator::locateWord(word_location const loc) const +{ + FontSpan f = FontSpan(); + + f.first = pos(); + top().paragraph().locateWord(f.first, f.last, loc); + return f; +} + + CursorSlice const & DocIterator::innerTextSlice() const { LASSERT(!empty(), /**/);