]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.h
minimal effort implementation of:
[lyx.git] / src / paragraph.h
index 13c99ca873527bec4efddf25eb3b39fb9e9dad43..c5b4270c3298113b0215705a6b236fbb35515f93 100644 (file)
@@ -58,7 +58,7 @@ public:
        lyx::pos_type first, last;
 };
 
-       
+
 /// A Paragraph holds all text, attributes and insets in a text paragraph
 class Paragraph  {
 public:
@@ -69,10 +69,20 @@ public:
                /// (returning 0) - if this was 0, then we'd
                /// try getInset() and crash. We should fix
                /// all these places.
-               META_INSET = 1
+               //META_INSET = 1 // as in trunk
+               META_INSET = 0x200001  // above 0x10ffff, for ucs-4
+       };
+       enum ChangeTracking
+       {
+               /// Change tracking is "on" in this buffer
+               trackingOn,
+               /// Change tracking is "off" in this buffer
+               trackingOff,
+               /// Change tracking is "unknown" in this buffer
+               trackingUnknown
        };
        ///
-       typedef char value_type;
+       typedef lyx::char_type value_type;
        ///
        typedef lyx::depth_type depth_type;
        ///
@@ -107,10 +117,10 @@ public:
        ///
        std::string const asString(Buffer const &, bool label) const;
        ///
-       std::string const Paragraph::asString(Buffer const & buffer,
-                                             lyx::pos_type beg,
-                                             lyx::pos_type end,
-                                             bool label) const;
+       std::string const asString(Buffer const & buffer,
+                                  lyx::pos_type beg,
+                                  lyx::pos_type end,
+                                  bool label) const;
        ///
        std::string const asString(Buffer const &,
                                   OutputParams const & runparams,
@@ -136,17 +146,10 @@ public:
                             LyXFont const & outerfont, std::ostream &,
                             TexRow & texrow, OutputParams const &) const;
 
-       /// Writes to stream the content of the paragraph for linuxdoc
-       void simpleLinuxDocOnePar(Buffer const & buf,
-                                 std::ostream & os,
-                                 LyXFont const & outerfont,
-                                 OutputParams const & runparams,
-                                 lyx::depth_type depth) const;
-
        /// Can we drop the standard paragraph wrapper?
        bool emptyTag() const;
 
-       /// Get the id of the paragraph, usefull for docbook and linuxdoc
+       /// Get the id of the paragraph, usefull for docbook
        std::string getID(Buffer const & buf,
                          OutputParams const & runparams) const;
 
@@ -208,13 +211,10 @@ public:
        void untrackChanges();
 
        /// set entire paragraph to new text for change tracking
-       void cleanChanges();
-
-       /// look up change type at given pos
-       Change::Type lookupChange(lyx::pos_type pos) const;
+       void cleanChanges(ChangeTracking ct = trackingUnknown);
 
        /// look up change at given pos
-       Change const lookupChangeFull(lyx::pos_type pos) const;
+       Change const lookupChange(lyx::pos_type pos) const;
 
        /// is there a change within the given range ?
        bool isChanged(lyx::pos_type start, lyx::pos_type end) const;
@@ -222,8 +222,11 @@ 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);
+       /// set change type at given pos
+       void setChangeType(lyx::pos_type pos, Change::Type type);
+
+       /// set change at given pos
+       void setChange(lyx::pos_type pos, Change change);
 
        /// accept change
        void acceptChange(lyx::pos_type start, lyx::pos_type end);
@@ -273,7 +276,7 @@ public:
        LyXFont const
        getFontSettings(BufferParams const &, lyx::pos_type pos) const;
        ///
-       LyXFont const getFirstFontSettings() const;
+       LyXFont const getFirstFontSettings(BufferParams const &) const;
 
        /** Get fully instantiated font. If pos == -1, use the layout
            font attached to this paragraph.
@@ -366,7 +369,7 @@ public:
        /// return true if we allow this par to stay empty
        bool allowEmpty() const;
        ///
-       unsigned char transformChar(unsigned char c, lyx::pos_type pos) const;
+       lyx::char_type transformChar(lyx::char_type c, lyx::pos_type pos) const;
        ///
        ParagraphParameters & params();
        ///
@@ -391,6 +394,8 @@ public:
        RowList & rows() { return rows_; }
        /// The painter and others use this
        RowList const & rows() const { return rows_; }
+       ///
+       RowSignature & rowSignature() const { return rowSignature_; }
 
        /// LyXText::redoParagraph updates this
        Dimension & dim() { return dim_; }
@@ -408,6 +413,9 @@ private:
 
        ///
        mutable RowList rows_;
+       ///
+       mutable RowSignature rowSignature_;
+
        ///
        LyXLayout_ptr layout_;
        /**
@@ -429,13 +437,13 @@ private:
 
 inline bool isInsertedText(Paragraph const & par, lyx::pos_type pos)
 {
-       return par.lookupChange(pos) == Change::INSERTED;
+       return par.lookupChange(pos).type == Change::INSERTED;
 }
 
 
 inline bool isDeletedText(Paragraph const & par, lyx::pos_type pos)
 {
-       return par.lookupChange(pos) == Change::DELETED;
+       return par.lookupChange(pos).type == Change::DELETED;
 }
 
 #endif // PARAGRAPH_H