]> git.lyx.org Git - lyx.git/blobdiff - src/Row.h
Limit the nopassthurchars case in beamer to URL
[lyx.git] / src / Row.h
index 62ee6cfb5e55aa8359790f0624a9c79c8e79315b..babe11510fd1d0edb625c17476785dc230f9c054 100644 (file)
--- a/src/Row.h
+++ b/src/Row.h
@@ -55,6 +55,14 @@ public:
                // by the initial width
                MARGINSPACE
        };
+       enum SplitType {
+               // split string to fit requested width, fail if string remains too long
+               FIT,
+               // if the requested width is too small, accept the first possible break
+               BEST_EFFORT,
+               // cut string at any place, even for languages that wrap at word delimiters
+               FORCE
+       };
 
 /**
  * One element of a Row. It has a set of attributes that can be used
@@ -66,9 +74,6 @@ public:
                        : type(t), pos(p), endpos(p + 1), font(f), change(ch) {}
 
 
-               // Return the number of separator in the element (only STRING type)
-               int countSeparators() const;
-
                // Return total width of element, including separator overhead
                // FIXME: Cache this value or the number of expanders?
                double full_width() const { return dim.wid + extra * countExpanders(); }
@@ -92,17 +97,17 @@ public:
                */
                pos_type x2pos(int &x) const;
                /** Break the element in two if possible, so that its width is less
-                * than \param w.
-                * \return a vector of elements containing the remainder of
-                *   the text (empty if nothing happened).
-                * \param width maximum width of the row.
-                * \param next_width available width on next row.
-                * \param force: if true, cut string at any place, even for
-                *   languages that wrap at word delimiters; if false, do not
-                *   break at all if first element would larger than \c width.
+                * than the required values.
+                * \return true if something has been done ; false if this is
+                * not needed or not possible.
+                * \param width: maximum width of the row.
+                * \param next_width: available width on next rows.
+                * \param split_type: indicate how the string should be split.
+                * \param tail: a vector of elements where the remainder of
+                *   the text will be appended (empty if nothing happened).
                 */
                // FIXME: ideally last parameter should be Elements&, but it is not possible.
-               bool splitAt(int width, int next_width, bool force, std::vector<Element> & tail);
+               bool splitAt(int width, int next_width, SplitType split_type, std::vector<Element> & tail);
                // remove trailing spaces (useful for end of row)
                void rtrim();
 
@@ -142,7 +147,7 @@ public:
                Change change;
                // is it possible to add contents to this element?
                bool final = false;
-               // properties with respect to row breaking (made of RowFlag enums)
+               // properties with respect to row breaking (made of RowFlag enumerators)
                int row_flags = Inline;
 
                friend std::ostream & operator<<(std::ostream & os, Element const & row);
@@ -207,9 +212,9 @@ public:
        ///
        pos_type endpos() const { return end_; }
        ///
-       void right_boundary(bool b) { right_boundary_ = b; }
+       void end_boundary(bool b) { end_boundary_ = b; }
        ///
-       bool right_boundary() const { return right_boundary_; }
+       bool end_boundary() const { return end_boundary_; }
        ///
        void flushed(bool b) { flushed_ = b; }
        ///
@@ -238,8 +243,6 @@ public:
        /// The offset of the right-most cursor position on the row
        int right_x() const;
 
-       // Return the number of separators in the row
-       int countSeparators() const;
        // Set the extra spacing for every expanding character in STRING-type
        // elements.  \param w is the total amount of extra width for the row to be
        // distributed among expanders.  \return false if the justification fails.
@@ -250,7 +253,7 @@ public:
                 Font const & f, Change const & ch);
        ///
        void add(pos_type pos, char_type const c,
-                Font const & f, Change const & ch, bool can_break);
+                Font const & f, Change const & ch);
        ///
        void addVirtual(pos_type pos, docstring const & s,
                        Font const & f, Change const & ch);
@@ -291,12 +294,12 @@ public:
        /**
         * if row width is too large, remove all elements after last
         * separator and update endpos if necessary. If all that
-        * remains is a large word, cut it to \param width.
-        * \param width maximum width of the row.
+        * remains is a large word, cut it to \c max_width.
+        * \param max_width maximum width of the row.
         * \param next_width available width on next row.
         * \return list of elements remaining after breaking.
         */
-       Elements shortenIfNeeded(int const width, int const next_width);
+       Elements shortenIfNeeded(int const max_width, int const next_width);
 
        /**
         * If last element of the row is a string, compute its width
@@ -371,7 +374,7 @@ private:
        /// one behind last pos covered by this row
        pos_type end_ = 0;
        // Is there a boundary at the end of the row (display inset...)
-       bool right_boundary_ = false;
+       bool end_boundary_ = false;
        // Shall the row be flushed when it is supposed to be justified?
        bool flushed_ = false;
        /// Row dimension.