From fbcbeb513068aeee20d0ad57705c534e563a2698 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 15 Dec 2010 20:51:25 +0000 Subject: [PATCH] latex export optimisation step 1: There is no need for TeXOnePar to return a par iterator and to depend on that. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36893 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/output_latex.cpp | 24 ++++++++++++++---------- src/output_latex.h | 14 +++++++------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/output_latex.cpp b/src/output_latex.cpp index 37b5f56d6c..172e292161 100644 --- a/src/output_latex.cpp +++ b/src/output_latex.cpp @@ -87,8 +87,9 @@ TeXDeeper(Buffer const & buf, par = TeXEnvironment(buf, text, par, os, texrow, runparams); } else { - par = TeXOnePar(buf, text, par, - os, texrow, runparams); + TeXOnePar(buf, text, par, os, texrow, runparams); + if (par != text.paragraphs().end()) + par++; } } LYXERR(Debug::LATEX, "TeXDeeper...done "); @@ -234,7 +235,9 @@ TeXEnvironment(Buffer const & buf, ParagraphList::const_iterator par = pit; do { - par = TeXOnePar(buf, text, par, os, texrow, runparams); + TeXOnePar(buf, text, par, os, texrow, runparams); + if (par != paragraphs.end()) + par++; if (par == paragraphs.end()) { // Make sure that the last paragraph is @@ -364,7 +367,7 @@ int latexArgInsets(Paragraph const & par, odocstream & os, // FIXME: this should be anonymous -ParagraphList::const_iterator TeXOnePar(Buffer const & buf, +void TeXOnePar(Buffer const & buf, Text const & text, ParagraphList::const_iterator const pit, odocstream & os, TexRow & texrow, @@ -388,7 +391,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, pit == paragraphs.end() ? pit : boost::next(pit); if (style.inpreamble) - return nextpit; + return; OutputParams runparams = runparams_in; runparams.isLastPar = nextpit == paragraphs.end(); @@ -418,7 +421,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, pit->latex(bparams, outerfont, os, texrow, runparams, start_pos, end_pos); - return nextpit; + return; } if (style.pass_thru) { @@ -440,7 +443,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, } } - return nextpit; + return; } // This paragraph's language @@ -903,7 +906,7 @@ ParagraphList::const_iterator TeXOnePar(Buffer const & buf, if (nextpit != paragraphs.end()) LYXERR(Debug::LATEX, "TeXOnePar...done " << &*nextpit); - return nextpit; + return; } @@ -1012,8 +1015,9 @@ void latexParagraphs(Buffer const & buf, par = TeXEnvironment(buf, text, par, os, texrow, runparams); } else { - par = TeXOnePar(buf, text, par, os, texrow, - runparams, everypar); + TeXOnePar(buf, text, par, os, texrow, runparams, everypar); + if (par != paragraphs.end()) + par++; } if (distance(lastpar, par) >= distance(lastpar, endpar)) break; diff --git a/src/output_latex.h b/src/output_latex.h index 9a7de7ed69..dee6f9f86e 100644 --- a/src/output_latex.h +++ b/src/output_latex.h @@ -61,13 +61,13 @@ std::pair switchEncoding(odocstream & os, bool force = false); /// FIXME: this should not be visible. -ParagraphList::const_iterator TeXOnePar(Buffer const & buf, - Text const & text, - ParagraphList::const_iterator pit, - odocstream & os, TexRow & texrow, - OutputParams const & runparams, - std::string const & everypar = std::string(), - int start_pos = -1, int end_pos = -1); +void TeXOnePar(Buffer const & buf, + Text const & text, + ParagraphList::const_iterator pit, + odocstream & os, TexRow & texrow, + OutputParams const & runparams, + std::string const & everypar = std::string(), + int start_pos = -1, int end_pos = -1); } // namespace lyx