[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Apr 8 09:47:17 PDT 2011


 sc/source/filter/excel/xipivot.cxx |   13 ++++++++++++-
 sc/source/filter/inc/xipivot.hxx   |    1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit ae279b6976a212dea9fcd7598bcb8bf1d303e6d8
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Apr 8 12:03:30 2011 -0400

    Update the source range with data in the pivot cache.
    
    Pivot table's source range is stored in DCONREF record; however,
    sometimes the real data range is larger than what DCONREF says, in
    which case the real data size is specified in the pivot cache stream.
    We need to properly resize the source range in such scenarios.

diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 1bd6239..29ccb46 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -852,6 +852,12 @@ void XclImpPivotCache::ReadPivotCacheStream( XclImpStream& rStrm )
     DBG_ASSERT( maPCInfo.mnTotalFields == maFields.size(),
         "XclImpPivotCache::ReadPivotCacheStream - field count mismatch" );
 
+    if (HasCacheRecords())
+    {
+        SCROW nNewEnd = maSrcRange.aStart.Row() + maPCInfo.mnSrcRecs;
+        maSrcRange.aEnd.SetRow(nNewEnd);
+    }
+
     // set source range for external source data
     if( bGenerateSource && (nFieldScCol > 0) )
     {
@@ -864,9 +870,14 @@ void XclImpPivotCache::ReadPivotCacheStream( XclImpStream& rStrm )
     }
 }
 
+bool XclImpPivotCache::HasCacheRecords() const
+{
+    return static_cast<bool>(maPCInfo.mnFlags & EXC_SXDB_SAVEDATA);
+}
+
 bool XclImpPivotCache::IsRefreshOnLoad() const
 {
-    return static_cast<bool>(maPCInfo.mnFlags & 0x0004);
+    return static_cast<bool>(maPCInfo.mnFlags & EXC_SXDB_REFRESH_LOAD);
 }
 
 bool XclImpPivotCache::IsValid() const
diff --git a/sc/source/filter/inc/xipivot.hxx b/sc/source/filter/inc/xipivot.hxx
index 54992db..8257290 100644
--- a/sc/source/filter/inc/xipivot.hxx
+++ b/sc/source/filter/inc/xipivot.hxx
@@ -190,6 +190,7 @@ public:
     /** Reads the entire pivot cache stream. Uses decrypter from passed stream. */
     void                ReadPivotCacheStream( XclImpStream& rStrm );
 
+    bool                HasCacheRecords() const;
     bool                IsRefreshOnLoad() const;
     bool                IsValid() const;
 


More information about the Libreoffice-commits mailing list