diff options
author | Eike Rathke <erack@redhat.com> | 2014-03-20 10:16:50 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-03-20 13:03:33 +0100 |
commit | 9cee6a45632623d3d7e5a574128940f96d8c926b (patch) | |
tree | 8a661ad692aa0c0cfc178233e73b196e6bf28932 | |
parent | 56dd3c277ab342edf08f1f01955ca2a84f7112b1 (diff) |
added ScEnhancedProtection to ScTableProtection
Change-Id: Id6a444bd01873e30ea1522aaf3b951f4d5adc261
-rw-r--r-- | sc/inc/tabprotection.hxx | 19 | ||||
-rw-r--r-- | sc/source/core/data/tabprotection.cxx | 43 |
2 files changed, 62 insertions, 0 deletions
diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx index 7703ffb5676e..a32f50f4828f 100644 --- a/sc/inc/tabprotection.hxx +++ b/sc/inc/tabprotection.hxx @@ -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; }; diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx index c030d3247d13..10eef3c8c227 100644 --- a/sc/source/core/data/tabprotection.cxx +++ b/sc/source/core/data/tabprotection.cxx @@ -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: */ |