[ooo-build-commit] 2 commits - patches/dev300 scratch/mso-dumper

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Jul 13 10:01:35 PDT 2009


 patches/dev300/apply                                    |    3 +
 patches/dev300/calc-xls-hyperlink-single-quote-fix.diff |   38 ++++++++++++++++
 scratch/mso-dumper/src/xlsrecord.py                     |   17 +++++++
 scratch/mso-dumper/src/xlsstream.py                     |    2 
 4 files changed, 59 insertions(+), 1 deletion(-)

New commits:
commit 5c355b068f9fc37d7ba124ae424f6a6817c4fdde
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Jul 13 12:59:40 2009 -0400

    Fixed incorrect import of hyperlink strings from xls.
    
    * patches/dev300/apply:
    * patches/dev300/calc-xls-hyperlink-single-quote-fix.diff: check
      for double single quotes in sheet name, and handle it correctly.
      (n#521447, i#103520)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 8106083..1358d17 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3172,6 +3172,9 @@ calc-dirty-cells-after-load-fix.diff, n#491898, kohei
 # fix incorrect URI path generation for external references.
 calc-external-ref-path-fix.diff, i#103347, kohei
 
+# fix incorrect import of hyperlink texts in presence of single quotes in sheet name.
+calc-xls-hyperlink-single-quote-fix.diff, n#521447, kohei
+
 [ CalcRowLimit ]
 # The work to increase Calc's row size limit, and any work associated with it.
 SectionOwner => kohei
diff --git a/patches/dev300/calc-xls-hyperlink-single-quote-fix.diff b/patches/dev300/calc-xls-hyperlink-single-quote-fix.diff
new file mode 100644
index 0000000..ba9eb19
--- /dev/null
+++ b/patches/dev300/calc-xls-hyperlink-single-quote-fix.diff
@@ -0,0 +1,38 @@
+diff --git sc/source/filter/excel/xicontent.cxx sc/source/filter/excel/xicontent.cxx
+index 24c1999..3aa1cc0 100644
+--- sc/source/filter/excel/xicontent.cxx
++++ sc/source/filter/excel/xicontent.cxx
+@@ -377,14 +377,33 @@ void XclImpHyperlink::ConvertToValidTabName(String& rUrl)
+     String aNewUrl(sal_Unicode('#')), aTabName;
+ 
+     bool bInQuote = false;
++    bool bQuoteTabName = false;
+     for (xub_StrLen i = 1; i < n; ++i)
+     {
+         c = rUrl.GetChar(i);
+         if (c == sal_Unicode('\''))
+         {
++            if (bInQuote && i+1 < n && rUrl.GetChar(i+1) == sal_Unicode('\''))
++            {
++                // Two consecutive single quotes ('') signify a single literal
++                // quite.  When this occurs, the whole table name needs to be
++                // quoted.
++                bQuoteTabName = true;
++                aTabName.Append(c);
++                aTabName.Append(c);
++                ++i;
++                continue;
++            }
++
+             bInQuote = !bInQuote;
+             if (!bInQuote && aTabName.Len() > 0)
++            {
++                if (bQuoteTabName)
++                    aNewUrl.Append(sal_Unicode('\''));
+                 aNewUrl.Append(aTabName);
++                if (bQuoteTabName)
++                    aNewUrl.Append(sal_Unicode('\''));
++            }
+         }
+         else if (bInQuote)
+             aTabName.Append(c);
commit 0795fcd89aa34c603ad0eed1f4d6f7fffc6e340f
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Jul 13 12:50:12 2009 -0400

    [xls-dump] Added handler for Hyperlink records.
    
    * scratch/mso-dumper/src/xlsrecord.py:
    * scratch/mso-dumper/src/xlsstream.py:

diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index 04fb248..f4e457e 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -635,6 +635,23 @@ class RefreshAll(BaseRecordHandler):
         self.appendLine("refresh all external data ranges and pivot tables: %s"%strVal)
 
 
+class Hyperlink(BaseRecordHandler):
+
+    def parseBytes (self):
+        rowFirst = self.readUnsignedInt(2)
+        rowLast = self.readUnsignedInt(2)
+        colFirst = self.readUnsignedInt(2)
+        colLast = self.readUnsignedInt(2)
+        # Rest of the stream stores undocumented hyperlink stream.  Refer to 
+        # page 128 of MS Excel binary format spec.
+        self.appendLine("rows: %d - %d"%(rowFirst, rowLast))
+        self.appendLine("columns: %d - %d"%(colFirst, colLast))
+        msg  = "NOTE: The stream after the first 8 bytes stores undocumented hyperlink stream.  "
+        msg += "Refer to page 128 of the MS Excel binary format spec."
+        self.appendLine('')
+        self.appendMultiLine(msg)
+
+
 # -------------------------------------------------------------------
 # SX - Pivot Table
 
diff --git a/scratch/mso-dumper/src/xlsstream.py b/scratch/mso-dumper/src/xlsstream.py
index ef0cddc..c30ba61 100644
--- a/scratch/mso-dumper/src/xlsstream.py
+++ b/scratch/mso-dumper/src/xlsstream.py
@@ -166,7 +166,7 @@ recData = {
     0x01B5: ["DCONBIN", "Data Consolidation Information"],
     0x01B6: ["TXO", "Text Object"],
     0x01B7: ["REFRESHALL", "Refresh Flag", xlsrecord.RefreshAll],
-    0x01B8: ["HLINK", "Hyperlink"],
+    0x01B8: ["HLINK", "Hyperlink", xlsrecord.Hyperlink],
     0x01BB: ["SXFDBTYPE", "SQL Datatype Identifier"],
     0x01BC: ["PROT4REVPASS", "Shared Workbook Protection Password"],
     0x01BE: ["DV", "Data Validation Criteria"],


More information about the ooo-build-commit mailing list