]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettabular.C
Implement copying of rows and columns in tables
[lyx.git] / src / insets / insettabular.C
index 5e9e4da802a522491f8b78fa81ed4e902155461b..0774f66c3fd38245f1c2ff6437992557ffc5e80d 100644 (file)
@@ -37,8 +37,8 @@
 #include "support/convert.h"
 
 #include "frontends/Alert.h"
+#include "frontends/Application.h"
 #include "frontends/font_metrics.h"
-#include "frontends/LyXView.h"
 #include "frontends/Clipboard.h"
 #include "frontends/Painter.h"
 #include "frontends/Selection.h"
@@ -95,6 +95,8 @@ TabularFeature tabularFeature[] =
        { LyXTabular::APPEND_COLUMN, "append-column" },
        { LyXTabular::DELETE_ROW, "delete-row" },
        { LyXTabular::DELETE_COLUMN, "delete-column" },
+       { LyXTabular::COPY_ROW, "copy-row" },
+       { LyXTabular::COPY_COLUMN, "copy-column" },
        { LyXTabular::TOGGLE_LINE_TOP, "toggle-line-top" },
        { LyXTabular::TOGGLE_LINE_BOTTOM, "toggle-line-bottom" },
        { LyXTabular::TOGGLE_LINE_LEFT, "toggle-line-left" },
@@ -826,6 +828,8 @@ bool InsetTabular::getStatus(LCursor & cur, FuncRequest const & cmd,
                case LyXTabular::APPEND_COLUMN:
                case LyXTabular::DELETE_ROW:
                case LyXTabular::DELETE_COLUMN:
+               case LyXTabular::COPY_ROW:
+               case LyXTabular::COPY_COLUMN:
                case LyXTabular::SET_ALL_LINES:
                case LyXTabular::UNSET_ALL_LINES:
                case LyXTabular::SET_TOP_SPACE:
@@ -1461,6 +1465,15 @@ void InsetTabular::tabularFeatures(LCursor & cur,
                cur.selection() = false;
                break;
 
+       case LyXTabular::COPY_ROW:
+               tabular.copyRow(bv.buffer()->params(), row);
+               break;
+
+       case LyXTabular::COPY_COLUMN:
+               tabular.copyColumn(bv.buffer()->params(), column);
+               cur.idx() = tabular.getCellNumber(row, column);
+               break;
+
        case LyXTabular::M_TOGGLE_LINE_TOP:
                flag = false;
        case LyXTabular::TOGGLE_LINE_TOP: {