]> git.lyx.org Git - features.git/commitdiff
Remove Paragraph dependency from texrow, use a id instead.
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 7 May 2003 21:27:29 +0000 (21:27 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 7 May 2003 21:27:29 +0000 (21:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6949 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/buffer.C
src/paragraph.C
src/paragraph_pimpl.C
src/texrow.C
src/texrow.h

index f0ff9fbc0cee4ee9458c75c86e4ed91e9c009f77..46f1d23d1f12781ebd49cb14be7d1c16680325bf 100644 (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
index e0dbba53041157f3fbd15865c4ad1ded4942798c..731e538c1c756f3e3345ebea7db34efdbd7a957a 100644 (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.  "
index e406875749aca265a942c1def78ee9220ad7e22b..f55e38e9dc2b7bdf8a78c72c4d7d6f351e83d73f 100644 (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()) {
index 65810266ddd09cccc1abfac8439502b1b6ea21c2..260d5d801dedac578fb3eb28006a4e9e0c2b638d 100644 (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;
index 80adc8463ee7c8b15332b48d73965b10b4a34bf8..96e3d2bd0e8d2dc5d86491ce0113a27e215af482 100644 (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);
 }
index 2ee432f6af84aac3d18de945518016e00c4bf3d6..6a8f4b0aa17f7059891310feda03e797b2b91b19 100644 (file)
 
 #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;
 };