Kaydet (Commit) cd66b523 authored tarafından Vasily Melenchuk's avatar Vasily Melenchuk Kaydeden (comit) Andras Timar

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.

Reviewed-on: https://gerrit.libreoffice.org/63785
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Reviewed-on: https://gerrit.libreoffice.org/64265Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit 78457f7462aa3bf92839667a550451f0d434f48b)
Reviewed-on: https://gerrit.libreoffice.org/64303Reviewed-by: 's avatarVasily Melenchuk <vasily.melenchuk@cib.de>
(cherry picked from commit 52c088c4)

Change-Id: Ib0b9e98a5588159c5c7de1e2e5d2bdcbfe986d8d
üst 5ce47ed1
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <attrib.hxx> #include <attrib.hxx>
#include <globstr.hrc> #include <globstr.hrc>
#include <global.hxx> #include <global.hxx>
#include <dpobject.hxx>
#include <svx/svdoole2.hxx> #include <svx/svdoole2.hxx>
#include <svx/svdpage.hxx> #include <svx/svdpage.hxx>
...@@ -211,6 +212,7 @@ public: ...@@ -211,6 +212,7 @@ public:
void testTdf118990(); void testTdf118990();
void testKeepSettingsOfBlankRows(); void testKeepSettingsOfBlankRows();
void testTdf121612();
CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test); CPPUNIT_TEST(test);
...@@ -321,6 +323,7 @@ public: ...@@ -321,6 +323,7 @@ public:
CPPUNIT_TEST(testOpenDocumentAsReadOnly); CPPUNIT_TEST(testOpenDocumentAsReadOnly);
CPPUNIT_TEST(testTdf118990); CPPUNIT_TEST(testTdf118990);
CPPUNIT_TEST(testKeepSettingsOfBlankRows); CPPUNIT_TEST(testKeepSettingsOfBlankRows);
CPPUNIT_TEST(testTdf121612);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -4102,6 +4105,23 @@ void ScExportTest::testKeepSettingsOfBlankRows() ...@@ -4102,6 +4105,23 @@ void ScExportTest::testKeepSettingsOfBlankRows()
assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2);
} }
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_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -419,15 +419,22 @@ XclExpXmlPivotTableManager::XclExpXmlPivotTableManager( const XclExpRoot& rRoot ...@@ -419,15 +419,22 @@ XclExpXmlPivotTableManager::XclExpXmlPivotTableManager( const XclExpRoot& rRoot
void XclExpXmlPivotTableManager::Initialize() void XclExpXmlPivotTableManager::Initialize()
{ {
const ScDocument& rDoc = GetDoc(); ScDocument& rDoc = GetDoc();
if (!rDoc.HasPivotTable()) if (!rDoc.HasPivotTable())
// No pivot table to export. // No pivot table to export.
return; return;
const ScDPCollection* pDPColl = rDoc.GetDPCollection(); ScDPCollection* pDPColl = rDoc.GetDPCollection();
if (!pDPColl) if (!pDPColl)
return; 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. // Go through the caches first.
std::vector<XclExpXmlPivotCaches::Entry> aCaches; std::vector<XclExpXmlPivotCaches::Entry> aCaches;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment