]> git.lyx.org Git - lyx.git/blobdiff - src/ParagraphMetrics.h
[the "translation" patch series] Part 2: fixing document label translations
[lyx.git] / src / ParagraphMetrics.h
index d685af837659e812a1405fd5f58f78f056082e63..6d9a3fa828ca74b9e3195dd098223710e78cc3f4 100644 (file)
 #ifndef PARAGRAPH_METRICS_H
 #define PARAGRAPH_METRICS_H
 
-#include "paragraph.h"
+#include "Paragraph.h"
 
 namespace lyx {
 
+/**
+ * Each paragraph is broken up into a number of rows on the screen.
+ * This is a list of such on-screen rows, ordered from the top row
+ * downwards.
+ */
+typedef std::vector<Row> RowList;
+
 class MetricsInfo;
 class PainterInfo;
 
@@ -31,6 +38,13 @@ public:
        ParagraphMetrics(): par_(0) {};
        /// The only useful constructor.
        ParagraphMetrics(Paragraph const & par);
+
+       /// Copy operator.
+       /// Important note: We don't copy \c row_change_status_ and
+       /// \c row_signature_ because those are updated externally with
+       /// \c updateRowChangeStatus() in TextMetrics::redoParagraph().
+       ParagraphMetrics & operator=(ParagraphMetrics const &);
+
        ///
        Row & getRow(pos_type pos, bool boundary);
        ///
@@ -49,12 +63,15 @@ public:
        unsigned int ascent() const { return dim_.ascent(); }
        /// descend of paragraph below baseline
        unsigned int descent() const { return dim_.descent(); }
-       /// LyXText updates the rows using this access point
+       /// Text updates the rows using this access point
        RowList & rows() { return rows_; }
        /// The painter and others use this
        RowList const & rows() const { return rows_; }
+       /// The painter and others use this
+       std::vector<bool> const & rowChangeStatus() const
+       { return row_change_status_; }
        ///
-       RowSignature & rowSignature() const { return rowSignature_; }
+       void updateRowChangeStatus();
        ///
        int rightMargin(Buffer const & buffer) const;
 
@@ -62,10 +79,16 @@ public:
        void dump() const;
 
 private:
+       ///
+       typedef std::vector<size_type> RowSignature;
+       ///
+       size_type calculateRowSignature(Row const &);
        ///
        mutable RowList rows_;
        ///
-       mutable RowSignature rowSignature_;
+       RowSignature row_signature_;
+       ///
+       std::vector<bool> row_change_status_;
        /// cached dimensions of paragraph
        Dimension dim_;
        ///