[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - 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 8b2b2010f98e4e5997b3d4ecb83a1c5b0c9e49ab Author: Justin Luth AuthorDate: Thu Aug 9 15:04:20 2018 +0300 Commit: Eike Rathke CommitDate: Wed Aug 15 14:58:49 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/59065 Tested-by: Jenkins diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 168dc7f572d2..1444ebd39b5a 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3318,9 +3318,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 a4d79d21ae14..f601903bfde9 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-0' - sc/qa sc/source
sc/qa/unit/data/functions/text/fods/replace.fods | 230 +-- sc/source/core/tool/interpr1.cxx | 17 + 2 files changed, 227 insertions(+), 20 deletions(-) New commits: commit 44487fee8646c0ded5c2b2ffaaa70e75a7af7e04 Author: Winfried Donkers Date: Tue Nov 28 15:55:56 2017 +0100 tdf#97198 Make Calc function REPLACE work with UniCode non-BMP-characters. Change-Id: Ie9bd27ba2c28bdad0af9d91cb270ef37d5384791 Reviewed-on: https://gerrit.libreoffice.org/45421 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit aaba725b466950f47c4e93d790986d209e80ead3) Reviewed-on: https://gerrit.libreoffice.org/45495 diff --git a/sc/qa/unit/data/functions/text/fods/replace.fods b/sc/qa/unit/data/functions/text/fods/replace.fods index 140b735e7090..1ab069f6460a 100644 --- a/sc/qa/unit/data/functions/text/fods/replace.fods +++ b/sc/qa/unit/data/functions/text/fods/replace.fods @@ -1141,36 +1141,230 @@ - - - - + + Q + + + Q + + + TRUE + + + =REPLACE("";5;1;"Q") + - + + Bð + - - - - - + + + abðBðghð¬ðððððð! + + + abðBðghð¬ðððððð! + + + TRUE + + + =REPLACE(I11;4;3;I10) + - + + abðdeðghð¬ðððððð! + + + + + + BðxXxðd + + + BðxXxðd + + + TRUE + + + =REPLACE(I12;3;1;"xXx") + + + + Bðcðd + + + + + + BxXxcðd + + + BxXxcðd + + + TRUE + + + =REPLACE(I12;2;1;"xXx") + + + + + + Bððððd + + + Bððððd + + + TRUE + + + =REPLACE(I12;3;1;"ðð") + + + - + + Bxððxcðd + + + Bxððxcðd + + + TRUE + + + =REPLACE(I12;2;1;"xððx") + + + + + + + + BxXxðcðd + + + BxXxðcðd + + + TRUE + + + =REPLACE(I12;2;0;"xXx") + + + + + + + + BðxXxcðd + + + BðxXxcðd + + + TRUE + + + =REPLACE(I12;3;0;"xXx") + + + + + + + + xYxBðcðd + + + xYxBðcðd + + + TRUE + + + =REPLACE(I12;1;0;"xYx") + + + + + + xYxðcðd + + + xYxðcðd + + + TRUE + + + =REPLACE(I12;1;1;"xYx") + + + + + + + + xYxcðd + + + xYxcðd + + + TRUE + + + =REPLACE(I12;1;2;"xYx") + + + + + + + + xYxðd + + + xYxðd + + + TRUE + + + =REPLACE(I12;1;3;"xYx") + + - - + + + + + xYxd + + + xYxd + + + TRUE + + + =REPLACE(I12;1;4;"xYx") + - - + - @@ -1210,4 +1404,4 @@ - \ No newline at end of file + diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 2895c93f2a2e..164c1185e1b8 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8451,9 +8451,22 @@ void ScInterpreter::ScReplace() nPos = nLen + 1; if (nCount > nLen - nPos + 1) nCount = nLen - nPos + 1; -aOldStr = aOldStr.replaceAt( nPos-1, nCount, "" ); +sal_Int32 nIdx = 0; +sal_Int32 nCnt = 0; +while ( nIdx < nLen && nPos > nCnt + 1 ) +{ +aOldStr.iterateCodePoints( &nIdx ); +++nCnt; +} +sal_Int32 nStart = nIdx; +while ( nIdx < nLen && nPos + nCount - 1 > nCnt ) +{ +aOldStr.iterateCodePoints( &nIdx ); +++nCnt; +} +aOldStr = aOldStr.replaceAt( nStart, nIdx - nStart, "" ); if ( CheckStringResultLen( aOldStr, aNewStr ) ) -aOldStr = aOldStr.replaceAt( nPos-1, 0, aNewStr ); +aOldStr = aOldStr.replaceAt( nStart, 0, aNewStr ); PushString( aOldStr ); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source
sc/qa/unit/data/xlsx/built-in_ranges.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 28 sc/source/filter/excel/xltools.cxx|6 +- sc/source/filter/inc/xltools.hxx |4 ++-- 4 files changed, 35 insertions(+), 3 deletions(-) New commits: commit 1f5d7c8b986d4839788e3e2f4ac24ab2df25af9c Author: Aron Budea Date: Tue Nov 28 07:23:12 2017 +0100 tdf#109240, tdf#112571: don't export dupe built-in named ranges XclTools::GetBuiltInDefNameIndex(...) only checked for prefix used in binary Excel format, and didn't recognize OOXML built-in names, which resulted in saving them twice in OOXML files. Adapt to check both binary and OOXML prefixes, similarly to XclTools::IsBuiltInStyleName(...). Saving "bad" files after the fix will purge bad "_0", "_0_0" etc. suffixed built-in names due to how GetBuiltInDefNameIndex(...) works. Change-Id: I1bbe11f9c654a142a4626003df4cb0fd2a0f9c71 Reviewed-on: https://gerrit.libreoffice.org/45381 Reviewed-by: Eike Rathke Tested-by: Eike Rathke (cherry picked from commit f8b9d0fb0767d8bbe8477f92abaf6b8e0ff65546) Reviewed-on: https://gerrit.libreoffice.org/45700 Tested-by: Jenkins diff --git a/sc/qa/unit/data/xlsx/built-in_ranges.xlsx b/sc/qa/unit/data/xlsx/built-in_ranges.xlsx new file mode 100644 index ..b18a4862fdd6 Binary files /dev/null and b/sc/qa/unit/data/xlsx/built-in_ranges.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 0e7a3913ba35..06ed9dcdf9ad 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -103,6 +103,7 @@ public: void testConditionalFormatRangeListXLSX(); void testMiscRowHeightExport(); void testNamedRangeBugfdo62729(); +void testBuiltinRangesXLSX(); void testRichTextExportODS(); void testRichTextCellFormatXLSX(); void testFormulaRefSheetNameODS(); @@ -212,6 +213,7 @@ public: CPPUNIT_TEST(testConditionalFormatRangeListXLSX); CPPUNIT_TEST(testMiscRowHeightExport); CPPUNIT_TEST(testNamedRangeBugfdo62729); +CPPUNIT_TEST(testBuiltinRangesXLSX); CPPUNIT_TEST(testRichTextExportODS); CPPUNIT_TEST(testRichTextCellFormatXLSX); CPPUNIT_TEST(testFormulaRefSheetNameODS); @@ -1159,6 +1161,32 @@ void ScExportTest::testNamedRangeBugfdo62729() xDocSh->DoClose(); } +void ScExportTest::testBuiltinRangesXLSX() +{ +ScDocShellRef xShell = loadDoc("built-in_ranges.", FORMAT_XLSX); +CPPUNIT_ASSERT(xShell.is()); +ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); +xShell->DoClose(); + +xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +//assert the existing OOXML built-in names are still there +assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='0']", "'Sheet1 Test'!$A$1:$A$5"); +assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='1']", "'Sheet2 Test'!$K$10:$K$14"); +assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='0']", "'Sheet1 Test'!$A$1:$A$5"); +assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='1']", "'Sheet2 Test'!$K$10:$M$18"); + +//...and that no extra ones are added (see tdf#112571) +assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='0']", 0); +assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='1']", 0); +assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='0']", 0); +assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='1']", 0); + +xDocSh->DoClose(); +} + void ScExportTest::testRichTextExportODS() { struct diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index 34e572460f4a..cffb346ec27b 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -482,8 +482,12 @@ OUString XclTools::GetBuiltInDefNameXml( sal_Unicode cBuiltIn ) sal_Unicode XclTools::GetBuiltInDefNameIndex( const OUString& rDefName ) { -sal_Int32 nPrefixLen = strlen(maDefNamePrefix); +sal_Int32 nPrefixLen = 0; if( rDefName.startsWithIgnoreAsciiCase( maDefNamePrefix ) ) +nPrefixLen = strlen(maDefNamePrefix); +else if( rDefName.startsWithIgnoreAsciiCase( maDefNamePrefixXml ) ) +nPrefixLen = strlen(maDefNamePrefixXml); +if( nPrefixLen > 0 ) { for( sal_Unicode cBuiltIn = 0; cBuiltIn < EXC_BUILTIN_UNKNOWN;
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - 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 69c5be9b26cf1a45e220d69f65b1bb0fa2aedaf6 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/54970 Tested-by: Jenkins Reviewed-by: Christian Lohmaier 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 e63db6cdb1ab..669d6262cc2d 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
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - 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 cd51f388c96cafdf81303722c43c6025d9f0073e 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/55272 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 122fad288343..af1b344dcf89 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(); @@ -280,6 +281,7 @@ public: CPPUNIT_TEST(testImageWithSpecialID); CPPUNIT_TEST(testPreserveTextWhitespaceXLSX); CPPUNIT_TEST(testPreserveTextWhitespace2XLSX); +CPPUNIT_TEST(testAbsNamedRangeHTML); CPPUNIT_TEST(testSheetLocalRangeNameXLS); CPPUNIT_TEST(testSheetTextBoxHyperlinkXLSX); CPPUNIT_TEST(testFontSizeXLSX); @@ -3307,6 +3309,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 72d56b4d9126..f601903bfde9 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-0' - 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 399bf0dcd26ed23d2864d60ccba0541d81f48cdc 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 (cherry picked from commit f62340a104813e4a6a34e7281d86407bc8314ffd) Reviewed-on: https://gerrit.libreoffice.org/55698 Tested-by: Justin Luth diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index af1b344dcf89..168dc7f572d2 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3318,9 +3318,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 f601903bfde9..a4d79d21ae14 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-0' - sc/qa sc/source
sc/qa/unit/data/functions/statistical/fods/countif.fods | 22 sc/source/core/data/dociter.cxx |2 - 2 files changed, 18 insertions(+), 6 deletions(-) New commits: commit 9b2ebcfe80900b2f6299851d3a271bdcaa85049a Author: Winfried Donkers Date: Wed May 9 10:40:03 2018 +0200 tdf#117433 count empty cells properly with COUNTIF. All empty columns after the first column of the range were skipped. When the query contains an 'cell is empty' expression, skipping is omitted. Change-Id: I0d5b0d24c2d08bad88479cd5b356529a0a709156 Reviewed-on: https://gerrit.libreoffice.org/54021 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit 1a8febcaa4f932124d417877a3b08bd059c0362d) Reviewed-on: https://gerrit.libreoffice.org/54037 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/sc/qa/unit/data/functions/statistical/fods/countif.fods b/sc/qa/unit/data/functions/statistical/fods/countif.fods index 557e70b2044f..8625ebe7aeff 100644 --- a/sc/qa/unit/data/functions/statistical/fods/countif.fods +++ b/sc/qa/unit/data/functions/statistical/fods/countif.fods @@ -3865,10 +3865,22 @@ - - - - + + 12 + + + 12 + + + TRUE + + + =COUNTIF(P20:R23,"") + + + tdf#117433 + + @@ -4469,4 +4481,4 @@ - \ No newline at end of file + diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 96af2dbc3150..689abc31d07a 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -1144,7 +1144,7 @@ bool ScQueryCellIterator::GetThis() } pCol = &(pDoc->maTabs[nTab])->aCol[nCol]; } -while (pCol->IsEmptyData()); +while (!rItem.mbMatchEmpty && pCol->IsEmptyData()); InitPos(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source
sc/qa/unit/data/xls/pass/forcepoint-selfseriesadd.xls |binary sc/source/filter/excel/xichart.cxx|5 + 2 files changed, 5 insertions(+) New commits: commit 06af4f16ec1a6bfc93d5f22dba073a1f7093df8d Author: Caolán McNamara Date: Mon Mar 26 08:57:09 2018 +0100 forcepoint #29 detect illegal self series add Change-Id: I3bba0f942780c54951a3a810c05cc3b56ca18a5e Reviewed-on: https://gerrit.libreoffice.org/51861 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/data/xls/pass/forcepoint-selfseriesadd.xls b/sc/qa/unit/data/xls/pass/forcepoint-selfseriesadd.xls new file mode 100755 index ..e5eafd262520 Binary files /dev/null and b/sc/qa/unit/data/xls/pass/forcepoint-selfseriesadd.xls differ diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx index 4243fd08221e..5cef222d07ce 100644 --- a/sc/source/filter/excel/xichart.cxx +++ b/sc/source/filter/excel/xichart.cxx @@ -1872,6 +1872,11 @@ void XclImpChSeries::SetDataLabel( const XclImpChTextRef& xLabel ) void XclImpChSeries::AddChildSeries( const XclImpChSeries& rSeries ) { OSL_ENSURE( !HasParentSeries(), "XclImpChSeries::AddChildSeries - not allowed for child series" ); +if (&rSeries == this) +{ +SAL_WARN("sc.filter", "self add attempt"); +return; +} /* In Excel, trend lines and error bars are stored as own series. In Calc, these are properties of the parent series. This function adds the ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source
sc/qa/unit/data/xls/fail/forcepoint-group-range-1.xls |binary sc/source/core/data/column3.cxx |2 ++ 2 files changed, 2 insertions(+) New commits: commit 6969f1fbfd1c8ead222af416ff86f30e2f74f00e Author: Caolán McNamara Date: Mon Mar 26 09:23:48 2018 +0100 forcepoint #30 check validity of group range Change-Id: Ie0611f36809b051ce46030e44c137b4e1f8d2fe0 Reviewed-on: https://gerrit.libreoffice.org/51864 Tested-by: Jenkins Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/data/xls/fail/forcepoint-group-range-1.xls b/sc/qa/unit/data/xls/fail/forcepoint-group-range-1.xls new file mode 100755 index ..1aca9c7f113e Binary files /dev/null and b/sc/qa/unit/data/xls/fail/forcepoint-group-range-1.xls differ diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 961bf244df60..a50856290c35 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -3091,6 +3091,8 @@ public: xPrevGrp->mnLength += xCurGrp->mnLength; pCur->SetCellGroup(xPrevGrp); sc::formula_block::iterator itGrpEnd = it; +if (xCurGrp->mnLength > std::distance(itGrpEnd, itEnd)) +throw css::lang::IllegalArgumentException(); std::advance(itGrpEnd, xCurGrp->mnLength); for (++it; it != itGrpEnd; ++it) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source
sc/qa/unit/data/functions/mathematical/fods/aggregate.fods | 40 - sc/source/core/tool/interpr6.cxx |6 + 2 files changed, 42 insertions(+), 4 deletions(-) New commits: commit 2c51260d91490a6fc512875d8befb38367bf3227 Author: Winfried Donkers Date: Fri Apr 6 19:55:12 2018 +0200 tdf#116706 fix for AGGREGATE with hidden rows and single references. Change-Id: I6ac88f26b46a17e1857b7b40d2034fb321973625 Reviewed-on: https://gerrit.libreoffice.org/52522 Reviewed-by: Eike Rathke Tested-by: Jenkins (cherry picked from commit 0a4c1fb68c3619e61099a7c548f550b0d3fd7a53) Reviewed-on: https://gerrit.libreoffice.org/52651 diff --git a/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods b/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods index 66162e697742..62e72ca08da6 100644 --- a/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods +++ b/sc/qa/unit/data/functions/mathematical/fods/aggregate.fods @@ -5881,7 +5881,43 @@ - + + + 0 + + + 0 + + + TRUE + + + =AGGREGATE(3,5,$C$6) + + + tdf116706 + + + + + + 0 + + + 0 + + + TRUE + + + =AGGREGATE(3,5,$C$6:$C$6) + + + tdf116706 + + + + @@ -5920,4 +5956,4 @@ - \ No newline at end of file + diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx index 62c96376c664..449375638cb5 100644 --- a/sc/source/core/tool/interpr6.cxx +++ b/sc/source/core/tool/interpr6.cxx @@ -678,8 +678,10 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero ) ++nCount; break; } -if ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) && - pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) ) +if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) && + pDok->RowFiltered( aAdr.Row(), aAdr.Tab() ) ) || + ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) && + pDok->RowHidden( aAdr.Row(), aAdr.Tab() ) ) ) { break; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source
sc/qa/unit/data/xls/fail/ofz5527-1.xls |binary sc/source/filter/excel/xicontent.cxx |4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) New commits: commit 9bf9b6d6f751bc1c6c3e12caf91c6e8eee3650ac Author: Caolán McNamara Date: Sun Jan 21 16:15:30 2018 + copy ScAddress before possibly joining it Change-Id: Ib1148584b9771da67d3f4b3141184228e1bbe3a2 Reviewed-on: https://gerrit.libreoffice.org/48271 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara (cherry picked from commit f6eefd96cb16a9b5607fe59bdbf9b1121c9b56e8) Reviewed-on: https://gerrit.libreoffice.org/48296 Reviewed-by: Eike Rathke diff --git a/sc/qa/unit/data/xls/fail/ofz5527-1.xls b/sc/qa/unit/data/xls/fail/ofz5527-1.xls new file mode 100644 index ..334cafe42445 Binary files /dev/null and b/sc/qa/unit/data/xls/fail/ofz5527-1.xls differ diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 4db48555220a..3d0de0d1413c 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -678,6 +678,8 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) // *** create the Calc conditional formatting *** +const ScAddress aPos(rPos); //in case maRanges.Join invalidates it + if( !mxScCondFmt.get() ) { mxScCondFmt.reset( new ScConditionalFormat( 0/*nKey*/, &GetDocRef() ) ); @@ -686,7 +688,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) mxScCondFmt->SetRange(maRanges); } -ScCondFormatEntry* pEntry = new ScCondFormatEntry( eMode, xTokArr1.get(), pTokArr2.get(), &GetDocRef(), rPos, aStyleName ); +ScCondFormatEntry* pEntry = new ScCondFormatEntry(eMode, xTokArr1.get(), pTokArr2.get(), &GetDocRef(), aPos, aStyleName); mxScCondFmt->AddEntry( pEntry ); ++mnCondIndex; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/qa sc/source
sc/qa/unit/parallelism.cxx | 23 +++ sc/source/core/tool/formulagroup.cxx | 16 +--- 2 files changed, 36 insertions(+), 3 deletions(-) New commits: commit 1c6244f1faaefb6a5198c79c00849924ac2e91c2 Author: Dennis Francis Date: Tue Jan 23 19:53:19 2018 +0530 tdf#115093 : Do not reuse singleref tokens... ...in formula group computation if the formula contains only a single reference besides any ocOpen/ocClose pairs wrapping it as the sole content. In such a case the "result" formula token returned by ScInterpreter::GetResultToken() is the same as the original singleref token, so for each row of the formulagroup, we need to use a separate singleref token. Also added a unit test in sc/qa/unit/parallelism.cxx Change-Id: I6032efc5be9b51ca1e9daf9bdd19997a949d2f43 Reviewed-on: https://gerrit.libreoffice.org/48449 Reviewed-by: Michael Meeks Tested-by: Jenkins (cherry picked from commit ff166845fa5ed178a97b54bb2deef4beb0cf3bdf) Reviewed-on: https://gerrit.libreoffice.org/48478 Tested-by: Michael Meeks diff --git a/sc/qa/unit/parallelism.cxx b/sc/qa/unit/parallelism.cxx index 428d65a20bec..896b7c1d8382 100644 --- a/sc/qa/unit/parallelism.cxx +++ b/sc/qa/unit/parallelism.cxx @@ -46,12 +46,14 @@ public: void testDivision(); void testVLOOKUP(); void testVLOOKUPSUM(); +void testSingleRef(); CPPUNIT_TEST_SUITE(ScParallelismTest); CPPUNIT_TEST(testSUMIFS); CPPUNIT_TEST(testDivision); CPPUNIT_TEST(testVLOOKUP); CPPUNIT_TEST(testVLOOKUPSUM); +CPPUNIT_TEST(testSingleRef); CPPUNIT_TEST_SUITE_END(); private: @@ -296,6 +298,27 @@ void ScParallelismTest::testVLOOKUPSUM() m_pDoc->DeleteTab(0); } +void ScParallelismTest::testSingleRef() +{ +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), "=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, static_cast(m_pDoc->GetValue(1, 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 d763d15d2f1c..38b9c2a327ee 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -177,6 +177,7 @@ public: ScTokenArray aCode2; ScInterpreterContext aContext(mrDoc, mpFormatter); +sal_uInt16 nNumNonOpenClose = mrCode.GetLen(); for (SCROW i = mnIdx; i <= mnLastIdx; ++i, maBatchTopPos.IncRow()) { @@ -212,7 +213,7 @@ public: aCode2.AddString(rPool.intern(OUString(pStr))); else { -if ( pTargetTok->GetType() == formula::svString ) +if ( ( pTargetTok->GetType() == formula::svString ) && ( nNumNonOpenClose > 1 ) ) pTargetTok->SetString(rPool.intern(OUString(pStr))); else { @@ -226,7 +227,7 @@ public: // Value of NaN represents an empty cell. if ( !pTargetTok ) aCode2.AddToken(ScEmptyCellToken(false, false)); -else if ( pTargetTok->GetType() != formula::svEmptyCell ) +else if ( ( pTargetTok->GetType() != formula::svEmptyCell ) || ( nNumNonOpenClose == 1 ) ) { ScEmptyCellToken* pEmptyTok = new ScEmptyCellToken(false, false); aCode2.ReplaceToken(nTokIdx, pEmptyTok, formula::FormulaTokenArray::CODE_ONLY); @@ -239,7 +240,7 @@ public: aCode2.AddDouble(fVal); else { -if ( pTargetTok->GetType() == formula::svDouble ) +if ( ( pTargetTok->GetType() == formula::svDouble ) && ( nNumNonOpenClose > 1 ) ) pTargetTok->GetDoubleAsReference() = fVal; else { @@ -291,7 +292,16 @@ public: break; default: if ( !pTargetTok ) +{ +if ( p->GetType() == formula::svSep ) +{ +