commit 963a0aa466a98b0c11b0dd30034f7fbf6f78ee62
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Mon Jul 12 00:07:59 2021 +0200

    Implement Row::Element::row_flags
    
    Move the enum definition RowFlags in its own include file, to avoid
    loading Inset.h. Document it more thoroughly.
    
    Rename RowAfter to AlwaysBreakAfter.
    
    Add CanBreakInside (rows that can be themselves broken). This allow to
    differentiate elements before bodyPos() and allows to remove a
    parameter to shortenIfNeeded().
    
    Make the Inset::rowFlags() method return int instead of RowFlags, as
    should be done for all the bitwise flags. Remove the hand-made bitwise
    operators.
    
    Set R::E::row_flags when creating elements.
    * INSET elements use the inset's rowFLags();
    * virtual element forbid breaking before them, and inherit the *After
      flags from the previous element of the row;
    * STRING elements usr CanBreakInside, except before bodyPos.
    
    More stuff may be added later.
---
 src/Makefile.am                 |    1 +
 src/Row.cpp                     |   24 +++++++++-------
 src/Row.h                       |    8 +++--
 src/RowFlags.h                  |   57 +++++++++++++++++++++++++++++++++++++++
 src/TextMetrics.cpp             |   29 ++++++++++---------
 src/insets/Inset.h              |   37 ++-----------------------
 src/insets/InsetBibtex.h        |    2 +-
 src/insets/InsetCaption.h       |    2 +-
 src/insets/InsetFloatList.h     |    2 +-
 src/insets/InsetInclude.cpp     |    2 +-
 src/insets/InsetInclude.h       |    2 +-
 src/insets/InsetIndex.h         |    2 +-
 src/insets/InsetListings.cpp    |    2 +-
 src/insets/InsetListings.h      |    2 +-
 src/insets/InsetNewline.h       |    2 +-
 src/insets/InsetNewpage.h       |    2 +-
 src/insets/InsetNomencl.h       |    2 +-
 src/insets/InsetSeparator.h     |    2 +-
 src/insets/InsetSpace.cpp       |    2 +-
 src/insets/InsetSpace.h         |    2 +-
 src/insets/InsetSpecialChar.cpp |    2 +-
 src/insets/InsetSpecialChar.h   |    2 +-
 src/insets/InsetTOC.h           |    2 +-
 src/insets/InsetTabular.cpp     |   30 ++++++++++----------
 src/insets/InsetTabular.h       |    2 +-
 src/insets/InsetVSpace.h        |    2 +-
 src/mathed/InsetMathHull.cpp    |    2 +-
 src/mathed/InsetMathHull.h      |    2 +-
 28 files changed, 130 insertions(+), 98 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 31701f2..99a0f98 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -273,6 +273,7 @@ HEADERFILESCORE = \
        ParIterator.h \
        PDFOptions.h \
        Row.h \
+       RowFlags.h \
        RowPainter.h \
        Server.h \
        ServerSocket.h \
