]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph_pimpl.C
remove more forms.h cruft
[lyx.git] / src / paragraph_pimpl.C
index 8e3a9eee818f6226ce2cb80f30ec153abee27c42..37f71b1569420b61457dcf38440773a6069dbe9c 100644 (file)
@@ -40,7 +40,7 @@ Paragraph::Pimpl::Pimpl(Paragraph * owner)
 
 
 Paragraph::Pimpl::Pimpl(Paragraph::Pimpl const & p, Paragraph * owner)
-       : owner_(owner)
+       : params(p.params), owner_(owner)
 {
        inset_owner = p.inset_owner;
        text = p.text;
@@ -93,17 +93,17 @@ void Paragraph::Pimpl::insertChar(Paragraph::size_type pos,
 
        // Update the font table.
        FontTable search_font(pos, LyXFont());
-       for (FontList::iterator it = lower_bound(fontlist.begin(),
-                                                fontlist.end(),
-                                                search_font, matchFT());
+       for (FontList::iterator it = std::lower_bound(fontlist.begin(),
+                                                     fontlist.end(),
+                                                     search_font, matchFT());
             it != fontlist.end(); ++it)
                (*it).pos((*it).pos() + 1);
    
        // Update the inset table.
        InsetTable search_inset(pos, 0);
-       for (InsetList::iterator it = lower_bound(owner_->insetlist.begin(),
-                                                 owner_->insetlist.end(),
-                                                 search_inset, matchIT());
+       for (InsetList::iterator it = std::lower_bound(owner_->insetlist.begin(),
+                                                      owner_->insetlist.end(),
+                                                      search_inset, matchIT());
             it != owner_->insetlist.end(); ++it)
                ++(*it).pos;
 
@@ -122,12 +122,12 @@ void Paragraph::Pimpl::insertInset(Paragraph::size_type pos,
        
        // Add a new entry in the inset table.
        InsetTable search_inset(pos, 0);
-       InsetList::iterator it = lower_bound(owner_->insetlist.begin(),
-                                            owner_->insetlist.end(),
-                                            search_inset, matchIT());
+       InsetList::iterator it = std::lower_bound(owner_->insetlist.begin(),
+                                                 owner_->insetlist.end(),
+                                                 search_inset, matchIT());
        if (it != owner_->insetlist.end() && (*it).pos == pos) {
                lyxerr << "ERROR (Paragraph::InsertInset): "
-                       "there is an inset in position: " << pos << endl;
+                       "there is an inset in position: " << pos << std::endl;
        } else {
                owner_->insetlist.insert(it, InsetTable(pos, inset));
        }
@@ -145,9 +145,9 @@ void Paragraph::Pimpl::erase(Paragraph::size_type pos)
                // find the entry
                InsetTable search_inset(pos, 0);
                InsetList::iterator it =
-                       lower_bound(owner_->insetlist.begin(),
-                                   owner_->insetlist.end(),
-                                   search_inset, matchIT());
+                       std::lower_bound(owner_->insetlist.begin(),
+                                        owner_->insetlist.end(),
+                                        search_inset, matchIT());
                if (it != owner_->insetlist.end() && (*it).pos == pos) {
                        delete (*it).inset;
                        owner_->insetlist.erase(it);
@@ -160,7 +160,7 @@ void Paragraph::Pimpl::erase(Paragraph::size_type pos)
        FontTable search_font(pos, LyXFont());
        
        FontList::iterator it =
-               lower_bound(fontlist.begin(),
+               std::lower_bound(fontlist.begin(),
                            fontlist.end(),
                            search_font, matchFT());
        if (it != fontlist.end() && (*it).pos() == pos &&
@@ -190,27 +190,29 @@ void Paragraph::Pimpl::erase(Paragraph::size_type pos)
        InsetTable search_inset(pos, 0);
        InsetList::iterator lend = owner_->insetlist.end();
        for (InsetList::iterator it =
-                    upper_bound(owner_->insetlist.begin(),
-                                lend,
-                                search_inset, matchIT());
+                    std::upper_bound(owner_->insetlist.begin(),
+                                     lend,
+                                     search_inset, matchIT());
             it != lend; ++it)
                --(*it).pos;
 }
 
 
-void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow,
-                                  Paragraph::size_type const i,
-                                  int & column, LyXFont const & font,
-                                  LyXLayout const & style)
+void Paragraph::Pimpl::simpleTeXBlanks(std::ostream & os, TexRow & texrow,
+                                      Paragraph::size_type const i,
+                                      int & column, LyXFont const & font,
+                                      LyXLayout const & style)
 {
        if (column > tex_code_break_column
            && i 
            && owner_->getChar(i - 1) != ' '
            && (i < owner_->size() - 1)
+#ifndef NO_LATEX
            // In LaTeX mode, we don't want to
            // break lines since some commands
            // do not like this
            && ! (font.latex() == LyXFont::ON)
+#endif
            // same in FreeSpacing mode
            && !style.free_spacing
            // In typewriter mode, we want to avoid 
@@ -230,19 +232,25 @@ void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow,
                texrow.newline();
                texrow.start(owner_, i + 1);
                column = 0;
-       } else if (font.latex() == LyXFont::OFF) {
+       } else
+#ifndef NO_LATEX
+               if (font.latex() == LyXFont::OFF) {
+#endif
                if (style.free_spacing) {
                        os << '~';
                } else {
                        os << ' ';
                }
+#ifndef NO_LATEX
        }
+#endif
 }
 
 
 void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
                                             BufferParams const & bparams,
-                                            ostream & os, TexRow & texrow,
+                                            std::ostream & os,
+                                            TexRow & texrow,
                                             bool moving_arg,
                                             LyXFont & font,
                                             LyXFont & running_font,
@@ -263,15 +271,15 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
                        bool close = false;
                        int const len = os.tellp();
                        //ostream::pos_type const len = os.tellp();
-                       if ((inset->LyxCode() == Inset::GRAPHICS_CODE
-                            || inset->LyxCode() == Inset::MATH_CODE
-                            || inset->LyxCode() == Inset::URL_CODE)
+                       if ((inset->lyxCode() == Inset::GRAPHICS_CODE
+                            || inset->lyxCode() == Inset::MATH_CODE
+                            || inset->lyxCode() == Inset::URL_CODE)
                            && running_font.isRightToLeft()) {
                                os << "\\L{";
                                close = true;
                        }
 
-                       int tmp = inset->Latex(buf, os, moving_arg,
+                       int tmp = inset->latex(buf, os, moving_arg,
                                               style.free_spacing);
 
                        if (close)
@@ -307,6 +315,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
 
        default:
                // And now for the special cases within each mode
+#ifndef NO_LATEX
                // Are we in LaTeX mode?
                if (font.latex() == LyXFont::ON) {
                        // at present we only have one option
@@ -325,6 +334,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
                                break;
                        }
                } else {
+#endif
                        // Plain mode (i.e. not LaTeX)
                        switch (c) {
                        case '\\': 
@@ -498,7 +508,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
                                }
                                break;
                        }
+#ifndef NO_LATEX
                }
+#endif
        }
 }
 
@@ -506,9 +518,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
 
 Paragraph * Paragraph::Pimpl::TeXDeeper(Buffer const * buf,
                                        BufferParams const & bparams,
-                                       ostream & os, TexRow & texrow)
+                                       std::ostream & os, TexRow & texrow)
 {
-       lyxerr[Debug::LATEX] << "TeXDeeper...     " << this << endl;
+       lyxerr[Debug::LATEX] << "TeXDeeper...     " << this << std::endl;
        Paragraph * par = owner_;
 
        while (par && par->params().depth() == owner_->params().depth()) {
@@ -521,7 +533,7 @@ Paragraph * Paragraph::Pimpl::TeXDeeper(Buffer const * buf,
                                             os, texrow, false);
                }
        }
-       lyxerr[Debug::LATEX] << "TeXDeeper...done " << par << endl;
+       lyxerr[Debug::LATEX] << "TeXDeeper...done " << par << std::endl;
 
        return par;
 }