]> git.lyx.org Git - features.git/blobdiff - src/paragraph.h
parlist-22-a.diff
[features.git] / src / paragraph.h
index 1842cd558e723d57237019df1adbd7b166e696f8..5abcaf4d78324cabf8c451763d6b3b8de4d84d00 100644 (file)
 #include "ParagraphList.h"
 #include "LString.h"
 
+#include <boost/optional.hpp>
+
 class BufferParams;
 class BufferView;
 class Counters;
 class InsetBibitem;
 class Language;
 class LaTeXFeatures;
+class LatexRunParams;
 class ParagraphParameters;
 class TexRow;
 
 // Define this if you want to try out the new storage container for
 // paragraphs. (Lgb)
 // This is non working and far from finished.
-// #define NO_NEXT 1
+#define NO_STD_LIST 1
 
 /// A Paragraph holds all text, attributes and insets in a text paragraph
 class Paragraph  {
 public:
+#ifdef NO_STD_LIST
        // Remove this whan ParagraphList transition is over. (Lgb)
        friend class ParagraphList;
        friend class ParagraphList::iterator;
-
+#endif
        ///
        enum META_KIND {
                /// Note that this is 1 right now to avoid
@@ -58,13 +62,11 @@ public:
 
        ///
        Paragraph();
-#ifndef NO_NEXT
-       /// this constructor inserts the new paragraph in a list
-       explicit
-       Paragraph(Paragraph * par);
-#endif
+
+       ///
+       Paragraph(Paragraph const &);
        ///
-       Paragraph(Paragraph const &, bool same_ids);
+       //void operator=(Paragraph const &);
        /// the destructor removes the new paragraph from the list
        ~Paragraph();
 
@@ -92,6 +94,8 @@ public:
 
        /// return the unique ID of this paragraph
        int id() const;
+       /// Set the Id of this paragraph.
+       void id(int);
 
        ///
        int startTeXParParams(BufferParams const &, std::ostream &, bool) const;
@@ -103,13 +107,13 @@ public:
        ///
        bool simpleTeXOnePar(Buffer const *, BufferParams const &,
                             LyXFont const & outerfont, std::ostream &,
-                            TexRow & texrow, bool moving_arg);
+                            TexRow & texrow, LatexRunParams const &);
 
        ///
-       bool hasSameLayout(Paragraph const * par) const;
+       bool hasSameLayout(Paragraph const & par) const;
 
        ///
-       void makeSameLayout(Paragraph const * par);
+       void makeSameLayout(Paragraph const & par);
 
        ///
        Inset * inInset() const;
@@ -125,7 +129,7 @@ public:
        ///
        bool empty() const;
        ///
-       void setContentsFromPar(Paragraph * par);
+       void setContentsFromPar(Paragraph const & par);
        ///
        void clearContents();
 
@@ -143,23 +147,6 @@ public:
        ///
        InsetBibitem * bibitem();  // ale970302
 
-#ifndef NO_NEXT
-       ///
-       void next(Paragraph *);
-       /** these function are able to hide closed footnotes
-        */
-       Paragraph * next();
-       ///
-       Paragraph const * next() const;
-
-       ///
-       void previous(Paragraph *);
-       ///
-       Paragraph * previous();
-       ///
-       Paragraph const * previous() const;
-#endif
-
        /// initialise tracking for this par
        void trackChanges(Change::Type = Change::UNCHANGED);
 
@@ -218,9 +205,9 @@ public:
        /// definite erase
        void eraseIntern(lyx::pos_type pos);
        /// erase the char at the given position
-       void erase(lyx::pos_type pos);
-       /// erase the given range. Returns true if actually erased.
-       bool erase(lyx::pos_type start, lyx::pos_type end);
+       bool erase(lyx::pos_type pos);
+       /// erase the given range. Returns the number of chars actually erased
+       int erase(lyx::pos_type start, lyx::pos_type end);
 
        /** Get uninstantiated font setting. Returns the difference
            between the characters font and the layoutfont.
@@ -316,25 +303,26 @@ public:
        InsetList insetlist;
        ///
        //Counters & counters();
+       ///
+       void owningBuffer(Buffer const & b) {
+               buffer_.reset(&b);
+       }
 private:
        ///
        LyXLayout_ptr layout_;
-       /// if anything uses this we don't want it to.
-       Paragraph(Paragraph const &);
-#ifndef NO_NEXT
-       ///
-       Paragraph * next_;
-       ///
-       Paragraph * previous_;
-#else
+#ifdef NO_STD_LIST
        Paragraph * next_par_;
        Paragraph * prev_par_;
 #endif
+       ///
+       boost::optional<Buffer const *> buffer_;
+
        struct Pimpl;
        ///
        friend struct Paragraph::Pimpl;
        ///
        Pimpl * pimpl_;
+
 };
 
 
@@ -349,4 +337,6 @@ inline bool isDeletedText(Paragraph const & par, lyx::pos_type pos)
        return par.lookupChange(pos) == Change::DELETED;
 }
 
+bool operator==(Paragraph const & lhs, Paragraph const & rhs);
+
 #endif // PARAGRAPH_H