]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.C
fix reading the author field.
[lyx.git] / src / paragraph.C
index 66eebe04eb15c016a0d0e44005351b670c90175b..05a525c53a9e22dbfd891308c190d3e6ab31fae7 100644 (file)
@@ -138,12 +138,12 @@ void Paragraph::write(Buffer const & buf, ostream & os,
        if (dth != params().depth()) {
                if (params().depth() > dth) {
                        while (params().depth() > dth) {
-                               os << "\n\\begin_deeper ";
+                               os << "\n\\begin_deeper";
                                ++dth;
                        }
                } else {
                        while (params().depth() < dth) {
-                               os << "\n\\end_deeper ";
+                               os << "\n\\end_deeper";
                                --dth;
                        }
                }
@@ -192,13 +192,13 @@ void Paragraph::write(Buffer const & buf, ostream & os,
                                } else {
                                        os << "\n\\begin_inset ";
                                        inset->write(buf, os);
-                                       os << "\n\\end_inset \n\n";
+                                       os << "\n\\end_inset\n\n";
                                        column = 0;
                                }
                }
                break;
                case '\\':
-                       os << "\n\\backslash \n";
+                       os << "\n\\backslash\n";
                        column = 0;
                        break;
                case '.':
@@ -278,29 +278,32 @@ bool Paragraph::checkInsertChar(LyXFont &)
 }
 
 
-void Paragraph::insertChar(pos_type pos, Paragraph::value_type c)
+void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
+                          Change change)
 {
-       insertChar(pos, c, LyXFont(LyXFont::ALL_INHERIT));
+       pimpl_->insertChar(pos, c, change);
 }
 
 
 void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
                           LyXFont const & font, Change change)
 {
-       pimpl_->insertChar(pos, c, font, change);
+       pimpl_->insertChar(pos, c, change);
+       setFont(pos, font);
 }
 
 
-void Paragraph::insertInset(pos_type pos, InsetBase * inset)
+void Paragraph::insertInset(pos_type pos, InsetBase * inset, Change change)
 {
-       insertInset(pos, inset, LyXFont(LyXFont::ALL_INHERIT));
+       pimpl_->insertInset(pos, inset, change);
 }
 
 
 void Paragraph::insertInset(pos_type pos, InsetBase * inset,
-       LyXFont const & font, Change change)
+                           LyXFont const & font, Change change)
 {
-       pimpl_->insertInset(pos, inset, font, change);
+       pimpl_->insertInset(pos, inset, change);
+       setFont(pos, font);
 }
 
 
@@ -917,15 +920,16 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
        unsigned int column = 0;
 
        if (body_pos > 0) {
-               os << '[';
-               ++column;
+               // the optional argument is kept in curly brackets in
+               // case it contains a ']'
+               os << "[{";
+               column += 2;
                basefont = getLabelFont(bparams, outerfont);
        } else {
                basefont = getLayoutFont(bparams, outerfont);
        }
 
-       bool moving_arg = runparams.moving_arg;
-       moving_arg |= style->needprotect;
+       bool const moving_arg = runparams.moving_arg | style->needprotect;
 
        // Which font is currently active?
        LyXFont running_font(basefont);
@@ -957,8 +961,8 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
                                }
                                basefont = getLayoutFont(bparams, outerfont);
                                running_font = basefont;
-                               os << ']';
-                               ++column;
+                               os << "}] ";
+                               column +=3;
                        }
                        if (style->isCommand()) {
                                os << '{';
@@ -1027,8 +1031,10 @@ bool Paragraph::simpleTeXOnePar(Buffer const & buf,
                OutputParams rp = runparams;
                rp.moving_arg = moving_arg;
                rp.free_spacing = style->free_spacing;
+               rp.lang = font.language()->babel();
+               rp.intitle = style->intitle;
                pimpl_->simpleTeXSpecialChars(buf, bparams,
-                                             os, texrow, runparams,
+                                             os, texrow, rp,
                                              font, running_font,
                                              basefont, outerfont, open_font,
                                              running_change,
@@ -1475,15 +1481,15 @@ bool IsInsetChar(char c)
 
 bool Paragraph::isHfill(pos_type pos) const
 {
-       return
-               isInset(pos) && getInset(pos)->lyxCode() == InsetBase::HFILL_CODE;
+       return isInset(pos) 
+               && getInset(pos)->lyxCode() == InsetBase::HFILL_CODE;
 }
 
 
 bool Paragraph::isNewline(pos_type pos) const
 {
-       return
-               isInset(pos) && getInset(pos)->lyxCode() == InsetBase::NEWLINE_CODE;
+       return isInset(pos) 
+               && getInset(pos)->lyxCode() == InsetBase::NEWLINE_CODE;
 }
 
 
@@ -1730,25 +1736,6 @@ void Paragraph::rejectChange(pos_type start, pos_type end)
 }
 
 
-Paragraph::value_type Paragraph::getChar(pos_type pos) const
-{
-       // This is in the critical path!
-       pos_type const siz = text_.size();
-
-       BOOST_ASSERT(0 <= pos);
-       BOOST_ASSERT(pos <= siz);
-
-       if (pos == siz) {
-               lyxerr << "getChar() on pos " << pos << " in par id "
-                      << id() << " of size " << siz
-                      << "  is a bit silly !" << endl;
-               BOOST_ASSERT(false);
-       }
-
-       return text_[pos];
-}
-
-
 int Paragraph::id() const
 {
        return pimpl_->id_;