]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.h
Alfredo's second patch
[lyx.git] / src / paragraph.h
index 62a82b68308ee8d8f85f3e5babad470382d71436..248107ff6c61ed4c9a6a7d91340317c8cb95843c 100644 (file)
@@ -18,6 +18,7 @@
 #include "support/types.h"
 #include "changes.h"
 
+#include "ParagraphList.h"
 #include "LString.h"
 
 class BufferParams;
@@ -37,14 +38,18 @@ class TexRow;
 /// A Paragraph holds all text, attributes and insets in a text paragraph
 class Paragraph  {
 public:
+       // Remove this whan ParagraphList transition is over. (Lgb)
+       friend class ParagraphList;
+       friend class ParagraphList::iterator;
+
        ///
        enum META_KIND {
-               ///
-               META_HFILL = 1,
-               ///
-               META_NEWLINE,
-               ///
-               META_INSET
+               /// Note that this is 1 right now to avoid
+               /// crashes where getChar() is called wrongly
+               /// (returning 0) - if this was 0, then we'd
+               /// try getInset() and crash. We should fix
+               /// all these places.
+               META_INSET = 1
        };
        ///
        typedef char value_type;
@@ -87,8 +92,6 @@ public:
 
        /// return the unique ID of this paragraph
        int id() const;
-       ///
-       void read();
 
        ///
        int startTeXParParams(BufferParams const &, std::ostream &, bool) const;
@@ -99,20 +102,15 @@ public:
 
        ///
        bool simpleTeXOnePar(Buffer const *, BufferParams const &,
-                            std::ostream &, TexRow & texrow, bool moving_arg);
+                            LyXFont const & outerfont, std::ostream &,
+                            TexRow & texrow, bool moving_arg);
 
        ///
-       bool hasSameLayout(Paragraph const * par) const;
+       bool hasSameLayout(Paragraph const & par) const;
 
        ///
-       void makeSameLayout(Paragraph const * par);
-
-       /// Is it the first par with same depth and layout?
-       bool isFirstInSequence() const;
+       void makeSameLayout(Paragraph const & par);
 
-       /** Check if the current paragraph is the last paragraph in a
-           proof environment */
-       int getEndLabel() const;
        ///
        Inset * inInset() const;
        ///
@@ -127,7 +125,7 @@ public:
        ///
        bool empty() const;
        ///
-       void setContentsFromPar(Paragraph * par);
+       void setContentsFromPar(Paragraph const & par);
        ///
        void clearContents();
 
@@ -183,6 +181,9 @@ public:
        /// is there a non-addition in this range ?
        bool isChangeEdited(lyx::pos_type start, lyx::pos_type end) const;
 
+       /// set change at pos
+       void setChange(lyx::pos_type pos, Change::Type type);
+
        /// accept change
        void acceptChange(lyx::pos_type start, lyx::pos_type end);
 
@@ -192,16 +193,12 @@ public:
        /// mark whole par as erased
        void markErased();
 
-       /// for the environments
-       Paragraph * depthHook(depth_type depth);
-       /// for the environments
-       Paragraph const * depthHook(depth_type depth) const;
-       ///
-       Paragraph * outerHook();
-       ///
-       Paragraph const * outerHook() const;
-       ///
-       int beginningOfMainBody() const;
+       /// Paragraphs can contain "manual labels", for example, Description environment.
+       /// The text for this user-editable label is stored in the paragraph alongside
+       /// the text of the rest of the paragraph (the body). This function returns
+       /// the starting position of the body of the text in the paragraph.
+       int beginningOfBody() const;
+
        ///
        string const & getLabelstring() const;
 
@@ -218,10 +215,12 @@ public:
        ///
        void applyLayout(LyXLayout_ptr const & new_layout);
 
+       /// 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);
+       /// 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.
@@ -239,9 +238,12 @@ public:
            attributes with values LyXFont::INHERIT, LyXFont::IGNORE or
            LyXFont::TOGGLE.
        */
-       LyXFont const getFont(BufferParams const &, lyx::pos_type pos) const;
-       LyXFont const getLayoutFont(BufferParams const &) const;
-       LyXFont const getLabelFont(BufferParams const &) const;
+       LyXFont const getFont(BufferParams const &, lyx::pos_type pos,
+                             LyXFont const & outerfont) const;
+       LyXFont const getLayoutFont(BufferParams const &,
+                                   LyXFont const & outerfont) const;
+       LyXFont const getLabelFont(BufferParams const &,
+                                  LyXFont const & outerfont) const;
        ///
        value_type getChar(lyx::pos_type pos) const;
        ///
@@ -314,10 +316,6 @@ public:
        InsetList insetlist;
        ///
        //Counters & counters();
-
-       friend void breakParagraph(BufferParams const & bparams,
-                   Paragraph * par, lyx::pos_type pos, int flag);
-
 private:
        ///
        LyXLayout_ptr layout_;
@@ -328,12 +326,18 @@ private:
        Paragraph * next_;
        ///
        Paragraph * previous_;
+#else
+       Paragraph * next_par_;
+       Paragraph * prev_par_;
 #endif
        struct Pimpl;
        ///
        friend struct Paragraph::Pimpl;
        ///
        Pimpl * pimpl_;
+
+       /// unimplemented
+       void operator=(Paragraph const &);
 };