]> git.lyx.org Git - lyx.git/blobdiff - src/TextMetrics.cpp
Hopefully this works on other archs too.
[lyx.git] / src / TextMetrics.cpp
index 20aa586a4424ccdf42246c9109de4dfcdce47cdd..288424a44ed6af6e5083064210aff9d1bd93328a 100644 (file)
@@ -34,7 +34,6 @@
 #include "Length.h"
 #include "LyXRC.h"
 #include "MetricsInfo.h"
-#include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "ParIterator.h"
 #include "rowpainter.h"
@@ -293,7 +292,7 @@ Font TextMetrics::displayFont(pit_type pit, pos_type pos) const
        // NOTE: the cast to pit_type should be removed when pit_type
        // changes to a unsigned integer.
        if (pit < pit_type(pars.size()))
-               font.fontInfo().realize(outerFont(pit, pars).fontInfo());
+               font.fontInfo().realize(text_->outerFont(pit).fontInfo());
 
        // Realize with the fonts of lesser depth.
        font.fontInfo().realize(params.getFont().fontInfo());
@@ -576,7 +575,7 @@ void TextMetrics::computeRowMetrics(pit_type const pit,
                        align = par.params().align();
 
                // handle alignment inside tabular cells
-               Inset const & owner = par.inInset();
+               Inset const & owner = text_->inset();
                switch (owner.contentAlignment()) {
                        case LYX_ALIGN_CENTER:
                        case LYX_ALIGN_LEFT:
@@ -1041,7 +1040,7 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
        ++maxdesc;
 
        ParagraphList const & pars = text_->paragraphs();
-       Inset const & inset = par.inInset();
+       Inset const & inset = text_->inset();
 
        // is it a top line?
        if (first == 0 && topBottomSpace) {
@@ -1075,7 +1074,7 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
                if ((layout.labeltype == LABEL_TOP_ENVIRONMENT
                     || layout.labeltype == LABEL_BIBLIO
                     || layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
-                   && isFirstInSequence(pit, pars)
+                   && text_->isFirstInSequence(pit)
                    && !par.labelString().empty())
                {
                        labeladdon = int(
@@ -1089,7 +1088,7 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
                // a section, or between the items of a itemize or enumerate
                // environment.
 
-               pit_type prev = depthHook(pit, pars, par.getDepth());
+               pit_type prev = text_->depthHook(pit, par.getDepth());
                Paragraph const & prevpar = pars[prev];
                if (prev != pit
                    && prevpar.layout() == layout
@@ -1102,7 +1101,7 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
                                layoutasc = layout.topsep * dh;
                }
 
-               prev = outerHook(pit, pars);
+               prev = text_->outerHook(pit);
                if (prev != pit_type(pars.size())) {
                        maxasc += int(pars[prev].layout().parsep * dh);
                } else if (pit != 0) {
@@ -1127,7 +1126,7 @@ Dimension TextMetrics::rowHeight(pit_type const pit, pos_type const first,
 
                        if (pars[cpit].getDepth() > pars[nextpit].getDepth()) {
                                usual = pars[cpit].layout().bottomsep * dh;
-                               cpit = depthHook(cpit, pars, pars[nextpit].getDepth());
+                               cpit = text_->depthHook(cpit, pars[nextpit].getDepth());
                                if (pars[cpit].layout() != pars[nextpit].layout()
                                        || pars[nextpit].getLabelWidthString() != pars[cpit].getLabelWidthString())
                                {
@@ -1845,7 +1844,7 @@ int TextMetrics::leftMargin(int max_width,
 
        if (par.getDepth() != 0) {
                // find the next level paragraph
-               pit_type newpar = outerHook(pit, pars);
+               pit_type newpar = text_->outerHook(pit);
                if (newpar != pit_type(pars.size())) {
                        if (pars[newpar].layout().isEnvironment()) {
                                l_margin = leftMargin(max_width, newpar);
@@ -1914,7 +1913,7 @@ int TextMetrics::leftMargin(int max_width,
                           // theorems (JMarc)
                           || (layout.labeltype == LABEL_STATIC
                               && layout.latextype == LATEX_ENVIRONMENT
-                              && !isFirstInSequence(pit, pars))) {
+                              && !text_->isFirstInSequence(pit))) {
                        l_margin += labelfont_metrics.signedWidth(layout.leftmargin);
                } else if (layout.labeltype != LABEL_TOP_ENVIRONMENT
                           && layout.labeltype != LABEL_BIBLIO
@@ -1963,7 +1962,7 @@ int TextMetrics::leftMargin(int max_width,
               || layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT
               || (layout.labeltype == LABEL_STATIC
                   && layout.latextype == LATEX_ENVIRONMENT
-                  && !isFirstInSequence(pit, pars)))
+                  && !text_->isFirstInSequence(pit)))
            && align == LYX_ALIGN_BLOCK
            && !par.params().noindent()
            // in some insets, paragraphs are never indented