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

added ScEnhancedProtection to ScTableProtection

Change-Id: Id6a444bd01873e30ea1522aaf3b951f4d5adc261
üst 56dd3c27
......@@ -24,6 +24,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include "global.hxx"
#include "rangelst.hxx"
#include <boost/shared_ptr.hpp>
class ScDocument;
......@@ -110,6 +111,19 @@ private:
::boost::shared_ptr<ScTableProtectionImpl> mpImpl;
};
/** Container for the Excel EnhancedProtection feature.
*/
struct ScEnhancedProtection
{
ScRangeListRef maRangeList;
sal_uInt32 mnAreserved;
sal_uInt32 mnPasswordVerifier;
OUString maTitle;
::std::vector< sal_uInt8 > maSecurityDescriptor; // raw data
ScEnhancedProtection() : mnAreserved(0), mnPasswordVerifier(0) {}
};
/** sheet protection state container
*
* This class stores sheet's protection state: 1) whether the protection
......@@ -163,6 +177,11 @@ public:
bool isOptionEnabled(Option eOption) const;
void setOption(Option eOption, bool bEnabled);
void setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt );
const ::std::vector< ScEnhancedProtection > & getEnhancedProtection() const;
bool updateReference( UpdateRefMode, ScDocument*, const ScRange& rWhere, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
private:
::boost::shared_ptr<ScTableProtectionImpl> mpImpl;
};
......
......@@ -117,6 +117,10 @@ public:
bool isOptionEnabled(SCSIZE nOptId) const;
void setOption(SCSIZE nOptId, bool bEnabled);
void setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt );
const ::std::vector< ScEnhancedProtection > & getEnhancedProtection() const;
bool updateReference( UpdateRefMode, ScDocument*, const ScRange& rWhere, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
private:
OUString maPassText;
::com::sun::star::uno::Sequence<sal_Int8> maPassHash;
......@@ -125,6 +129,7 @@ private:
bool mbProtected;
ScPasswordHash meHash1;
ScPasswordHash meHash2;
::std::vector< ScEnhancedProtection > maEnhancedProtection;
};
Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const OUString& aPassText, ScPasswordHash eHash)
......@@ -352,6 +357,27 @@ void ScTableProtectionImpl::setOption(SCSIZE nOptId, bool bEnabled)
maOptions[nOptId] = bEnabled;
}
void ScTableProtectionImpl::setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt )
{
maEnhancedProtection = rProt;
}
const ::std::vector< ScEnhancedProtection > & ScTableProtectionImpl::getEnhancedProtection() const
{
return maEnhancedProtection;
}
bool ScTableProtectionImpl::updateReference( UpdateRefMode eMode, ScDocument* pDoc,
const ScRange& rWhere, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
{
bool bChanged = false;
for (::std::vector<ScEnhancedProtection>::iterator it(maEnhancedProtection.begin());
it != maEnhancedProtection.end(); ++it)
{
bChanged |= (*it).maRangeList->UpdateReference( eMode, pDoc, rWhere, nDx, nDy, nDz);
}
return bChanged;
}
ScDocProtection::ScDocProtection() :
......@@ -505,4 +531,21 @@ void ScTableProtection::setOption(Option eOption, bool bEnabled)
{
mpImpl->setOption(eOption, bEnabled);
}
void ScTableProtection::setEnhancedProtection( const ::std::vector< ScEnhancedProtection > & rProt )
{
mpImpl->setEnhancedProtection(rProt);
}
const ::std::vector< ScEnhancedProtection > & ScTableProtection::getEnhancedProtection() const
{
return mpImpl->getEnhancedProtection();
}
bool ScTableProtection::updateReference( UpdateRefMode eMode, ScDocument* pDoc, const ScRange& rWhere,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
{
return mpImpl->updateReference( eMode, pDoc, rWhere, nDx, nDy, nDz);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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