[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/extras/anchor.cxx | 62 +++ sc/source/core/data/drwlayer.cxx | 15 ++--- 2 files changed, 73 insertions(+), 4 deletions(-) New commits: commit e1a283b7b353f897b2f85bb1552ff0df3f024e67 Author: Samuel Mehrbrodt AuthorDate: Thu Feb 14 10:34:35 2019 +0100 Commit: Thorsten Behrens CommitDate: Tue Feb 19 13:44:37 2019 +0100 tdf#122982 Remove image from cell when cutting the cell Reviewed-on: https://gerrit.libreoffice.org/67844 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt (cherry picked from commit e756b6f310f309ac29bb2bce92309bb74edd788d) Change-Id: Idd73dcc88a8cd76eb4011bb26efdd5c712d16e5e Reviewed-on: https://gerrit.libreoffice.org/67854 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sc/qa/extras/anchor.cxx b/sc/qa/extras/anchor.cxx index 133b1bdae043..89b4c864dd32 100644 --- a/sc/qa/extras/anchor.cxx +++ b/sc/qa/extras/anchor.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -40,12 +41,14 @@ public: void testTdf76183(); void testODFAnchorTypes(); void testCopyColumnWithImages(); +void testCutWithImages(); CPPUNIT_TEST_SUITE(ScAnchorTest); CPPUNIT_TEST(testUndoAnchor); CPPUNIT_TEST(testTdf76183); CPPUNIT_TEST(testODFAnchorTypes); CPPUNIT_TEST(testCopyColumnWithImages); +CPPUNIT_TEST(testCutWithImages); CPPUNIT_TEST_SUITE_END(); private: @@ -307,6 +310,65 @@ void ScAnchorTest::testCopyColumnWithImages() pDocSh->DoClose(); } +void ScAnchorTest::testCutWithImages() +{ +OUString aFileURL; +createFileURL("3AnchorTypes.ods", aFileURL); +// open the document with graphic included +uno::Reference xComponent = loadFromDesktop(aFileURL); +CPPUNIT_ASSERT(xComponent.is()); + +// Get the document model +SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); +CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); + +ScDocShell* pDocSh = dynamic_cast(pFoundShell); +CPPUNIT_ASSERT(pDocSh); + +ScDocument* pDoc = &(pDocSh->GetDocument()); +ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); +CPPUNIT_ASSERT(pDrawLayer); + +// Get the document controller +ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pViewShell != nullptr); + +// Cut whole column +{ +// Cut source range +ScRange aSrcRange; +aSrcRange.Parse("A1:A11", pDoc, pDoc->GetAddressConvention()); +pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange); +pViewShell->GetViewData().GetView()->CutToClip(); + +std::map> aRowObjects += pDrawLayer->GetObjectsAnchoredToRange(0, 0, 0, 11); + +// Images should have been removed from the cells +CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to A3", 0, + static_cast(aRowObjects[2].size())); +CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to A11", 0, + static_cast(aRowObjects[10].size())); +} + +// Cut individual cells +{ +// Cut source cells +ScRange aSrcRange; +aSrcRange.Parse("A3:B3", pDoc, pDoc->GetAddressConvention()); +pViewShell->GetViewData().GetMarkData().SetMarkArea(aSrcRange); +pViewShell->GetViewData().GetView()->CutToClip(); + +// Image should have been removed from the cell +std::map> aRowObjects += pDrawLayer->GetObjectsAnchoredToRange(0, 0, 2, 2); +CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no image anchored to A3", 0, + static_cast(aRowObjects[2].size())); +} + +pDocSh->DoClose(); +} + void ScAnchorTest::tearDown() { if (mxComponent.is()) diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 4f7f1978919f..8739d3b195c0 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1446,11 +1446,18 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark ) if (!IsNoteCaption( pObject )) { tools::Rectangle aObjRect = pObject->GetCurrentBoundRect(); -if ( aMarkBound.IsInside( aObjRect ) ) +ScRange aRange = pDoc->GetRange(nTab, aObjRect); +bool bObjectInMarkArea += aMarkBound.IsInside(aObjRect) && rMark.IsAllMarked(aRange); +const ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObject); +ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObject); +bool bObjectAnchoredToMarkedCell += ((aAnchorType == SCA_CELL || aAnchorType == SCA_CELL_RESIZE) +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
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 52c088c4d738a3299bda434635a2d9f2da03467c Author: Vasily Melenchuk AuthorDate: Thu Nov 22 11:30:29 2018 +0300 Commit: Katarina Behrens CommitDate: Fri Nov 30 15:54:08 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 (cherry picked from commit 78457f7462aa3bf92839667a550451f0d434f48b) Reviewed-on: https://gerrit.libreoffice.org/64303 Reviewed-by: Vasily Melenchuk 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
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/data/ods/tdf62268.ods |binary sc/qa/unit/helper/qahelper.cxx |3 + sc/qa/unit/subsequent_export-test.cxx | 59 +++-- sc/qa/unit/subsequent_filters-test.cxx | 26 -- sc/source/filter/xml/xmlimprt.cxx | 21 +++ sc/source/filter/xml/xmlimprt.hxx |5 ++ sc/source/filter/xml/xmlrowi.cxx | 16 7 files changed, 94 insertions(+), 36 deletions(-) New commits: commit 693953dd4699887bd3f5bca2c3582b5fae1d6992 Author: Vasily Melenchuk AuthorDate: Fri Apr 6 20:19:10 2018 +0300 Commit: Katarina Behrens CommitDate: Mon Oct 22 23:30:23 2018 +0200 tdf#62268: allow row height recalculation on document load During document load rows with style:use-optimal-row-height="true" should recalculate it's height. * includes: Row height tolerance level increase for unittest * tdf#118086: calc: invalid row autoheight fixed Change-Id: Ib38b5b753d9ff8352116d77851d228c5d77bd530 Reviewed-on: https://gerrit.libreoffice.org/52521 Reviewed-by: Katarina Behrens Tested-by: Jenkins Reviewed-by: Thorsten Behrens (cherry picked from commit 1e55a47e89a9d9d6cf9cb3993484022aaf2c097b) Reviewed-on: https://gerrit.libreoffice.org/61898 Tested-by: Jenkins diff --git a/sc/qa/unit/data/ods/tdf62268.ods b/sc/qa/unit/data/ods/tdf62268.ods new file mode 100644 index ..da88adfd25cd Binary files /dev/null and b/sc/qa/unit/data/ods/tdf62268.ods differ diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 8aa9cc883568..d414b1abfb96 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -754,7 +754,8 @@ void ScBootstrapFixture::miscRowHeightsTest( TestParam const * aTestValues, unsi bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CRFlags::ManualSize); CPPUNIT_ASSERT_EQUAL(aTestValues[ index ].pData[ i ].bOptimal, bOpt); } -CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight); +// Due to some minor differences on Mac this comparison is made bit fuzzy +CPPUNIT_ASSERT_LESSEQUAL( 15, abs( nHeight - nExpectedHeight ) ); } } xShell->DoClose(); diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ea0792f5acee..36f62373e7e0 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -1034,60 +1034,57 @@ void ScExportTest::testOutlineExportXLSX() // We expected that exactly 13 unique Nodes will be produced assertXPath(pSheet, "/x:worksheet/x:cols/x:col", 13); -// We need to save all 30 rows, as it provides information about outLineLevel -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "r", "1"); +// First row is empty and default so it is not written into XML file +// so we need to save 29 rows, as it provides information about outLineLevel +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "r", "2"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "hidden", "false"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "outlineLevel", "0"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "outlineLevel", "1"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[1]", "collapsed", "false"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "r", "2"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "r", "3"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "hidden", "false"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "outlineLevel", "1"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "outlineLevel", "2"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[2]", "collapsed", "false"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "r", "3"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "r", "4"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "hidden", "false"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "outlineLevel", "2"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[3]", "collapsed", "false"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "r", "4"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "r", "5"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "hidden", "false"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "outlineLevel", "2"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "outlineLevel", "3"); assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[4]", "collapsed", "false"); -assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "r", "5"); +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row[5]", "r", "6");
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/parallelism.cxx | 25 sc/source/core/tool/formulagroup.cxx | 43 --- 2 files changed, 55 insertions(+), 13 deletions(-) New commits: commit 7bafe2441480e2b88d999b30b7f117f05e72c3b3 Author: Dennis Francis AuthorDate: Thu Oct 4 12:28:14 2018 +0530 Commit: Michael Meeks CommitDate: Mon Oct 8 10:30:29 2018 +0200 tdf#119904 : Generalize the fix for tdf#115093 The point is, if one of the FormulaTokens in the formula is returned as the "result" FormulaToken, then we should not reuse that same FormulaToken for each formula-cell in the group. If we do, then we end up with whole group/batch having the same result. Also adds a unit test specific to this bug. This issue is non existent in master because "SoftwareInterpreter" and related code were removed from master long after branch-off to 6.1. Change-Id: I10265211b5f14c82ed385401aa3fb838c492872d Reviewed-on: https://gerrit.libreoffice.org/61362 Tested-by: Jenkins Reviewed-by: Michael Meeks diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx index c5c196154123..2e74840a215d 100644 --- a/sc/qa/unit/parallelism.cxx +++ b/sc/qa/unit/parallelism.cxx @@ -52,6 +52,7 @@ public: void testVLOOKUPSUM(); void testSingleRef(); void testSUMIFImplicitRange(); +void testTdf119904(); CPPUNIT_TEST_SUITE(ScParallelismTest); CPPUNIT_TEST(testSUMIFS); @@ -60,6 +61,7 @@ public: CPPUNIT_TEST(testVLOOKUPSUM); CPPUNIT_TEST(testSingleRef); CPPUNIT_TEST(testSUMIFImplicitRange); +CPPUNIT_TEST(testTdf119904); CPPUNIT_TEST_SUITE_END(); private: @@ -396,6 +398,29 @@ void ScParallelismTest::testSUMIFImplicitRange() m_pDoc->DeleteTab(0); } +void ScParallelismTest::testTdf119904() +{ +m_pDoc->InsertTab(0, "1"); + +const size_t nNumRows = 200; +for (size_t i = 0; i < nNumRows; ++i) +{ +m_pDoc->SetValue(0, i, 0, static_cast(i)); +m_pDoc->SetFormula(ScAddress(1, i, 0), (i % 2) ? OUString("=TRUE()") : OUString("=FALSE()"), formula::FormulaGrammar::GRAM_NATIVE_UI); +m_pDoc->SetFormula(ScAddress(2, i, 0), "=IF(B" + OUString::number(i+1) + + "; A" + OUString::number(i+1) + "; \"\")", formula::FormulaGrammar::GRAM_NATIVE_UI); +} + +m_xDocShell->DoHardRecalc(); + +for (size_t i = 0; i < nNumRows; ++i) +{ +OString aMsg = "At row " + OString::number(i); +CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), (i % 2) ? i : 0, static_cast(m_pDoc->GetValue(2, i, 0))); +} +m_pDoc->DeleteTab(0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScParallelismTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index ffd961ae7b99..8d0da740508d 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -29,7 +29,9 @@ #endif #include #include +#include +#include #include #include #include @@ -177,7 +179,12 @@ public: ScTokenArray aCode2; ScInterpreterContext aContext(mrDoc, mpFormatter); -sal_uInt16 nNumNonOpenClose = mrCode.GetLen(); +const formula::FormulaToken* pLastDoubleResultToken = nullptr; +const formula::FormulaToken* pLastStringResultToken = nullptr; +size_t nNumToks = mrCode.GetLen(); +bool* pReuseFlags = static_cast(alloca(sizeof(bool)*nNumToks)); +if (pReuseFlags) +std::fill_n(pReuseFlags, nNumToks, true); for (SCROW i = mnIdx; i <= mnLastIdx; ++i, maBatchTopPos.IncRow()) { @@ -213,7 +220,12 @@ public: aCode2.AddString(rPool.intern(OUString(pStr))); else { -if ( ( pTargetTok->GetType() == formula::svString ) && ( nNumNonOpenClose > 1 ) ) +bool bReuseToken = pReuseFlags && pReuseFlags[nTokIdx]; +if (bReuseToken && pTargetTok == pLastStringResultToken) +// Once pReuseFlags[nTokIdx] is set to false, it will continue to be so. +bReuseToken = pReuseFlags[nTokIdx] = false; + +if ( ( pTargetTok->GetType() == formula::svString ) && bReuseToken ) pTargetTok->SetString(rPool.intern(OUString(pStr))); else { @@ -227,7 +239,7 @@ public: // Value of NaN represents an empty cell. if ( !pTargetTok ) aCode2.AddToken(ScEmptyCellToken(false, false)); -else if ( ( pTargetTok->GetType() != formula::svEmptyCell ) || ( nNumNonOpenClose == 1 ) ) +
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf118990.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 33 + sc/source/filter/excel/xecontent.cxx |3 ++- 3 files changed, 35 insertions(+), 1 deletion(-) New commits: commit e9e18b5a3a0e9651b7161278a61c6a7ce0b9df0b Author: Mike Kaganski AuthorDate: Wed Aug 15 12:35:30 2018 +0300 Commit: Christian Lohmaier CommitDate: Thu Aug 16 12:04:04 2018 +0200 tdf#118990: use full URI for absolute references Previously (since commit 7eb5e135422f1a5830a44d129300bc3fafb4627d) only path relative to reference host was stored, and host itself was dropped. That resulted in URIs like "/share/file.xlsx", even without scheme. For Windows shares, this broke UNC paths like "\\HOSTNAME\share\file.xlsx" (which are stored in XLSX by Excel as "file:///\\HOSTNAME\share\file.xlsx"), and on subsequent import, this resulted in paths on the same drive as the document (like "C:\share\file.xlsx"). With this change, we will store "file://HOSTNAME/share/file.xlsx", which is correctly processed by both LibreOffice and MS Excel. Change-Id: I3f13aa0b3ae8dc41ec28eaa1416d536469c4562a Reviewed-on: https://gerrit.libreoffice.org/59064 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski (cherry picked from commit f24b0ec13c5c8edda5ffb1336b0eb6da173dfc97) Reviewed-on: https://gerrit.libreoffice.org/59141 Tested-by: Jenkins Reviewed-by: Christian Lohmaier diff --git a/sc/qa/unit/data/xlsx/tdf118990.xlsx b/sc/qa/unit/data/xlsx/tdf118990.xlsx new file mode 100644 index ..b680edceef0e Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf118990.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index f4a1dac54de2..42921737b08a 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -207,6 +207,8 @@ public: void testOpenDocumentAsReadOnly(); void testKeepSettingsOfBlankRows(); +void testTdf118990(); + CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); CPPUNIT_TEST(testTdf111876); @@ -314,6 +316,8 @@ public: CPPUNIT_TEST(testOpenDocumentAsReadOnly); CPPUNIT_TEST(testKeepSettingsOfBlankRows); +CPPUNIT_TEST(testTdf118990); + CPPUNIT_TEST_SUITE_END(); private: @@ -4022,6 +4026,35 @@ void ScExportTest::testKeepSettingsOfBlankRows() assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2); } +void ScExportTest::testTdf118990() +{ +ScDocShellRef xDocSh = loadDoc("tdf118990.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); +xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX); +ScDocument& rDoc = xDocSh->GetDocument(); + +// TODO: also test A1, which contains a UNC reference to \\localhost\share\lookupsource.xlsx, +// but currently looses "localhost" part when normalized in INetURLObject, becoming +// file:///share/lookupsource.xlsx - which is incorrect, since it points to local filesystem +// and not to Windows network share. + +#if defined LINUX // following INetURLObject::setAbsURIRef +#define TDF118990_SCHEME "smb:" +#else // for Windows and macOS +#define TDF118990_SCHEME "file:" +#endif + +ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 1, 0), + "VLOOKUP(B1,'" TDF118990_SCHEME "//192.168.1.1/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)", + "Wrong Windows share (using host IP) URL in A2"); + +ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 2, 0), + "VLOOKUP(B1,'" TDF118990_SCHEME "//NETWORKHOST/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)", + "Wrong Windows share (using hostname) URL in A3"); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index aa92499f135b..2ab4cc9cc668 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -457,7 +457,8 @@ OUString XclExpHyperlink::BuildFileName( sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl, const XclExpRoot& rRoot, bool bEncoded ) { INetURLObject aURLObject( rUrl ); -OUString aDosName( bEncoded ? aURLObject.GetURLPath() : aURLObject.getFSysPath( FSysStyle::Dos ) ); +OUString aDosName(bEncoded ? aURLObject.GetMainURL(INetURLObject::DecodeMechanism::ToIUri) + : aURLObject.getFSysPath(FSysStyle::Dos)); rnLevel = 0; rbRel = rRoot.IsRelUrl(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |5 +++-- sc/source/filter/html/htmlimp.cxx |2 +- 2 files changed, 4 insertions(+), 3 deletions(-) New commits: commit f4b83b45a43d635082f8b9d765f9522fad4e467f Author: Justin Luth AuthorDate: Thu Aug 9 15:04:20 2018 +0300 Commit: Eike Rathke CommitDate: Wed Aug 15 14:59:00 2018 +0200 tdf#119141 Revert "sc htmlimp: non-global sheet range names" This reverts commit 5720c85ccea9f1481bd604b806c5be728e59a13f, which was made in response to the suggestion in comment 6 of bug 114487 and backported to 6.0.6. But ScAreaLink::FindExtRange doesn't bother to search the local rangenames, and the Links to External Files dialog also doesn't give non-global variables as options. Since this was just a "logical" change, simply revert it to repair the regression. Any attempt to support local rangenames is something bigger that isn't appropriate for backport to stable. Change-Id: I8bd4dcc6492da2712e13b2e54cf81609cdc5936e Reviewed-on: https://gerrit.libreoffice.org/58761 Reviewed-by: Justin Luth Tested-by: Justin Luth Reviewed-by: Eike Rathke (cherry picked from commit 1597dbb5ba5d68b5807236c1d045f5215f221c91) Reviewed-on: https://gerrit.libreoffice.org/59066 Tested-by: Jenkins diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 6816e86fd2a4..f4a1dac54de2 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3340,9 +3340,10 @@ void ScExportTest::testAbsNamedRangeHTML() xDocSh2->DoHardRecalc(); ScDocument& rDoc = xDocSh2->GetDocument(); -ScRangeData* pRangeData = rDoc.GetRangeName(0)->findByUpperName(OUString("HTML_1")); +ScRangeData* pRangeData = rDoc.GetRangeName()->findByUpperName(OUString("HTML_1")); ScSingleRefData* pRef = pRangeData->GetCode()->FirstToken()->GetSingleRef(); -CPPUNIT_ASSERT_MESSAGE("Sheet1.HTML_1 is an absolute reference",!pRef->IsTabRel()); +// see tdf#119141 for the reason why this isn't Sheet1.HTML_1 +CPPUNIT_ASSERT_MESSAGE("HTML_1 is an absolute reference",!pRef->IsTabRel()); } void ScExportTest::testSheetLocalRangeNameXLS() diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 45b942ab1b98..4957b2d381ad 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -107,7 +107,7 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const OUString& rName, con ScTokenArray aTokArray; aTokArray.AddDoubleReference( aRefData ); ScRangeData* pRangeData = new ScRangeData( pDoc, rName, aTokArray ); -pDoc->GetRangeName( rRange.aStart.Tab() )->insert( pRangeData ); +pDoc->GetRangeName()->insert( pRangeData ); } void ScHTMLImport::WriteToDocument( ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - 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 d7cbaac61b8f3575184c675a760907c3b4bb225e Author: László Németh AuthorDate: Fri Aug 3 16:11:16 2018 +0200 Commit: Christian Lohmaier CommitDate: Tue Aug 14 14:03:55 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. Change-Id: Icac9441b7eb1520dcd20fc04337e070d070591c7 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 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 c250ef8bb3eb..6816e86fd2a4 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -205,6 +205,7 @@ public: void testHiddenRepeatedRowsODS(); void testHyperlinkTargetFrameODS(); void testOpenDocumentAsReadOnly(); +void testKeepSettingsOfBlankRows(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -311,6 +312,7 @@ public: CPPUNIT_TEST(testHiddenRepeatedRowsODS); CPPUNIT_TEST(testHyperlinkTargetFrameODS); CPPUNIT_TEST(testOpenDocumentAsReadOnly); +CPPUNIT_TEST(testKeepSettingsOfBlankRows); CPPUNIT_TEST_SUITE_END(); @@ -4006,6 +4008,19 @@ void ScExportTest::testOpenDocumentAsReadOnly() xDocSh2->DoClose(); } +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 7ca907dff18f..875a7c531231 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2455,6 +2455,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 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |2 +- sc/source/filter/excel/xestyle.cxx| 11 --- 2 files changed, 9 insertions(+), 4 deletions(-) New commits: commit f67c6912e8612c5850a5728c971b4ec130b9 Author: Markus Mohrhard AuthorDate: Sat Jul 21 23:16:19 2018 +0200 Commit: Eike Rathke CommitDate: Thu Jul 26 02:09:49 2018 +0200 tdf#98074, using the same builtinId maps the styles to the same one Additionally, using customBuiltin for all styles is a bad idea as well. Change-Id: I788a3c5b9164f79aa65ded2fc3e6a556e44ee0a8 Reviewed-on: https://gerrit.libreoffice.org/57807 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit fa881095bc62c3646406c82a98d8503377288a54) Reviewed-on: https://gerrit.libreoffice.org/57813 Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index e7440a249da8..c250ef8bb3eb 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3884,7 +3884,7 @@ void ScExportTest::testNatNumInNumberFormatXLSX() xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); -assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); +assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); xDocSh->DoClose(); } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index f8c077ce7860..b9986f338e48 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -2342,13 +2342,19 @@ static const char* lcl_StyleNameFromId( sal_Int32 nStyleId ) void XclExpStyle::SaveXml( XclExpXmlStream& rStrm ) { +constexpr sal_Int32 CELL_STYLE_MAX_BUILTIN_ID = 54; OString sName; +OString sBuiltinId; +const char* pBuiltinId = nullptr; if( IsBuiltIn() ) { sName = OString( lcl_StyleNameFromId( mnStyleId ) ); +sBuiltinId = OString::number( std::min( static_cast( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast ( mnStyleId ) ) ); +pBuiltinId = sBuiltinId.getStr(); } else sName = XclXmlUtils::ToOString( maName ); + // get the index in sortedlist associated with the mnXId sal_Int32 nXFId = rStrm.GetRoot().GetXFBuffer().GetXFIndex( maXFId.mnXFId ); // get the style index associated with index into sortedlist @@ -2357,11 +2363,10 @@ void XclExpStyle::SaveXml( XclExpXmlStream& rStrm ) XML_name, sName.getStr(), XML_xfId, OString::number( nXFId ).getStr(), // builtinId of 54 or above is invalid according to OpenXML SDK validator. -#define CELL_STYLE_MAX_BUILTIN_ID 54 - XML_builtinId, OString::number( std::min( static_cast( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast ( mnStyleId ) ) ).getStr(), +XML_builtinId, pBuiltinId, // OOXTODO: XML_iLevel, // OOXTODO: XML_hidden, -XML_customBuiltin, ToPsz( ! IsBuiltIn() ), +// XML_customBuiltin, ToPsz( ! IsBuiltIn() ), FSEND ); // OOXTODO: XML_extLst } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/data/functions/date_time/fods/hour.fods | 31 ++- sc/qa/unit/data/functions/date_time/fods/minute.fods | 26 ++- sc/qa/unit/data/functions/date_time/fods/second.fods | 26 ++- sc/source/core/tool/interpr2.cxx |6 +-- 4 files changed, 74 insertions(+), 15 deletions(-) New commits: commit bda9288ffee552b55eed9dbf02e1204957bd4513 Author: Winfried Donkers AuthorDate: Thu Jul 19 12:05:14 2018 +0200 Commit: Eike Rathke CommitDate: Thu Jul 19 19:27:28 2018 +0200 tdf#118800 fix rounding error in Calc function HOUR, MINUTE, SECOND. Change-Id: I7a875b172493112b66fca8f70d2061371a05486c Reviewed-on: https://gerrit.libreoffice.org/57721 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit c69e7266916ac1b8917477fb4eccdb9098da5792) Reviewed-on: https://gerrit.libreoffice.org/57728 diff --git a/sc/qa/unit/data/functions/date_time/fods/hour.fods b/sc/qa/unit/data/functions/date_time/fods/hour.fods index 847632a9750a..bb5abc52ab4e 100644 --- a/sc/qa/unit/data/functions/date_time/fods/hour.fods +++ b/sc/qa/unit/data/functions/date_time/fods/hour.fods @@ -154,8 +154,8 @@ Function basISODateTime(dVal#) basISODateTime = format(year(dt),)- format(Month(dt),00)- format(day(dt),00) format(Hour(dt),00): format(Minute(dt),00): format(Second(dt),00) End Function - - + + @@ -1755,11 +1755,26 @@ End Function - - - - - + + 10 + + + 10 + + + TRUE + + + =HOUR(J10) + + + tdf11880 + + + + 10:59:59.60 + + @@ -2432,4 +2447,4 @@ End Function - \ No newline at end of file + diff --git a/sc/qa/unit/data/functions/date_time/fods/minute.fods b/sc/qa/unit/data/functions/date_time/fods/minute.fods index d27ec1ef5031..69fba0187454 100644 --- a/sc/qa/unit/data/functions/date_time/fods/minute.fods +++ b/sc/qa/unit/data/functions/date_time/fods/minute.fods @@ -896,7 +896,29 @@ - + + + 11 + + + 11 + + + TRUE + + + =MINUTE(J9) + + + tdf11880 + + + + 10:11:59.60 + + + + @@ -1105,4 +1127,4 @@ - \ No newline at end of file + diff --git a/sc/qa/unit/data/functions/date_time/fods/second.fods b/sc/qa/unit/data/functions/date_time/fods/second.fods index e6d2b46946e5..8db288ae3ae9 100644 --- a/sc/qa/unit/data/functions/date_time/fods/second.fods +++ b/sc/qa/unit/data/functions/date_time/fods/second.fods @@ -825,7 +825,29 @@ - + + + 12 + + + 12 + + + TRUE + + + =SECOND(J9) + + + tdf11880 + + + + 10:11:12.60 + + + + @@ -1034,4 +1056,4 @@ - \ No newline at end of file + diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 45cefa1d0423..debe3509eb44 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -146,7 +146,7 @@ void ScInterpreter::ScGetMin() { double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // date part absent -long nVal = static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) % ::tools::Time::secondPerHour; +long nVal = static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) % ::tools::Time::secondPerHour; PushDouble( static_cast(nVal / ::tools::Time::secondPerMinute) ); } @@ -154,7 +154,7 @@ void ScInterpreter::ScGetSec() { double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // date part absent -long nVal = static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) % ::tools::Time::secondPerMinute; +long nVal = static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) % ::tools::Time::secondPerMinute; PushDouble( static_cast(nVal) ); } @@ -162,7 +162,7 @@ void ScInterpreter::ScGetHour() { double fTime = GetDouble(); fTime -= ::rtl::math::approxFloor(fTime); // date part absent -long nVal = static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5)) / ::tools::Time::secondPerHour; +long nVal = static_cast(::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR)) / ::tools::Time::secondPerHour; PushDouble(static_cast(nVal)); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv |2 +- sc/source/filter/excel/xestyle.cxx |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 35a78c9082df46b338f0f137485a9a4cd7aede19 Author: Markus Mohrhard AuthorDate: Sun Jul 15 00:35:21 2018 +0200 Commit: Eike Rathke CommitDate: Mon Jul 16 18:01:41 2018 +0200 related tdf#117816, the dxf ID is a global and not a sheet property Change-Id: I4c5ca66ce550de74d8b9396aa0213c558b7f884f Reviewed-on: https://gerrit.libreoffice.org/57467 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv b/sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv index b35f4e58e25b..9bbdfede11ac 100644 --- a/sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv +++ b/sc/qa/unit/data/contentCSV/new_cond_format_test_sheet2.csv @@ -1,3 +1,3 @@ 2.00,2 -1,1.00 +1,1.000 4.00,3 diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 746cad084b16..dd74300e4774 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -2980,12 +2980,12 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) mxFormatter->FillKeywordTableForExcel( *mpKeywordTable ); SCTAB nTables = rRoot.GetDoc().GetTableCount(); +sal_Int32 nIndex = 0; for(SCTAB nTab = 0; nTab < nTables; ++nTab) { ScConditionalFormatList* pList = rRoot.GetDoc().GetCondFormList(nTab); if (pList) { -sal_Int32 nIndex = 0; for (ScConditionalFormatList::const_iterator itr = pList->begin(); itr != pList->end(); ++itr) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |6 ++ sc/source/ui/docshell/docsh.cxx | 19 +++ sc/source/ui/inc/tabvwsh.hxx |7 +-- sc/source/ui/undo/undoblk.cxx|2 +- sc/source/ui/vba/excelvbahelper.cxx |4 ++-- sc/source/ui/view/cellsh.cxx | 25 +++-- sc/source/ui/view/cellsh1.cxx| 16 +--- sc/source/ui/view/cliputil.cxx |2 +- sc/source/ui/view/drawvie4.cxx |1 - sc/source/ui/view/gridwin.cxx|2 +- sc/source/ui/view/tabvwshc.cxx | 16 sc/source/ui/view/viewfun3.cxx | 11 +-- sc/source/ui/view/viewfun7.cxx |2 +- 13 files changed, 53 insertions(+), 60 deletions(-) New commits: commit 6c2f1a228e297398f3d7eb3140b4c1878f67b7a9 Author: Henry Castro Date: Tue Jun 26 23:32:41 2018 -0400 tdf#118308: Incorrect Paste Special dialog when ... pasting content from another cell In tiled rendering case (headless) each window has its own clipboard, otherwise exists a unique clipboard (UNO service). Change-Id: I7d5d0b085faeaffa3fc0a80914fbe9349f4aa402 Reviewed-on: https://gerrit.libreoffice.org/56508 Tested-by: Jenkins Reviewed-by: Eike Rathke Reviewed-on: https://gerrit.libreoffice.org/56652 Tested-by: Eike Rathke diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 84c8ed3b7ed0..9fc932805413 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1550,12 +1551,17 @@ void ScTiledRenderingTest::testMultiViewCopyPaste() // view #1 ScTabViewShell* pView1 = dynamic_cast(SfxViewShell::Current()); CPPUNIT_ASSERT(pView1); +// emulate clipboard + pView1->GetViewData().GetActiveWin()->SetClipboard(css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext())); // view #2 SfxLokHelper::createView(); ScTabViewShell* pView2 = dynamic_cast(SfxViewShell::Current()); +// emulate clipboard + pView2->GetViewData().GetActiveWin()->SetClipboard(css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext())); CPPUNIT_ASSERT(pView2); CPPUNIT_ASSERT(pView1 != pView2); +CPPUNIT_ASSERT(pView1->GetViewData().GetActiveWin()->GetClipboard() != pView2->GetViewData().GetActiveWin()->GetClipboard()); // copy text view 1 pView1->SetCursor(0, 0); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 39ce7714fe1d..3d3e6473cd43 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2755,24 +2755,11 @@ ScDocFunc *ScDocShell::CreateDocFunc() ScDocument* ScDocShell::GetClipDoc() { -css::uno::Reference xTransferable; - +vcl::Window* pWin = nullptr; if (ScTabViewShell* pViewShell = GetBestViewShell()) -xTransferable.set(pViewShell->GetClipData()); -else -{ -SfxViewFrame* pViewFrame = nullptr; -css::uno::Reference xClipboard; - -if ((pViewFrame = SfxViewFrame::GetFirst(this, false))) -xClipboard = pViewFrame->GetWindow().GetClipboard(); -else if ((pViewFrame = SfxViewFrame::GetFirst())) - xClipboard = pViewFrame->GetWindow().GetClipboard(); - -xTransferable.set(xClipboard.is() ? xClipboard->getContents() : nullptr, css::uno::UNO_QUERY); -} +pWin = pViewShell->GetViewData().GetActiveWin(); -const ScTransferObj* pObj = ScTransferObj::GetOwnClipboard(xTransferable); +const ScTransferObj* pObj = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin)); if (pObj) { ScDocument* pDoc = pObj->GetDocument(); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 2181e61aa325..8b4753e18c42 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -167,9 +167,6 @@ private: OUString maName; OUString maScope; -// ClipData -css::uno::Reference m_xClipData; - private: voidConstruct( TriState nForceDesignMode ); @@ -394,9 +391,7 @@ public: static void notifyAllViewsHeaderInvalidation(bool Columns, SCTAB nCurrentTabIndex); static bool isAnyEditViewInRange(bool bColumns, SCCOLROW nStart, SCCOLROW nEnd); css::uno::Reference getSelectedXShapes(); - -const css::uno::Reference & GetClipData() { return m_xClipData; }; -void SetClipData(const css::uno::Reference& xTransferable) { m_xClipData = xTransferable; } +static css::uno::Reference GetClipData(vcl::Window* pWin); }; #endif diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |4 ++-- sc/source/filter/html/htmlimp.cxx |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit f62340a104813e4a6a34e7281d86407bc8314ffd Author: Justin Luth Date: Tue Jun 5 19:30:58 2018 +0300 tdf#114487 sc htmlimp: non-global sheet range names Allow multiple file imports, each one having a non-conflicting range name, by being sheet specific. As Eike states, "This does *not* mean that they couldn't be referenced from other sheets. By prefixing the sheet name it can be used from any other sheet, for example Sheet2.HTML_1. (This wasn't possible in early versions with sheet-local names but it has been possible for a while already)." In theory, it would previously have been possible to create a generic sheet with calculations using a range name that doesn't exist yet, and then importing *any* file to be analyzed. In practice that has never been possible since all names were relative, and imports always create a new sheet, so the relative name would point elsewhere. Also, the non-existant name only resolves after a round-trip of the file, not immediately upon file import. So, it is logical to set the imported range names to be sheet-local instead of global. Change-Id: I3103f0655b2373bb731c192bb5d2c0757938ee28 Reviewed-on: https://gerrit.libreoffice.org/55349 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Eike Rathke (cherry picked from commit 5720c85ccea9f1481bd604b806c5be728e59a13f) Reviewed-on: https://gerrit.libreoffice.org/55648 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 8762cbcc339a..5e65134fbfbe 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3336,9 +3336,9 @@ void ScExportTest::testAbsNamedRangeHTML() xDocSh2->DoHardRecalc(); ScDocument& rDoc = xDocSh2->GetDocument(); -ScRangeData* pRangeData = rDoc.GetRangeName()->findByUpperName(OUString("HTML_1")); +ScRangeData* pRangeData = rDoc.GetRangeName(0)->findByUpperName(OUString("HTML_1")); ScSingleRefData* pRef = pRangeData->GetCode()->FirstToken()->GetSingleRef(); -CPPUNIT_ASSERT_MESSAGE("HTML_1 is an absolute reference",!pRef->IsTabRel()); +CPPUNIT_ASSERT_MESSAGE("Sheet1.HTML_1 is an absolute reference",!pRef->IsTabRel()); } void ScExportTest::testSheetLocalRangeNameXLS() diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index 4957b2d381ad..45b942ab1b98 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -107,7 +107,7 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const OUString& rName, con ScTokenArray aTokArray; aTokArray.AddDoubleReference( aRefData ); ScRangeData* pRangeData = new ScRangeData( pDoc, rName, aTokArray ); -pDoc->GetRangeName()->insert( pRangeData ); +pDoc->GetRangeName( rRange.aStart.Tab() )->insert( pRangeData ); } void ScHTMLImport::WriteToDocument( ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 16 sc/source/filter/html/htmlimp.cxx |2 ++ 2 files changed, 18 insertions(+) New commits: commit 513204bcf7b9a43535ed585251e73a6d77805148 Author: Justin Luth Date: Wed May 23 08:36:54 2018 +0300 tdf#114487 sc htmlimp: rangeNames should be 3D Without a visible sheet name, these absolute ranges become relative after a round-trip. Another way to handle this would be to ensure that ODS (and other text-based formats) export Absolute in a way that can be properly imported. But handling it on import is safer and ensures UI consistency. The InitRange default is for !IsFlag3D and !IsTabRel(). Since the range already imports as absolute, just add the appropriate 3D flags. Change-Id: Ia664e6f87e235096e1c2e5b702e18505e375e2ad Reviewed-on: https://gerrit.libreoffice.org/54725 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit c42b1cf2464924b125aeae15968fb79cf795bc81) Reviewed-on: https://gerrit.libreoffice.org/55273 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 2a7a76e244a8..8762cbcc339a 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -175,6 +175,7 @@ public: #if !defined _WIN32 void testSupBookVirtualPathXLS(); #endif +void testAbsNamedRangeHTML(); void testSheetLocalRangeNameXLS(); void testSheetTextBoxHyperlinkXLSX(); void testFontSizeXLSX(); @@ -281,6 +282,7 @@ public: CPPUNIT_TEST(testImageWithSpecialID); CPPUNIT_TEST(testPreserveTextWhitespaceXLSX); CPPUNIT_TEST(testPreserveTextWhitespace2XLSX); +CPPUNIT_TEST(testAbsNamedRangeHTML); CPPUNIT_TEST(testSheetLocalRangeNameXLS); CPPUNIT_TEST(testSheetTextBoxHyperlinkXLSX); CPPUNIT_TEST(testFontSizeXLSX); @@ -3325,6 +3327,20 @@ void ScExportTest::testImageWithSpecialID() } } +void ScExportTest::testAbsNamedRangeHTML() +{ +ScDocShellRef xDocSh = loadDoc("numberformat.", FORMAT_HTML); +xDocSh->DoHardRecalc(); +ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_ODS); +xDocSh->DoClose(); +xDocSh2->DoHardRecalc(); + +ScDocument& rDoc = xDocSh2->GetDocument(); +ScRangeData* pRangeData = rDoc.GetRangeName()->findByUpperName(OUString("HTML_1")); +ScSingleRefData* pRef = pRangeData->GetCode()->FirstToken()->GetSingleRef(); +CPPUNIT_ASSERT_MESSAGE("HTML_1 is an absolute reference",!pRef->IsTabRel()); +} + void ScExportTest::testSheetLocalRangeNameXLS() { ScDocShellRef xDocSh = loadDoc("named-ranges-local.", FORMAT_XLS); diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index a5f1f11abe4b..4957b2d381ad 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -102,6 +102,8 @@ void ScHTMLImport::InsertRangeName( ScDocument* pDoc, const OUString& rName, con { ScComplexRefData aRefData; aRefData.InitRange( rRange ); +aRefData.Ref1.SetFlag3D( true ); +aRefData.Ref2.SetFlag3D( aRefData.Ref2.Tab() != aRefData.Ref1.Tab() ); ScTokenArray aTokArray; aTokArray.AddDoubleReference( aRefData ); ScRangeData* pRangeData = new ScRangeData( pDoc, rName, aTokArray ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sc/qa sc/source
sc/qa/unit/data/xls/forcepoint-pivot-1.xls |binary sc/source/filter/excel/xipivot.cxx |8 2 files changed, 4 insertions(+), 4 deletions(-) New commits: commit d9f2a3e005f10bbb3426bc21b08ed55ffdc00b76 Author: Caolán McNamara Date: Mon May 28 21:22:56 2018 +0100 forcepoint#40 null deref presumably since commit 0098bee792c3e208ea4f6ef1c676958d3f4cd207 Date: Thu Sep 21 06:48:09 2017 +0200 tdf#112501: Pivot table: popupbuttons are placed on wrong cells Change-Id: I5413c0ba06fca25cb22256a20ef9640767dd9e50 Reviewed-on: https://gerrit.libreoffice.org/54969 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sc/qa/unit/data/xls/forcepoint-pivot-1.xls b/sc/qa/unit/data/xls/forcepoint-pivot-1.xls new file mode 100644 index ..12919922666b Binary files /dev/null and b/sc/qa/unit/data/xls/forcepoint-pivot-1.xls differ diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index 118e9a014691..b0452408054b 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -1566,13 +1566,13 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD itr= aFieldBtns.begin(); itrEnd = aFieldBtns.end(); vector::const_iterator itDim = aFieldDims.begin(); -for (; itr != itrEnd; ++itr, ++itDim) +for (; itr != itrEnd; ++itr) { ScMF nMFlag = ScMF::Button; -const ScDPSaveDimension* pDim = *itDim; -if (pDim->HasInvisibleMember()) +const ScDPSaveDimension* pDim = itDim != aFieldDims.end() ? *itDim++ : nullptr; +if (pDim && pDim->HasInvisibleMember()) nMFlag |= ScMF::HiddenMember; -if (!pDim->IsDataLayout()) +if (!pDim || !pDim->IsDataLayout()) nMFlag |= ScMF::ButtonPopup; rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits