]> 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 69c160855c34fbd9b7c5b2bd7213732d2f7d65a4..9130ec76e359408a8768401054f8322e00ef0134 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "bufferview_funcs.h"
 
-#include "Author.h"
 #include "Buffer.h"
 #include "BufferParams.h"
 #include "BufferView.h"
 #include "Language.h"
 #include "Color.h"
 #include "Lexer.h"
-#include "Row.h"
-#include "Paragraph.h"
-#include "ParagraphParameters.h"
-#include "ParIterator.h"
 
 #include "frontends/alert.h"
 
 
 #include <sstream>
 
-
-namespace lyx {
-
-using support::bformat;
-
 using std::istringstream;
 using std::ostringstream;
 using std::string;
@@ -52,6 +42,10 @@ using std::vector;
 using std::find;
 
 
+namespace lyx {
+
+using support::bformat;
+
 namespace bv_funcs {
 
 // Set data using font and toggle
@@ -181,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;
                }
@@ -195,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
@@ -216,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;