]> git.lyx.org Git - lyx.git/blobdiff - src/text2.C
Oops...
[lyx.git] / src / text2.C
index 50030c4d5281374a79a68aa19598a7869093a108..bb72fc1778c531b10e72178234b03e5f423a1278 100644 (file)
@@ -31,7 +31,7 @@
 #include "counters.h"
 
 #include "insets/inseterror.h"
-#include "insets/insetbib.h"
+#include "insets/insetbibitem.h"
 #include "insets/insetspecialchar.h"
 #include "insets/insettext.h"
 #include "insets/insetfloat.h"
@@ -53,17 +53,17 @@ using lyx::pos_type;
 
 LyXText::LyXText(BufferView * bv)
        : height(0), width(0), first_y(0),
-         inset_owner(0), the_locking_inset(0), need_break_row(0), 
-         refresh_y(0), refresh_row(0), bv_owner(bv), 
+         inset_owner(0), the_locking_inset(0), need_break_row(0),
+         refresh_y(0), refresh_row(0), bv_owner(bv),
          status_(LyXText::UNCHANGED), firstrow(0), lastrow(0)
 {}
 
 
 LyXText::LyXText(InsetText * inset)
-       :  height(0), width(0), first_y(0),
-          inset_owner(inset), the_locking_inset(0), need_break_row(0), 
-          refresh_y(0), refresh_row(0), bv_owner(0), 
-          status_(LyXText::UNCHANGED), firstrow(0), lastrow(0)
+       : height(0), width(0), first_y(0),
+         inset_owner(inset), the_locking_inset(0), need_break_row(0),
+         refresh_y(0), refresh_row(0), bv_owner(0),
+         status_(LyXText::UNCHANGED), firstrow(0), lastrow(0)
 {}
 
 
@@ -409,21 +409,21 @@ void LyXText::toggleInset(BufferView * bview)
 
 /* used in setlayout */
 // Asger is not sure we want to do this...
-void LyXText::makeFontEntriesLayoutSpecific(Buffer const * buf,
-                                           Paragraph * par)
+void LyXText::makeFontEntriesLayoutSpecific(Buffer const & buf,
+                                           Paragraph & par)
 {
-       LyXLayout_ptr const & layout = par->layout();
+       LyXLayout_ptr const & layout = par.layout();
 
        LyXFont layoutfont;
-       for (pos_type pos = 0; pos < par->size(); ++pos) {
-               if (pos < par->beginningOfMainBody())
+       for (pos_type pos = 0; pos < par.size(); ++pos) {
+               if (pos < par.beginningOfMainBody())
                        layoutfont = layout->labelfont;
                else
                        layoutfont = layout->font;
 
-               LyXFont tmpfont = par->getFontSettings(buf->params, pos);
+               LyXFont tmpfont = par.getFontSettings(buf.params, pos);
                tmpfont.reduce(layoutfont);
-               par->setFont(pos, tmpfont);
+               par.setFont(pos, tmpfont);
        }
 }
 
@@ -458,7 +458,7 @@ Paragraph * LyXText::setLayout(BufferView * bview,
 
        do {
                par->applyLayout(lyxlayout);
-               makeFontEntriesLayoutSpecific(bview->buffer(), par);
+               makeFontEntriesLayoutSpecific(*bview->buffer(), *par);
                Paragraph * fppar = par;
                fppar->params().spaceTop(lyxlayout->fill_top ?
                                         VSpace(VSpace::VFILL)
@@ -1263,15 +1263,10 @@ void LyXText::setCounter(Buffer const * buf, Paragraph * par) const
        } else if (layout->labeltype == LABEL_BIBLIO) {// ale970302
                textclass.counters().step("bibitem");
                int number = textclass.counters().value("bibitem");
-               //if (!par->bibkey()) {
-               if (par->bibkey()) {
-                       par->bibkey()->setCounter(number);
+               if (par->bibitem()) {
+                       par->bibitem()->setCounter(number);
                        par->params().labelString(layout->labelstring());
                }
-               // else {
-               //      InsetCommandParams p("bibitem");
-               //      par->bibkey() = new InsetBibKey(p);
-               //}
                // In biblio should't be following counters but...
        } else {
                string s = layout->labelstring();
@@ -1639,7 +1634,7 @@ void LyXText::checkParagraph(BufferView * bview, Paragraph * par,
 
        // is there a break one row above
        if (row->previous() && row->previous()->par() == row->par()) {
-               z = nextBreakPoint(bview, row->previous(), workWidth(bview));
+               z = nextBreakPoint(bview, row->previous(), workWidth(*bview));
                if (z >= row->pos()) {
                        // set the dimensions of the row above
                        y -= row->previous()->height();
@@ -2378,6 +2373,12 @@ bool LyXText::isTopLevel() const
 }
 
 
+bool LyXText::isInInset() const
+{
+       return inset_owner;
+}
+
+
 int defaultRowHeight()
 {
        LyXFont const font(LyXFont::ALL_SANE);