]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.C
refrain from computing width in setHeightOfRow as this happens already
[lyx.git] / src / paragraph.C
index c949662f7154019fb4fadc2b88d89a44921403c1..8c640b6d6277b22f9e39b896d7357106507d54e6 100644 (file)
@@ -52,7 +52,7 @@ using std::ostringstream;
 
 
 Paragraph::Paragraph()
-       : y(0), pimpl_(new Paragraph::Pimpl(this))
+       : y(0), height(0), pimpl_(new Paragraph::Pimpl(this))
 {
        itemdepth = 0;
        params().clear();
@@ -60,7 +60,7 @@ Paragraph::Paragraph()
 
 
 Paragraph::Paragraph(Paragraph const & lp)
-       : y(0), text_(lp.text_), pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this))
+       : y(0), height(0), text_(lp.text_), pimpl_(new Paragraph::Pimpl(*lp.pimpl_, this))
 {
        itemdepth = 0;
        // this is because of the dummy layout of the paragraphs that
@@ -374,12 +374,12 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
        else
                layoutfont = lout->font;
 
-       LyXFont tmpfont = getFontSettings(bparams, pos);
-       tmpfont.realize(layoutfont);
-       tmpfont.realize(outerfont);
-       tmpfont.realize(bparams.getLyXTextClass().defaultfont());
+       LyXFont font = getFontSettings(bparams, pos);
+       font.realize(layoutfont);
+       font.realize(outerfont);
+       font.realize(bparams.getLyXTextClass().defaultfont());
 
-       return tmpfont;
+       return font;
 }
 
 
@@ -637,7 +637,7 @@ int Paragraph::beginningOfBody() const
 
        // Unroll the first two cycles of the loop
        // and remember the previous character to
-       // remove unnecessary GetChar() calls
+       // remove unnecessary getChar() calls
        pos_type i = 0;
        if (i < size() && !isNewline(i)) {
                ++i;
@@ -1420,3 +1420,15 @@ bool Paragraph::allowEmpty() const
                return pimpl_->inset_owner->owner()->lyxCode() == InsetOld::ERT_CODE;
        return false;
 }
+
+
+RowList::iterator Paragraph::getRow(pos_type pos)
+{
+       RowList::iterator rit = rows.end();
+       RowList::iterator const begin = rows.begin();
+
+       for (--rit; rit != begin && rit->pos() > pos; --rit)
+               ;
+
+       return rit;
+}