[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/qa sc/source

2019-07-27 Thread Serge Krot (via logerrit)
 sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py |  191 ++
 sc/source/ui/inc/checklistmenu.hxx|7 
 sc/source/ui/inc/gridwin.hxx  |4 
 sc/source/ui/view/gridwin.cxx |   17 +
 4 files changed, 218 insertions(+), 1 deletion(-)

New commits:
commit 27671492ade3eeabefdb57a75e7d16f7cbab22d7
Author: Serge Krot 
AuthorDate: Tue Mar 5 17:03:31 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Sun Jul 28 00:26:37 2019 +0200

tdf#117276 sc: autofilter was unexpected reset with OK pressed

Change-Id: I53331434bb4d5e2f13e9f2ab5b768e9880aecca8
Reviewed-on: https://gerrit.libreoffice.org/68765
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

tdf#126306: ignore Top10, Empty and NonEmpty in fix for tdf#117276

Regression from 4e7e3670c31329d60f5cc782abc4568c2aba33a7

Change-Id: I034f4f087580aa7c54b92909736af712047251a6
Reviewed-on: https://gerrit.libreoffice.org/75304
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
Reviewed-on: https://gerrit.libreoffice.org/76350
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py 
b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
new file mode 100644
index ..6d01a4b1fd61
--- /dev/null
+++ b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py
@@ -0,0 +1,191 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_sheet_from_doc
+from uitest.debug import sleep
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_row
+from uitest.path import get_srcdir_url
+
+
+def get_url_for_data_file(file_name):
+return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name
+
+def is_row_hidden(doc, index):
+row = get_row(doc, index)
+val = row.getPropertyValue("IsVisible")
+return not val
+
+#Bug 117276 - Autofilter settings being reset in some cases
+
+class tdf117276_autofilter_reset(UITestCase):
+def get_values_count_in_AutoFilter(self, xGridWindow, columnIndex, 
buttonName = "cancel"):
+# open filter pop-up window
+self.assertIsNotNone(xGridWindow)
+xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": columnIndex, "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+self.assertIsNotNone(xFloatWindow)
+
+# get check list
+xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+self.assertIsNotNone(xCheckListMenu)
+
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertIsNotNone(xTreeList)
+
+valuesCount = len(xTreeList.getChildren())
+
+# close pop-up window
+xButton = xFloatWindow.getChild(buttonName)
+self.assertIsNotNone(xButton)
+xButton.executeAction("CLICK", tuple())
+
+return valuesCount
+
+def openAutoFilterAndCloseIt(self, xGridWindow, columnIndex, buttonName):
+self.get_values_count_in_AutoFilter(xGridWindow, columnIndex, 
buttonName)
+
+def check_state(self, document, xGridWindow):
+self.assertFalse(is_row_hidden(document, 0))  # column headers
+self.assertTrue(is_row_hidden(document, 1))
+self.assertTrue(is_row_hidden(document, 2))
+self.assertTrue(is_row_hidden(document, 3))
+self.assertTrue(is_row_hidden(document, 4))
+self.assertFalse(is_row_hidden(document, 5))
+
+self.assertEqual(1, self.get_values_count_in_AutoFilter(xGridWindow, 
"0"))
+self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, 
"1"))
+
+def test_run(self):
+self.ui_test.create_doc_in_start_center("calc")
+document = self.ui_test.get_component()
+calcDoc = self.xUITest.getTopFocusWindow()
+xGridWindow = calcDoc.getChild("grid_window")
+
+#self.ui_test.execute_dialog_through_command(".uno:Insert")  # insert 
sheet
+#xDialog = self.xUITest.getTopFocusWindow()
+#xOKButton = xDialog.getChild("ok")
+#xOKButton.executeAction("CLICK", tuple())
+
+# 1. prepare document
+#|A   | B  |
+#  -
+#  1 | HEADER-A   | HEADER-B   |
+#  -
+#  2 | Unique a2  | common value for B2:B4 |
+#  3 | Unique a3  | common value for B2:B4 |
+#  4 | Unique a4  | common value for B2:B4 |
+#  5 | Unique a5  | Unique b5   

