[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Fri Jul 29 13:11:11 UTC 2016


 sc/source/ui/docshell/docfunc.cxx |    5 +++++
 sc/source/ui/view/cellsh.cxx      |   11 +++++++++++
 sc/source/ui/view/cellsh1.cxx     |    6 ++++++
 3 files changed, 22 insertions(+)

New commits:
commit c729ee7622b1d54b2dc82b1807c68899efeab6d7
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Jul 29 15:02:12 2016 +0200

    Resolves: tdf#60056 disallow Fill when entire sheet is selected
    
    Change-Id: I866f84d72c27be962dbad8f8e4dcb345aa336bff

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 1f4ed8d..cdaedc2 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 7379cdb..8b0a138 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 797bf86..10a3430 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;


More information about the Libreoffice-commits mailing list