]> git.lyx.org Git - lyx.git/blobdiff - src/paragraph.h
* Replace all use of 'slashify_path' with 'internal_path'.
[lyx.git] / src / paragraph.h
index 82d0732fe32722e57480b4c5da5b0c6df75dba27..26d11218283e4f9d982921cec162fb9a093141c7 100644 (file)
@@ -17,6 +17,7 @@
 #define PARAGRAPH_H
 
 #include "changes.h"
+#include "dimension.h"
 #include "InsetList.h"
 #include "lyxlayout_ptr_fwd.h"
 #include "RowList_fwd.h"
@@ -35,12 +36,14 @@ class BufferView;
 class Counters;
 class InsetBase;
 class InsetBibitem;
-class InsetOld_code;
-class Language;
 class LaTeXFeatures;
-class OutputParams;
+class InsetBase_code;
+class Language;
 class LyXFont;
 class LyXFont_size;
+class MetricsInfo;
+class OutputParams;
+class PainterInfo;
 class ParagraphParameters;
 class TexRow;
 class UpdatableInset;
@@ -76,6 +79,7 @@ public:
        ///
        int id() const;
 
+
        ///
        Language const * getParLanguage(BufferParams const &) const;
        ///
@@ -165,8 +169,6 @@ public:
        ///
        InsetBase::Code ownerCode() const;
        ///
-       bool autoBreakRows() const;
-       ///
        bool forceDefaultParagraphs() const;
 
        ///
@@ -319,7 +321,7 @@ public:
        void insertInset(lyx::pos_type pos, InsetBase * inset,
                LyXFont const &, Change change = Change(Change::INSERTED));
        ///
-       bool insetAllowed(InsetOld_code code);
+       bool insetAllowed(InsetBase_code code);
        ///
        InsetBase * getInset(lyx::pos_type pos);
        ///
@@ -335,12 +337,9 @@ public:
        bool isSeparator(lyx::pos_type pos) const;
        ///
        bool isLineSeparator(lyx::pos_type pos) const;
-       ///
-       bool isKomma(lyx::pos_type pos) const;
-       /// Used by the spellchecker
+       /// True if the character/inset at this point can be part of a word
+       // Note that digits in particular are considered as letters
        bool isLetter(lyx::pos_type pos) const;
-       ///
-       bool isWord(lyx::pos_type pos) const;
 
        /// returns -1 if inset not found
        int getPositionOfInset(InsetBase const * inset) const;
@@ -361,25 +360,39 @@ public:
        ParagraphParameters const & params() const;
 
        ///
-       RowList::iterator getRow(lyx::pos_type pos);
+       Row & getRow(lyx::pos_type pos);
        ///
-       RowList::const_iterator getRow(lyx::pos_type pos) const;
+       Row const & getRow(lyx::pos_type pos) const;
        ///
-       size_t row(lyx::pos_type pos) const;
+       size_t pos2row(lyx::pos_type pos) const;
 
        ///
        InsetList insetlist;
 
-       ///
-       mutable RowList rows;
-       /// last draw y position (baseline of top row)
-       int y;
        /// total height of paragraph
-       unsigned int height;
+       unsigned int height() const { return dim_.height(); }
        /// total width of paragraph, may differ from workwidth
-       unsigned int width;
+       unsigned int width() const { return dim_.width(); }
+       unsigned int ascent() const { return dim_.ascent(); }
+       unsigned int descent() const { return dim_.descent(); }
+       ///
+       RowList & rows() { return rows_; }
+       ///
+       RowList const & rows() const { return rows_; }
+
+       // compute paragraph metrics    
+       void metrics(MetricsInfo & mi, Dimension & dim, LyXText & text);
+       // draw paragraph
+       void draw(PainterInfo & pi, int x, int y, LyXText & text) const;
+       /// dump some information
+       void dump() const;
+
+       /// cached dimensions of paragraph
+       Dimension dim_;
 
 private:
+       ///
+       mutable RowList rows_;
        ///
        LyXLayout_ptr layout_;
        /// keeping this here instead of in the pimpl makes LyX >10% faster