[gnumeric] Fix paste into locked cells [#702292]



commit d3f959d490959e0d99ce6674d96c41594e28388b
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Sun Oct 6 13:53:27 2013 -0600

    Fix paste into locked cells [#702292]
    
    2013-10-06  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * src/cmd-edit.c (cmd_paste): chceck for locked cells

 ChangeLog      |    4 ++++
 NEWS           |    1 +
 src/cmd-edit.c |   10 ++++++++--
 3 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2f46ec7..b5ea1d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-06  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * src/cmd-edit.c (cmd_paste): chceck for locked cells
+
 2013-10-03  Morten Welinder  <terra gnome org>
 
        * src/item-cursor.c (item_cursor_draw): Drop expose area
diff --git a/NEWS b/NEWS
index 7911d2e..b431f00 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.12.8
 
 Andreas:
        * Update/fix documentation [#708679][#707075][#708556]
+       * Fix paste into locked cells [#702292]
 
 Jean:
        * Fix radio buttons behavior in covariance dialog. [#707595]
diff --git a/src/cmd-edit.c b/src/cmd-edit.c
index 16a8491..d3e186d 100644
--- a/src/cmd-edit.c
+++ b/src/cmd-edit.c
@@ -294,10 +294,18 @@ cmd_paste (WorkbookControl *wbc, GnmPasteTarget const *pt)
 {
        GnmCellRegion  *content;
        GnmRange const *src_range;
+       GnmRange dst;
 
        g_return_if_fail (pt != NULL);
        g_return_if_fail (IS_SHEET (pt->sheet));
 
+       dst = pt->range;
+
+       /* Check for locks */
+       if (cmd_cell_range_is_locked_effective (pt->sheet, &dst, wbc, 
+                                               _("Paste")))
+               return ;
+
        src_range = gnm_app_clipboard_area_get ();
        content = gnm_app_clipboard_contents_get ();
 
@@ -310,8 +318,6 @@ cmd_paste (WorkbookControl *wbc, GnmPasteTarget const *pt)
                int const cols = (src_range->end.col - src_range->start.col);
                int const rows = (src_range->end.row - src_range->start.row);
 
-               GnmRange dst = pt->range;
-
                if (range_is_singleton (&dst)) {
                        dst.end.col = dst.start.col + cols;
                        dst.end.row = dst.start.row + rows;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]