]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetTabular.cpp
Implement proper pasting from multiple table cells to non-table (#4447)
[features.git] / src / insets / InsetTabular.cpp
index 68fff9b51f816e16746a13ee3571a60674876434..4dcb1c2bbaacb4cba263684c3ac60f250e82b164 100644 (file)
@@ -7206,6 +7206,22 @@ docstring InsetTabular::asString(idx_type stidx, idx_type enidx,
 }
 
 
+ParagraphList InsetTabular::asParList(idx_type stidx, idx_type enidx)
+{
+       LASSERT(stidx <= enidx, return ParagraphList());
+       ParagraphList retval;
+       col_type const col1 = tabular.cellColumn(stidx);
+       col_type const col2 = tabular.cellColumn(enidx);
+       row_type const row1 = tabular.cellRow(stidx);
+       row_type const row2 = tabular.cellRow(enidx);
+       for (col_type col = col1; col <= col2; col++)
+               for (row_type row = row1; row <= row2; row++)
+                       for (auto par : tabular.cellInset(row, col)->paragraphs())
+                               retval.push_back(par);
+       return retval;
+}
+
+
 void InsetTabular::getSelection(Cursor & cur,
        row_type & rs, row_type & re, col_type & cs, col_type & ce) const
 {