summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2016-07-29 15:02:12 +0200
committerEike Rathke <erack@redhat.com>2016-07-29 15:10:43 +0200
commitc729ee7622b1d54b2dc82b1807c68899efeab6d7 (patch)
tree1e0aba1495f832ff6546e375da370614f3ef8d20 /sc
parent410382a423018faeac1b47400f930bef62be3e46 (diff)
Resolves: tdf#60056 disallow Fill when entire sheet is selected
Change-Id: I866f84d72c27be962dbad8f8e4dcb345aa336bff
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/docfunc.cxx5
-rw-r--r--sc/source/ui/view/cellsh.cxx11
-rw-r--r--sc/source/ui/view/cellsh1.cxx6
3 files changed, 22 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 1f4ed8d3fdf6..cdaedc22a8b4 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -4604,6 +4604,11 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
return false;
}
+ // FID_FILL_... slots should already had been disabled, check here for API
+ // calls, no message.
+ if (ScViewData::SelectionFillDOOM( aDestArea))
+ return false;
+
WaitObject aWait( ScDocShell::GetActiveDialogParent() );
ScDocument* pUndoDoc = nullptr;
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 7379cdb94897..8b0a1382ce3c 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -129,6 +129,8 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
case FID_FILL_TO_BOTTOM: // fill to top / bottom
{
bDisable = !bSimpleArea || (nRow1 == 0 && nRow2 == 0);
+ if (!bDisable && GetViewData()->SelectionForbidsPaste())
+ bDisable = true;
if ( !bDisable && bEditable )
{ // do not damage matrix
bDisable = pDoc->HasSelectedBlockMatrixFragment(
@@ -139,6 +141,8 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
case FID_FILL_TO_TOP:
{
bDisable = (!bSimpleArea) || (nRow1 == MAXROW && nRow2 == MAXROW);
+ if (!bDisable && GetViewData()->SelectionForbidsPaste())
+ bDisable = true;
if ( !bDisable && bEditable )
{ // do not damage matrix
bDisable = pDoc->HasSelectedBlockMatrixFragment(
@@ -149,6 +153,8 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
case FID_FILL_TO_RIGHT: // fill to left / right
{
bDisable = !bSimpleArea || (nCol1 == 0 && nCol2 == 0);
+ if (!bDisable && GetViewData()->SelectionForbidsPaste())
+ bDisable = true;
if ( !bDisable && bEditable )
{ // do not damage matrix
bDisable = pDoc->HasSelectedBlockMatrixFragment(
@@ -159,6 +165,8 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
case FID_FILL_TO_LEFT:
{
bDisable = (!bSimpleArea) || (nCol1 == MAXCOL && nCol2 == MAXCOL);
+ if (!bDisable && GetViewData()->SelectionForbidsPaste())
+ bDisable = true;
if ( !bDisable && bEditable )
{ // do not damage matrix
bDisable = pDoc->HasSelectedBlockMatrixFragment(
@@ -185,6 +193,9 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
else
bDisable = (!bSimpleArea) || (nCol1 == nCol2 && nRow1 == nRow2);
+ if (!bDisable && GetViewData()->SelectionForbidsPaste())
+ bDisable = true;
+
if ( !bDisable && bEditable && nWhich == FID_FILL_SERIES )
{ // do not damage matrix
bDisable = pDoc->HasSelectedBlockMatrixFragment(
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 797bf8667caf..10a34303cabb 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -527,6 +527,12 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case FID_FILL_SERIES:
{
+ if (GetViewData()->SelectionForbidsPaste())
+ // Slot should be already disabled, but in case it wasn't
+ // don't even attempt to do the evaluation and popup a
+ // dialog.
+ break;
+
SCCOL nStartCol;
SCROW nStartRow;
SCTAB nStartTab;