// 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
* not needed or not possible.
* \param width: maximum width of the row.
* \param next_width: available width on next rows.
- * \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.
+ * \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();
/**
* 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