Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hey folkzz,

can some1 please review attached patch that fixes the following bug: 
https://bugs.freedesktop.org/show_bug.cgi?id=38154 ? If spreadsheet file 
contains split/frozen window,  LibO exports invalid xls, causing Excel to pop-
up an error and open the file in protected (read-only) mode, which sucks.

It's some fallout from increasing Calc's row limit above 65k lines ( 
interesting commits: 2e404645, 252d25a1, 26d84b51 ), where the internal 
variable holding row no. became 32-bit instead of 16-bit integer. However, all 
32-bit ints must be converted back to 16-bit ones on binary export. In this 
particular scenario (doc with split/frozen window) Y coordinate of the split 
was still exported as 32bit, which was obviously wrong.

Note that just the 1st hunk is sufficient for fixing the binary export, the 
rest is there for the sake of consistency and unified handling of variables 
holding the row number on import & export.

Thanks

B.
-- 
  \\\\\              Katarina Machalkova    
  \\\\\\\__o          LibO developer
__\\\\\\\'/_          & hedgehog painter
From eb82695e19d8f25b41c9b00f791e105176f7a151 Mon Sep 17 00:00:00 2001
From: Katarina Machalkova <kmachalkova@suse.cz>
Date: Mon, 13 Jun 2011 13:53:02 +0200
Subject: [PATCH] fdo#38154: convert split win Y coord to 16bit int before xls export

Excel then won't complain about invalid xls file
(this is some fallout from increasing Calc row limit above 65k lines)
---
 sc/source/filter/excel/xeview.cxx |    4 ++--
 sc/source/filter/excel/xiview.cxx |    7 ++++---
 sc/source/filter/inc/xlview.hxx   |    2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx
index 8d54c15..9b21c2b 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -207,7 +207,7 @@ void XclExpPane::SaveXml( XclExpXmlStream& rStrm )
 void XclExpPane::WriteBody( XclExpStream& rStrm )
 {
     rStrm   << mnSplitX
-            << mnSplitY
+            << static_cast<sal_uInt16>( mnSplitY )
             << maSecondXclPos
             << mnActivePane;
     if( rStrm.GetRoot().GetBiff() >= EXC_BIFF5 )
@@ -369,7 +369,7 @@ XclExpTabViewSettings::XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nSc
         {
             // split window: position is in twips
             maData.mnSplitX = ulimit_cast< sal_uInt16 >( rTabSett.maSplitPos.X() );
-            maData.mnSplitY = ulimit_cast< sal_uInt16 >( rTabSett.maSplitPos.Y() );
+            maData.mnSplitY = ulimit_cast< sal_uInt32 >( rTabSett.maSplitPos.Y() );
         }
 
         // selection
diff --git a/sc/source/filter/excel/xiview.cxx b/sc/source/filter/excel/xiview.cxx
index 48b72b5..bd849fc 100644
--- a/sc/source/filter/excel/xiview.cxx
+++ b/sc/source/filter/excel/xiview.cxx
@@ -198,9 +198,10 @@ void XclImpTabViewSettings::ReadScl( XclImpStream& rStrm )
 
 void XclImpTabViewSettings::ReadPane( XclImpStream& rStrm )
 {
-    rStrm   >> maData.mnSplitX
-            >> maData.mnSplitY
-            >> maData.maSecondXclPos
+    rStrm   >> maData.mnSplitX;
+    maData.mnSplitY = rStrm.ReaduInt16();
+
+    rStrm   >> maData.maSecondXclPos
             >> maData.mnActivePane;
 }
 
diff --git a/sc/source/filter/inc/xlview.hxx b/sc/source/filter/inc/xlview.hxx
index ff524b8..b3dff0a 100644
--- a/sc/source/filter/inc/xlview.hxx
+++ b/sc/source/filter/inc/xlview.hxx
@@ -137,7 +137,7 @@ struct XclTabViewData
     XclAddress          maFirstXclPos;      /// First visible cell.
     XclAddress          maSecondXclPos;     /// First visible cell in additional panes.
     sal_uInt16          mnSplitX;           /// Split X position, or number of frozen columns.
-    sal_uInt16          mnSplitY;           /// Split Y position, or number of frozen rows.
+    sal_uInt32          mnSplitY;           /// Split Y position, or number of frozen rows.
     sal_uInt16          mnNormalZoom;       /// Zoom factor for normal view.
     sal_uInt16          mnPageZoom;         /// Zoom factor for pagebreak preview.
     sal_uInt16          mnCurrentZoom;      /// Zoom factor for current view.
-- 
1.7.3.4

Attachment: signature.asc
Description: This is a digitally signed message part.


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.