summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-03-25 20:39:10 +0100
committerEike Rathke <erack@redhat.com>2014-03-25 20:43:07 +0100
commit98c6b4149e46eec6aaee5b64f2fa40678589dd4b (patch)
treebea990f78070e8a48867ace8c9c0ad995a5afac9
parentcdb473b00a7d56c43df568708c069fa31a07f0a6 (diff)
union of a to be edited range may be distributed over two different records
Change-Id: I1d0047e04394a79134b3333eef35ba0cfe6a8ca1
-rw-r--r--sc/source/core/data/tabprotection.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
index 161cf652f478..a8aa2787543e 100644
--- a/sc/source/core/data/tabprotection.cxx
+++ b/sc/source/core/data/tabprotection.cxx
@@ -434,6 +434,33 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
}
}
+ // Ranges may even be distributed over different protection records, for
+ // example if they are assigned different names, and can have different
+ // passwords. Combine the ones that can be edited.
+ /* TODO: once we handle passwords, remember a successful unlock at
+ * ScEnhancedProtection so we can use that here. */
+ ScRangeList aRangeList;
+ for (::std::vector<ScEnhancedProtection>::const_iterator it(maEnhancedProtection.begin()),
+ itEnd(maEnhancedProtection.end()); it != itEnd; ++it)
+ {
+ if ((*it).maSecurityDescriptor.empty() && (*it).maRangeList.Is())
+ {
+ // Ranges are editable if no password is assigned.
+ if (!(*it).mnPasswordVerifier)
+ {
+ const ScRangeList& rRanges = *(*it).maRangeList;
+ size_t nRanges = rRanges.size();
+ for (size_t i=0; i < nRanges; ++i)
+ {
+ aRangeList.Append( *rRanges[i]);
+ }
+ }
+ }
+ }
+ ScRangeList aResultList( aRangeList.GetIntersectedRange( rRange));
+ if (aResultList.size() == 1 && *aResultList[0] == rRange)
+ return true;
+
return false;
}