summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/cellsh.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2017-05-11 18:07:56 -0400
committerKohei Yoshida <libreoffice@kohei.us>2017-05-17 05:16:44 +0200
commit034be10413ed4915090678ad4f1d48596cf5e206 (patch)
tree5227cc4aae303272338e8fc25225fc48914168d0 /sc/source/ui/view/cellsh.cxx
parent296c2296f5565556eea9fab51563050f28bbcafc (diff)
tdf#43535: support additional sheet protection options.
New options are: * insert columns. * insert rows. * delete columns. * delete rows. Change-Id: I076b0d01bee0fff0623e2f1137c09938a6110939 Reviewed-on: https://gerrit.libreoffice.org/37695 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'sc/source/ui/view/cellsh.cxx')
-rw-r--r--sc/source/ui/view/cellsh.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 79d356e1a86f..52785f4fc883 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -231,6 +231,19 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
case FID_INS_ROW:
case FID_INS_ROWS_BEFORE: // insert rows
case FID_INS_ROWS_AFTER:
+ {
+ sc::ColRowEditAction eAction = sc::ColRowEditAction::InsertRowsBefore;
+ if (nWhich == FID_INS_ROWS_AFTER)
+ eAction = sc::ColRowEditAction::InsertRowsAfter;
+
+ bDisable = (!bSimpleArea) || GetViewData()->SimpleColMarked();
+ if (!bEditable && nCol1 == 0 && nCol2 == MAXCOL)
+ {
+ // See if row insertions are allowed.
+ bEditable = pDoc->IsEditActionAllowed(eAction, rMark, nRow1, nRow2);
+ }
+ break;
+ }
case FID_INS_CELLSDOWN:
case SID_ROW_OPERATIONS:
bDisable = (!bSimpleArea) || GetViewData()->SimpleColMarked();
@@ -239,6 +252,19 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
case FID_INS_COLUMN:
case FID_INS_COLUMNS_BEFORE: // insert columns
case FID_INS_COLUMNS_AFTER:
+ {
+ sc::ColRowEditAction eAction = sc::ColRowEditAction::InsertColumnsBefore;
+ if (nWhich == FID_INS_COLUMNS_AFTER)
+ eAction = sc::ColRowEditAction::InsertColumnsAfter;
+
+ bDisable = (!bSimpleArea) || GetViewData()->SimpleRowMarked();
+ if (!bEditable && nRow1 == 0 && nRow2 == MAXROW)
+ {
+ // See if row insertions are allowed.
+ bEditable = pDoc->IsEditActionAllowed(eAction, rMark, nCol1, nCol2);
+ }
+ break;
+ }
case FID_INS_CELLSRIGHT:
case SID_COLUMN_OPERATIONS:
bDisable = (!bSimpleArea) || GetViewData()->SimpleRowMarked();