[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - sc/qa sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 30 14:26:49 UTC 2018


 sc/qa/unit/data/ods/tdf121612.ods     |binary
 sc/qa/unit/subsequent_export-test.cxx |   20 ++++++++++++++++++++
 sc/source/filter/excel/xepivotxml.cxx |   11 +++++++++--
 3 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit f8c76ab81bb5b443c5077c2cac9112f8e0ee6855
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Thu Nov 22 11:30:29 2018 +0300
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Nov 30 15:26:20 2018 +0100

    tdf#121612: update pivot caches during saving to XLSX
    
    Cache was empty so pivot table was not exported completely
    and pivot table filter were missing.
    
    Change-Id: Ib0b9e98a5588159c5c7de1e2e5d2bdcbfe986d8d
    Reviewed-on: https://gerrit.libreoffice.org/63785
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 6481bda69ade61cb5420156272fcf17edd43d620)
    Reviewed-on: https://gerrit.libreoffice.org/64317

diff --git a/sc/qa/unit/data/ods/tdf121612.ods b/sc/qa/unit/data/ods/tdf121612.ods
new file mode 100644
index 000000000000..6afc4e0c931c
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf121612.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 2472b3f9d55f..e5e6f5c98bc1 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -45,6 +45,7 @@
 #include <attrib.hxx>
 #include <global.hxx>
 #include <scmod.hxx>
+#include <dpobject.hxx>
 
 #include <svx/svdoole2.hxx>
 #include <svx/svdpage.hxx>
@@ -216,6 +217,7 @@ public:
     void testKeepSettingsOfBlankRows();
 
     void testTdf118990();
+    void testTdf121612();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -329,6 +331,7 @@ public:
     CPPUNIT_TEST(testKeepSettingsOfBlankRows);
 
     CPPUNIT_TEST(testTdf118990);
+    CPPUNIT_TEST(testTdf121612);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -4179,6 +4182,23 @@ void ScExportTest::testTdf118990()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testTdf121612()
+{
+    ScDocShellRef xDocSh = loadDoc("tdf121612.", FORMAT_ODS);
+    CPPUNIT_ASSERT(xDocSh.is());
+    xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX);
+
+    ScDocument& rDoc = xDocSh->GetDocument();
+
+    // There should be a pivot table
+    CPPUNIT_ASSERT(rDoc.HasPivotTable());
+
+    // DP collection is not lost after export and has one entry
+    ScDPCollection* pDPColl = rDoc.GetDPCollection();
+    CPPUNIT_ASSERT(pDPColl);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), pDPColl->GetCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index b7e790eca6da..271b4cb8fdf4 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -418,15 +418,22 @@ XclExpXmlPivotTableManager::XclExpXmlPivotTableManager( const XclExpRoot& rRoot
 
 void XclExpXmlPivotTableManager::Initialize()
 {
-    const ScDocument& rDoc = GetDoc();
+    ScDocument& rDoc = GetDoc();
     if (!rDoc.HasPivotTable())
         // No pivot table to export.
         return;
 
-    const ScDPCollection* pDPColl = rDoc.GetDPCollection();
+    ScDPCollection* pDPColl = rDoc.GetDPCollection();
     if (!pDPColl)
         return;
 
+    // Update caches from DPObject
+    for (size_t i = 0; i < pDPColl->GetCount(); ++i)
+    {
+        ScDPObject& rDPObj = (*pDPColl)[i];
+        rDPObj.SyncAllDimensionMembers();
+    }
+
     // Go through the caches first.
 
     std::vector<XclExpXmlPivotCaches::Entry> aCaches;


More information about the Libreoffice-commits mailing list