summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-04-08 14:41:10 +0200
committerEike Rathke <erack@redhat.com>2014-04-08 14:44:27 +0200
commitf1ca1384707cb6c4fa240fdc4903bfb3ceaff889 (patch)
tree5ae3d43b52c35a3129cdc70045405cae54df4fe7 /sc
parent3974d6a2d96ec3facf529a4e54a2db63783961dd (diff)
also check if a newly read password protection applies to a range
Change-Id: Ibbf4fee2b87c82cdbd565681690a231fb06da66f
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/tabprotection.hxx5
-rw-r--r--sc/source/core/data/tabprotection.cxx8
2 files changed, 9 insertions, 4 deletions
diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx
index b057ad08fb0f..9a4fef125739 100644
--- a/sc/inc/tabprotection.hxx
+++ b/sc/inc/tabprotection.hxx
@@ -133,6 +133,11 @@ struct ScEnhancedProtection
{
return !maSecurityDescriptor.empty() || !maSecurityDescriptorXML.isEmpty();
}
+
+ bool hasPassword() const
+ {
+ return mnPasswordVerifier != 0 || !maHashValue.isEmpty();
+ }
};
/** sheet protection state container
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
index a9bfd8f78a70..52bc0fea382c 100644
--- a/sc/source/core/data/tabprotection.cxx
+++ b/sc/source/core/data/tabprotection.cxx
@@ -379,7 +379,7 @@ bool ScTableProtectionImpl::updateReference( UpdateRefMode eMode, ScDocument* pD
bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
{
- /* TODO: ask for password (and remember) if mnPasswordVerifier was set for
+ /* TODO: ask for password (and remember) if a password was set for
* a matching range and no matching range without password was encountered.
* Would need another return type than boolean to reflect
* "password required for a specific protection". */
@@ -401,7 +401,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
if ((*it).maRangeList->In( rRange))
{
// Range is editable if no password is assigned.
- if (!(*it).mnPasswordVerifier)
+ if (!(*it).hasPassword())
return true;
}
}
@@ -422,7 +422,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
if (aList.size() == 1 && *aList[0] == rRange)
{
// Range is editable if no password is assigned.
- if (!(*it).mnPasswordVerifier)
+ if (!(*it).hasPassword())
return true;
}
}
@@ -440,7 +440,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is())
{
// Ranges are editable if no password is assigned.
- if (!(*it).mnPasswordVerifier)
+ if (!(*it).hasPassword())
{
const ScRangeList& rRanges = *(*it).maRangeList;
size_t nRanges = rRanges.size();