summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-03-20 13:00:48 +0100
committerEike Rathke <erack@redhat.com>2014-03-20 13:03:35 +0100
commit273195cb0a237142dd8885529688325438f27281 (patch)
tree8eaf975c43cdbf167f3e0f76c40064505b731047 /sc
parent6daff4ed350b6b2493f36290a00892a9584e786f (diff)
stuff Excel enhanced protection read into ScTableProtection
Change-Id: I06db8f7466f5baddc55ea9cb117bb8a222de0c01
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/excel/xicontent.cxx39
-rw-r--r--sc/source/filter/inc/xicontent.hxx6
2 files changed, 40 insertions, 5 deletions
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 4edbff68308e..bc27a2992216 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -74,11 +74,29 @@ const XclRef8U & XclRef8U::read( XclImpStream & rStrm )
return *this;
}
-ScRange XclRef8U::convertToScRange( SCTAB nTab )
+ScRange XclRef8U::convertToScRange( SCTAB nTab ) const
{
return ScRange( mnCol1, mnRow1, nTab, mnCol2, mnRow2, nTab);
}
+ScEnhancedProtection XclEnhancedProtection::convertToScEnhancedProtection( SCTAB nTab ) const
+{
+ ScEnhancedProtection aProt;
+ if (!maRefs.empty())
+ {
+ aProt.maRangeList = new ScRangeList;
+ for (::std::vector<XclRef8U>::const_iterator it(maRefs.begin()), itEnd(maRefs.end()); it != itEnd; ++it)
+ {
+ aProt.maRangeList->Append( it->convertToScRange( nTab));
+ }
+ }
+ aProt.mnAreserved = mnAreserved;
+ aProt.mnPasswordVerifier = mnPasswordVerifier;
+ aProt.maTitle = maTitle;
+ aProt.maSecurityDescriptor = maSecurityDescriptor;
+ return aProt;
+}
+
// Shared string table ========================================================
@@ -1302,8 +1320,6 @@ void XclImpSheetProtectBuffer::Apply() const
pProtect->setPasswordHash(aPass, PASSHASH_XL);
}
- // ranges the protection is applied to
-
// sheet protection options
const sal_uInt16 nOptions = itr->second.mnOptions;
pProtect->setOption( ScTableProtection::OBJECTS, (nOptions & 0x0001) );
@@ -1322,8 +1338,23 @@ void XclImpSheetProtectBuffer::Apply() const
pProtect->setOption( ScTableProtection::PIVOT_TABLES, (nOptions & 0x2000) );
pProtect->setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, (nOptions & 0x4000) );
+ SCTAB nTab = itr->first;
+
+ // Enhanced protection containing editable ranges and permissions.
+ if (!itr->second.maEnhancedProtections.empty())
+ {
+ ::std::vector<ScEnhancedProtection> aProtections;
+ for (::std::vector<XclEnhancedProtection>::const_iterator
+ it(itr->second.maEnhancedProtections.begin()), itEnd(itr->second.maEnhancedProtections.end());
+ it != itEnd; ++it)
+ {
+ aProtections.push_back( it->convertToScEnhancedProtection( nTab));
+ }
+ pProtect->setEnhancedProtection( aProtections);
+ }
+
// all done. now commit.
- GetDoc().SetTabProtection(itr->first, pProtect.get());
+ GetDoc().SetTabProtection(nTab, pProtect.get());
}
}
diff --git a/sc/source/filter/inc/xicontent.hxx b/sc/source/filter/inc/xicontent.hxx
index 72ed769156ea..86142ece5315 100644
--- a/sc/source/filter/inc/xicontent.hxx
+++ b/sc/source/filter/inc/xicontent.hxx
@@ -31,6 +31,8 @@
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp>
+class ScEnhancedProtection;
+
/* ============================================================================
Classes to import the big Excel document contents (related to several cells or
globals for the document).
@@ -52,7 +54,7 @@ struct XclRef8U
sal_uInt16 mnCol2;
const XclRef8U & read( XclImpStream & rStrm );
- ScRange convertToScRange( SCTAB nTab );
+ ScRange convertToScRange( SCTAB nTab ) const;
};
/** Feat ISFPROTECTION refs plus FeatProtection */
@@ -63,6 +65,8 @@ struct XclEnhancedProtection
sal_uInt32 mnPasswordVerifier;
OUString maTitle;
::std::vector< sal_uInt8 > maSecurityDescriptor; // raw data
+
+ ScEnhancedProtection convertToScEnhancedProtection( SCTAB nTab ) const;
};
// Shared string table ========================================================