[gnumeric] Protect (partially) against accidentally pushing data off the sheet. [#98562]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Protect (partially) against accidentally pushing data off the sheet. [#98562]
- Date: Fri, 30 Apr 2010 18:31:07 +0000 (UTC)
commit fac60238608aa47bac8bc58e8c65465e6cef363c
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Fri Apr 30 12:30:34 2010 -0600
Protect (partially) against accidentally pushing data off the sheet. [#98562]
2010-04-30 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/commands.c (cmd_insert_cols): protect against data loss
(cmd_insert_rows): ditto
ChangeLog | 5 +++++
NEWS | 4 +++-
src/commands.c | 36 ++++++++++++++++++++++++++++++++++--
3 files changed, 42 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2766b66..9f2ea8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-04-30 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/commands.c (cmd_insert_cols): protect against data loss
+ (cmd_insert_rows): ditto
+
2010-04-30 Morten Welinder <terra gnome org>
* src/value.c (find_rows_that_match): Fix checking of multiple
diff --git a/NEWS b/NEWS
index cf1d870..f3acd6d 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,9 @@ Andreas:
* Fix CHITEST for rectangular ranges. [#615920]
* Fix printing and preview of graph only sheets. [#616475]
* Make even active sheets invisible. [#616474]
- * Improve date & time import from and export to ODF. [#617208]
+ * Improve date & time import from and export to ODF. [#617208]
+ * Protect (partially) against accidentally pushing data
+ off the sheet. [#98562]
Jean:
* Implement graph only sheets. [#158170]
diff --git a/src/commands.c b/src/commands.c
index 5def518..326617b 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -1350,7 +1350,23 @@ gboolean
cmd_insert_cols (WorkbookControl *wbc,
Sheet *sheet, int start_col, int count)
{
- char *mesg = g_strdup_printf
+ char *mesg;
+ GnmRange r = sheet_get_extent (sheet, TRUE);
+
+ r.end.col += count;
+
+ if (gnm_sheet_get_last_col (sheet) < r.end.col) {
+ go_gtk_notice_dialog (wbcg_toplevel (WBC_GTK (wbc)), GTK_MESSAGE_ERROR,
+ ngettext ("Inserting %i column before column %s would push data off the sheet. "
+ "Please enlarge the sheet first.",
+ "Inserting %i columns before column %s would push data off the sheet. "
+ "Please enlarge the sheet first.",
+ count),
+ count, col_name (start_col));
+ return TRUE;
+ }
+
+ mesg = g_strdup_printf
(ngettext ("Inserting %d column before %s",
"Inserting %d columns before %s",
count),
@@ -1362,7 +1378,23 @@ gboolean
cmd_insert_rows (WorkbookControl *wbc,
Sheet *sheet, int start_row, int count)
{
- char *mesg = g_strdup_printf
+ char *mesg;
+ GnmRange r = sheet_get_extent (sheet, TRUE);
+
+ r.end.row += count;
+
+ if (gnm_sheet_get_last_row (sheet) < r.end.row) {
+ go_gtk_notice_dialog (wbcg_toplevel (WBC_GTK (wbc)), GTK_MESSAGE_ERROR,
+ ngettext ("Inserting %i row before row %s would push data off the sheet. "
+ "Please enlarge the sheet first.",
+ "Inserting %i rows before row %s would push data off the sheet. "
+ "Please enlarge the sheet first.",
+ count),
+ count, row_name (start_row));
+ return TRUE;
+ }
+
+ mesg = g_strdup_printf
(ngettext ("Inserting %d row before %s",
"Inserting %d rows before %s",
count),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]