diff --git a/src/Row.cpp b/src/Row.cpp
index da2d885..705a147 100644
--- a/src/Row.cpp
+++ b/src/Row.cpp
@@ -135,7 +135,7 @@ pos_type Row::Element::x2pos(int &x) const
 
 Row::Element Row::Element::splitAt(int w, bool force)
 {
-       if (type != STRING)
+       if (type != STRING || !(row_flags & CanBreakInside))
                return Element();
 
        FontMetrics const & fm = theFontMetrics(font);
@@ -145,6 +145,7 @@ Row::Element Row::Element::splitAt(int w, bool force)
                Element ret(STRING, pos + i, font, change);
                ret.str = str.substr(i);
                ret.endpos = ret.pos + ret.str.length();
+               ret.row_flags = row_flags & (CanBreakInside | AfterFlags);
                str.erase(i);
                endpos = pos + i;
                //lyxerr << "breakAt(" << w << ")  Row element Broken at " << x 
<< "(w(str)=" << fm.width(str) << "): e=" << *this << endl;
@@ -378,12 +379,13 @@ void Row::finalizeLast()
 
 
 void Row::add(pos_type const pos, Inset const * ins, Dimension const & dim,
-             Font const & f, Change const & ch)
+              Font const & f, Change const & ch)
 {
        finalizeLast();
        Element e(INSET, pos, f, ch);
        e.inset = ins;
        e.dim = dim;
+       e.row_flags = ins->rowFlags();
        elements_.push_back(e);
        dim_.wid += dim.wid;
        changebar_ |= ins->isChanged();
@@ -391,11 +393,12 @@ void Row::add(pos_type const pos, Inset const * ins, 
Dimension const & dim,
 
 
 void Row::add(pos_type const pos, char_type const c,
-             Font const & f, Change const & ch)
+              Font const & f, Change const & ch, bool can_break)
 {
        if (!sameString(f, ch)) {
                finalizeLast();
                Element e(STRING, pos, f, ch);
+               e.row_flags = can_break ? CanBreakInside : Inline;
                elements_.push_back(e);
        }
        if (back().str.length() % 30 == 0) {
@@ -420,6 +423,10 @@ void Row::addVirtual(pos_type const pos, docstring const & 
s,
        e.dim.wid = theFontMetrics(f).width(s);
        dim_.wid += e.dim.wid;
        e.endpos = pos;
+       // Copy after* flags from previous elements, forbid break before element
+       int const prev_row_flags = elements_.empty() ? Inline : 
elements_.back().row_flags;
+       int const can_inherit = AfterFlags & ~AlwaysBreakAfter;
+       e.row_flags = (prev_row_flags & can_inherit) | NoBreakBefore;
        elements_.push_back(e);
        finalizeLast();
 }
@@ -450,7 +457,7 @@ void Row::pop_back()
 }
 
 
-bool Row::shortenIfNeeded(pos_type const keep, int const w, int const 
next_width)
+bool Row::shortenIfNeeded(int const w, int const next_width)
 {
        if (empty() || width() <= w)
                return false;
@@ -482,11 +489,10 @@ bool Row::shortenIfNeeded(pos_type const keep, int const 
w, int const next_width
                // make a copy of the element to work on it.
                Element brk = *cit_brk;
                /* If the current element is an inset that allows breaking row
-                * after itself, and it the row is already short enough after
+                * after itself, and if the row is already short enough after
                 * this inset, then cut right after this element.
                 */
-               if (wid_brk <= w && brk.type == INSET
-                   && brk.inset->rowFlags() & Inset::CanBreakAfter) {
+               if (wid_brk <= w && brk.row_flags & CanBreakAfter) {
                        end_ = brk.endpos;
                        dim_.wid = wid_brk;
                        elements_.erase(cit_brk + 1, end);
@@ -504,10 +510,6 @@ bool Row::shortenIfNeeded(pos_type const keep, int const 
w, int const next_width
                 * not allowed at the beginning or end of line.
                */
                bool const word_wrap = brk.font.language()->wordWrap();
-               // When there is text before the body part (think description
-               // environment), do not try to break.
-               if (brk.pos < keep)
-                       continue;
                /* We have found a suitable separable element. This is the 
common case.
                 * Try to break it cleanly (at word boundary) at a length that 
is both
                 * - less than the available space on the row
diff --git a/src/Row.h b/src/Row.h
index 3048cf1..4fdcee4 100644
--- a/src/Row.h
+++ b/src/Row.h
@@ -18,6 +18,7 @@
 #include "Changes.h"
 #include "Dimension.h"
 #include "Font.h"
+#include "RowFlags.h"
 
 #include "support/docstring.h"
 #include "support/types.h"
@@ -143,6 +144,8 @@ 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)
+               int row_flags = Inline;
 
                friend std::ostream & operator<<(std::ostream & os, Element 
const & row);
        };
@@ -247,7 +250,7 @@ public:
                 Font const & f, Change const & ch);
        ///
        void add(pos_type pos, char_type const c,
-                Font const & f, Change const & ch);
+                Font const & f, Change const & ch, bool can_break);
        ///
        void addVirtual(pos_type pos, docstring const & s,
                        Font const & f, Change const & ch);
@@ -287,12 +290,11 @@ 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 body_pos minimum amount of text to keep.
         * \param width maximum width of the row.
         * \param available width on next row.
         * \return true if the row has been shortened.
         */
-       bool shortenIfNeeded(pos_type const body_pos, int const width, int 
const next_width);
+       bool shortenIfNeeded(int const width, int const next_width);
 
        /**
         * If last element of the row is a string, compute its width
diff --git a/src/RowFlags.h b/src/RowFlags.h
new file mode 100644
index 0000000..f94f0c6
--- /dev/null
+++ b/src/RowFlags.h
@@ -0,0 +1,57 @@
+// -*- C++ -*-
+/**
+ * \file RowFlags.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef ROWFLAGS_H
+#define ROWFLAGS_H
+
+// Do not include anything here
+
+namespace lyx {
+
+/* The list of possible flags, that can be combined.
+ * Some flags that should logically be here (e.g.,
+ * CanBreakBefore), do not exist. This is because the need has not
+ * been identitfied yet.
+ *
+ * Priorities when before/after disagree:
+ *      AlwaysBreak* > NoBreak* > Break* or CanBreak*.
+ */
+enum RowFlags {
+       // Do not break before or after this element, except if really
+       // needed (between NoBreak* and CanBreak*).
+       Inline = 0,
+       // break row before this element if the row is not empty
+       BreakBefore = 1 << 0,
+       // Avoid breaking row before this element
+       NoBreakBefore = 1 << 1,
+       // force new (maybe empty) row after this element
+       AlwaysBreakAfter = 1 << 2,
+       // break row after this element if there are more elements
+       BreakAfter = 1 << 3,
+       // break row whenever needed after this element
+       CanBreakAfter = 1 << 4,
+       // Avoid breaking row after this element
+       NoBreakAfter = 1 << 5,
+       // The contents of the row may be broken in two (e.g. string)
+       CanBreakInside = 1 << 6,
+       // specify an alignment (left, right) for a display element
+       // (default is center)
+       AlignLeft = 1 << 7,
+       AlignRight = 1 << 8,
+       // A display element breaks row at both ends
+       Display = BreakBefore | BreakAfter,
+       // Flags that concern breaking after element
+       AfterFlags = AlwaysBreakAfter | BreakAfter | CanBreakAfter | 
NoBreakAfter
+};
+
+} // namespace lyx
+
+#endif
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index f14fe1f..cc380cc 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -634,10 +634,10 @@ LyXAlignment TextMetrics::getAlign(Paragraph const & par, 
Row const & row) const
 
        // Display-style insets should always be on a centered row
        if (Inset const * inset = par.getInset(row.pos())) {
-               if (inset->rowFlags() & Inset::Display) {
-                       if (inset->rowFlags() & Inset::AlignLeft)
+               if (inset->rowFlags() & Display) {
+                       if (inset->rowFlags() & AlignLeft)
                                align = LYX_ALIGN_BLOCK;
-                       else if (inset->rowFlags() & Inset::AlignRight)
+                       else if (inset->rowFlags() & AlignRight)
                                align = LYX_ALIGN_RIGHT;
                        else
                                align = LYX_ALIGN_CENTER;
@@ -928,7 +928,7 @@ Row TextMetrics::tokenizeParagraph(pit_type const pit) const
                        row.addSpace(i, add, *fi, par.lookupChange(i));
                } else if (c == '\t')
                        row.addSpace(i, theFontMetrics(*fi).width(from_ascii("  
  ")),
-                                    *fi, par.lookupChange(i));
+                                    *fi, par.lookupChange(i));
                else if (c == 0x2028 || c == 0x2029) {
                        /**
                         * U+2028 LINE SEPARATOR
@@ -944,9 +944,10 @@ Row TextMetrics::tokenizeParagraph(pit_type const pit) 
const
                        // ⤶ U+2936 ARROW POINTING DOWNWARDS THEN CURVING 
LEFTWARDS
                        // ¶ U+00B6 PILCROW SIGN
                        char_type const screen_char = (c == 0x2028) ? 0x2936 : 
0x00B6;
-                       row.add(i, screen_char, *fi, par.lookupChange(i));
+                       row.add(i, screen_char, *fi, par.lookupChange(i), i >= 
body_pos);
                } else
-                       row.add(i, c, *fi, par.lookupChange(i));
+                       // row elements before body are unbreakable
+                       row.add(i, c, *fi, par.lookupChange(i), i >= body_pos);
 
                // add inline completion width
                // draw logically behind the previous character
@@ -1080,9 +1081,9 @@ bool TextMetrics::breakRow(Row & row, int const 
right_margin) const
                        // ⤶ U+2936 ARROW POINTING DOWNWARDS THEN CURVING 
LEFTWARDS
                        // ¶ U+00B6 PILCROW SIGN
                        char_type const screen_char = (c == 0x2028) ? 0x2936 : 
0x00B6;
-                       row.add(i, screen_char, *fi, par.lookupChange(i));
+                       row.add(i, screen_char, *fi, par.lookupChange(i), i >= 
body_pos);
                } else
-                       row.add(i, c, *fi, par.lookupChange(i));
+                       row.add(i, c, *fi, par.lookupChange(i), i >= body_pos);
 
                // add inline completion width
                // draw logically behind the previous character
@@ -1105,8 +1106,8 @@ bool TextMetrics::breakRow(Row & row, int const 
right_margin) const
                // - After an inset with BreakAfter
                Inset const * prevInset = !row.empty() ? row.back().inset : 0;
                Inset const * nextInset = (i + 1 < end) ? par.getInset(i + 1) : 
0;
-               if ((nextInset && nextInset->rowFlags() & Inset::BreakBefore)
-                   || (prevInset && prevInset->rowFlags() & 
Inset::BreakAfter)) {
+               if ((nextInset && nextInset->rowFlags() & BreakBefore)
+                   || (prevInset && prevInset->rowFlags() & BreakAfter)) {
                        row.flushed(true);
                        // Force a row creation after this one if it is ended by
                        // an inset that either
@@ -1114,8 +1115,8 @@ bool TextMetrics::breakRow(Row & row, int const 
right_margin) const
                        // - or (1) did force the row breaking, (2) is at end of
                        //   paragraph and (3) the said paragraph has an end 
label.
                        need_new_row = prevInset &&
-                               (prevInset->rowFlags() & Inset::RowAfter
-                                || (prevInset->rowFlags() & Inset::BreakAfter 
&& i + 1 == end
+                               (prevInset->rowFlags() & AlwaysBreakAfter
+                                || (prevInset->rowFlags() & BreakAfter && i + 
1 == end
                                     && text_->getEndLabel(row.pit()) != 
END_LABEL_NO_LABEL));
                        ++i;
                        break;
@@ -1156,7 +1157,7 @@ bool TextMetrics::breakRow(Row & row, int const 
right_margin) const
        int const next_width = max_width_ - leftMargin(row.pit(), row.endpos())
                - rightMargin(row.pit());
 
-       if (row.shortenIfNeeded(body_pos, width, next_width))
+       if (row.shortenIfNeeded(width, next_width))
                row.flushed(false);
        row.right_boundary(!row.empty() && row.endpos() < end
                           && row.back().endpos == row.endpos());
@@ -1900,7 +1901,7 @@ int TextMetrics::leftMargin(pit_type const pit, pos_type 
const pos) const
            // display style insets do not need indentation
            && !(!par.empty()
                 && par.isInset(0)
-                && par.getInset(0)->rowFlags() & Inset::Display)
+                && par.getInset(0)->rowFlags() & Display)
            && (!(tclass.isDefaultLayout(par.layout())
                || tclass.isPlainLayout(par.layout()))
                || buffer.params().paragraph_separation
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index af24423..372b95a 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -20,6 +20,7 @@
 #include "LayoutEnums.h"
 #include "OutputEnums.h"
 #include "OutputParams.h"
+#include "RowFlags.h"
 
 #include "support/docstring.h"
 #include "support/strfwd.h"
@@ -478,26 +479,8 @@ public:
 
        virtual CtObject getCtObject(OutputParams const &) const;
 
-       enum RowFlags {
-               Inline = 0,
-               // break row before this inset
-               BreakBefore = 1 << 0,
-               // break row after this inset
-               BreakAfter = 1 << 1,
-               // it is possible to break after this inset
-               CanBreakAfter = 1 << 2,
-               // force new (maybe empty) row after this inset
-               RowAfter = 1 << 3,
-               // specify an alignment (left, right) for a display inset
-               // (default is center)
-               AlignLeft = 1 << 4,
-               AlignRight = 1 << 5,
-               // A display inset breaks row at both ends
-               Display = BreakBefore | BreakAfter
-       };
-
-       /// How should this inset be displayed in its row?
-       virtual RowFlags rowFlags() const { return Inline; }
+       // properties with respect to row breaking (made of RowFLag enums)
+       virtual int rowFlags() const { return Inline; }
        /// indentation before this inset (only needed for displayed hull 
insets with fleqn option)
        virtual int indent(BufferView const &) const { return 0; }
        ///
@@ -655,20 +638,6 @@ protected:
 };
 
 
-inline Inset::RowFlags operator|(Inset::RowFlags const d1,
-                                    Inset::RowFlags const d2)
-{
-       return static_cast<Inset::RowFlags>(int(d1) | int(d2));
-}
-
-
-inline Inset::RowFlags operator&(Inset::RowFlags const d1,
-                                    Inset::RowFlags const d2)
-{
-       return static_cast<Inset::RowFlags>(int(d1) & int(d2));
-}
-
-
 } // namespace lyx
 
 #endif
diff --git a/src/insets/InsetBibtex.h b/src/insets/InsetBibtex.h
index be7659f..55451f5 100644
--- a/src/insets/InsetBibtex.h
+++ b/src/insets/InsetBibtex.h
@@ -47,7 +47,7 @@ public:
        ///
        InsetCode lyxCode() const override { return BIBTEX_CODE; }
        ///
-       RowFlags rowFlags() const override { return Display; }
+       int rowFlags() const override { return Display; }
        ///
        void latex(otexstream &, OutputParams const &) const override;
        ///
diff --git a/src/insets/InsetCaption.h b/src/insets/InsetCaption.h
index ed6dbbb..c1bcd17 100644
--- a/src/insets/InsetCaption.h
+++ b/src/insets/InsetCaption.h
@@ -40,7 +40,7 @@ private:
        ///
        void write(std::ostream & os) const override;
        ///
-       RowFlags rowFlags() const override { return Display; }
+       int rowFlags() const override { return Display; }
        ///
        bool neverIndent() const override { return true; }
        ///
diff --git a/src/insets/InsetFloatList.h b/src/insets/InsetFloatList.h
index 489b0fe..ce6caa5 100644
--- a/src/insets/InsetFloatList.h
+++ b/src/insets/InsetFloatList.h
@@ -32,7 +32,7 @@ public:
        ///
        InsetCode lyxCode() const override { return FLOAT_LIST_CODE; }
        ///
-       RowFlags rowFlags() const override { return Display; }
+       int rowFlags() const override { return Display; }
        ///
        void write(std::ostream &) const override;
        ///
diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp
index aeae2fb..10ea52b 100644
--- a/src/insets/InsetInclude.cpp
+++ b/src/insets/InsetInclude.cpp
@@ -1251,7 +1251,7 @@ string InsetInclude::contextMenuName() const
 }
 
 
-Inset::RowFlags InsetInclude::rowFlags() const
+int InsetInclude::rowFlags() const
 {
        return type(params()) == INPUT ? Inline : Display;
 }
diff --git a/src/insets/InsetInclude.h b/src/insets/InsetInclude.h
index 8585222..d62c751 100644
--- a/src/insets/InsetInclude.h
+++ b/src/insets/InsetInclude.h
@@ -75,7 +75,7 @@ public:
        ///
        void draw(PainterInfo & pi, int x, int y) const override;
        ///
-       RowFlags rowFlags() const override;
+       int rowFlags() const override;
        ///
        InsetCode lyxCode() const override { return INCLUDE_CODE; }
        ///
diff --git a/src/insets/InsetIndex.h b/src/insets/InsetIndex.h
index bddb8ba..b064cc7 100644
--- a/src/insets/InsetIndex.h
+++ b/src/insets/InsetIndex.h
@@ -119,7 +119,7 @@ public:
        ///
        bool hasSettings() const override;
        ///
-       RowFlags rowFlags() const override { return Display; }
+       int rowFlags() const override { return Display; }
        //@}
 
        /// \name Static public methods obligated for InsetCommand derived 
classes
diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp
index e8fe8b1..57df06e 100644
--- a/src/insets/InsetListings.cpp
+++ b/src/insets/InsetListings.cpp
@@ -64,7 +64,7 @@ InsetListings::~InsetListings()
 }
 
 
-Inset::RowFlags InsetListings::rowFlags() const
+int InsetListings::rowFlags() const
 {
        return params().isInline() || params().isFloat() ? Inline : Display | 
AlignLeft;
 }
diff --git a/src/insets/InsetListings.h b/src/insets/InsetListings.h
index 41be439..9d4eeb1 100644
--- a/src/insets/InsetListings.h
+++ b/src/insets/InsetListings.h
@@ -46,7 +46,7 @@ private:
        ///
        InsetCode lyxCode() const override { return LISTINGS_CODE; }
        /// lstinline is inlined, normal listing is displayed
-       RowFlags rowFlags() const override;
+       int rowFlags() const override;
        ///
        docstring layoutName() const override;
        ///
diff --git a/src/insets/InsetNewline.h b/src/insets/InsetNewline.h
index 3d540a8..1ef0ae5 100644
--- a/src/insets/InsetNewline.h
+++ b/src/insets/InsetNewline.h
@@ -47,7 +47,7 @@ public:
        explicit InsetNewline(InsetNewlineParams par) : Inset(0)
        { params_.kind = par.kind; }
        ///
-       RowFlags rowFlags() const override { return BreakAfter | RowAfter; }
+       int rowFlags() const override { return AlwaysBreakAfter; }
        ///
        static void string2params(std::string const &, InsetNewlineParams &);
        ///
diff --git a/src/insets/InsetNewpage.h b/src/insets/InsetNewpage.h
index f020488..d086276 100644
--- a/src/insets/InsetNewpage.h
+++ b/src/insets/InsetNewpage.h
@@ -76,7 +76,7 @@ private:
        ///
        void write(std::ostream & os) const override;
        ///
-       RowFlags rowFlags() const override { return (params_.kind == 
InsetNewpageParams::NOPAGEBREAK) ? Inline : Display; }
+       int rowFlags() const override { return (params_.kind == 
InsetNewpageParams::NOPAGEBREAK) ? Inline : Display; }
        ///
        docstring insetLabel() const;
        ///
diff --git a/src/insets/InsetNomencl.h b/src/insets/InsetNomencl.h
index 1778e01..362cd46 100644
--- a/src/insets/InsetNomencl.h
+++ b/src/insets/InsetNomencl.h
@@ -94,7 +94,7 @@ public:
        ///
        bool hasSettings() const override { return true; }
        ///
-       RowFlags rowFlags() const override { return Display; }
+       int rowFlags() const override { return Display; }
        ///
        void latex(otexstream &, OutputParams const &) const override;
        ///
diff --git a/src/insets/InsetSeparator.h b/src/insets/InsetSeparator.h
index f7e0ab9..9352bdf 100644
--- a/src/insets/InsetSeparator.h
+++ b/src/insets/InsetSeparator.h
@@ -65,7 +65,7 @@ public:
                return docstring();
        }
        ///
-       RowFlags rowFlags() const override { return BreakAfter; }
+       int rowFlags() const override { return BreakAfter; }
 private:
        ///
        InsetCode lyxCode() const override { return SEPARATOR_CODE; }
diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp
index 9585596..1a2eb09 100644
--- a/src/insets/InsetSpace.cpp
+++ b/src/insets/InsetSpace.cpp
@@ -192,7 +192,7 @@ bool InsetSpace::getStatus(Cursor & cur, FuncRequest const 
& cmd,
 }
 
 
-Inset::RowFlags InsetSpace::rowFlags() const
+int InsetSpace::rowFlags() const
 {
        switch (params_.kind) {
                case InsetSpaceParams::PROTECTED:
diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h
index 5cf7aa7..e401d6d 100644
--- a/src/insets/InsetSpace.h
+++ b/src/insets/InsetSpace.h
@@ -115,7 +115,7 @@ public:
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const override;
        /// unprotected spaces allow line breaking after them
-       RowFlags rowFlags() const override;
+       int rowFlags() const override;
        ///
        void metrics(MetricsInfo &, Dimension &) const override;
        ///
diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp
index 3ecdaf1..88af653 100644
--- a/src/insets/InsetSpecialChar.cpp
+++ b/src/insets/InsetSpecialChar.cpp
@@ -83,7 +83,7 @@ docstring InsetSpecialChar::toolTip(BufferView const &, int, 
int) const
 }
 
 
-Inset::RowFlags InsetSpecialChar::rowFlags() const
+int InsetSpecialChar::rowFlags() const
 {
        switch (kind_) {
        case ALLOWBREAK:
diff --git a/src/insets/InsetSpecialChar.h b/src/insets/InsetSpecialChar.h
index 3056b10..0c8cc36 100644
--- a/src/insets/InsetSpecialChar.h
+++ b/src/insets/InsetSpecialChar.h
@@ -63,7 +63,7 @@ public:
        ///
        docstring toolTip(BufferView const & bv, int x, int y) const override;
        /// some special chars allow line breaking after them
-       RowFlags rowFlags() const override;
+       int rowFlags() const override;
        ///
        void metrics(MetricsInfo &, Dimension &) const override;
        ///
diff --git a/src/insets/InsetTOC.h b/src/insets/InsetTOC.h
index 045ae07..ca3f463 100644
--- a/src/insets/InsetTOC.h
+++ b/src/insets/InsetTOC.h
@@ -37,7 +37,7 @@ public:
        ///
        docstring layoutName() const override;
        ///
-       RowFlags rowFlags() const override { return Display; }
+       int rowFlags() const override { return Display; }
        ///
        void validate(LaTeXFeatures &) const override;
        ///
diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp
index fcf89e7..24bde65 100644
--- a/src/insets/InsetTabular.cpp
+++ b/src/insets/InsetTabular.cpp
@@ -6144,21 +6144,21 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest 
const & cmd,
 }
 
 
-Inset::RowFlags InsetTabular::rowFlags() const
-{
-               if (tabular.is_long_tabular) {
-                       switch (tabular.longtabular_alignment) {
-                       case Tabular::LYX_LONGTABULAR_ALIGN_LEFT:
-                               return Display | AlignLeft;
-                       case Tabular::LYX_LONGTABULAR_ALIGN_CENTER:
-                               return Display;
-                       case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT:
-                               return Display | AlignRight;
-                       default:
-                               return Display;
-                       }
-               } else
-                       return Inline;
+int InsetTabular::rowFlags() const
+{
+       if (tabular.is_long_tabular) {
+               switch (tabular.longtabular_alignment) {
+               case Tabular::LYX_LONGTABULAR_ALIGN_LEFT:
+                       return Display | AlignLeft;
+               case Tabular::LYX_LONGTABULAR_ALIGN_CENTER:
+                       return Display;
+               case Tabular::LYX_LONGTABULAR_ALIGN_RIGHT:
+                       return Display | AlignRight;
+               default:
+                       return Display;
+               }
+       } else
+               return Inline;
 }
 
 
diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h
index 8d1be1b..0d4e7af 100644
--- a/src/insets/InsetTabular.h
+++ b/src/insets/InsetTabular.h
@@ -989,7 +989,7 @@ public:
        //
        bool isTable() const override { return true; }
        ///
-       RowFlags rowFlags() const override;
+       int rowFlags() const override;
        ///
        void latex(otexstream &, OutputParams const &) const override;
        ///
diff --git a/src/insets/InsetVSpace.h b/src/insets/InsetVSpace.h
index 9b95f00..51c2b5b 100644
--- a/src/insets/InsetVSpace.h
+++ b/src/insets/InsetVSpace.h
@@ -62,7 +62,7 @@ private:
        ///
        void write(std::ostream & os) const override;
        ///
-       RowFlags rowFlags() const override { return Display; }
+       int rowFlags() const override { return Display; }
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd) override;
        ///
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index b33813b..8fd2bdd 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -988,7 +988,7 @@ bool InsetMathHull::outerDisplay() const
 }
 
 
-Inset::RowFlags InsetMathHull::rowFlags() const
+int InsetMathHull::rowFlags() const
 {
        switch (type_) {
        case hullUnknown:
diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h
index 0b865be..b019188 100644
--- a/src/mathed/InsetMathHull.h
+++ b/src/mathed/InsetMathHull.h
@@ -288,7 +288,7 @@ public:
        ///
        Inset * editXY(Cursor & cur, int x, int y) override;
        ///
-       RowFlags rowFlags() const override;
+       int rowFlags() const override;
        /// helper function
        bool display() const { return rowFlags() & Display; }
 
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to