]> git.lyx.org Git - lyx.git/blobdiff - src/lyxrow_funcs.C
ws changes only
[lyx.git] / src / lyxrow_funcs.C
index 3b6c0b44fe86fa05187f9e89732cb5c939e27e1c..a8a28e5172e847dd3f045eb7f0ab2d54c70a0aa4 100644 (file)
@@ -1,18 +1,26 @@
+/**
+ * \file lyxrow_funcs.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 #include <config.h>
 
 #include "lyxrow_funcs.h"
+#include "debug.h"
+#include "lyxlayout.h"
+#include "lyxrow.h"
 #include "lyxtext.h"
 #include "paragraph.h"
-#include "lyxlayout.h"
-#include "debug.h"
-
-#include "support/LAssert.h"
 
 #include <boost/next_prior.hpp>
-#include <algorithm>
 
 using lyx::pos_type;
-using lyx::support::Assert;
 
 using std::max;
 using std::min;
@@ -27,13 +35,13 @@ bool isParEnd(Paragraph const & par, RowList::iterator rit)
                lyxerr << "broken row 1: end: " << rit->end() << " next: "
                        << boost::next(rit)->pos() << endl;
                lyxerr << endl;
-               Assert(false);
+               BOOST_ASSERT(false);
        }
 #endif
        return boost::next(rit) == par.rows.end();
 }
 
-
+#if 1
 pos_type lastPos(Paragraph const & par, RowList::iterator rit)
 {
        if (par.empty())
@@ -47,47 +55,21 @@ pos_type lastPos(Paragraph const & par, RowList::iterator rit)
                lyxerr << "broken row 2: end: " << rit->end() << " next: "
                        << boost::next(rit)->pos() << endl;
                lyxerr << endl;
-               Assert(false);
+               BOOST_ASSERT(false);
        }
        return boost::next(rit)->pos() - 1;
 }
-
-
-namespace {
-
-bool nextRowIsAllInset(Paragraph const & par, pos_type last)
-{
-       if (last + 1 >= par.size())
-               return false;
-
-       if (!par.isInset(last + 1))
-               return false;
-
-       InsetOld const * i = par.getInset(last + 1);
-       return i->needFullRow() || i->display();
-}
-
-} // anon namespace
-
-
-pos_type lastPrintablePos(Paragraph const & par, RowList::iterator rit)
+#else
+pos_type lastPos(Paragraph const &, RowList::iterator rit)
 {
-       pos_type const last = lastPos(par, rit);
-
-       // if this row is an end of par, just act like lastPos()
-       if (isParEnd(par, rit))
-               return last;
-
-       if (!nextRowIsAllInset(par, last) && par.isSeparator(last))
-               return last - 1;
-
-       return last;
+       return rit->end() - 1;
 }
+#endif
 
 
 int numberOfSeparators(Paragraph const & par, RowList::iterator rit)
 {
-       pos_type const last = lastPrintablePos(par, rit);
+       pos_type const last = lastPos(par, rit);
        int n = 0;
        pos_type p = max(rit->pos(), par.beginningOfBody());
        for ( ; p < last; ++p)