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
This commit is contained in:
Lars Gullik Bjønnes 2003-05-07 21:27:29 +00:00
parent ac1faa8439
commit 468560431f
6 changed files with 24 additions and 18 deletions

View File

@ -1,5 +1,13 @@
2003-05-07 Lars Gullik Bjønnes <larsbj@gullik.net>
* 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

View File

@ -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. "

View File

@ -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()) {

View File

@ -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;

View File

@ -8,12 +8,11 @@
#include <config.h>
#include <algorithm>
#include "texrow.h"
#include "paragraph.h"
#include "debug.h"
#include <algorithm>
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);
}

View File

@ -13,19 +13,20 @@
#include <list>
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;
};