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

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Jan 26 12:24:19 PST 2010


 patches/dev300/apply                                  |    3 
 patches/dev300/calc-xls-export-hidden-row-height.diff |   89 ++++++++++++++++++
 scratch/mso-dumper/src/xlsrecord.py                   |   25 ++++-
 scratch/mso-dumper/src/xlsstream.py                   |    2 
 4 files changed, 117 insertions(+), 2 deletions(-)

New commits:
commit 23f1523ef72ea8ce71bd101c72d51600de4c1c9d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Jan 26 15:05:59 2010 -0500

    Correctly export the heights of hidden rows.
    
    * patches/dev300/apply:
    * patches/dev300/calc-xls-export-hidden-row-height.diff: When a row
      is hidden, Excel expects the height of that row before it got
      hidden.  But Calc incorrectly stored the default height value
      for all hidden rows. (n#573938)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 8213e1e..25771b3 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -860,6 +860,9 @@ sc-uninitialized-var-fix.diff, kohei
 # when double-clicking on a cell that contains a field name, it crashes.
 calc-dp-drilldown-fieldname-crash-fix.diff, n#573456, i#103347, kohei
 
+# correctly export the heights of hidden rows.
+calc-xls-export-hidden-row-height.diff, n#573938, 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-export-hidden-row-height.diff b/patches/dev300/calc-xls-export-hidden-row-height.diff
new file mode 100644
index 0000000..c3d9a16
--- /dev/null
+++ b/patches/dev300/calc-xls-export-hidden-row-height.diff
@@ -0,0 +1,89 @@
+diff --git sc/inc/document.hxx sc/inc/document.hxx
+index 4d94701..82b1582 100644
+--- sc/inc/document.hxx
++++ sc/inc/document.hxx
+@@ -1249,7 +1249,7 @@ public:
+     void			SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BOOL bManual );
+ 
+     SC_DLLPUBLIC USHORT			GetColWidth( SCCOL nCol, SCTAB nTab ) const;
+-    SC_DLLPUBLIC USHORT			GetRowHeight( SCROW nRow, SCTAB nTab ) const;
++    SC_DLLPUBLIC USHORT         GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const;
+     SC_DLLPUBLIC ULONG			GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
+     ULONG			GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const;
+     SC_DLLPUBLIC ULONG			GetColOffset( SCCOL nCol, SCTAB nTab ) const;
+diff --git sc/inc/table.hxx sc/inc/table.hxx
+index 9606b98..7d6f363 100644
+--- sc/inc/table.hxx
++++ sc/inc/table.hxx
+@@ -613,7 +613,7 @@ public:
+     void		SetManualHeight( SCROW nStartRow, SCROW nEndRow, BOOL bManual );
+ 
+ 	USHORT		GetColWidth( SCCOL nCol );
+-    SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL );
++    SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true );
+ 	ULONG		GetRowHeight( SCROW nStartRow, SCROW nEndRow );
+ 	ULONG		GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale );
+ 	ULONG		GetColOffset( SCCOL nCol );
+diff --git sc/source/core/data/document.cxx sc/source/core/data/document.cxx
+index 65a3cc7..40df826 100644
+--- sc/source/core/data/document.cxx
++++ sc/source/core/data/document.cxx
+@@ -3191,10 +3191,10 @@ USHORT ScDocument::GetOriginalHeight( SCROW nRow, SCTAB nTab ) const
+ }
+ 
+ 
+-USHORT ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab ) const
++USHORT ScDocument::GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero ) const
+ {
+     if ( ValidTab(nTab) && pTab[nTab] )
+-        return pTab[nTab]->GetRowHeight( nRow );
++        return pTab[nTab]->GetRowHeight( nRow, NULL, NULL, bHiddenAsZero );
+     DBG_ERROR("Falsche Tabellennummer");
+     return 0;
+ }
+diff --git sc/source/core/data/table2.cxx sc/source/core/data/table2.cxx
+index 35c126d..7511774 100644
+--- sc/source/core/data/table2.cxx
++++ sc/source/core/data/table2.cxx
+@@ -2307,13 +2307,13 @@ USHORT ScTable::GetCommonWidth( SCCOL nEndCol )
+ }
+ 
+ 
+-USHORT ScTable::GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* pEndRow )
++USHORT ScTable::GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero )
+ {
+     DBG_ASSERT(VALIDROW(nRow),"Falsche Zeilennummer");
+ 
+ 	if (VALIDROW(nRow) && mpRowHeights)
+     {
+-        if (RowHidden(nRow))
++        if (bHiddenAsZero && RowHidden(nRow))
+             return 0;
+         else
+         {
+diff --git sc/source/filter/excel/xetable.cxx sc/source/filter/excel/xetable.cxx
+index 2816daf..ceb708e 100644
+--- sc/source/filter/excel/xetable.cxx
++++ sc/source/filter/excel/xetable.cxx
+@@ -1835,17 +1835,11 @@ XclExpRow::XclExpRow( const XclExpRoot& rRoot, sal_uInt16 nXclRow,
+ 
+     // *** Row height *** -----------------------------------------------------
+ 
+-    USHORT nScHeight = GetDoc().GetRowHeight( nScRow, nScTab );
+-    if( nScHeight == 0 )
+-    {
+-        ::set_flag( mnFlags, EXC_ROW_HIDDEN );
+-        mnHeight = EXC_ROW_DEFAULTHEIGHT;
+-    }
++    if (bUserHeight)
++        mnHeight = GetDoc().GetRowHeight(nScRow, nScTab, false);
+     else
+-    {
+-        // Calc and Excel use twips
+-        mnHeight = static_cast< sal_uInt16 >( nScHeight );
+-    }
++        mnHeight = EXC_ROW_DEFAULTHEIGHT;
++
+     // #76250# not usable in Applix
+ //    ::set_flag( mnHeight, EXC_ROW_FLAGDEFHEIGHT, !bUserHeight );
+ 
commit 9eb3e888c3e3ca222d638a66dc58fdc4d4b6997d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Jan 26 15:22:26 2010 -0500

    [xls-dump] Added handler for the DEFROWHEIGHT record.
    
    * 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 97ac2c8..e430aae 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -896,6 +896,29 @@ class DefColWidth(BaseRecordHandler):
         self.appendLine("default column width (in characters): %d"%w)
 
 
+class DefRowHeight(BaseRecordHandler):
+
+    def __parseBytes (self):
+        flag = self.readUnsignedInt(1)
+        self.readUnsignedInt(1) # ignore 1 byte.
+        self.unsynced = (flag & 0x01) != 0
+        self.dyZero   = (flag & 0x02) != 0
+        self.exAsc    = (flag & 0x04) != 0
+        self.exDsc    = (flag & 0x08) != 0
+        self.rowHeight = self.readUnsignedInt(2)
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLineBoolean("default row height settings changed", self.unsynced)
+        self.appendLineBoolean("empty rows have a height of zero", self.dyZero)
+        self.appendLineBoolean("empty rows have a thick border style at top", self.exAsc)
+        self.appendLineBoolean("empty rows have a thick border style at bottom", self.exDsc)
+        if self.dyZero:
+            self.appendLine("default height for hidden rows: %d"%self.rowHeight)
+        else:
+            self.appendLine("default height for empty rows: %d"%self.rowHeight)
+
+
 class ColInfo(BaseRecordHandler):
 
     def parseBytes (self):
@@ -926,7 +949,7 @@ class Row(BaseRecordHandler):
 
         flag = self.readUnsignedInt(2)
         self.rowHeight     = (flag & 0x7FFF)
-        self.defaultHeight = ((flag & 0x8000) == 1)
+        self.defaultHeight = ((flag & 0x8000) != 0)
         self.irwMac = self.readUnsignedInt(2)
 
         dummy = self.readUnsignedInt(2)
diff --git a/scratch/mso-dumper/src/xlsstream.py b/scratch/mso-dumper/src/xlsstream.py
index 8f40d1a..eb37b7f 100644
--- a/scratch/mso-dumper/src/xlsstream.py
+++ b/scratch/mso-dumper/src/xlsstream.py
@@ -184,7 +184,7 @@ recData = {
     0x0218: ["NAME", "Defined Name"],
     0x0221: ["ARRAY", "Array-Entered Formula", xlsrecord.Array],
     0x0223: ["EXTERNNAME", "Externally Referenced Name"],
-    0x0225: ["DEFAULTROWHEIGHT", "Default Row Height"],
+    0x0225: ["DEFAULTROWHEIGHT", "Default Row Height", xlsrecord.DefRowHeight],
     0x0231: ["FONT", "Font Description", xlsrecord.Font],
     0x0236: ["TABLE", "Data Table"],
     0x023E: ["WINDOW2", "Sheet Window Information"],


More information about the ooo-build-commit mailing list