[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/qa sc/source

2019-05-04 Thread Vasily Melenchuk (via logerrit)
 sc/qa/unit/copy_paste_test.cxx |   65 +
 sc/source/core/data/table7.cxx |   10 ++
 2 files changed, 75 insertions(+)

New commits:
commit 5b32ac3e953d4ed92d4bec1a6ffbbee5b8af4f94
Author: Vasily Melenchuk 
AuthorDate: Fri May 3 00:09:37 2019 +0300
Commit: Thorsten Behrens 
CommitDate: Sat May 4 13:59:01 2019 +0200

tdf#124565: calc: copy/paste manual row height

Row height being pasted is not sufficient without knowing
if it is auto height or was set manually.

Change-Id: I3c892fbe3ea5a54e7468fb23b993fa19370f85af
Reviewed-on: https://gerrit.libreoffice.org/71706
Tested-by: Jenkins
Reviewed-by: Eike Rathke 
Reviewed-on: https://gerrit.libreoffice.org/71788
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index f222f8fd3e34..c8f75f15b975 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -32,10 +32,12 @@ public:
 
 void testCopyPasteXLS();
 void testTdf84411();
+void testTdf124565();
 
 CPPUNIT_TEST_SUITE(ScCopyPasteTest);
 CPPUNIT_TEST(testCopyPasteXLS);
 CPPUNIT_TEST(testTdf84411);
+CPPUNIT_TEST(testTdf124565);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -225,6 +227,69 @@ void ScCopyPasteTest::testTdf84411()
 xComponent->dispose();
 }
 
