Kaydet (Commit) f1ca1384 authored tarafından Eike Rathke's avatar Eike Rathke

also check if a newly read password protection applies to a range

Change-Id: Ibbf4fee2b87c82cdbd565681690a231fb06da66f
üst 3974d6a2
...@@ -133,6 +133,11 @@ struct ScEnhancedProtection ...@@ -133,6 +133,11 @@ struct ScEnhancedProtection
{ {
return !maSecurityDescriptor.empty() || !maSecurityDescriptorXML.isEmpty(); return !maSecurityDescriptor.empty() || !maSecurityDescriptorXML.isEmpty();
} }
bool hasPassword() const
{
return mnPasswordVerifier != 0 || !maHashValue.isEmpty();
}
}; };
/** sheet protection state container /** sheet protection state container
......
...@@ -379,7 +379,7 @@ bool ScTableProtectionImpl::updateReference( UpdateRefMode eMode, ScDocument* pD ...@@ -379,7 +379,7 @@ bool ScTableProtectionImpl::updateReference( UpdateRefMode eMode, ScDocument* pD
bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const 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. * a matching range and no matching range without password was encountered.
* Would need another return type than boolean to reflect * Would need another return type than boolean to reflect
* "password required for a specific protection". */ * "password required for a specific protection". */
...@@ -401,7 +401,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const ...@@ -401,7 +401,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
if ((*it).maRangeList->In( rRange)) if ((*it).maRangeList->In( rRange))
{ {
// Range is editable if no password is assigned. // Range is editable if no password is assigned.
if (!(*it).mnPasswordVerifier) if (!(*it).hasPassword())
return true; return true;
} }
} }
...@@ -422,7 +422,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const ...@@ -422,7 +422,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
if (aList.size() == 1 && *aList[0] == rRange) if (aList.size() == 1 && *aList[0] == rRange)
{ {
// Range is editable if no password is assigned. // Range is editable if no password is assigned.
if (!(*it).mnPasswordVerifier) if (!(*it).hasPassword())
return true; return true;
} }
} }
...@@ -440,7 +440,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const ...@@ -440,7 +440,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is()) if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is())
{ {
// Ranges are editable if no password is assigned. // Ranges are editable if no password is assigned.
if (!(*it).mnPasswordVerifier) if (!(*it).hasPassword())
{ {
const ScRangeList& rRanges = *(*it).maRangeList; const ScRangeList& rRanges = *(*it).maRangeList;
size_t nRanges = rRanges.size(); size_t nRanges = rRanges.size();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment