[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Nov 24 10:34:18 PST 2009


 patches/dev300/apply                                     |    3 +
 patches/dev300/calc-xls-import-sheet-protection-fix.diff |   35 +++++++++++++++
 2 files changed, 38 insertions(+)

New commits:
commit 10be824d74992d4050c4bf91928eea6e6718f554
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Nov 24 13:32:56 2009 -0500

    Fixed incorrect import of sheet protection options.
    
    * patches/dev300/apply:
    * patches/dev300/calc-xls-import-sheet-protection-fix.diff:
      some xls documents have extra "feature header" records (where sheet
      protection options are stored) that stores no data at all, but
      we weren't checking the validity of each feature header record and
      importing everything.  That caused the sheet protection options
      to be imported incorrectly. (n#542024)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index d3e74d7..ce7e1d2 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -847,6 +847,9 @@ calc-string-number-decimal.diff, kohei
 calc-xls-import-slanted-border-sc.diff,  n#549728, i#38709, kohei
 calc-xls-import-slanted-border-oox.diff, n#549728, i#38709, kohei
 
+# Fix incorrect import of sheet protection options.
+calc-xls-import-sheet-protection-fix.diff, n#542024, kohei
+
 # Support PHONETIC function to display asian phonetic guide.
 # LATER: I'll take care of this later.  --kohei
 # calc-formula-asian-phonetic.diff, i#80764, i#80765, i#80766, kohei
diff --git a/patches/dev300/calc-xls-import-sheet-protection-fix.diff b/patches/dev300/calc-xls-import-sheet-protection-fix.diff
new file mode 100644
index 0000000..7126638
--- /dev/null
+++ b/patches/dev300/calc-xls-import-sheet-protection-fix.diff
@@ -0,0 +1,35 @@
+diff --git sc/source/filter/excel/xicontent.cxx sc/source/filter/excel/xicontent.cxx
+index cfe65b4..666083d 100644
+--- sc/source/filter/excel/xicontent.cxx
++++ sc/source/filter/excel/xicontent.cxx
+@@ -1228,7 +1228,29 @@ void XclImpSheetProtectBuffer::ReadProtect( XclImpStream& rStrm, SCTAB nTab )
+ 
+ void XclImpSheetProtectBuffer::ReadOptions( XclImpStream& rStrm, SCTAB nTab )
+ {
+-    rStrm.Ignore(19);
++    rStrm.Ignore(12);
++
++    // feature type can be either 2 or 4.  If 2, this record stores flag for 
++    // enhanced protection, whereas if 4 it stores flag for smart tag.
++    sal_uInt16 nFeatureType;
++    rStrm >> nFeatureType;
++    if (nFeatureType != 2)
++        // We currently only support import of enhanced protection data.
++        return;
++
++    rStrm.Ignore(1); // always 1
++
++    // The flag size specifies the size of bytes that follows that stores 
++    // feature data.  If -1 it depends on the feature type imported earlier.
++    // For enhanced protection data, the size is always 4.  For the most xls
++    // documents out there this value is almost always -1.
++    sal_Int32 nFlagSize;
++    rStrm >> nFlagSize;
++    if (nFlagSize != -1)
++        return;
++
++    // There are actually 4 bytes to read, but the upper 2 bytes currently 
++    // don't store any bits.
+     sal_uInt16 nOptions;
+     rStrm >> nOptions;
+ 


More information about the ooo-build-commit mailing list