Resolves: tdf#60056 disallow Fill when entire sheet is selected

Change-Id: I866f84d72c27be962dbad8f8e4dcb345aa336bff
This commit is contained in:
Eike Rathke
2016-07-29 15:02:12 +02:00
parent 410382a423
commit c729ee7622
3 changed files with 22 additions and 0 deletions

View File

@@ -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;

View File

@@ -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(

View File

@@ -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;