+void ScCopyPasteTest::testTdf124565()
+{
+// Create new document
+ScDocShell* xDocSh = new ScDocShell(
+SfxModelFlags::EMBEDDED_OBJECT |
+SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS |
+SfxModelFlags::DISABLE_DOCUMENT_RECOVERY);
+xDocSh->DoInitNew();
+
+uno::Reference< frame::XDesktop2 > xDesktop = 
frame::Desktop::create(::comphelper::getProcessComponentContext());
+CPPUNIT_ASSERT( xDesktop.is() );
+
+Reference< frame::XFrame > xTargetFrame = xDesktop->findFrame( "_blank", 0 
);
+CPPUNIT_ASSERT( xTargetFrame.is() );
+
+uno::Reference< frame::XModel2 > xModel2 ( xDocSh->GetModel(), UNO_QUERY );
+CPPUNIT_ASSERT( xModel2.is() );
+
+Reference< frame::XController2 > xController ( 
xModel2->createDefaultViewController( xTargetFrame ), UNO_QUERY );
+CPPUNIT_ASSERT( xController.is() );
+
+// introduce model/view/controller to each other
+xController->attachModel( xModel2.get() );
+xModel2->connectController( xController.get() );
+xTargetFrame->setComponent( xController->getComponentWindow(), 
xController.get() );
+xController->attachFrame( xTargetFrame );
+xModel2->setCurrentController( xController.get() );
+
+ScDocument& rDoc = xDocSh->GetDocument();
+ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false);
+CPPUNIT_ASSERT(pViewShell != nullptr);
+
+// Set content and height of first row
+rDoc.SetString(ScAddress(0, 0, 0), "Test");
+rDoc.SetRowHeight(0, 0, 500);
+rDoc.SetManualHeight(0, 0, 0, true);
+
+// Copy first row
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+ScRange aCopyRange(0, 0, 0, MAXCOL, 0, 0);
+pViewShell->GetViewData().GetMarkData().SetMarkArea(aCopyRange);
+pViewShell->GetViewData().GetView()->CopyToClip(, false, false, 
false, false);
+
+// Paste to second row
+SCTAB nTab = 0;
+SCCOL nCol = 0;
+SCROW nRow = 1;
+
+ScRange aPasteRange(nCol, nRow, nTab, MAXCOL, nRow, nTab);
+pViewShell->GetViewData().GetMarkData().SetMarkArea(aPasteRange);
+pViewShell->GetViewData().GetView()->PasteFromClip(InsertDeleteFlags::ALL, 
);
+
+// Copy-pasted?
+CPPUNIT_ASSERT_EQUAL_MESSAGE("String was not pasted!", OUString("Test"), 
rDoc.GetString(nCol, nRow, nTab));
+
+// And height same as in source?
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Row#2 height is invalid!", sal_uInt16(500), 
rDoc.GetRowHeight(nRow, nTab));
+
+CPPUNIT_ASSERT_MESSAGE("Row#2 must be manual height!", 
rDoc.IsManualRowHeight(nRow, nTab));
+
+xDocSh->DoClose();
+}
+
 ScCopyPasteTest::ScCopyPasteTest()
   : ScBootstrapFixture( "sc/qa/unit/data" )
 {
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index aab7c47cf522..633d03474d0c 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 bool ScTable::IsMerged( SCCOL nCol, SCROW nRow ) const
 {
@@ -140,8 +141,17 @@ void ScTable::CopyOneCellFromClip(
 }
 
 if (nCol1 == 0 && nCol2 == MAXCOL && mpRowHeights)
+{
 mpRowHeights->setValue(nRow1, nRow2, 
pSrcTab->GetOriginalHeight(nSrcRow));
 
+if (pRowFlags && pSrcTab->pRowFlags) {
+   if (pSrcTab->pRowFlags->GetValue(nSrcRow) & CRFlags::ManualSize)
+   pRowFlags->OrValue(nRow1, CRFlags::ManualSize);
+   else
+   pRowFlags->AndValue(nRow1, ~CRFlags::ManualSize);
+}
+}
+
 // Copy graphics over too
 bool bCopyGraphics
 = (rCxt.getInsertFlag() & InsertDeleteFlags::OBJECTS) != 

[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/qa sc/source

2019-02-15 Thread Libreoffice Gerrit user
 sc/qa/unit/data/ods/tdf121040.ods  |binary
 sc/qa/unit/subsequent_filters-test.cxx |   18 ++
 sc/source/core/data/column2.cxx|   16 +---
 sc/source/ui/view/output2.cxx  |6 --
 4 files changed, 35 insertions(+), 5 deletions(-)

New commits:
commit c4f0a9dbe4aa4d3f418971b62b82620fe5e203d4
Author: Serge Krot 
AuthorDate: Wed Feb 6 20:02:02 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Feb 15 15:44:44 2019 +0100

tdf#121040 sc: cell with ### has too big height

Make the same behavior as inside MSO - numbers with any
different number format should not be broken on two or more lines
regardless "wrap text automatically" option.

Change-Id: I135ecef1ad01171dd22828100309311bd8eea6ce
Reviewed-on: https://gerrit.libreoffice.org/67470
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/67729
Tested-by: Thorsten Behrens 

diff --git a/sc/qa/unit/data/ods/tdf121040.ods 
b/sc/qa/unit/data/ods/tdf121040.ods
new file mode 100644
index ..ef25565a7ea8
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf121040.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx 
b/sc/qa/unit/subsequent_filters-test.cxx
index 326dc0608f29..83a803f71374 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -194,6 +194,7 @@ public:
 void testMiscRowHeights();
 void testOptimalHeightReset();
 void testCustomNumFormatHybridCellODS();
+void testTdf121040();
 
 void testPrintRangeODS();
 void testOutlineODS();
@@ -329,6 +330,7 @@ public:
 CPPUNIT_TEST(testMiscRowHeights);
 CPPUNIT_TEST(testOptimalHeightReset);
 CPPUNIT_TEST(testCustomNumFormatHybridCellODS);
+CPPUNIT_TEST(testTdf121040);
 CPPUNIT_TEST(testPrintRangeODS);
 CPPUNIT_TEST(testOutlineODS);
 CPPUNIT_TEST(testColumnStyleXLSX);
@@ -2748,6 +2750,22 @@ void ScFiltersTest::testCustomNumFormatHybridCellODS()
 xDocSh->DoClose();
 }
 
+void ScFiltersTest::testTdf121040()
+{
+ScDocShellRef xDocSh = loadDoc("tdf121040.", FORMAT_ODS);
+CPPUNIT_ASSERT_MESSAGE("Failed to load tdf121040.ods", xDocSh.is());
+
+const SCTAB nTab = 0;
+ScDocument& rDoc = xDocSh->GetDocument();
+
+// The first 9 rows should have the same height
+const sal_uInt16 nHeight = rDoc.GetRowHeight(0, nTab, false);
+for (SCTAB nRow=1; nRow<9; nRow++)
+{
+CPPUNIT_ASSERT_EQUAL(nHeight, rDoc.GetRowHeight(nRow, nTab, false));
+}
+}
+
 void ScFiltersTest::testPrintRangeODS()
 {
 ScDocShellRef xDocSh = loadDoc("print-range.", FORMAT_ODS);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 89ac4e47fe53..c7883862674f 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -159,8 +159,18 @@ long ScColumn::GetNeededSize(
 
 SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
 sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
-// #i111387# disable automatic line breaks only for "General" number format
-if (bBreak && ( nFormat % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
+
+// get "cell is value" flag
+// Must be synchronized with ScOutputData::LayoutStrings()
+bool bCellIsValue = (aCell.meType == CELLTYPE_VALUE);
+if (aCell.meType == CELLTYPE_FORMULA)
+{
+ScFormulaCell* pFCell = aCell.mpFormula;
+bCellIsValue = pFCell->IsRunning() || pFCell->IsValue();
+}
+
+// #i111387#, tdf#121040: disable automatic line breaks for all number 
formats
+if (bBreak && bCellIsValue && (pFormatter->GetType(nFormat) == 
SvNumFormatType::NUMBER))
 {
 // If a formula cell needs to be interpreted during aCell.hasNumeric()
 // to determine the type, the pattern may get invalidated because the
@@ -182,7 +192,7 @@ long ScColumn::GetNeededSize(
 else
 {
 nFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
-if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
+if (pFormatter->GetType(nFormat) == SvNumFormatType::NUMBER)
 bBreak = false;
 }
 }
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 3dfaaa9889f9..3f1f463b5d6b 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1716,8 +1716,10 @@ tools::Rectangle ScOutputData::LayoutStrings(bool 
bPixelToLogic, bool bPaint, co
 *pPattern, pCondSet, mpDoc, nTab, 
bNumberFormatIsText );
 
 bool bBreak = ( aVars.GetLineBreak() || aVars.GetHorJust() 
== SvxCellHorJustify::Block );
-// #i111387# #o11817313# disable automatic line breaks 
only for "General" number format
-if (bBreak && bCellIsValue && 
(aVars.GetResultValueFormat() % SV_COUNTRY_LANGUAGE_OFFSET) == 0)
+

[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/qa sc/source

2019-02-04 Thread Libreoffice Gerrit user
 sc/qa/uitest/autofilter/data/tdf122260.ods |binary
 sc/qa/uitest/autofilter/tdf117276.py   |2 
 sc/qa/uitest/autofilter/tdf122260.py   |  102 +
 sc/source/ui/view/gridwin.cxx  |1 
 4 files changed, 104 insertions(+), 1 deletion(-)

New commits:
commit 1c7c92116b55f25c4f7e43e7775745d91aa50da9
Author: Serge Krot 
AuthorDate: Mon Jan 28 11:02:37 2019 +0100
Commit: Thorsten Behrens 
CommitDate: Mon Feb 4 10:51:00 2019 +0100

tdf#122260 sc: Autofilters not properly cleared

Change-Id: I301b9ae8640e93b1ecf9e6818c9792ce45993cba
Reviewed-on: https://gerrit.libreoffice.org/67001
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
(cherry picked from commit fb3c3216ba1a6fc978176eebcef0cab4599a39e7)
Reviewed-on: https://gerrit.libreoffice.org/67347
Tested-by: Thorsten Behrens 

diff --git a/sc/qa/uitest/autofilter/data/tdf122260.ods 
b/sc/qa/uitest/autofilter/data/tdf122260.ods
new file mode 100644
index ..00c86d00a398
Binary files /dev/null and b/sc/qa/uitest/autofilter/data/tdf122260.ods differ
diff --git a/sc/qa/uitest/autofilter/tdf117276.py 
b/sc/qa/uitest/autofilter/tdf117276.py
index c5129e145b9b..acd7d11899b5 100644
--- a/sc/qa/uitest/autofilter/tdf117276.py
+++ b/sc/qa/uitest/autofilter/tdf117276.py
@@ -101,7 +101,7 @@ class tdf117276(UITestCase):
 xCheckListMenu = xFloatWindow.getChild("check_list_menu")
 xTreeList = xCheckListMenu.getChild("check_list_box")
 
-x8000Entry = xTreeList.getChild("0")
+x8000Entry = xTreeList.getChild("1") # check "8000"
 x8000Entry.executeAction("CLICK", tuple())
 
 xOkBtn = xFloatWindow.getChild("ok")
diff --git a/sc/qa/uitest/autofilter/tdf122260.py 
b/sc/qa/uitest/autofilter/tdf122260.py
new file mode 100644
index ..7d9df8564ab7
--- /dev/null
+++ b/sc/qa/uitest/autofilter/tdf122260.py
@@ -0,0 +1,102 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_sheet_from_doc
+from libreoffice.calc.conditional_format import 
get_conditional_format_from_sheet
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_row
+
+
+from uitest.path import get_srcdir_url
+def get_url_for_data_file(file_name):
+return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name
+
+def is_row_hidden(doc, index):
+row = get_row(doc, index)
+val = row.getPropertyValue("IsVisible")
+return not val
+
+#Bug 122260 - EDITING Autofilters not properly cleared
+class tdf122260(UITestCase):
+def check_value_in_AutoFilter(self, gridwin, columnIndex, valueIndex):
+# open filter pop-up window
+self.assertIsNotNone(gridwin)
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", 
"COL": columnIndex, "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+self.assertIsNotNone(xFloatWindow)
+
+# get check list
+xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+self.assertIsNotNone(xCheckListMenu)
+
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertIsNotNone(xTreeList)
+
+# on/off required checkbox
+xEntry = xTreeList.getChild(valueIndex)
+self.assertIsNotNone(xEntry)
+xEntry.executeAction("CLICK", tuple())
+
+# close pop-up window
+xOkBtn = xFloatWindow.getChild("ok")
+self.assertIsNotNone(xOkBtn)
+xOkBtn.executeAction("CLICK", tuple())
+
+def get_values_count_in_AutoFilter(self, gridwin, columnIndex):
+# open filter pop-up window
+self.assertIsNotNone(gridwin)
+gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", 
"COL": columnIndex, "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+self.assertIsNotNone(xFloatWindow)
+
+# get check list
+xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+self.assertIsNotNone(xCheckListMenu)
+
+xTreeList = xCheckListMenu.getChild("check_list_box")
+self.assertIsNotNone(xTreeList)
+
+valuesCount = len(xTreeList.getChildren())
+
+# close pop-up window
+xOkBtn = xFloatWindow.getChild("ok")
+self.assertIsNotNone(xOkBtn)
+xOkBtn.executeAction("CLICK", tuple())
+
+return valuesCount
+
+def test_tdf122260_autofilter(self):
+calc_doc = 

[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - sc/qa sc/source

2018-11-29 Thread Libreoffice Gerrit user
 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 78457f7462aa3bf92839667a550451f0d434f48b
Author: Vasily Melenchuk 
AuthorDate: Thu Nov 22 11:30:29 2018 +0300
Commit: Thorsten Behrens 
CommitDate: Thu Nov 29 23:10:15 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 
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/64265
Tested-by: Thorsten Behrens 

diff --git a/sc/qa/unit/data/ods/tdf121612.ods 
b/sc/qa/unit/data/ods/tdf121612.ods
new file mode 100644
index ..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 36f62373e7e0..2fb53a18ac3c 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -43,6 +43,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -209,6 +210,7 @@ public:
 void testKeepSettingsOfBlankRows();
 
 void testTdf118990();
+void testTdf121612();
 
 CPPUNIT_TEST_SUITE(ScExportTest);
 CPPUNIT_TEST(test);
@@ -319,6 +321,7 @@ public:
 CPPUNIT_TEST(testKeepSettingsOfBlankRows);
 
 CPPUNIT_TEST(testTdf118990);
+CPPUNIT_TEST(testTdf121612);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -4068,6 +4071,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 004f9938a72a..0f432793ec5a 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -419,15 +419,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 aCaches;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits