X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftexrow.h;h=0c3adb33301aed9f223042258bbbec3b53a41e4e;hb=342932ad32b6eb9afc0845717d2e3f25433bb5f1;hp=11aa605740c374896276f56c3725ec6c8c1929ca;hpb=27de1486ca34aaad446adb798d71a77d6f6304da;p=lyx.git diff --git a/src/texrow.h b/src/texrow.h index 11aa605740..0c3adb3330 100644 --- a/src/texrow.h +++ b/src/texrow.h @@ -1,79 +1,97 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich - * Copyright (C) 1995-1998 The LyX Team + * Copyright 1995 Matthias Ettrich + * Copyright 1995-2001 The LyX Team * - *======================================================*/ + * ====================================================== */ -#ifndef _TEXROW_H -#define _TEXROW_H +#ifndef TEXROW_H +#define TEXROW_H #ifdef __GNUG__ #pragma interface #endif -class LyXParagraph; +#include + +class Paragraph; // Controls correspondance between paragraphs and the generated LaTeX file class TexRow { public: /// - TexRow() { - count = 0; - next = 0; - lastpar = 0; - lastpos = -1; - } - /// - ~TexRow() { - reset(); - } + TexRow() : count(0), lastpar(0), lastpos(-1) {} /// Clears structure void reset(); /// Define what paragraph and position the next row will represent - void start(LyXParagraph *par, int pos); + void start(Paragraph * par, int pos); /// Insert node when line is completed void newline(); /// Returns paragraph id and position from a row number - void getIdFromRow(int row, int &id, int &pos); + bool getIdFromRow(int row, int & id, int & pos) const; /// Appends another TexRow - TexRow & operator+=(const TexRow &); + TexRow & operator+= (TexRow const &); + + /// Returns the number of rows in this texrow + int rows() const { return count; } -private: /// Linked list of items - struct TexRow_Item { + class RowItem { + public: + /// + RowItem() : id_(-1), pos_(-1), rownumber_(0) {} /// - TexRow_Item() { - id = -1; - pos = -1; - next = 0; - rownumber = 0; + void id(int i) { + id_ = i; + } + /// + int id() const { + return id_; + } + /// + void pos(int p) { + pos_ = p; } - /// - int id; + int pos() const { + return pos_; + } /// - int pos; + void rownumber(int r) { + rownumber_ = r; + } + /// + int rownumber() const { + return rownumber_; + } + private: /// - int rownumber; + int id_; /// - TexRow_Item *next; + int pos_; + /// + int rownumber_; }; + /// + typedef std::list RowList; + /// + void increasePos(int id, int pos) const; +private: /// unsigned int count; /// - TexRow_Item *next; + mutable RowList rowlist; /// Last paragraph - LyXParagraph * lastpar; + Paragraph * lastpar; /// Last position int lastpos;