[Libreoffice-commits] core.git: 2 commits - sc/source
Eike Rathke
erack at redhat.com
Fri Mar 21 19:44:08 PDT 2014
sc/source/core/data/table1.cxx | 20 ++++++++------------
sc/source/core/data/table2.cxx | 22 ++++++++++++++++++----
2 files changed, 26 insertions(+), 16 deletions(-)
New commits:
commit 0e0755e3903d54ec3942094060ca84e37e78264b
Author: Eike Rathke <erack at redhat.com>
Date: Sat Mar 22 03:31:33 2014 +0100
use enhanced protection permission to override protection attribute
Change-Id: I53eeb5ffe6e700dd02e3966ccd66738c7b5ab464
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 3eb4962..b4d6656 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)
{
commit eceba5512636445c9ce827e2d6151875a4fc4673
Author: Eike Rathke <erack at redhat.com>
Date: Sat Mar 22 03:08:50 2014 +0100
no need to use the getter here
Change-Id: I5bbec2c06a641729194ceee3882b88e7372d41a9
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 0f71358..cb59dc4 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1578,9 +1578,8 @@ void ScTable::UpdateReference(
if(mpCondFormatList)
mpCondFormatList->UpdateReference(rCxt);
- ScTableProtection* pProtection = GetProtection();
- if (pProtection)
- pProtection->updateReference( eUpdateRefMode, pDocument, rCxt.maRange, nDx, nDy, nDz);
+ if (pTabProtection)
+ pTabProtection->updateReference( eUpdateRefMode, pDocument, rCxt.maRange, nDx, nDy, nDz);
}
void ScTable::UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
@@ -1611,9 +1610,8 @@ void ScTable::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
if (mpCondFormatList)
mpCondFormatList->UpdateInsertTab(rCxt);
- ScTableProtection* pProtection = GetProtection();
- if (pProtection)
- pProtection->updateReference( URM_INSDEL, pDocument,
+ if (pTabProtection)
+ pTabProtection->updateReference( URM_INSDEL, pDocument,
ScRange( 0, 0, rCxt.mnInsertPos, MAXCOL, MAXROW, MAXTAB),
0, 0, rCxt.mnSheets);
@@ -1639,9 +1637,8 @@ void ScTable::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
if (mpCondFormatList)
mpCondFormatList->UpdateDeleteTab(rCxt);
- ScTableProtection* pProtection = GetProtection();
- if (pProtection)
- pProtection->updateReference( URM_INSDEL, pDocument,
+ if (pTabProtection)
+ pTabProtection->updateReference( URM_INSDEL, pDocument,
ScRange( 0, 0, rCxt.mnDeletePos, MAXCOL, MAXROW, MAXTAB),
0, 0, -rCxt.mnSheets);
@@ -1665,9 +1662,8 @@ void ScTable::UpdateMoveTab(
if(mpCondFormatList)
mpCondFormatList->UpdateMoveTab(rCxt);
- ScTableProtection* pProtection = GetProtection();
- if (pProtection)
- pProtection->updateReference( URM_REORDER, pDocument,
+ if (pTabProtection)
+ pTabProtection->updateReference( URM_REORDER, pDocument,
ScRange( 0, 0, rCxt.mnOldPos, MAXCOL, MAXROW, MAXTAB),
0, 0, rCxt.mnNewPos - rCxt.mnOldPos);
More information about the Libreoffice-commits
mailing list