#include "Counters.h"
#include "Cursor.h"
#include "CutAndPaste.h"
-#include "support/debug.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
-#include "support/gettext.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "TextClass.h"
#include "TextMetrics.h"
-#include "support/convert.h"
-#include "support/docstream.h"
-#include "support/FileName.h"
-#include "support/lstrings.h"
-
#include "frontends/alert.h"
#include "frontends/Clipboard.h"
#include "frontends/Painter.h"
#include "frontends/Selection.h"
+
+#include "support/convert.h"
+#include "support/debug.h"
+#include "support/docstream.h"
+#include "support/FileName.h"
+#include "support/gettext.h"
+#include "support/lstrings.h"
+
#include <boost/scoped_ptr.hpp>
#include <sstream>
#include <iostream>
#include <limits>
+#include <cstring>
using namespace std;
+using namespace lyx::support;
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
namespace lyx {
-using support::prefixIs;
-using support::FileName;
-using support::ltrim;
-using support::rtrim;
-using support::suffixIs;
-
using cap::dirtyTabularStack;
using cap::tabularStackDirty;
};
-class FeatureEqual : public std::unary_function<TabularFeature, bool> {
+class FeatureEqual : public unary_function<TabularFeature, bool> {
public:
FeatureEqual(Tabular::Feature feature)
: feature_(feature) {}
{
TabularFeature * end = tabularFeature +
sizeof(tabularFeature) / sizeof(TabularFeature);
- TabularFeature * it = std::find_if(tabularFeature, end,
+ TabularFeature * it = find_if(tabularFeature, end,
FeatureEqual(feature));
return (it == end) ? string() : it->feature;
}
usebox(BOX_NONE),
rotate(false),
inset(new InsetText(bp))
-{}
+{
+ inset->paragraphs().back().layout(bp.getTextClass().emptyLayout());
+}
Tabular::cellstruct::cellstruct(cellstruct const & cs)
cur.push(*inset);
// undo information has already been recorded
inset->getText(0)->setLayout(cur.bv().buffer(), 0, cur.lastpit() + 1,
- bp.getTextClass().defaultLayoutName());
+ bp.getTextClass().emptyLayoutName());
cur.pop();
}
++tmp;
}
if (use_booktabs && row == 0) {
- os << "\\toprule ";
+ if (topLine(fcell))
+ os << "\\toprule ";
} else if (tmp == n - fcell) {
os << (use_booktabs ? "\\midrule " : "\\hline ");
} else if (tmp) {
++tmp;
}
if (use_booktabs && row == rowCount() - 1) {
- os << "\\bottomrule";
+ if (bottomLine(fcell))
+ os << "\\bottomrule";
} else if (tmp == n - fcell) {
os << (use_booktabs ? "\\midrule" : "\\hline");
} else if (tmp) {
}
+bool InsetTabular::insetAllowed(InsetCode code) const
+{
+ if (code == MATHMACRO_CODE)
+ return false;
+
+ return true;
+}
+
+
void InsetTabular::write(Buffer const & buf, ostream & os) const
{
os << "Tabular" << endl;
}
-void InsetTabular::edit(Cursor & cur, bool left)
+void InsetTabular::edit(Cursor & cur, bool front, EntryDirection)
{
//lyxerr << "InsetTabular::edit: " << this << endl;
cur.finishUndo();
cur.selection() = false;
cur.push(*this);
- if (left) {
+ if (front) {
if (isRightToLeft(cur))
cur.idx() = tabular.getLastCellInRow(0);
else
}
case LFUN_PASTE:
- if (tabularStackDirty() && theClipboard().isInternal()) {
+ if (tabularStackDirty() && theClipboard().isInternal() ||
+ !theClipboard().hasInternal() && theClipboard().hasLyXContents()) {
cur.recordUndoInset(INSERT_UNDO);
pasteClipboard(cur);
break;
InsetTabular::idx_type InsetTabular::getNearestCell(BufferView & bv, int x, int y) const
{
idx_type idx_min = 0;
- int dist_min = std::numeric_limits<int>::max();
+ int dist_min = numeric_limits<int>::max();
for (idx_type i = 0, n = nargs(); i != n; ++i) {
if (bv.coordCache().getInsets().has(tabular.getCellInset(i).get())) {
int const d = dist(bv, i, x, y);
}
-bool InsetTabular::forceDefaultParagraphs(idx_type cell) const
+bool InsetTabular::allowParagraphCustomization(idx_type cell) const
{
return tabular.getPWidth(cell).zero();
}