X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftexrow.h;h=35a53be2f38ca71517202341d2414d1d1b321f12;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=2afb02fc013553f9238f3c8525eba577074826a6;hpb=83acbbd5237373926c629855379e1df9a04209b2;p=lyx.git diff --git a/src/texrow.h b/src/texrow.h index 2afb02fc01..35a53be2f3 100644 --- a/src/texrow.h +++ b/src/texrow.h @@ -1,99 +1,102 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team +/** + * \file texrow.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * ====================================================== */ + * \author Matthias Ettrich + * \author Lars Gullik Bjønnes + * \author John Levon + * + * Full author contact details are available in file CREDITS. + */ #ifndef TEXROW_H #define TEXROW_H -#ifdef __GNUG__ -#pragma interface -#endif - #include -class LyXParagraph; -// Controls correspondance between paragraphs and the generated LaTeX file +namespace lyx { + + +/// 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(LyXParagraph * par, int pos); + void start(int id, int pos); /// Insert node when line is completed void newline(); - /// Returns paragraph id and position from a row number + /** + * getIdFromRow - find pid and position for a given row + * @param row row number to find + * @param id set to id if found + * @param pos set to paragraph position if found + * @return true if found, false otherwise + * + * If the row could not be found, pos is set to zero and + * id is set to -1 + */ bool getIdFromRow(int row, int & id, int & pos) const; - /// Appends another TexRow - TexRow & operator+= (TexRow const &); - - /// Returns the number of rows in this texrow + /// Returns the number of rows contained int rows() const { return count; } - /// Linked list of items + /// an individual id/pos <=> row mapping class RowItem { public: - /// - RowItem() : id_(-1), pos_(-1), rownumber_(0) {} - /// - void id(int i) { - id_ = i; - } - /// + RowItem(int id, int pos, int row) + : id_(id), pos_(pos), rownumber_(row) + {} + + /// paragraph id int id() const { return id_; } - /// + + /// set paragraph position void pos(int p) { pos_ = p; } - /// + + /// paragraph position int pos() const { return pos_; } - /// - void rownumber(int r) { - rownumber_ = r; - } - /// + + /// row number int rownumber() const { return rownumber_; } private: - /// int id_; - /// int pos_; - /// int rownumber_; }; /// typedef std::list RowList; - /// - void increasePos(int id, int pos) const; private: - /// + /// number of lines unsigned int count; - /// - mutable RowList rowlist; + /// container of id/pos <=> row mapping + RowList rowlist; /// Last paragraph - LyXParagraph * lastpar; + int lastid; /// Last position int lastpos; - }; -#endif + + +} // namespace lyx + +#endif // TEXROW_H