From 468560431fafad23fedd6d952421c622fe7874b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Wed, 7 May 2003 21:27:29 +0000 Subject: [PATCH] Remove Paragraph dependency from texrow, use a id instead. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6949 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 8 ++++++++ src/buffer.C | 2 +- src/paragraph.C | 2 +- src/paragraph_pimpl.C | 6 +++--- src/texrow.C | 13 ++++++------- src/texrow.h | 11 +++++------ 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f0ff9fbc0c..46f1d23d1f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2003-05-07 Lars Gullik Bjønnes + * texrow.[Ch]: remove dependency on Paragraph and just store a id + instead. + * paragraph_pimpl.C (simpleTeXBlanks): adjust + (simpleTeXSpecialChars): adjust + (simpleTeXSpecialChars): adjust + * paragraph.C (simpleTeXOnePar): adjust + * buffer.C (makeLaTeXFile): adjust + * Makefile.am (BOOST_LIBS): allow boost as system lib. * text2.C (changeDepth): parlist cleanup diff --git a/src/buffer.C b/src/buffer.C index e0dbba5304..731e538c1c 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -1037,7 +1037,7 @@ void Buffer::makeLaTeXFile(ostream & os, texrow.reset(); // The starting paragraph of the coming rows is the // first paragraph of the document. (Asger) - texrow.start(&*paragraphs.begin(), 0); + texrow.start(paragraphs.begin()->id(), 0); if (!only_body && nice) { os << "%% " << lyx_docversion << " created this file. " diff --git a/src/paragraph.C b/src/paragraph.C index e406875749..f55e38e9dc 100644 --- a/src/paragraph.C +++ b/src/paragraph.C @@ -979,7 +979,7 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf, Change::Type running_change = Change::UNCHANGED; - texrow.start(this, 0); + texrow.start(id(), 0); // if the paragraph is empty, the loop will not be entered at all if (empty()) { diff --git a/src/paragraph_pimpl.C b/src/paragraph_pimpl.C index 65810266dd..260d5d801d 100644 --- a/src/paragraph_pimpl.C +++ b/src/paragraph_pimpl.C @@ -441,7 +441,7 @@ void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow, || getChar(i - 1) == '!'))) { os << '\n'; texrow.newline(); - texrow.start(owner_, i + 1); + texrow.start(owner_->id(), i + 1); column = 0; } else if (style.free_spacing) { os << '~'; @@ -540,7 +540,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, os << "\\\\\n"; } texrow.newline(); - texrow.start(owner_, i + 1); + texrow.start(owner_->id(), i + 1); column = 0; break; } @@ -589,7 +589,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf, for (int j = 0; j < tmp; ++j) { texrow.newline(); } - texrow.start(owner_, i + 1); + texrow.start(owner_->id(), i + 1); column = 0; } else { column += int(os.tellp()) - len; diff --git a/src/texrow.C b/src/texrow.C index 80adc8463e..96e3d2bd0e 100644 --- a/src/texrow.C +++ b/src/texrow.C @@ -8,12 +8,11 @@ #include -#include - #include "texrow.h" -#include "paragraph.h" #include "debug.h" +#include + using std::find_if; using std::for_each; using std::endl; @@ -70,21 +69,21 @@ void TexRow::reset() { rowlist.clear(); count = 0; - lastpar = 0; + lastid = -1; lastpos = -1; } -void TexRow::start(Paragraph * par, int pos) +void TexRow::start(int id, int pos) { - lastpar = par; + lastid = id; lastpos = pos; } void TexRow::newline() { - int const id = lastpar ? lastpar->id() : -1; + int const id = lastid; RowList::value_type tmp(id, lastpos, ++count); rowlist.push_back(tmp); } diff --git a/src/texrow.h b/src/texrow.h index 2ee432f6af..6a8f4b0aa1 100644 --- a/src/texrow.h +++ b/src/texrow.h @@ -13,19 +13,20 @@ #include -class Paragraph; /// Represents the correspondence between paragraphs and the generated LaTeX file class TexRow { public: /// - TexRow() : count(0), lastpar(0), lastpos(-1) {} + TexRow() : count(0), lastid(-1), lastpos(-1) {} + + TexRow & operator+= (TexRow const &); /// Clears structure void reset(); /// Define what paragraph and position the next row will represent - void start(Paragraph * par, int pos); + void start(int id, int pos); /// Insert node when line is completed void newline(); @@ -42,8 +43,6 @@ public: */ bool getIdFromRow(int row, int & id, int & pos) const; - TexRow & operator+= (TexRow const &); - /// Returns the number of rows contained int rows() const { return count; } @@ -90,7 +89,7 @@ private: /// container of id/pos <=> row mapping RowList rowlist; /// Last paragraph - Paragraph * lastpar; + int lastid; /// Last position int lastpos; }; -- 2.39.5