summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-03-22 03:31:33 +0100
committerEike Rathke <erack@redhat.com>2014-03-22 03:43:43 +0100
commit0e0755e3903d54ec3942094060ca84e37e78264b (patch)
tree23e8b94fcd0e48a9520c20f6225d8810d790770f /sc
parenteceba5512636445c9ce827e2d6151875a4fc4673 (diff)
use enhanced protection permission to override protection attribute
Change-Id: I53eeb5ffe6e700dd02e3966ccd66738c7b5ab464
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/table2.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 3eb49629ee17..b4d66562c6a8 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -49,6 +49,7 @@
#include "mtvcellfunc.hxx"
#include "refupdatecontext.hxx"
#include "scopetools.hxx"
+#include "tabprotection.hxx"
#include <rowheightcontext.hxx>
#include <refhint.hxx>
@@ -2172,7 +2173,13 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
else if ( IsProtected() && !pDocument->IsScenario(nTab) )
{
bIsEditable = !HasAttrib( nCol1, nRow1, nCol2, nRow2, HASATTR_PROTECTED );
- if(bIsEditable)
+ if (!bIsEditable)
+ {
+ // An enhanced protection permission may override the attribute.
+ if (pTabProtection)
+ bIsEditable = pTabProtection->isBlockEditable( ScRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab));
+ }
+ if (bIsEditable)
{
// If Sheet is protected and cells are not protected then
// check the active scenario protect flag if this range is
@@ -2239,13 +2246,20 @@ bool ScTable::IsSelectionEditable( const ScMarkData& rMark,
bIsEditable = false;
else if ( IsProtected() && !pDocument->IsScenario(nTab) )
{
- if((bIsEditable = !HasAttribSelection( rMark, HASATTR_PROTECTED )) != false)
+ ScRangeList aRanges;
+ rMark.FillRangeListWithMarks( &aRanges, false );
+ bIsEditable = !HasAttribSelection( rMark, HASATTR_PROTECTED );
+ if (!bIsEditable)
+ {
+ // An enhanced protection permission may override the attribute.
+ if (pTabProtection)
+ bIsEditable = pTabProtection->isSelectionEditable( aRanges);
+ }
+ if (bIsEditable)
{
// If Sheet is protected and cells are not protected then
// check the active scenario protect flag if this area is
// in the active scenario range.
- ScRangeList aRanges;
- rMark.FillRangeListWithMarks( &aRanges, false );
SCTAB nScenTab = nTab+1;
while(pDocument->IsScenario(nScenTab) && bIsEditable)
{