]> git.lyx.org Git - lyx.git/blobdiff - src/bufferview_funcs.cpp
* Text: Move some more stuff from Text to TextMetrics:
[lyx.git] / src / bufferview_funcs.cpp
index fff484cd4893803c547323ae2e5687792d150940..9130ec76e359408a8768401054f8322e00ef0134 100644 (file)
@@ -175,7 +175,7 @@ Point coordOffset(BufferView const & bv, DocIterator const & dit,
                // of xx:yy
                if (sl.text()) {
                        bool boundary_i = boundary && i + 1 == dit.depth();
-                       bool rtl = sl.text()->isRTL(bv.buffer(), sl, boundary_i);
+                       bool rtl = bv.textMetrics(sl.text()).isRTL(sl, boundary_i);
                        if (rtl)
                                x -= lastw;
                }
@@ -189,7 +189,8 @@ Point coordOffset(BufferView const & bv, DocIterator const & dit,
 
        // Add contribution of initial rows of outermost paragraph
        CursorSlice const & sl = dit[0];
-       ParagraphMetrics const & pm = bv.parMetrics(sl.text(), sl.pit());
+       TextMetrics const & tm = bv.textMetrics(sl.text());
+       ParagraphMetrics const & pm = tm.parMetrics(sl.pit());
        BOOST_ASSERT(!pm.rows().empty());
        y -= pm.rows()[0].ascent();
 #if 1
@@ -210,14 +211,16 @@ Point coordOffset(BufferView const & bv, DocIterator const & dit,
                y += pm.rows()[rit].height();
        y += pm.rows()[rend].ascent();
        
+       TextMetrics const & bottom_tm = bv.textMetrics(dit.bottom().text());
+       
        // Make relative position from the nested inset now bufferview absolute.
-       int xx = dit.bottom().text()->cursorX(bv, dit.bottom(), boundary && dit.depth() == 1);
+       int xx = bottom_tm.cursorX(dit.bottom(), boundary && dit.depth() == 1);
        x += xx;
        
        // In the RTL case place the nested inset at the left of the cursor in 
        // the outer paragraph
        bool boundary_1 = boundary && 1 == dit.depth();
-       bool rtl = dit.bottom().text()->isRTL(bv.buffer(), dit.bottom(), boundary_1);
+       bool rtl = bottom_tm.isRTL(dit.bottom(), boundary_1);
        if (rtl)
                x -= lastw;