[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf41425.xlsx|binary sc/qa/unit/subsequent_export-test.cxx | 15 +++ sc/source/filter/excel/xetable.cxx|3 +++ 3 files changed, 18 insertions(+) New commits: commit f9df3478ace3fb3ea25d24c7bc8b6b72cd7f1729 Author: László Németh AuthorDate: Fri Aug 3 16:11:16 2018 +0200 Commit: Andras Timar CommitDate: Mon Sep 17 18:36:39 2018 +0200 tdf#41425 XLS/XLSX export: workaround for style and validation loss of cells of blank rows. This workaround is probably a fix for problems of most users, but for a full solution it needs to extend the workaround for all rows with not default settings, also avoiding of the possible performance problems. Note: the number 1000 of the extra rows came from a similar workaround used in XLSX export of Google Spreadsheets, but instead of listing extra empty 1000 rows in OOXML, this fix writes only the cells with not default settings from the extra 1000 blank rows. Reviewed-on: https://gerrit.libreoffice.org/58575 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 99b9ea63bfc9a5fe63a0cd7b30b66ce2c1bde08e) Reviewed-on: https://gerrit.libreoffice.org/58812 Reviewed-by: Christian Lohmaier (cherry picked from commit d7cbaac61b8f3575184c675a760907c3b4bb225e) Change-Id: Icac9441b7eb1520dcd20fc04337e070d070591c7 diff --git a/sc/qa/unit/data/xlsx/tdf41425.xlsx b/sc/qa/unit/data/xlsx/tdf41425.xlsx new file mode 100644 index ..f7d3ec9ed6ec Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf41425.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 793b239d510d..36b3e9c8fd15 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -220,6 +220,7 @@ public: void testPivotTableOutlineModeXLSX(); void testPivotTableDuplicatedMemberFilterXLSX(); void testPivotTableTabularModeXLSX(); +void testKeepSettingsOfBlankRows(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -339,6 +340,7 @@ public: CPPUNIT_TEST(testPivotTableOutlineModeXLSX); CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX); CPPUNIT_TEST(testPivotTableTabularModeXLSX); +CPPUNIT_TEST(testKeepSettingsOfBlankRows); CPPUNIT_TEST_SUITE_END(); @@ -5262,6 +5264,19 @@ void ScExportTest::testPivotTableTabularModeXLSX() assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "outline", "0"); } +void ScExportTest::testKeepSettingsOfBlankRows() +{ +ScDocShellRef xDocSh = loadDoc("tdf41425.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +// saved blank row with not default setting in A2 +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 29257f2df5ed..12e5afc0b5a7 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2463,6 +2463,9 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : if(nLastUsedScCol > nMaxScCol) nLastUsedScCol = nMaxScCol; +// check extra blank rows to avoid of losing their not default settings (workaround for tdf#41425) +nLastUsedScRow += 1000; + if(nLastUsedScRow > nMaxScRow) nLastUsedScRow = nMaxScRow; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 43 +++ sc/source/ui/app/scmod.cxx | 32 +++- sc/source/ui/formdlg/formula.cxx |6 +-- sc/source/ui/inc/anyrefdg.hxx|4 +- sc/source/ui/miscdlgs/anyrefdg.cxx | 32 5 files changed, 73 insertions(+), 44 deletions(-) New commits: commit ea7fba0ff338098dea5292557c418b7d8c8a100b Author: Henry CastroDate: Thu Mar 15 14:23:48 2018 -0400 lokdialog: do not lock events when opened ScFilter Dialog When exists 2 or more views and one of the views open the ScFilter dialog, the other views are locked and no event process. In tiled rendering case, collaborative editing is not functional with 2 or more views are locked, so the patch prevents locking the other views Change-Id: I0133d38ac5ecef4d3ebc22f3e922602704dcd0b3 Reviewed-on: https://gerrit.libreoffice.org/51370 Tested-by: Jenkins Reviewed-by: Henry Castro Reviewed-on: https://gerrit.libreoffice.org/51437 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 2bb0c660ff69..bcd687a77599 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -30,9 +30,11 @@ #include #include +#include #include #include #include +#include #include #include @@ -83,6 +85,7 @@ public: void testLanguageStatus(); void testMultiViewCopyPaste(); void testIMESupport(); +void testFilterDlg(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -114,6 +117,7 @@ public: CPPUNIT_TEST(testLanguageStatus); CPPUNIT_TEST(testMultiViewCopyPaste); CPPUNIT_TEST(testIMESupport); +CPPUNIT_TEST(testFilterDlg); CPPUNIT_TEST_SUITE_END(); private: @@ -1599,6 +1603,45 @@ void ScTiledRenderingTest::testIMESupport() comphelper::LibreOfficeKit::setActive(false); } +void ScTiledRenderingTest::testFilterDlg() +{ +comphelper::LibreOfficeKit::setActive(); + +createDoc("empty.ods"); + +// view #1 +SfxViewShell* pView1 = SfxViewShell::Current(); +int nView1 = SfxLokHelper::getView(); + +// view #2 +SfxLokHelper::createView(); +SfxViewShell* pView2 = SfxViewShell::Current(); +CPPUNIT_ASSERT(pView1 != pView2); +{ +pView2->GetViewFrame()->GetDispatcher()->Execute(SID_FILTER, +SfxCallMode::SLOT|SfxCallMode::RECORD); +} + +Scheduler::ProcessEventsToIdle(); +SfxChildWindow* pRefWindow = pView2->GetViewFrame()->GetChildWindow(SID_FILTER); +CPPUNIT_ASSERT(pRefWindow); + +// switch to view 1 +SfxLokHelper::setView(nView1); +CPPUNIT_ASSERT_EQUAL(true, pView2->GetViewFrame()->GetDispatcher()->IsLocked()); +CPPUNIT_ASSERT_EQUAL(false, pView1->GetViewFrame()->GetDispatcher()->IsLocked()); + +KeyEvent aEvent(27, KEY_ESCAPE, 0); +Application::PostKeyEvent(VclEventId::WindowKeyInput, pRefWindow->GetWindow(), ); +Application::PostKeyEvent(VclEventId::WindowKeyUp, pRefWindow->GetWindow(), ); + +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT_EQUAL(false, pView2->GetViewFrame()->GetDispatcher()->IsLocked()); +CPPUNIT_ASSERT_EQUAL(false, pView1->GetViewFrame()->GetDispatcher()->IsLocked()); + +comphelper::LibreOfficeKit::setActive(false); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index bc2dcead5f30..18aa66f00456 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1554,20 +1554,25 @@ void ScModule::SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm ) } } -static SfxChildWindow* lcl_GetChildWinFromAnyView( sal_uInt16 nId ) +static inline SfxChildWindow* lcl_GetChildWinFromCurrentView( sal_uInt16 nId ) { -// First, try the current view SfxViewFrame* pViewFrm = SfxViewFrame::Current(); // #i46999# current view frame can be null (for example, when closing help) -SfxChildWindow* pChildWnd = pViewFrm ? pViewFrm->GetChildWindow( nId ) : nullptr; +return pViewFrm ? pViewFrm->GetChildWindow( nId ) : nullptr; +} + +static SfxChildWindow* lcl_GetChildWinFromAnyView( sal_uInt16 nId ) +{ +// First, try the current view +SfxChildWindow* pChildWnd = lcl_GetChildWinFromCurrentView( nId ); if ( pChildWnd ) return pChildWnd; // found in the current view // if not found there, get the child window from any open view // it can be open only in one view because nCurRefDlgId is global -pViewFrm = SfxViewFrame::GetFirst(); +SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst();
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |1 + sc/source/ui/unoobj/docuno.cxx |6 -- 2 files changed, 5 insertions(+), 2 deletions(-) New commits: commit 0178d2b7071be32ac2334e0548beae3b4e8dbc7d Author: Pranav KantDate: Fri Feb 23 02:58:59 2018 +0530 lokdialog sc: post key events to the main thread This also fixes the problem when some dialog is executed inside the key handler. Change-Id: I831ed4b886c1a5eac13dffd8e881a07045458e44 Reviewed-on: https://gerrit.libreoffice.org/50244 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 74d2d3dc5f0a..11c5179622c6 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1590,6 +1590,7 @@ void ScTiledRenderingTest::testIMESupport() // commit the string to the cell pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); +Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(aInputs[aInputs.size() - 1], pDoc->GetString(ScAddress(0, 0, 0))); diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index b6cbc5e46fac..d191d14ba9a5 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -619,14 +619,16 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode) if (!pWindow) return; +if (!pWindow->HasFocus()) +pWindow->GrabFocus(); KeyEvent aEvent(nCharCode, nKeyCode, 0); switch (nType) { case LOK_KEYEVENT_KEYINPUT: -pWindow->KeyInput(aEvent); +Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pWindow, ); break; case LOK_KEYEVENT_KEYUP: -pWindow->KeyUp(aEvent); +Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pWindow, ); break; default: assert(false); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/ods/pivottable_no_columns_layout.ods |binary sc/qa/unit/subsequent_filters-test.cxx | 30 +++ sc/source/core/data/dpoutputgeometry.cxx |2 - sc/source/filter/xml/xmldpimp.cxx|1 4 files changed, 32 insertions(+), 1 deletion(-) New commits: commit d5c7c8d8bde74e89db18212ccd48f972f1b49e3b Author: Tamás ZolnaiDate: Sat Oct 28 08:02:10 2017 +0200 tdf#113268: Pivot table: Missing popup button after opening a ODS Wrong row number was calculated here. This ++nCurRow is usefull only when headerlayout flag is set. It's a MSO compatibility flag so it's not there by default in LO created tables. Reviewed-on: https://gerrit.libreoffice.org/43552 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 291874c09c4bcde61f2c6808f2df6079f38d74e0) Change-Id: Id7989d898f2647f1ba45ed95e0aa615e3b4fa311 Reviewed-on: https://gerrit.libreoffice.org/43974 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/ods/pivottable_no_columns_layout.ods b/sc/qa/unit/data/ods/pivottable_no_columns_layout.ods new file mode 100755 index ..e6ddca7299fc Binary files /dev/null and b/sc/qa/unit/data/ods/pivottable_no_columns_layout.ods differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 2a1819b35c08..90fc2de69629 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -243,6 +243,7 @@ public: void testTdf97598XLSX(); void testTdf111974XLSM(); void testTdf112501(); +void testPivotTableNoColumnsLayout(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); @@ -363,6 +364,7 @@ public: CPPUNIT_TEST(testTdf97598XLSX); CPPUNIT_TEST(testTdf111974XLSM); CPPUNIT_TEST(testTdf112501); +CPPUNIT_TEST(testPivotTableNoColumnsLayout); CPPUNIT_TEST_SUITE_END(); @@ -3959,6 +3961,34 @@ void ScFiltersTest::testTdf112501() } } +void ScFiltersTest::testPivotTableNoColumnsLayout() +{ +// tdf#113268 - Pivot table: Missing popup button after opening a pivot table from ODS +ScDocShellRef xDocSh = loadDoc("pivottable_no_columns_layout.", FORMAT_ODS); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rDoc = xDocSh->GetDocument(); + +// There should be exactly 2 pivot tables +ScDPCollection* pDPs = rDoc.GetDPCollection(); +CPPUNIT_ASSERT_EQUAL(static_cast(2), pDPs->GetCount()); + +// Check first pivot table's popup button (headerlayout flag) +{ +const ScPatternAttr* pPattern = rDoc.GetPattern(0, 1, 1); +const SfxPoolItem& rPoolItem = pPattern->GetItem(ATTR_MERGE_FLAG); +const ScMergeFlagAttr& rMergeFlag = static_cast(rPoolItem); +CPPUNIT_ASSERT(rMergeFlag.GetValue() & ScMF::ButtonPopup); +} + +// Check second pivot table's popup button +{ +const ScPatternAttr* pPattern = rDoc.GetPattern(3, 0, 1); +const SfxPoolItem& rPoolItem = pPattern->GetItem(ATTR_MERGE_FLAG); +const ScMergeFlagAttr& rMergeFlag = static_cast(rPoolItem); +CPPUNIT_ASSERT(rMergeFlag.GetValue() & ScMF::ButtonPopup); +} +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) diff --git a/sc/source/core/data/dpoutputgeometry.cxx b/sc/source/core/data/dpoutputgeometry.cxx index 61d0633eafcd..34a4c7370416 100644 --- a/sc/source/core/data/dpoutputgeometry.cxx +++ b/sc/source/core/data/dpoutputgeometry.cxx @@ -239,7 +239,7 @@ ScDPOutputGeometry::getFieldButtonType(const ScAddress& rPos) const nCurRow += static_cast(nColumnFields); } -else +else if (mbHeaderLayout) ++nCurRow; if (nRowFields) diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx index cc39b95ce0aa..12f4f78cb842 100644 --- a/sc/source/filter/xml/xmldpimp.cxx +++ b/sc/source/filter/xml/xmldpimp.cxx @@ -345,6 +345,7 @@ void ScXMLDataPilotTableContext::SetButtons() aGeometry.setPageFieldCount(mnPageFieldCount); aGeometry.setDataFieldCount(mnDataFieldCount); aGeometry.setDataLayoutType(toFieldType(mnDataLayoutType)); +aGeometry.setHeaderLayout(bHeaderGridLayout); std::vector aRowDims, aColDims, aPageDims; pDPSave->GetAllDimensionsByOrientation(sheet::DataPilotFieldOrientation_ROW, aRowDims); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivottable_tabular_mode.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 20 +++ sc/source/filter/excel/xepivotxml.cxx | 57 -- 3 files changed, 64 insertions(+), 13 deletions(-) New commits: commit 24a673cd37ad8f63ad69904ef076ccfbdc59129d Author: Tamás ZolnaiDate: Fri Oct 27 22:03:32 2017 +0200 tdf#113159: Pivot table: tabular mode is converted to oultine mode ... after RT XLSX in Calc Reviewed-on: https://gerrit.libreoffice.org/43537 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 8cf0b4b4cd748094889a6a9ac6883dd457113b74) Change-Id: I9725ca55aed973133db1d5fe47463575148e00b8 Reviewed-on: https://gerrit.libreoffice.org/43971 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/pivottable_tabular_mode.xlsx b/sc/qa/unit/data/xlsx/pivottable_tabular_mode.xlsx new file mode 100755 index ..0bcfe1742d95 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_tabular_mode.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index dbf92510144a..4b6370ba64c8 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -216,6 +216,7 @@ public: void testPivotTableErrorItemFilterXLSX(); void testPivotTableOutlineModeXLSX(); void testPivotTableDuplicatedMemberFilterXLSX(); +void testPivotTableTabularModeXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -332,6 +333,7 @@ public: CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX); CPPUNIT_TEST(testPivotTableOutlineModeXLSX); CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX); +CPPUNIT_TEST(testPivotTableTabularModeXLSX); CPPUNIT_TEST_SUITE_END(); @@ -5191,6 +5193,24 @@ void ScExportTest::testPivotTableDuplicatedMemberFilterXLSX() assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]/x:items", "count", "21"); } +void ScExportTest::testPivotTableTabularModeXLSX() +{ +ScDocShellRef xShell = loadDoc("pivottable_tabular_mode.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pTable); + +// In tabular mode both outline and compact flag should be false +assertXPath(pTable, "/x:pivotTableDefinition", "outline", "0"); +assertXPath(pTable, "/x:pivotTableDefinition", "outlineData", "0"); +assertXPath(pTable, "/x:pivotTableDefinition", "compact", "0"); +assertXPath(pTable, "/x:pivotTableDefinition", "compactData", "0"); +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "compact", "0"); +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "outline", "0"); +} + 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 d567c8e1e87b..9c33b8277977 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -614,7 +615,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP // Dimension order here is significant as they specify the order of // appearance in each axis. const ScDPSaveData::DimsType& rDims = rSaveData.GetDimensions(); - +bool bTabularMode = false; for (const auto & i : rDims) { const ScDPSaveDimension& rDim = *i; @@ -657,6 +658,8 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP default: ; } +if(rDim.GetLayoutInfo()) +bTabularMode |= (rDim.GetLayoutInfo()->LayoutMode == sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT); } sax_fastparser::FSHelperPtr& pPivotStrm = rStrm.GetCurrentStream(); @@ -674,8 +677,8 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP XML_useAutoFormatting, XclXmlUtils::ToPsz10(false), XML_itemPrintTitles, XclXmlUtils::ToPsz10(true), XML_indent, XclXmlUtils::ToPsz10(false), -XML_outline, XclXmlUtils::ToPsz10(true), -XML_outlineData, XclXmlUtils::ToPsz10(true), +XML_outline, XclXmlUtils::ToPsz10(!bTabularMode), +XML_outlineData, XclXmlUtils::ToPsz10(!bTabularMode), XML_compact, XclXmlUtils::ToPsz10(false), XML_compactData, XclXmlUtils::ToPsz10(false), FSEND); @@ -732,26 +735,52 @@ void
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivottable_duplicated_member_filter.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 16 ++ sc/source/filter/excel/xepivotxml.cxx |6 ++- 3 files changed, 20 insertions(+), 2 deletions(-) New commits: commit d5f2f72aa58ed968e327403665e97ac3d6f97be8 Author: Tamás ZolnaiDate: Sat Oct 7 17:38:51 2017 +0200 tdf#109016: Avoid to write the same pivot item member more times It seems it's allowed to have the same member name in a pivot table. We need to handle this in the filtering code. Regression from: 625653c8d119e720fb93b0c9f6f50d1eb625b179 Reviewed-on: https://gerrit.libreoffice.org/43230 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai (cherry picked from commit fe6ea004872c86c4a2e5849c7c9e75905711d6f3) Change-Id: Ic6f4110da3d83f4bbf5284e1b772e9e31b250bf1 Reviewed-on: https://gerrit.libreoffice.org/43233 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/pivottable_duplicated_member_filter.xlsx b/sc/qa/unit/data/xlsx/pivottable_duplicated_member_filter.xlsx new file mode 100755 index ..21291a45ef96 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_duplicated_member_filter.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ac0f2960abd3..dbf92510144a 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -215,6 +215,7 @@ public: void testPivotTableRowColPageFieldFilterXLSX(); void testPivotTableErrorItemFilterXLSX(); void testPivotTableOutlineModeXLSX(); +void testPivotTableDuplicatedMemberFilterXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -330,6 +331,7 @@ public: CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX); CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX); CPPUNIT_TEST(testPivotTableOutlineModeXLSX); +CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX); CPPUNIT_TEST_SUITE_END(); @@ -5175,6 +5177,20 @@ void ScExportTest::testPivotTableOutlineModeXLSX() assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "compact", "0"); } +void ScExportTest::testPivotTableDuplicatedMemberFilterXLSX() +{ +ScDocShellRef xShell = loadDoc("pivottable_duplicated_member_filter.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pTable); + +// Check whether page field has the right number of items +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]", "axis", "axisPage"); +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[5]/x:items", "count", "21"); +} + 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 362e629482df..d567c8e1e87b 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -784,8 +784,10 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP if (sFormattedName == rMember.maName) { size_t nCachePos = it - iCacheFieldItems_begin; -aMemberSequence.push_back(std::make_pair(nCachePos, !rMember.mbVisible)); -aUsedCachePositions.insert(nCachePos); +auto aInserted = aUsedCachePositions.insert(nCachePos); +if (aInserted.second) +aMemberSequence.push_back(std::make_pair(nCachePos, !rMember.mbVisible)); +break; } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 19 +++ sc/source/filter/excel/xepivotxml.cxx |6 ++ 3 files changed, 25 insertions(+) New commits: commit 77cc0de89ddc097adce6d6ef2f4397c2f160461a Author: Tamás ZolnaiDate: Fri Oct 6 23:03:05 2017 +0200 tdf#112946: Pivot table: Missing selector for a row field after RT in Calc We need to explicitly set compact flags to false, since true is the default. It seems MSO prefers compact mode, when the file contains colliding mode flags. Reviewed-on: https://gerrit.libreoffice.org/43210 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit ad439ded005cffd525ffe874f535fca7a4da1f49) Change-Id: Ib311f1cf44345be294e6c6607c227c2baa0fb693 Reviewed-on: https://gerrit.libreoffice.org/43218 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx b/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx new file mode 100755 index ..6b575c0af7b3 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_outline_mode.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index f9ac660b5321..ac0f2960abd3 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -214,6 +214,7 @@ public: void testPivotTableBoolFieldFilterXLSX(); void testPivotTableRowColPageFieldFilterXLSX(); void testPivotTableErrorItemFilterXLSX(); +void testPivotTableOutlineModeXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -328,6 +329,7 @@ public: CPPUNIT_TEST(testPivotTableBoolFieldFilterXLSX); CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX); CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX); +CPPUNIT_TEST(testPivotTableOutlineModeXLSX); CPPUNIT_TEST_SUITE_END(); @@ -5156,6 +5158,23 @@ void ScExportTest::testPivotTableErrorItemFilterXLSX() xDocSh->DoClose(); } +void ScExportTest::testPivotTableOutlineModeXLSX() +{ +ScDocShellRef xShell = loadDoc("pivottable_outline_mode.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pTable); + +// Next to the outline flags, compact flags also should be set (true is the default) +assertXPath(pTable, "/x:pivotTableDefinition", "outline", "1"); +assertXPath(pTable, "/x:pivotTableDefinition", "outlineData", "1"); +assertXPath(pTable, "/x:pivotTableDefinition", "compact", "0"); +assertXPath(pTable, "/x:pivotTableDefinition", "compactData", "0"); +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]", "compact", "0"); +} + 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 f29d312b0020..362e629482df 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -676,6 +676,8 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP XML_indent, XclXmlUtils::ToPsz10(false), XML_outline, XclXmlUtils::ToPsz10(true), XML_outlineData, XclXmlUtils::ToPsz10(true), +XML_compact, XclXmlUtils::ToPsz10(false), +XML_compactData, XclXmlUtils::ToPsz10(false), FSEND); // NB: Excel's range does not include page field area (if any). @@ -725,6 +727,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP { pPivotStrm->singleElement(XML_pivotField, XML_showAll, XclXmlUtils::ToPsz10(false), +XML_compact, XclXmlUtils::ToPsz10(false), FSEND); continue; } @@ -736,6 +739,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP { pPivotStrm->singleElement(XML_pivotField, XML_showAll, XclXmlUtils::ToPsz10(false), +XML_compact, XclXmlUtils::ToPsz10(false), FSEND); continue; } @@ -745,6 +749,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP pPivotStrm->singleElement(XML_pivotField, XML_dataField, XclXmlUtils::ToPsz10(true), XML_showAll, XclXmlUtils::ToPsz10(false), +XML_compact, XclXmlUtils::ToPsz10(false), FSEND); continue; @@ -812,6 +817,7 @@ void
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivottable_error_item_filter.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 32 + sc/source/filter/excel/xepivotxml.cxx |3 + sc/source/filter/inc/pivotcachebuffer.hxx |2 - sc/source/filter/oox/pivotcachebuffer.cxx |8 ++-- sc/source/filter/oox/pivotcachefragment.cxx|2 - 6 files changed, 40 insertions(+), 7 deletions(-) New commits: commit 06104d00f01ce68e3e78f739d7a6bea110baf31b Author: Tamás ZolnaiDate: Thu Oct 5 15:13:46 2017 +0200 tdf#112893: Pivot table: filtering of error item is not imported ... from XLSX Reviewed-on: https://gerrit.libreoffice.org/43166 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai (cherry picked from commit 9fa34e9f2cebe2cfc551668f2a67ddcb799d3fb8) Change-Id: Ib155852e5f0718f41e02596d1042513286c6d845 Reviewed-on: https://gerrit.libreoffice.org/43216 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/pivottable_error_item_filter.xlsx b/sc/qa/unit/data/xlsx/pivottable_error_item_filter.xlsx new file mode 100755 index ..19d9b3c01b4d Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_error_item_filter.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 680bb5b3eac4..f9ac660b5321 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -213,6 +213,7 @@ public: void testPivotTableDateFieldFilterXLSX(); void testPivotTableBoolFieldFilterXLSX(); void testPivotTableRowColPageFieldFilterXLSX(); +void testPivotTableErrorItemFilterXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -326,6 +327,7 @@ public: CPPUNIT_TEST(testPivotTableDateFieldFilterXLSX); CPPUNIT_TEST(testPivotTableBoolFieldFilterXLSX); CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX); +CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX); CPPUNIT_TEST_SUITE_END(); @@ -5124,6 +5126,36 @@ void ScExportTest::testPivotTableRowColPageFieldFilterXLSX() xDocSh->DoClose(); } +void ScExportTest::testPivotTableErrorItemFilterXLSX() +{ +ScDocShellRef xDocSh = loadDoc("pivottable_error_item_filter.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rDoc = xDocSh->GetDocument(); +ScDPCollection* pDPs = rDoc.GetDPCollection(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount()); + +// Reload and check whether filtering is preserved +xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rLoadedDoc = xDocSh->GetDocument(); +pDPs = rLoadedDoc.GetDPCollection(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount()); +const ScDPObject* pDPObj = &(*pDPs)[0]; +CPPUNIT_ASSERT(pDPObj); +ScDPSaveData* pSaveData = pDPObj->GetSaveData(); +CPPUNIT_ASSERT(pSaveData); + +ScDPSaveDimension* pSaveDim = pSaveData->GetExistingDimensionByName("b"); +CPPUNIT_ASSERT(pSaveDim); +const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers(); +CPPUNIT_ASSERT_EQUAL(size_t(4), rMembers.size()); +ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("#DIV/0!"); +CPPUNIT_ASSERT(pMember); +CPPUNIT_ASSERT(pMember->HasIsVisible() && !pMember->GetIsVisible()); + +xDocSh->DoClose(); +} + 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 a7bbbe543e9b..f29d312b0020 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -292,7 +292,8 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr std::set aDPTypesWithoutBlank = aDPTypes; aDPTypesWithoutBlank.erase(ScDPItemData::Empty); -bool isContainsString = aDPTypesWithoutBlank.find(ScDPItemData::String) != aDPTypesWithoutBlank.end(); +bool isContainsString = aDPTypesWithoutBlank.find(ScDPItemData::String) != aDPTypesWithoutBlank.end() || +aDPTypesWithoutBlank.find(ScDPItemData::Error) != aDPTypesWithoutBlank.end(); bool isContainsBlank = aDPTypes.find(ScDPItemData::Empty) != aDPTypeEnd; bool isContainsNumber = !isContainsDate && aDPTypesWithoutBlank.find(ScDPItemData::Value) != aDPTypesWithoutBlank.end(); bool isContainsNonDate = !(isContainsDate && aDPTypesWithoutBlank.size() <= 1); diff --git a/sc/source/filter/inc/pivotcachebuffer.hxx b/sc/source/filter/inc/pivotcachebuffer.hxx index 0d775961abd3..38af4631f6a4 100644 ---
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivottable_bool_field_filter.xlsx |binary sc/qa/unit/data/xlsx/pivottable_date_field_filter.xlsx |binary sc/qa/unit/data/xlsx/pivottable_double_field_filter.xlsx |binary sc/qa/unit/data/xlsx/pivottable_rowcolpage_field_filter.xlsx |binary sc/qa/unit/data/xlsx/pivottable_string_field_filter.xlsx |binary sc/qa/unit/subsequent_export-test.cxx| 341 +++ sc/source/filter/excel/xepivotxml.cxx| 22 sc/source/filter/inc/pivotcachebuffer.hxx|7 sc/source/filter/oox/pivotcachebuffer.cxx| 20 sc/source/filter/oox/pivottablebuffer.cxx|8 10 files changed, 390 insertions(+), 8 deletions(-) New commits: commit e48853f7dbffd69dc7c55d4cbd200f2b7afaaed8 Author: Tamás ZolnaiDate: Fri Oct 6 22:24:17 2017 +0200 tdf#107711:Pivot table: filtering of non-string fields is not exported to XLSX Same issue what we have in case of XLS filter. We need to have the right string representation of pivot field items. Reviewed-on: https://gerrit.libreoffice.org/42956 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 625653c8d119e720fb93b0c9f6f50d1eb625b179) Change-Id: Ifb686ad268c61b03c7d66f65e6f8247eab4f Reviewed-on: https://gerrit.libreoffice.org/43053 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/pivottable_bool_field_filter.xlsx b/sc/qa/unit/data/xlsx/pivottable_bool_field_filter.xlsx new file mode 100755 index ..8fcdb1bec102 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_bool_field_filter.xlsx differ diff --git a/sc/qa/unit/data/xlsx/pivottable_date_field_filter.xlsx b/sc/qa/unit/data/xlsx/pivottable_date_field_filter.xlsx new file mode 100755 index ..316f201a5043 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_date_field_filter.xlsx differ diff --git a/sc/qa/unit/data/xlsx/pivottable_double_field_filter.xlsx b/sc/qa/unit/data/xlsx/pivottable_double_field_filter.xlsx new file mode 100755 index ..f2d3597b273c Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_double_field_filter.xlsx differ diff --git a/sc/qa/unit/data/xlsx/pivottable_rowcolpage_field_filter.xlsx b/sc/qa/unit/data/xlsx/pivottable_rowcolpage_field_filter.xlsx new file mode 100755 index ..4aaa32794519 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_rowcolpage_field_filter.xlsx differ diff --git a/sc/qa/unit/data/xlsx/pivottable_string_field_filter.xlsx b/sc/qa/unit/data/xlsx/pivottable_string_field_filter.xlsx new file mode 100755 index ..3bb6a77bcb79 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_string_field_filter.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 33c749382d36..680bb5b3eac4 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -208,6 +208,11 @@ public: void testPivotTableEmptyItem(); void testPivotTablePageFieldFilter(); void testPivotTableFirstHeaderRowXLSX(); +void testPivotTableDoubleFieldFilterXLSX(); +void testPivotTableStringFieldFilterXLSX(); +void testPivotTableDateFieldFilterXLSX(); +void testPivotTableBoolFieldFilterXLSX(); +void testPivotTableRowColPageFieldFilterXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -316,6 +321,11 @@ public: CPPUNIT_TEST(testPivotTableEmptyItem); CPPUNIT_TEST(testPivotTablePageFieldFilter); CPPUNIT_TEST(testPivotTableFirstHeaderRowXLSX); +CPPUNIT_TEST(testPivotTableDoubleFieldFilterXLSX); +CPPUNIT_TEST(testPivotTableStringFieldFilterXLSX); +CPPUNIT_TEST(testPivotTableDateFieldFilterXLSX); +CPPUNIT_TEST(testPivotTableBoolFieldFilterXLSX); +CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX); CPPUNIT_TEST_SUITE_END(); @@ -4783,6 +4793,337 @@ void ScExportTest::testPivotTableFirstHeaderRowXLSX() assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); } +void ScExportTest::testPivotTableDoubleFieldFilterXLSX() +{ +ScDocShellRef xDocSh = loadDoc("pivottable_double_field_filter.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rDoc = xDocSh->GetDocument(); +ScDPCollection* pDPs = rDoc.GetDPCollection(); +CPPUNIT_ASSERT_EQUAL(static_cast(3), pDPs->GetCount()); + +// Reload and check filtering of row dimensions +xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rLoadedDoc = xDocSh->GetDocument(); +pDPs = rLoadedDoc.GetDPCollection(); +
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivot_table_first_header_row.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 23 + sc/source/filter/excel/xepivotxml.cxx |2 - 3 files changed, 24 insertions(+), 1 deletion(-) New commits: commit 307f95db16880d2fed121c2ebb80485abf7e8ed5 Author: Tamás ZolnaiDate: Mon Oct 2 16:59:18 2017 +0200 tdf#112733: Pivot table is displayed wrong in Excel after saved in LO Calc Reviewed-on: https://gerrit.libreoffice.org/42955 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 9e81e845d8299f117e96c30e8b40fcf602e9ca2c) Change-Id: I5dad2ff95ab5dd090296cf8c6e4a8274355c262b Reviewed-on: https://gerrit.libreoffice.org/43051 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/pivot_table_first_header_row.xlsx b/sc/qa/unit/data/xlsx/pivot_table_first_header_row.xlsx new file mode 100755 index ..664637d4bd57 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivot_table_first_header_row.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 9466fbe8f28d..33c749382d36 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -207,6 +207,7 @@ public: void testPivotTableRowColPageFieldFilter(); void testPivotTableEmptyItem(); void testPivotTablePageFieldFilter(); +void testPivotTableFirstHeaderRowXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -314,6 +315,7 @@ public: CPPUNIT_TEST(testPivotTableRowColPageFieldFilter); CPPUNIT_TEST(testPivotTableEmptyItem); CPPUNIT_TEST(testPivotTablePageFieldFilter); +CPPUNIT_TEST(testPivotTableFirstHeaderRowXLSX); CPPUNIT_TEST_SUITE_END(); @@ -4760,6 +4762,27 @@ void ScExportTest::testPivotTablePageFieldFilter() xDocSh->DoClose(); } +void ScExportTest::testPivotTableFirstHeaderRowXLSX() +{ +// tdf#112733: We have different tables here, but have the same value as firstHeaderRow +// The documentation is not clear about thit firstHeaderRow actually measn, but MS Excel works on this way +ScDocShellRef xShell = loadDoc("pivot_table_first_header_row.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pTable); +assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); + +pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable2.xml"); +CPPUNIT_ASSERT(pTable); +assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); + +pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable3.xml"); +CPPUNIT_ASSERT(pTable); +assertXPath(pTable, "/x:pivotTableDefinition/x:location", "firstHeaderRow", "1"); +} + 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 dcbbb0fdb518..b50182e157d8 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -679,7 +679,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP // NB: Excel's range does not include page field area (if any). ScRange aOutRange = rDPObj.GetOutputRangeByType(sheet::DataPilotOutputRangeType::TABLE); -sal_Int32 nFirstHeaderRow = aColFields.size(); +sal_Int32 nFirstHeaderRow = rDPObj.GetHeaderLayout() ? 2 : 1; sal_Int32 nFirstDataRow = 2; sal_Int32 nFirstDataCol = 1; ScRange aResRange = rDPObj.GetOutputRangeByType(sheet::DataPilotOutputRangeType::RESULT); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xls/pivottable_page_field_filter.xls |binary sc/qa/unit/subsequent_export-test.cxx| 95 +++ sc/source/filter/excel/xipivot.cxx | 71 -- sc/source/filter/inc/xipivot.hxx |4 4 files changed, 141 insertions(+), 29 deletions(-) New commits: commit da033662525304b3351b0ed6b38363380b905bd5 Author: Tamás ZolnaiDate: Wed Sep 13 07:22:41 2017 +0200 tdf#112348: Pivot table: page field filtering is not imported from XLS Reviewed-on: https://gerrit.libreoffice.org/42201 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 55a43f30a54816e13eb6704a8ec5952a63b01a64) Change-Id: I3477cd17f679bdfefb9340656999630380713d3f Reviewed-on: https://gerrit.libreoffice.org/42225 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xls/pivottable_page_field_filter.xls b/sc/qa/unit/data/xls/pivottable_page_field_filter.xls new file mode 100755 index ..4f8a3b8ab650 Binary files /dev/null and b/sc/qa/unit/data/xls/pivottable_page_field_filter.xls differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 45ee28ce26cb..cb7f563a6947 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -205,6 +205,7 @@ public: void testPivotTableBoolFieldFilter(); void testPivotTableRowColPageFieldFilter(); void testPivotTableEmptyItem(); +void testPivotTablePageFieldFilter(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -310,6 +311,7 @@ public: CPPUNIT_TEST(testPivotTableBoolFieldFilter); CPPUNIT_TEST(testPivotTableRowColPageFieldFilter); CPPUNIT_TEST(testPivotTableEmptyItem); +CPPUNIT_TEST(testPivotTablePageFieldFilter); CPPUNIT_TEST_SUITE_END(); @@ -4643,6 +4645,99 @@ void ScExportTest::testPivotTableEmptyItem() xDocSh->DoClose(); } +void ScExportTest::testPivotTablePageFieldFilter() +{ +ScDocShellRef xDocSh = loadDoc("pivottable_page_field_filter.", FORMAT_XLS); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rDoc = xDocSh->GetDocument(); +ScDPCollection* pDPs = rDoc.GetDPCollection(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount()); + +// Reload and check filtering of row dimensions +xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLS); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rLoadedDoc = xDocSh->GetDocument(); +pDPs = rLoadedDoc.GetDPCollection(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount()); +const ScDPObject* pDPObj = &(*pDPs)[0]; +CPPUNIT_ASSERT(pDPObj); +ScDPSaveData* pSaveData = pDPObj->GetSaveData(); +CPPUNIT_ASSERT(pSaveData); + +// Only one item is selected (an empty item) +{ +ScDPSaveDimension* pSaveDim = pSaveData->GetExistingDimensionByName("Product"); +CPPUNIT_ASSERT(pSaveDim); +const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers(); +CPPUNIT_ASSERT_EQUAL(size_t(3), rMembers.size()); +ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("Banana"); +CPPUNIT_ASSERT(pMember); +CPPUNIT_ASSERT(pMember->HasIsVisible() && !pMember->GetIsVisible()); +pMember = pSaveDim->GetExistingMemberByName("Carrots"); +CPPUNIT_ASSERT(pMember); +CPPUNIT_ASSERT(pMember->HasIsVisible() && !pMember->GetIsVisible()); +pMember = pSaveDim->GetExistingMemberByName(""); +CPPUNIT_ASSERT(pMember); +CPPUNIT_ASSERT(pMember->HasIsVisible() && pMember->GetIsVisible()); +} + +// More items are selected, but not all +{ +ScDPSaveDimension* pSaveDim = pSaveData->GetExistingDimensionByName("Category"); +CPPUNIT_ASSERT(pSaveDim); + +const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers(); +CPPUNIT_ASSERT_EQUAL(size_t(3), rMembers.size()); +ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("Vegetables"); +CPPUNIT_ASSERT(pMember); +CPPUNIT_ASSERT(pMember->HasIsVisible() && !pMember->GetIsVisible()); +pMember = pSaveDim->GetExistingMemberByName("Fruit"); +CPPUNIT_ASSERT(pMember); +CPPUNIT_ASSERT(pMember->HasIsVisible() && pMember->GetIsVisible()); +pMember = pSaveDim->GetExistingMemberByName(""); +CPPUNIT_ASSERT(pMember); +CPPUNIT_ASSERT(pMember->HasIsVisible() && pMember->GetIsVisible()); +} + +// All items are selected +{ +ScDPSaveDimension* pSaveDim = pSaveData->GetExistingDimensionByName("Order ID"); +CPPUNIT_ASSERT(pSaveDim); + +const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers(); +
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 85 ++ sc/source/filter/excel/xepivotxml.cxx | 27 +-- 3 files changed, 66 insertions(+), 46 deletions(-) New commits: commit 539fd8d8cbe213f5897b5e6b4363632aa2efb0fb Author: Mike KaganskiDate: Sun Sep 10 09:07:02 2017 +0300 tdf#112306: containsSemiMixedTypes is true for blanks-only Also export containsNonDate Change-Id: I16283a272d51e6c305f8c381c359168c1e3848a8 Reviewed-on: https://gerrit.libreoffice.org/42130 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/42131 Tested-by: Mike Kaganski diff --git a/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx b/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx index f343b51f98be..882ed1a1c529 100644 Binary files a/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx and b/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index b76a69dc92e0..91e9a742ce42 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -570,11 +570,11 @@ void ScExportTest::testPivotCacheExportXLSX() xmlDocPtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 5); +assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 6); // Four strings and one empty field -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", "mixed strings and empty"); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsBlank", "1"); +assertXPath (pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", "mixed strings and empty"); +assertXPath (pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsBlank", "1"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsMixedTypes"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsSemiMixedTypes"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsNonDate"); @@ -586,75 +586,92 @@ void ScExportTest::testPivotCacheExportXLSX() assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsInteger"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "minValue"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "maxValue"); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "count", "5"); +assertXPath (pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "count", "5"); // Two integers and one empty field -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", "mixed empty fileds and integers"); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsBlank", "1"); +assertXPath (pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", "mixed empty fields and integers"); +assertXPath (pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsBlank", "1"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsMixedTypes"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsSemiMixedTypes"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsNonDate"); assertXPathNoAttribute(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsDate"); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsString", "0"); +assertXPath (pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsString", "0"); assertXPathNoAttribute(pCacheDef,
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
dev/null |binary sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 138 ++ sc/source/filter/excel/xepivotxml.cxx | 65 +++- 4 files changed, 146 insertions(+), 57 deletions(-) New commits: commit 0c457ee0f069b5a53dbcf4480069568fdf201bd7 Author: Bartosz KosiorekDate: Tue Aug 15 07:35:35 2017 +0200 tdf#89139 Fix exporting of DateTime to CacheDefinition according to ISO 8601 With this commit, the date is saved in Excel format, like: "2009-07-06T10:53:02" We are now exporting attributes: "minDate" "maxDate" "containsDate" This is necessary to export properly .xlsx file. Without that MS Office 365 is displaying error, and it is not even trying displaying .xslx file content Reviewed-on: https://gerrit.libreoffice.org/41162 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek Change-Id: I1239f5582173afe99bf9178fd4edd1dc5ca28e8e Reviewed-on: https://gerrit.libreoffice.org/41871 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski diff --git a/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx b/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx new file mode 100644 index ..f343b51f98be Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivot-table/with-strings-integers-and-dates.xlsx differ diff --git a/sc/qa/unit/data/xlsx/pivot.xlsx b/sc/qa/unit/data/xlsx/pivot.xlsx deleted file mode 100644 index e6297a91777b.. Binary files a/sc/qa/unit/data/xlsx/pivot.xlsx and /dev/null differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index b5965bcd5aa6..b76a69dc92e0 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -113,7 +113,8 @@ public: void testFormatExportODS(); void testPivotTableExportXLSX(); -void testPivotExportXLSX(); +void testPivotCacheExportXLSX(); + void testCommentExportXLSX(); void testCustomColumnWidthExportXLSX(); void testXfDefaultValuesXLSX(); @@ -221,7 +222,8 @@ public: CPPUNIT_TEST(testFormatExportODS); CPPUNIT_TEST(testPivotTableExportXLSX); -CPPUNIT_TEST(testPivotExportXLSX); +CPPUNIT_TEST(testPivotCacheExportXLSX); + CPPUNIT_TEST(testCommentExportXLSX); CPPUNIT_TEST(testCustomColumnWidthExportXLSX); CPPUNIT_TEST(testXfDefaultValuesXLSX); @@ -552,63 +554,107 @@ void ScExportTest::testPivotTableExportXLSX() assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item[3]", "h", "1"); } -void ScExportTest::testPivotExportXLSX() +void ScExportTest::testPivotCacheExportXLSX() { -//tdf#89139 FILESAVE xlsx pivot table corrupted after save with LO and re-open with MS Office -ScDocShellRef xShell = loadDoc("pivot.", FORMAT_XLSX); +// tdf#89139 FILESAVE xlsx pivot table corrupted after save with LO and re-open with MS Office +// MS Excel is very sensitive for proper values of fields: +// containsMixedTypes, containsSemiMixedTypes, containsInteger, containsBlank +// If it is not properly set, then Excel is not opening spreadsheet properly. +// This test case ensures, that such values are properly set according to documentation: +// https://technet.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.shareditems.aspx + +ScDocShellRef xShell = loadDoc("pivot-table/with-strings-integers-and-dates.", FORMAT_XLSX); CPPUNIT_ASSERT(xShell.Is()); std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); -xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); -CPPUNIT_ASSERT(pSheet); +xmlDocPtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); +CPPUNIT_ASSERT(pCacheDef); -assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 5); +assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 5); // Four strings and one empty field -assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", "imieinazwisko"); -assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsBlank", "1"); -assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsMixedTypes"); -assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsSemiMixedTypes"); -assertXPathNoAttribute(pSheet,
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf112106.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 33 + sc/source/filter/excel/xepivot.cxx|4 +--- 3 files changed, 34 insertions(+), 3 deletions(-) New commits: commit 895c23b97eecd9cd32a145a6267f4b43db479248 Author: Tamás ZolnaiDate: Thu Aug 31 14:41:49 2017 +0200 tdf#112106: Corrupted pivot table after XLSX -> XLS conversion in Calc Always write out a data layout name. Reviewed-on: https://gerrit.libreoffice.org/41739 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit a2f2a40e37aadc0a32435a33402a21a678464ba4) Change-Id: Ic0b43d9c0365eca5e417fe9f2fe4b77b538f3278 Reviewed-on: https://gerrit.libreoffice.org/41755 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/tdf112106.xlsx b/sc/qa/unit/data/xlsx/tdf112106.xlsx new file mode 100755 index ..37203d1dbd5b Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf112106.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index b8559ec3f6a4..b5965bcd5aa6 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -42,6 +42,8 @@ #include #include #include +#include "globstr.hrc" +#include "global.hxx" #include #include @@ -195,6 +197,7 @@ public: void testHiddenRepeatedRowsODS(); void testHyperlinkTargetFrameODS(); +void testTdf112106(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -292,6 +295,7 @@ public: CPPUNIT_TEST(testHiddenRepeatedRowsODS); CPPUNIT_TEST(testHyperlinkTargetFrameODS); +CPPUNIT_TEST(testTdf112106); CPPUNIT_TEST_SUITE_END(); private: @@ -4155,6 +4159,35 @@ void ScExportTest::testPivotTableRowHeaderXLS() xDocSh->DoClose(); } +void ScExportTest::testTdf112106() +{ +ScDocShellRef xDocSh = loadDoc("tdf112106.", FORMAT_XLSX); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rDoc = xDocSh->GetDocument(); +ScDPCollection* pDPs = rDoc.GetDPCollection(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount()); + +// Reload and check data layout dim +xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLS); +CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is()); +ScDocument& rLoadedDoc = xDocSh->GetDocument(); +pDPs = rLoadedDoc.GetDPCollection(); +CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount()); +const ScDPObject* pDPObj = &(*pDPs)[0]; +CPPUNIT_ASSERT(pDPObj); +const ScDPSaveData* pSaveData = pDPObj->GetSaveData(); +CPPUNIT_ASSERT(pSaveData); + +// Check that we have an existing data layout dimension +const ScDPSaveDimension* pDim = pSaveData->GetExistingDataLayoutDimension(); +CPPUNIT_ASSERT(pDim); +const OUString* pLayoutName = pDim->GetLayoutName(); +CPPUNIT_ASSERT(pLayoutName); +CPPUNIT_ASSERT_EQUAL(ScGlobal::GetRscString(STR_PIVOT_DATA), (*pLayoutName)); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 62f84eb69ae5..2203a83ac1cd 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -1304,10 +1304,8 @@ void XclExpPivotTable::SetPropertiesFromDP( const ScDPSaveData& rSaveData ) ::set_flag( maPTExtInfo.mnFlags, EXC_SXEX_DRILLDOWN, rSaveData.GetDrillDown() ); mbFilterBtn = rSaveData.GetFilterButton(); const ScDPSaveDimension* pDim = rSaveData.GetExistingDataLayoutDimension(); -if (!pDim) -return; -const OUString* pLayoutName = pDim->GetLayoutName(); +const OUString* pLayoutName = pDim ? pDim->GetLayoutName() : nullptr; if (pLayoutName) maPTInfo.maDataName = *pLayoutName; else ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf89139_pivot_table.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 18 + sc/source/filter/excel/xepivotxml.cxx | 80 +++-- 3 files changed, 68 insertions(+), 30 deletions(-) New commits: commit 711cdc36c42a3a9b8d0369c6fd853b8c071bb71a Author: Mike KaganskiDate: Thu Aug 24 13:18:44 2017 +0300 tdf#89139: list all items in pivot table definition, incl. hidden Change-Id: I14ce935185a6e0e3739fcf01fdefa031d814e821 Reviewed-on: https://gerrit.libreoffice.org/41509 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/41588 Tested-by: Mike Kaganski diff --git a/sc/qa/unit/data/xlsx/tdf89139_pivot_table.xlsx b/sc/qa/unit/data/xlsx/tdf89139_pivot_table.xlsx new file mode 100644 index ..83d5b3dc1556 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf89139_pivot_table.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index caa0f07815f0..13598b5b0423 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -109,6 +109,7 @@ public: void testCellNoteExportXLS(); void testFormatExportODS(); +void testPivotTableExportXLSX(); void testPivotExportXLSX(); void testCommentExportXLSX(); void testCustomColumnWidthExportXLSX(); @@ -214,6 +215,7 @@ public: CPPUNIT_TEST(testCellNoteExportXLS); CPPUNIT_TEST(testFormatExportODS); +CPPUNIT_TEST(testPivotTableExportXLSX); CPPUNIT_TEST(testPivotExportXLSX); CPPUNIT_TEST(testCommentExportXLSX); CPPUNIT_TEST(testCustomColumnWidthExportXLSX); @@ -527,6 +529,22 @@ void ScExportTest::testFormatExportODS() xDocSh->DoClose(); } +void ScExportTest::testPivotTableExportXLSX() +{ +// tdf#89139: pivot table definition needs to list items, including hidden + +ScDocShellRef xShell = loadDoc("tdf89139_pivot_table.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pTable); + +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items", "count", "4"); +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item", 4); +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[3]/x:items/x:item[3]", "h", "1"); +} + void ScExportTest::testPivotExportXLSX() { //tdf#89139 FILESAVE xlsx pivot table corrupted after save with LO and re-open with MS Office diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 80a85316d01c..4c91cd8d690e 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -616,18 +616,18 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main;, XML_name, XclXmlUtils::ToOString(rDPObj.GetName()).getStr(), XML_cacheId, OString::number(nCacheId).getStr(), -XML_applyNumberFormats, BS(false), -XML_applyBorderFormats, BS(false), -XML_applyFontFormats, BS(false), -XML_applyPatternFormats, BS(false), -XML_applyAlignmentFormats, BS(false), -XML_applyWidthHeightFormats, BS(false), +XML_applyNumberFormats, XclXmlUtils::ToPsz10(false), +XML_applyBorderFormats, XclXmlUtils::ToPsz10(false), +XML_applyFontFormats, XclXmlUtils::ToPsz10(false), +XML_applyPatternFormats, XclXmlUtils::ToPsz10(false), +XML_applyAlignmentFormats, XclXmlUtils::ToPsz10(false), +XML_applyWidthHeightFormats, XclXmlUtils::ToPsz10(false), XML_dataCaption, "Values", -XML_useAutoFormatting, BS(false), -XML_itemPrintTitles, BS(true), -XML_indent, BS(false), -XML_outline, BS(true), -XML_outlineData, BS(true), +XML_useAutoFormatting, XclXmlUtils::ToPsz10(false), +XML_itemPrintTitles, XclXmlUtils::ToPsz10(true), +XML_indent, XclXmlUtils::ToPsz10(false), +XML_outline, XclXmlUtils::ToPsz10(true), +XML_outlineData, XclXmlUtils::ToPsz10(true), FSEND); // NB: Excel's range does not include page field area (if any). @@ -676,7 +676,7 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP if (!pDim) { pPivotStrm->singleElement(XML_pivotField, -XML_showAll, BS(false), +XML_showAll, XclXmlUtils::ToPsz10(false), FSEND); continue; } @@ -687,7 +687,7 @@ void
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf111876.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 22 ++ sc/source/filter/excel/xecontent.cxx | 15 --- sc/source/filter/excel/xestream.cxx |4 4 files changed, 38 insertions(+), 3 deletions(-) New commits: commit 6273f015108ffb10c40f97604a11ce2e3ec0a06d Author: Szymon KÅosDate: Thu Aug 24 09:59:42 2017 +0200 tdf#111876 Save correct relative links in Calc Relative links were saved as: file:///a/file.odt instead of: ../a/file.odt Relative path was based on source document, not target. Unit test contains spreadsheet with relative link to the "../xls/bug-fixes.xls" file. Change-Id: I803b7b8936bde9644ae5760756ee7249677f2641 Reviewed-on: https://gerrit.libreoffice.org/41500 Tested-by: Jenkins Reviewed-by: Szymon KÅos Reviewed-on: https://gerrit.libreoffice.org/41555 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/tdf111876.xlsx b/sc/qa/unit/data/xlsx/tdf111876.xlsx new file mode 100755 index ..a12f14c3b008 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf111876.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 514f08c68a54..caa0f07815f0 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -90,6 +90,7 @@ public: void test(); void testPasswordExport(); +void testTdf111876(); void testConditionalFormatExportODS(); void testConditionalFormatExportXLSX(); void testColorScaleExportODS(); @@ -195,6 +196,7 @@ public: CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); CPPUNIT_TEST(testPasswordExport); +CPPUNIT_TEST(testTdf111876); CPPUNIT_TEST(testConditionalFormatExportODS); CPPUNIT_TEST(testConditionalFormatExportXLSX); CPPUNIT_TEST(testColorScaleExportODS); @@ -378,6 +380,26 @@ void ScExportTest::test() xDocSh->DoClose(); } +void ScExportTest::testTdf111876() + { +// DOcument with relative path hyperlink + +ScDocShellRef xShell = loadDoc("tdf111876.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.Is()); + +ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.Is()); + +xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/worksheets/_rels/sheet1.xml.rels", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); +OUString sTarget = getXPath(pDoc, "/r:Relationships/r:Relationship", "Target"); + +// Document is saved to the temporary directory, relative path should be different than original one +CPPUNIT_ASSERT(sTarget != "../xls/bug-fixes.xls"); + +xDocSh->DoClose(); +} + void ScExportTest::testPasswordExport() { ScDocShell* pShell = new ScDocShell( diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index fa5f336329e2..ac6be4e26cd9 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -382,9 +382,18 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU m_Repr = aFileName; msTarget = XclXmlUtils::ToOUString( aLink ); -// ooxml expects the file:/// part appended ( or at least -// ms2007 does, ms2010 is more tolerant ) -msTarget = "file:///" + msTarget; + +if( bRel ) +{ +for( int i = 0; i < nLevel; ++i ) +msTarget = "../" + msTarget; +} +else +{ +// ooxml expects the file:/// part appended ( or at least +// ms2007 does, ms2010 is more tolerant ) +msTarget = "file:///" + msTarget; +} } else if( eProtocol != INetProtocol::NotValid ) { diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 58d9c761f7af..82d4c4d20479 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -1076,6 +1076,10 @@ bool XclExpXmlStream::exportDocument() aData.maMaxPos.SetRow( ::std::min( aData.maScMaxPos.Row(), aData.maXclMaxPos.Row() ) ); aData.maMaxPos.SetTab( ::std::min( aData.maScMaxPos.Tab(), aData.maXclMaxPos.Tab() ) ); aData.mpCompileFormulaCxt.reset( new sc::CompileFormulaContext() ); +// set target path to get correct relative links to target document, not source +INetURLObject aPath(getFileUrl()); +aData.maBasePath = aPath.GetPath() + "\\"; +aData.maBasePath = "file:///" + aData.maBasePath.replace('\\', '/'); XclExpRoot aRoot( aData ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/extras/testdocuments/AutoFilter.xls |binary sc/source/ui/vba/vbarange.cxx | 45 ++ 2 files changed, 40 insertions(+), 5 deletions(-) New commits: commit 44ec0adc7ea196f5aede4964fe49248aded4ab28 Author: Szymon KÅosDate: Wed May 10 12:36:48 2017 +0200 tdf#107238 VBA autofilter: list of strings * support of string arrays in the VBA AutoFilter * tests: - reading string arrays - skip Criteria2 when Criteria1 is an array - use only last element of Criteria2 array Change-Id: I8faf6af8c4fbf9b654885b31210ef77bae3a39af Reviewed-on: https://gerrit.libreoffice.org/37515 Tested-by: Jenkins Reviewed-by: Szymon KÅos Reviewed-on: https://gerrit.libreoffice.org/41137 Reviewed-by: Aron Budea Tested-by: Aron Budea diff --git a/sc/qa/extras/testdocuments/AutoFilter.xls b/sc/qa/extras/testdocuments/AutoFilter.xls index 75efd8ddc609..1a8e5e5e9904 100644 Binary files a/sc/qa/extras/testdocuments/AutoFilter.xls and b/sc/qa/extras/testdocuments/AutoFilter.xls differ diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 955d35a2c4e8..c5bade6e0dbb 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -4477,6 +4477,7 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const if ( ( Field >>= nField ) ) { bool bAll = false; +bool bAcceptCriteria2 = true; uno::Reference< sheet::XSheetFilterDescriptor2 > xDesc( xDataBaseRange->getFilterDescriptor(), uno::UNO_QUERY ); @@ -4491,11 +4492,35 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const if ( !bCritHasNumericValue ) { Criteria1 >>= sCriteria1; -sTabFilts[0].IsNumeric = bCritHasNumericValue; -if ( bHasCritValue && !sCriteria1.isEmpty() ) -lcl_setTableFieldsFromCriteria( sCriteria1, xDescProps, sTabFilts[0] ); +if ( sCriteria1.isEmpty() ) +{ +uno::Sequence< OUString > aCriteria1; +Criteria1 >>= aCriteria1; +sal_uInt16 nLength = aCriteria1.getLength(); +if ( nLength ) +{ +// When sequence is provided for Criteria1 don't care about Criteria2 +bAcceptCriteria2 = false; + +sTabFilts.realloc( nLength ); +for ( sal_uInt16 i = 0; i < nLength; ++i ) +{ +lcl_setTableFieldsFromCriteria( aCriteria1[i], xDescProps, sTabFilts[i] ); +sTabFilts[i].Connection = sheet::FilterConnection_OR; +sTabFilts[i].Field = (nField - 1); +} +} +else +bAll = true; +} else -bAll = true; +{ +sTabFilts[0].IsNumeric = bCritHasNumericValue; +if ( bHasCritValue && !sCriteria1.isEmpty() ) +lcl_setTableFieldsFromCriteria( sCriteria1, xDescProps, sTabFilts[0] ); +else +bAll = true; +} } else // numeric { @@ -4543,12 +4568,13 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const } } -if ( !bAll ) +if ( !bAll && bAcceptCriteria2 ) { sTabFilts[0].Connection = sheet::FilterConnection_AND; sTabFilts[0].Field = (nField - 1); OUString sCriteria2; +uno::Sequence< OUString > aCriteria2; if ( Criteria2.hasValue() ) // there is a Criteria2 { sTabFilts.realloc(2); @@ -4564,6 +4590,15 @@ ScVbaRange::AutoFilter( const uno::Any& aField, const uno::Any& Criteria1, const sTabFilts[1].IsNumeric = false; } } +else if ( Criteria2 >>= aCriteria2 ) +{ +sal_uInt16 nLength = aCriteria2.getLength(); +if ( nLength ) +{ +// For compatibility use only the last value form the sequence +lcl_setTableFieldsFromCriteria( aCriteria2[nLength - 1], xDescProps, sTabFilts[1] ); +} +} else // numeric { Criteria2 >>= sTabFilts[1].NumericValue; ___ Libreoffice-commits mailing list
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivot.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 61 +- sc/source/filter/excel/xepivotxml.cxx | 79 +++--- 3 files changed, 123 insertions(+), 17 deletions(-) New commits: commit 084a1fc85f2e9099b89b7a0bc519a8d482645155 Author: Bartosz KosiorekDate: Tue Aug 1 05:40:34 2017 +0200 tdf#89139 tdf#109016 Fix PivotCache fields according to OOXML specification Apply changes to fields: - XML_containsInteger - XML_containsBlank - XML_containsMixedTypes - XML_containsSemiMixedTypes - XML_count According to OOXML specification https://technet.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.shareditems.aspx Generally OOXML specification allows listing items for mixed items (example: STRING + NUMBERS). This patch is fixing that. Example of mixed types: Cherry-picked from Change-Id: I02b07c79bea60890e3c995dd70cb5c72901a3d4a Change-Id: I384629de7dc64dd1c62e1fab24df5595b8d6f03e Reviewed-on: https://gerrit.libreoffice.org/40970 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/pivot.xlsx b/sc/qa/unit/data/xlsx/pivot.xlsx new file mode 100644 index ..e6297a91777b Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivot.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 9deb04ba8be0..514f08c68a54 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -108,7 +108,7 @@ public: void testCellNoteExportXLS(); void testFormatExportODS(); - +void testPivotExportXLSX(); void testCommentExportXLSX(); void testCustomColumnWidthExportXLSX(); void testXfDefaultValuesXLSX(); @@ -212,6 +212,7 @@ public: CPPUNIT_TEST(testCellNoteExportXLS); CPPUNIT_TEST(testFormatExportODS); +CPPUNIT_TEST(testPivotExportXLSX); CPPUNIT_TEST(testCommentExportXLSX); CPPUNIT_TEST(testCustomColumnWidthExportXLSX); CPPUNIT_TEST(testXfDefaultValuesXLSX); @@ -504,6 +505,64 @@ void ScExportTest::testFormatExportODS() xDocSh->DoClose(); } +void ScExportTest::testPivotExportXLSX() +{ +//tdf#89139 FILESAVE xlsx pivot table corrupted after save with LO and re-open with MS Office +ScDocShellRef xShell = loadDoc("pivot.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.Is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); +CPPUNIT_ASSERT(pSheet); + +assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField", 5); + +// Four strings and one empty field +assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", "imieinazwisko"); +assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsBlank", "1"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsMixedTypes"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsSemiMixedTypes"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsString"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsNumber"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "containsInteger"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "minValue"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "maxValue"); +assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", "count", "5"); + +// Two integers and one empty field +assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", "wartosc"); +assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsBlank", "1"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsMixedTypes"); +assertXPathNoAttribute(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsSemiMixedTypes"); +assertXPath(pSheet, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "containsString", "0"); +assertXPath(pSheet,
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/data/xlsx/column-style-autofilter.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx| 17 + sc/source/filter/oox/sheetdatabuffer.cxx | 21 - 3 files changed, 37 insertions(+), 1 deletion(-) New commits: commit 20241e3b747c1dd8b28dce79bc75230b9bf57752 Author: Szymon KÅosDate: Wed Aug 2 14:24:56 2017 +0200 tdf#91567 Apply pattern without AutoFilter only When AutoFilter button was placed in first row, was also copied to other cells without formatting all over the worksheet. Take pattern from first row without AutoFilter button. Change-Id: Ib2eb12659bf8105e39b469b21386b3232e710007 Reviewed-on: https://gerrit.libreoffice.org/40675 Tested-by: Jenkins Reviewed-by: Szymon KÅos Reviewed-on: https://gerrit.libreoffice.org/40787 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/column-style-autofilter.xlsx b/sc/qa/unit/data/xlsx/column-style-autofilter.xlsx new file mode 100755 index ..67b2dd479576 Binary files /dev/null and b/sc/qa/unit/data/xlsx/column-style-autofilter.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 8873513f7212..5c5e730ef591 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -215,6 +215,7 @@ public: void testOutlineODS(); void testColumnStyleXLSX(); +void testColumnStyleAutoFilterXLSX(); void testSharedFormulaHorizontalXLS(); void testSharedFormulaWrappedRefsXLS(); @@ -331,6 +332,7 @@ public: CPPUNIT_TEST(testPrintRangeODS); CPPUNIT_TEST(testOutlineODS); CPPUNIT_TEST(testColumnStyleXLSX); +CPPUNIT_TEST(testColumnStyleAutoFilterXLSX); CPPUNIT_TEST(testSharedFormulaHorizontalXLS); CPPUNIT_TEST(testSharedFormulaWrappedRefsXLS); CPPUNIT_TEST(testSharedFormulaBIFF5); @@ -3270,6 +3272,21 @@ void ScFiltersTest::testColumnStyleXLSX() xDocSh->DoClose(); } +void ScFiltersTest::testColumnStyleAutoFilterXLSX() +{ +ScDocShellRef xDocSh = loadDoc("column-style-autofilter.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.Is()); +ScDocument& rDoc = xDocSh->GetDocument(); + +const ScPatternAttr* pPattern = rDoc.GetPattern(0, 10, 18); +CPPUNIT_ASSERT(pPattern); + +const ScMergeFlagAttr& rAttr = static_cast(pPattern->GetItem(ATTR_MERGE_FLAG)); +CPPUNIT_ASSERT(!rAttr.HasAutoFilter()); + +xDocSh->DoClose(); +} + void ScFiltersTest::testSharedFormulaHorizontalXLS() { ScDocShellRef xDocSh = loadDoc("shared-formula/horizontal.", FORMAT_XLS); diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 44a0e02fdeb3..dbcc07d5db64 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -453,7 +453,26 @@ void SheetDataBuffer::finalizeImport() { RowStyles& rRowStyles = col->second; SCCOL nScCol = static_cast< SCCOL >( col->first ); -const ScPatternAttr* pDefPattern = rDoc.getDoc().GetPattern(nScCol, 0, getSheetIndex()); + +// tdf#91567 Get pattern from the first row without AutoFilter +const ScPatternAttr* pDefPattern = nullptr; +bool bAutoFilter = true; +SCROW nScRow = 0; +while ( bAutoFilter && nScRow < MAXROW ) +{ +pDefPattern = rDoc.getDoc().GetPattern( nScCol, nScRow, getSheetIndex() ); +if ( pDefPattern ) +{ +const ScMergeFlagAttr* pAttr = static_cast( pDefPattern->GetItemSet().GetItem( ATTR_MERGE_FLAG ) ); +bAutoFilter = pAttr->HasAutoFilter(); +} +else +break; +nScRow++; +} +if ( !pDefPattern || nScRow == MAXROW ) +pDefPattern = rDoc.getDoc().GetDefPattern(); + Xf::AttrList aAttrs(pDefPattern); for ( RowStyles::iterator rRows = rRowStyles.begin(), rRows_end = rRowStyles.end(); rRows != rRows_end; ++rRows ) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source sfx2/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 66 +++ sc/source/ui/view/tabvwshb.cxx |3 + sfx2/source/view/viewfrm.cxx | 30 +--- 3 files changed, 93 insertions(+), 6 deletions(-) New commits: commit 61396c713fcce8b4c6d6fd159753c58b53a55449 Author: Henry CastroDate: Wed Jun 28 10:26:21 2017 -0400 sc lok: disable Undo/Redo state if conflict with other views Change-Id: I5bc5be2b17925ec3a203f9704f62a8c80ac5fc9d Reviewed-on: https://gerrit.libreoffice.org/39363 Tested-by: Jenkins Reviewed-by: Henry Castro Reviewed-on: https://gerrit.libreoffice.org/39402 Reviewed-by: Jan Holesovsky Tested-by: Jan Holesovsky diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index fd318fe37a1e..8eaf06f7483d 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -76,6 +76,7 @@ public: void testUndoRepairDispatch(); void testInsertGraphicInvalidations(); void testDocumentSizeWithTwoViews(); +void testDisableUndoRepair(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -102,6 +103,7 @@ public: CPPUNIT_TEST(testUndoRepairDispatch); CPPUNIT_TEST(testInsertGraphicInvalidations); CPPUNIT_TEST(testDocumentSizeWithTwoViews); +CPPUNIT_TEST(testDisableUndoRepair); CPPUNIT_TEST_SUITE_END(); private: @@ -1350,6 +1352,70 @@ void ScTiledRenderingTest::testDocumentSizeWithTwoViews() comphelper::LibreOfficeKit::setActive(false); } +void ScTiledRenderingTest::testDisableUndoRepair() +{ +comphelper::LibreOfficeKit::setActive(); +ScModelObj* pModelObj = createDoc("cursor-away.ods"); +CPPUNIT_ASSERT(pModelObj); + +// view #1 +int nView1 = SfxLokHelper::getView(); +SfxViewShell* pView1 = SfxViewShell::Current(); + +// view #2 +SfxLokHelper::createView(); +int nView2 = SfxLokHelper::getView(); +SfxViewShell* pView2 = SfxViewShell::Current(); +CPPUNIT_ASSERT(pView1 != pView2); +{ +SfxItemSet aSet1(pView1->GetPool(), SID_UNDO, SID_UNDO); +SfxItemSet aSet2(pView2->GetPool(), SID_UNDO, SID_UNDO); +pView1->GetSlotState(SID_UNDO, nullptr, ); +pView2->GetSlotState(SID_UNDO, nullptr, ); +CPPUNIT_ASSERT(SfxItemState::DISABLED == aSet1.GetItemState(SID_UNDO)); +CPPUNIT_ASSERT(SfxItemState::DISABLED == aSet2.GetItemState(SID_UNDO)); +} + +// text edit a cell in view #1 +SfxLokHelper::setView(nView1); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'h', 0); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 'h', 0); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); +Scheduler::ProcessEventsToIdle(); +{ +SfxItemSet aSet1(pView1->GetPool(), SID_UNDO, SID_UNDO); +SfxItemSet aSet2(pView2->GetPool(), SID_UNDO, SID_UNDO); +pView1->GetSlotState(SID_UNDO, nullptr, ); +pView2->GetSlotState(SID_UNDO, nullptr, ); +CPPUNIT_ASSERT(SfxItemState::SET == aSet1.GetItemState(SID_UNDO)); +CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(aSet1.GetItem(SID_UNDO))); +CPPUNIT_ASSERT(SfxItemState::SET == aSet2.GetItemState(SID_UNDO)); +CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aSet2.GetItem(SID_UNDO))); +CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item* >(aSet2.GetItem(SID_UNDO))->GetValue()); +} + +// text edit a cell in view #2 +SfxLokHelper::setView(nView2); +pModelObj->setPart(1); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'c', 0); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 'c', 0); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); +Scheduler::ProcessEventsToIdle(); +{ +SfxItemSet aSet1(pView1->GetPool(), SID_UNDO, SID_UNDO); +SfxItemSet aSet2(pView2->GetPool(), SID_UNDO, SID_UNDO); +pView1->GetSlotState(SID_UNDO, nullptr, ); +pView2->GetSlotState(SID_UNDO, nullptr, ); +CPPUNIT_ASSERT(SfxItemState::SET == aSet1.GetItemState(SID_UNDO)); +CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aSet1.GetItem(SID_UNDO))); +CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item* >(aSet1.GetItem(SID_UNDO))->GetValue()); +CPPUNIT_ASSERT(SfxItemState::SET == aSet2.GetItemState(SID_UNDO)); +CPPUNIT_ASSERT(dynamic_cast< const SfxStringItem* >(aSet2.GetItem(SID_UNDO))); +} +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); diff --git
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |8 -- sc/source/ui/view/gridwin4.cxx | 33 --- 2 files changed, 21 insertions(+), 20 deletions(-) New commits: commit 23d0b17f259a7bf8bac3cab8fdb97c227c134108 Author: Jan HolesovskyDate: Wed May 3 15:51:34 2017 +0200 sc lok: Extend MaxTiledCol/Row when painting beoyond the current doc area. We were stripping the painted area only to what was the current document size. But the document size has to grow when the user moves outside of the view, and we have to be able to draw even tiles that are outside of the area. Let's play it safe, and actually extend the MaxTiledCol/Row when we paint beyond the document size. The unit test has to be adapted to assert only the tile content - which is what actually mattered for the original problem. Change-Id: I447c006cc184a27e55a345e51b4fe28e77cfc8ae Reviewed-on: https://gerrit.libreoffice.org/37205 Reviewed-by: Marco Cecchetti Tested-by: Marco Cecchetti diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 577e79aeb41c..b48d65408470 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1322,8 +1322,6 @@ void ScTiledRenderingTest::testDocumentSizeWithTwoViews() pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN); Scheduler::ProcessEventsToIdle(); -Size aDocSize = pModelObj->getDocumentSize(); - int nCanvasWidth = 256; int nCanvasHeight = 256; std::vector aBuffer1(nCanvasWidth * nCanvasHeight * 4); @@ -1334,7 +1332,6 @@ void ScTiledRenderingTest::testDocumentSizeWithTwoViews() // Create a new view SfxLokHelper::createView(); -Size aViewSize = pModelObj->getDocumentSize(); std::vector aBuffer2(nCanvasWidth * nCanvasHeight * 4); ScopedVclPtrInstance pDevice2(nullptr, Size(1, 1), DeviceFormat::DEFAULT); @@ -1342,10 +1339,7 @@ void ScTiledRenderingTest::testDocumentSizeWithTwoViews() pModelObj->paintTile(*pDevice2.get(), nCanvasWidth, nCanvasHeight, /*nTilePosX=*/0, /*nTilePosY=*/291840, /*nTileWidth=*/3840, /*nTileHeight=*/3840); Scheduler::ProcessEventsToIdle(); -// Make sure the newly created view has the same size as the original one -CPPUNIT_ASSERT_EQUAL(aDocSize, aViewSize); - -// and that the tiles actually have the same content +// Check that the tiles actually have the same content for (size_t i = 0; i < aBuffer1.size(); ++i) CPPUNIT_ASSERT_EQUAL(aBuffer1[i], aBuffer2[i]); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 6454eadcfd9e..5e9b2c07570a 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1140,24 +1140,17 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, SCTAB nTab = pViewData->GetTabNo(); ScDocument* pDoc = pViewData->GetDocument(); -SCCOL nEndCol = 0; -SCROW nEndRow = 0; - -// size of the document including drawings, charts, etc. -pDoc->GetTiledRenderingArea(nTab, nEndCol, nEndRow); - const double fPPTX = pViewData->GetPPTX(); const double fPPTY = pViewData->GetPPTY(); -ScTableInfo aTabInfo(nEndRow + 3); sal_Int32 nTopLeftTileRowOffset = 0; sal_Int32 nTopLeftTileColOffset = 0; sal_Int32 nTopLeftTileRowOrigin = 0; sal_Int32 nTopLeftTileColOrigin = 0; // find approximate col/row offsets of nearby. -sal_Int32 nTopLeftTileRow =0; -sal_Int32 nTopLeftTileCol =0; +sal_Int32 nTopLeftTileRow = 0; +sal_Int32 nTopLeftTileCol = 0; sal_Int32 nBottomRightTileRow = 0; sal_Int32 nBottomRightTileCol = 0; sal_Int32 nDummy; @@ -1175,12 +1168,25 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, nBottomRightTileCol++; nBottomRightTileRow++; -nTopLeftTileCol = std::min(nTopLeftTileCol, (sal_Int32)nEndCol); -nTopLeftTileRow = std::min(nTopLeftTileRow, (sal_Int32)nEndRow); +// size of the document including drawings, charts, etc. +SCCOL nEndCol = 0; +SCROW nEndRow = 0; +pDoc->GetTiledRenderingArea(nTab, nEndCol, nEndRow); + +if (nEndCol < nBottomRightTileCol) +{ +nEndCol = nBottomRightTileCol; +pViewData->SetMaxTiledCol(nEndCol); +} + +if (nEndRow < nBottomRightTileRow) +{ +nEndRow = nBottomRightTileRow; +pViewData->SetMaxTiledRow(nEndRow); +} + nTopLeftTileCol = std::max(nTopLeftTileCol, 0); nTopLeftTileRow = std::max(nTopLeftTileRow, 0); -nBottomRightTileCol = std::min(nBottomRightTileCol, (sal_Int32)nEndCol); -nBottomRightTileRow = std::min(nBottomRightTileRow, (sal_Int32)nEndRow); nTopLeftTileColOrigin = nTopLeftTileColOrigin * TWIPS_PER_PIXEL; nTopLeftTileRowOrigin = nTopLeftTileRowOrigin * TWIPS_PER_PIXEL; @@
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 133 +++ sc/source/ui/view/tabvwshb.cxx | 28 + 2 files changed, 161 insertions(+) New commits: commit bb69dc8feb4701d162713f4095656c98bb0d5f80 Author: Marco CecchettiDate: Fri Jan 6 18:35:08 2017 +0100 LOK: Calc: limiting undo and add support for repair mode During collaborative editing changes can be undone regardless of who made them. This patch avoids this possibility and introduce support for repair mode, for cases where undo/redo of others' changes is intentional. Change-Id: I69fd435e96c4c675ffd1df81e936b5eae109daa0 diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index cb9cd2bf3d8b..5e1ba9b3cec1 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -72,6 +72,8 @@ public: void testInvalidateOnCopyPasteCells(); void testInvalidateOnInserRowCol(); void testCommentCallback(); +void testUndoLimiting(); +void testUndoRepairDispatch(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -94,6 +96,8 @@ public: CPPUNIT_TEST(testInvalidateOnCopyPasteCells); CPPUNIT_TEST(testInvalidateOnInserRowCol); CPPUNIT_TEST(testCommentCallback); +CPPUNIT_TEST(testUndoLimiting); +CPPUNIT_TEST(testUndoRepairDispatch); CPPUNIT_TEST_SUITE_END(); private: @@ -1130,6 +1134,135 @@ void ScTiledRenderingTest::testCommentCallback() comphelper::LibreOfficeKit::setActive(false); } +void ScTiledRenderingTest::testUndoLimiting() +{ +comphelper::LibreOfficeKit::setActive(); + +ScModelObj* pModelObj = createDoc("small.ods"); +CPPUNIT_ASSERT(pModelObj); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); +SfxUndoManager* pUndoManager = pDoc->GetUndoManager(); +CPPUNIT_ASSERT(pUndoManager); + +// view #1 +ViewCallback aView1; +int nView1 = SfxLokHelper::getView(); + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(::callback, ); + +// view #2 +SfxLokHelper::createView(); +ViewCallback aView2; +int nView2 = SfxLokHelper::getView(); + pModelObj->initializeForTiledRendering(uno::Sequence()); + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(::callback, ); + +// text edit a cell in view #1 +SfxLokHelper::setView(nView1); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN); +Scheduler::ProcessEventsToIdle(); + +// check that undo action count in not 0 +CPPUNIT_ASSERT(pUndoManager->GetUndoActionCount() == 1); + +// try to execute undo in view #2 +SfxLokHelper::setView(nView2); +comphelper::dispatchCommand(".uno:Undo", {}); +Scheduler::ProcessEventsToIdle(); +// check that undo has not been executed on view #2 +CPPUNIT_ASSERT(pUndoManager->GetUndoActionCount() == 1); + +// try to execute undo in view #1 +SfxLokHelper::setView(nView1); +comphelper::dispatchCommand(".uno:Undo", {}); +Scheduler::ProcessEventsToIdle(); +// check that undo has been executed on view #1 +CPPUNIT_ASSERT(pUndoManager->GetUndoActionCount() == 0); + +// check that redo action count in not 0 +CPPUNIT_ASSERT(pUndoManager->GetRedoActionCount() == 1); + +// try to execute redo in view #2 +SfxLokHelper::setView(nView2); +comphelper::dispatchCommand(".uno:Redo", {}); +Scheduler::ProcessEventsToIdle(); +// check that redo has not been executed on view #2 +CPPUNIT_ASSERT(pUndoManager->GetRedoActionCount() == 1); + +// try to execute redo in view #1 +SfxLokHelper::setView(nView1); +comphelper::dispatchCommand(".uno:Redo", {}); +Scheduler::ProcessEventsToIdle(); +// check that redo has been executed on view #1 +CPPUNIT_ASSERT(pUndoManager->GetRedoActionCount() == 0); + +mxComponent->dispose(); +mxComponent.clear(); + +comphelper::LibreOfficeKit::setActive(false); +} + +void ScTiledRenderingTest::testUndoRepairDispatch() +{ +comphelper::LibreOfficeKit::setActive(); + +ScModelObj* pModelObj = createDoc("small.ods"); +CPPUNIT_ASSERT(pModelObj); +ScDocument* pDoc = pModelObj->GetDocument(); +CPPUNIT_ASSERT(pDoc); +SfxUndoManager* pUndoManager = pDoc->GetUndoManager(); +CPPUNIT_ASSERT(pUndoManager); + +// view #1 +ViewCallback aView1; +int nView1 = SfxLokHelper::getView(); + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(::callback, ); + +// view #2 +SfxLokHelper::createView(); +ViewCallback aView2; +int nView2 = SfxLokHelper::getView(); +