X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftexrow.h;h=700bcd67dfff7a8e42265be55db2a5d4b154ce8e;hb=98c966c64594611e469313314abd1e59524adb4a;hp=8d4017e9d3504fb04aa9f90bcde8531ec92efc2d;hpb=1d7d3cc4afa2205c801ccc2aa71c7ac59359dc5f;p=lyx.git diff --git a/src/texrow.h b/src/texrow.h index 8d4017e9d3..700bcd67df 100644 --- a/src/texrow.h +++ b/src/texrow.h @@ -1,11 +1,11 @@ // -*- C++ -*- /* This file is part of - * ====================================================== - * + * ====================================================== + * * LyX, The Document Processor - * + * * Copyright 1995 Matthias Ettrich - * Copyright 1995-1998 The LyX Team + * Copyright 1995-2001 The LyX Team * * ====================================================== */ @@ -17,62 +17,83 @@ #endif #include -using std::list; -class LyXParagraph; +class Paragraph; // Controls correspondance between paragraphs and the generated LaTeX file class TexRow { public: /// - TexRow() { - count = 0; - lastpar = 0; - lastpos = -1; - } + 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+= (TexRow const &); -private: + /// Returns the number of rows in this texrow + int rows() const { return count; } + /// Linked list of items - struct RowItem { + class RowItem { + public: + /// + RowItem() : id_(-1), pos_(-1), rownumber_(0) {} /// - RowItem() { - id = -1; - pos = -1; - rownumber = 0; + void id(int i) { + id_ = i; } - /// - int id; + int id() const { + return id_; + } /// - int pos; + void pos(int p) { + pos_ = p; + } /// - int rownumber; + int pos() const { + return pos_; + } + /// + void rownumber(int r) { + rownumber_ = r; + } + /// + int rownumber() const { + return rownumber_; + } + private: + /// + int id_; + /// + int pos_; + /// + int rownumber_; }; /// - unsigned int count; + typedef std::list RowList; /// - typedef list RowList; + void increasePos(int id, int pos) const; +private: /// - RowList rowlist; + unsigned int count; + /// + mutable RowList rowlist; /// Last paragraph - LyXParagraph * lastpar; + Paragraph * lastpar; /// Last position int lastpos; - + }; #endif